@univerjs/core 0.6.1 → 0.6.2

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,10 +1,10 @@
1
- (function(f,ke){typeof exports=="object"&&typeof module<"u"?ke(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],ke):(f=typeof globalThis<"u"?globalThis:f||self,ke(f.UniverCore={},f["@wendellhu/redi"],f.rxjs,f.rxjs.operators))})(this,function(f,ke,be,fr){"use strict";var NE=Object.defineProperty;var ME=(f,ke,be)=>ke in f?NE(f,ke,{enumerable:!0,configurable:!0,writable:!0,value:be}):f[ke]=be;var R=(f,ke,be)=>ME(f,typeof ke!="symbol"?ke+"":ke,be);var Ku,Xu;function Ju(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const gr=typeof global<"u"?global:typeof self<"u"?self:window;function Zu(){const t=new Map;let n=0;typeof gr.requestIdleCallback!="function"&&(gr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof gr.cancelIdleCallback!="function"&&(gr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function Qu(){Zu()}var Si=typeof global=="object"&&global&&global.Object===Object&&global,ec=typeof self=="object"&&self&&self.Object===Object&&self,Qt=Si||ec||Function("return this")(),hn=Qt.Symbol,vi=Object.prototype,tc=vi.hasOwnProperty,nc=vi.toString,Dn=hn?hn.toStringTag:void 0;function rc(e){var t=tc.call(e,Dn),n=e[Dn];try{e[Dn]=void 0;var r=!0}catch{}var s=nc.call(e);return r&&(t?e[Dn]=n:delete e[Dn]),s}var sc=Object.prototype,ic=sc.toString;function oc(e){return ic.call(e)}var ac="[object Null]",lc="[object Undefined]",Oi=hn?hn.toStringTag:void 0;function Ln(e){return e==null?e===void 0?lc:ac:Oi&&Oi in Object(e)?rc(e):oc(e)}function dn(e){return e!=null&&typeof e=="object"}var uc="[object Symbol]";function mr(e){return typeof e=="symbol"||dn(e)&&Ln(e)==uc}function cc(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var fn=Array.isArray,wi=hn?hn.prototype:void 0,bi=wi?wi.toString:void 0;function yi(e){if(typeof e=="string")return e;if(fn(e))return cc(e,yi)+"";if(mr(e))return bi?bi.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var hc=/\s/;function dc(e){for(var t=e.length;t--&&hc.test(e.charAt(t)););return t}var fc=/^\s+/;function gc(e){return e&&e.slice(0,dc(e)+1).replace(fc,"")}function _t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ai=NaN,mc=/^[-+]0x[0-9a-f]+$/i,_c=/^0b[01]+$/i,pc=/^0o[0-7]+$/i,Ec=parseInt;function Ti(e){if(typeof e=="number")return e;if(mr(e))return Ai;if(_t(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=_t(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=gc(e);var n=_c.test(e);return n||pc.test(e)?Ec(e.slice(2),n?2:8):mc.test(e)?Ai:+e}function Ni(e){return e}var Cc="[object AsyncFunction]",Rc="[object Function]",Ic="[object GeneratorFunction]",Sc="[object Proxy]";function ss(e){if(!_t(e))return!1;var t=Ln(e);return t==Rc||t==Ic||t==Cc||t==Sc}var is=Qt["__core-js_shared__"],Mi=function(){var e=/[^.]+$/.exec(is&&is.keys&&is.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function vc(e){return!!Mi&&Mi in e}var Oc=Function.prototype,wc=Oc.toString;function bc(e){if(e!=null){try{return wc.call(e)}catch{}try{return e+""}catch{}}return""}var yc=/[\\^$.*+?()[\]{}|]/g,Ac=/^\[object .+?Constructor\]$/,Tc=Function.prototype,Nc=Object.prototype,Mc=Tc.toString,Dc=Nc.hasOwnProperty,Lc=RegExp("^"+Mc.call(Dc).replace(yc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Uc(e){if(!_t(e)||vc(e))return!1;var t=ss(e)?Lc:Ac;return t.test(bc(e))}function kc(e,t){return e==null?void 0:e[t]}function os(e,t){var n=kc(e,t);return Uc(n)?n:void 0}var Di=Object.create,Pc=function(){function e(){}return function(t){if(!_t(t))return{};if(Di)return Di(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Fc(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xc(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var $c=800,Bc=16,Hc=Date.now;function Wc(e){var t=0,n=0;return function(){var r=Hc(),s=Bc-(r-n);if(n=r,s>0){if(++t>=$c)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function jc(e){return function(){return e}}var _r=function(){try{var e=os(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Yc=_r?function(e,t){return _r(e,"toString",{configurable:!0,enumerable:!1,value:jc(t),writable:!0})}:Ni,zc=Wc(Yc),Vc=9007199254740991,Gc=/^(?:0|[1-9]\d*)$/;function as(e,t){var n=typeof e;return t=t==null?Vc:t,!!t&&(n=="number"||n!="symbol"&&Gc.test(e))&&e>-1&&e%1==0&&e<t}function ls(e,t,n){t=="__proto__"&&_r?_r(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function pr(e,t){return e===t||e!==e&&t!==t}var Kc=Object.prototype,Xc=Kc.hasOwnProperty;function Li(e,t,n){var r=e[t];(!(Xc.call(e,t)&&pr(r,n))||n===void 0&&!(t in e))&&ls(e,t,n)}function qc(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?ls(n,a,l):Li(n,a,l)}return n}var Ui=Math.max;function Jc(e,t,n){return t=Ui(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Ui(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Fc(e,this,a)}}function Zc(e,t){return zc(Jc(e,t,Ni),e+"")}var Qc=9007199254740991;function ki(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Qc}function us(e){return e!=null&&ki(e.length)&&!ss(e)}function eh(e,t,n){if(!_t(n))return!1;var r=typeof t;return(r=="number"?us(n)&&as(t,n.length):r=="string"&&t in n)?pr(n[t],e):!1}function Pi(e){return Zc(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&eh(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var th=Object.prototype;function Fi(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||th;return e===n}function nh(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var rh="[object Arguments]";function xi(e){return dn(e)&&Ln(e)==rh}var $i=Object.prototype,sh=$i.hasOwnProperty,ih=$i.propertyIsEnumerable,cs=xi(function(){return arguments}())?xi:function(e){return dn(e)&&sh.call(e,"callee")&&!ih.call(e,"callee")};function oh(){return!1}var Bi=typeof f=="object"&&f&&!f.nodeType&&f,Hi=Bi&&typeof module=="object"&&module&&!module.nodeType&&module,ah=Hi&&Hi.exports===Bi,Wi=ah?Qt.Buffer:void 0,lh=Wi?Wi.isBuffer:void 0,ji=lh||oh,uh="[object Arguments]",ch="[object Array]",hh="[object Boolean]",dh="[object Date]",fh="[object Error]",gh="[object Function]",mh="[object Map]",_h="[object Number]",ph="[object Object]",Eh="[object RegExp]",Ch="[object Set]",Rh="[object String]",Ih="[object WeakMap]",Sh="[object ArrayBuffer]",vh="[object DataView]",Oh="[object Float32Array]",wh="[object Float64Array]",bh="[object Int8Array]",yh="[object Int16Array]",Ah="[object Int32Array]",Th="[object Uint8Array]",Nh="[object Uint8ClampedArray]",Mh="[object Uint16Array]",Dh="[object Uint32Array]",Qe={};Qe[Oh]=Qe[wh]=Qe[bh]=Qe[yh]=Qe[Ah]=Qe[Th]=Qe[Nh]=Qe[Mh]=Qe[Dh]=!0,Qe[uh]=Qe[ch]=Qe[Sh]=Qe[hh]=Qe[vh]=Qe[dh]=Qe[fh]=Qe[gh]=Qe[mh]=Qe[_h]=Qe[ph]=Qe[Eh]=Qe[Ch]=Qe[Rh]=Qe[Ih]=!1;function Lh(e){return dn(e)&&ki(e.length)&&!!Qe[Ln(e)]}function Uh(e){return function(t){return e(t)}}var Yi=typeof f=="object"&&f&&!f.nodeType&&f,Un=Yi&&typeof module=="object"&&module&&!module.nodeType&&module,kh=Un&&Un.exports===Yi,hs=kh&&Si.process,zi=function(){try{var e=Un&&Un.require&&Un.require("util").types;return e||hs&&hs.binding&&hs.binding("util")}catch{}}(),Vi=zi&&zi.isTypedArray,Gi=Vi?Uh(Vi):Lh;function Ph(e,t){var n=fn(e),r=!n&&cs(e),s=!n&&!r&&ji(e),i=!n&&!r&&!s&&Gi(e),o=n||r||s||i,a=o?nh(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||as(u,l))||a.push(u);return a}function Fh(e,t){return function(n){return e(t(n))}}function xh(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var $h=Object.prototype,Bh=$h.hasOwnProperty;function Hh(e){if(!_t(e))return xh(e);var t=Fi(e),n=[];for(var r in e)r=="constructor"&&(t||!Bh.call(e,r))||n.push(r);return n}function Ki(e){return us(e)?Ph(e):Hh(e)}var Wh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jh=/^\w*$/;function Yh(e,t){if(fn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||mr(e)?!0:jh.test(e)||!Wh.test(e)||t!=null&&e in Object(t)}var kn=os(Object,"create");function zh(){this.__data__=kn?kn(null):{},this.size=0}function Vh(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Gh="__lodash_hash_undefined__",Kh=Object.prototype,Xh=Kh.hasOwnProperty;function qh(e){var t=this.__data__;if(kn){var n=t[e];return n===Gh?void 0:n}return Xh.call(t,e)?t[e]:void 0}var Jh=Object.prototype,Zh=Jh.hasOwnProperty;function Qh(e){var t=this.__data__;return kn?t[e]!==void 0:Zh.call(t,e)}var ed="__lodash_hash_undefined__";function td(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=kn&&t===void 0?ed:t,this}function en(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}en.prototype.clear=zh,en.prototype.delete=Vh,en.prototype.get=qh,en.prototype.has=Qh,en.prototype.set=td;function nd(){this.__data__=[],this.size=0}function Er(e,t){for(var n=e.length;n--;)if(pr(e[n][0],t))return n;return-1}var rd=Array.prototype,sd=rd.splice;function id(e){var t=this.__data__,n=Er(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():sd.call(t,n,1),--this.size,!0}function od(e){var t=this.__data__,n=Er(t,e);return n<0?void 0:t[n][1]}function ad(e){return Er(this.__data__,e)>-1}function ld(e,t){var n=this.__data__,r=Er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Lt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Lt.prototype.clear=nd,Lt.prototype.delete=id,Lt.prototype.get=od,Lt.prototype.has=ad,Lt.prototype.set=ld;var Xi=os(Qt,"Map");function ud(){this.size=0,this.__data__={hash:new en,map:new(Xi||Lt),string:new en}}function cd(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Cr(e,t){var n=e.__data__;return cd(t)?n[typeof t=="string"?"string":"hash"]:n.map}function hd(e){var t=Cr(this,e).delete(e);return this.size-=t?1:0,t}function dd(e){return Cr(this,e).get(e)}function fd(e){return Cr(this,e).has(e)}function gd(e,t){var n=Cr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Bt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bt.prototype.clear=ud,Bt.prototype.delete=hd,Bt.prototype.get=dd,Bt.prototype.has=fd,Bt.prototype.set=gd;var md="Expected a function";function ds(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(md);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(ds.Cache||Bt),n}ds.Cache=Bt;var _d=500;function pd(e){var t=ds(e,function(r){return n.size===_d&&n.clear(),r}),n=t.cache;return t}var Ed=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Cd=/\\(\\)?/g,Rd=pd(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Ed,function(n,r,s,i){t.push(s?i.replace(Cd,"$1"):r||n)}),t});function Id(e){return e==null?"":yi(e)}function qi(e,t){return fn(e)?e:Yh(e,t)?[e]:Rd(Id(e))}function Ji(e){if(typeof e=="string"||mr(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Sd(e,t){t=qi(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ji(t[n++])];return n&&n==r?e:void 0}function vd(e,t,n){var r=e==null?void 0:Sd(e,t);return r===void 0?n:r}var Zi=Fh(Object.getPrototypeOf,Object),Od="[object Object]",wd=Function.prototype,bd=Object.prototype,Qi=wd.toString,yd=bd.hasOwnProperty,Ad=Qi.call(Object);function Td(e){if(!dn(e)||Ln(e)!=Od)return!1;var t=Zi(e);if(t===null)return!0;var n=yd.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Qi.call(n)==Ad}function Nd(){this.__data__=new Lt,this.size=0}function Md(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Dd(e){return this.__data__.get(e)}function Ld(e){return this.__data__.has(e)}var Ud=200;function kd(e,t){var n=this.__data__;if(n instanceof Lt){var r=n.__data__;if(!Xi||r.length<Ud-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Bt(r)}return n.set(e,t),this.size=n.size,this}function gn(e){var t=this.__data__=new Lt(e);this.size=t.size}gn.prototype.clear=Nd,gn.prototype.delete=Md,gn.prototype.get=Dd,gn.prototype.has=Ld,gn.prototype.set=kd;var eo=typeof f=="object"&&f&&!f.nodeType&&f,to=eo&&typeof module=="object"&&module&&!module.nodeType&&module,Pd=to&&to.exports===eo,no=Pd?Qt.Buffer:void 0;no&&no.allocUnsafe;function Fd(e,t){return e.slice()}var ro=Qt.Uint8Array;function xd(e){var t=new e.constructor(e.byteLength);return new ro(t).set(new ro(e)),t}function $d(e,t){var n=xd(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Bd(e){return typeof e.constructor=="function"&&!Fi(e)?Pc(Zi(e)):{}}function Hd(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Wd=Hd(),fs=function(){return Qt.Date.now()},jd="Expected a function",Yd=Math.max,zd=Math.min;function Vd(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(jd);t=Ti(t)||0,_t(n)&&(c=!!n.leading,h="maxWait"in n,i=h?Yd(Ti(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function g(T){var j=r,Q=s;return r=s=void 0,u=T,o=e.apply(Q,j),o}function C(T){return u=T,a=setTimeout(U,t),c?g(T):o}function I(T){var j=T-l,Q=T-u,ge=t-j;return h?zd(ge,i-Q):ge}function b(T){var j=T-l,Q=T-u;return l===void 0||j>=t||j<0||h&&Q>=i}function U(){var T=fs();if(b(T))return Z(T);a=setTimeout(U,I(T))}function Z(T){return a=void 0,d&&r?g(T):(r=s=void 0,o)}function V(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function fe(){return a===void 0?o:Z(fs())}function M(){var T=fs(),j=b(T);if(r=arguments,s=this,l=T,j){if(a===void 0)return C(l);if(h)return clearTimeout(a),a=setTimeout(U,t),g(l)}return a===void 0&&(a=setTimeout(U,t)),o}return M.cancel=V,M.flush=fe,M}function gs(e,t,n){(n!==void 0&&!pr(e[t],n)||n===void 0&&!(t in e))&&ls(e,t,n)}function Gd(e){return dn(e)&&us(e)}function ms(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Kd(e){return qc(e,Ki(e))}function Xd(e,t,n,r,s,i,o){var a=ms(e,n),l=ms(t,n),u=o.get(l);if(u){gs(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=fn(l),g=!d&&ji(l),C=!d&&!g&&Gi(l);c=l,d||g||C?fn(a)?c=a:Gd(a)?c=xc(a):g?(h=!1,c=Fd(l)):C?(h=!1,c=$d(l)):c=[]:Td(l)||cs(l)?(c=a,cs(a)?c=Kd(a):(!_t(a)||ss(a))&&(c=Bd(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),gs(e,n,c)}function _s(e,t,n,r,s){e!==t&&Wd(t,function(i,o){if(s||(s=new gn),_t(i))Xd(e,t,o,n,_s,r,s);else{var a=r?r(ms(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),gs(e,o,a)}},Ki)}var qd=Pi(function(e,t,n,r){_s(e,t,n,r)}),ps=Pi(function(e,t,n){_s(e,t,n)});function Jd(e,t,n,r){if(!_t(e))return e;t=qi(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Ji(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=_t(c)?c:as(t[s+1])?[]:{})}Li(a,l,u),a=a[l]}return e}function Zd(e,t,n){return e==null?e:Jd(e,t,n)}function pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Es,so;function Qd(){if(so)return Es;so=1;var e=-1,t=1,n=0;function r(p,W,O,D,y){if(p===W)return p?[[n,p]]:[];if(O!=null){var w=ge(p,W,O);if(w)return w}var x=a(p,W),B=p.substring(0,x);p=p.substring(x),W=W.substring(x),x=u(p,W);var G=p.substring(p.length-x);p=p.substring(0,p.length-x),W=W.substring(0,W.length-x);var ie=s(p,W);return B&&ie.unshift([n,B]),G&&ie.push([n,G]),Z(ie,y),D&&h(ie),ie}function s(p,W){var O;if(!p)return[[t,W]];if(!W)return[[e,p]];var D=p.length>W.length?p:W,y=p.length>W.length?W:p,w=D.indexOf(y);if(w!==-1)return O=[[t,D.substring(0,w)],[n,y],[t,D.substring(w+y.length)]],p.length>W.length&&(O[0][0]=O[2][0]=e),O;if(y.length===1)return[[e,p],[t,W]];var x=c(p,W);if(x){var B=x[0],G=x[1],ie=x[2],de=x[3],me=x[4],Me=r(B,ie),Ae=r(G,de);return Me.concat([[n,me]],Ae)}return i(p,W)}function i(p,W){for(var O=p.length,D=W.length,y=Math.ceil((O+D)/2),w=y,x=2*y,B=new Array(x),G=new Array(x),ie=0;ie<x;ie++)B[ie]=-1,G[ie]=-1;B[w+1]=0,G[w+1]=0;for(var de=O-D,me=de%2!==0,Me=0,Ae=0,v=0,$=0,K=0;K<y;K++){for(var q=-K+Me;q<=K-Ae;q+=2){var z=w+q,Y;q===-K||q!==K&&B[z-1]<B[z+1]?Y=B[z+1]:Y=B[z-1]+1;for(var ue=Y-q;Y<O&&ue<D&&p.charAt(Y)===W.charAt(ue);)Y++,ue++;if(B[z]=Y,Y>O)Ae+=2;else if(ue>D)Me+=2;else if(me){var ae=w+de-q;if(ae>=0&&ae<x&&G[ae]!==-1){var H=O-G[ae];if(Y>=H)return o(p,W,Y,ue)}}}for(var ne=-K+v;ne<=K-$;ne+=2){var ae=w+ne,H;ne===-K||ne!==K&&G[ae-1]<G[ae+1]?H=G[ae+1]:H=G[ae-1]+1;for(var oe=H-ne;H<O&&oe<D&&p.charAt(O-H-1)===W.charAt(D-oe-1);)H++,oe++;if(G[ae]=H,H>O)$+=2;else if(oe>D)v+=2;else if(!me){var z=w+de-ne;if(z>=0&&z<x&&B[z]!==-1){var Y=B[z],ue=w+Y-z;if(H=O-H,Y>=H)return o(p,W,Y,ue)}}}}return[[e,p],[t,W]]}function o(p,W,O,D){var y=p.substring(0,O),w=W.substring(0,D),x=p.substring(O),B=W.substring(D),G=r(y,w),ie=r(x,B);return G.concat(ie)}function a(p,W){if(!p||!W||p.charAt(0)!==W.charAt(0))return 0;for(var O=0,D=Math.min(p.length,W.length),y=D,w=0;O<y;)p.substring(w,y)==W.substring(w,y)?(O=y,w=O):D=y,y=Math.floor((D-O)/2+O);return V(p.charCodeAt(y-1))&&y--,y}function l(p,W){var O=p.length,D=W.length;if(O==0||D==0)return 0;O>D?p=p.substring(O-D):O<D&&(W=W.substring(0,O));var y=Math.min(O,D);if(p==W)return y;for(var w=0,x=1;;){var B=p.substring(y-x),G=W.indexOf(B);if(G==-1)return w;x+=G,(G==0||p.substring(y-x)==W.substring(0,x))&&(w=x,x++)}}function u(p,W){if(!p||!W||p.slice(-1)!==W.slice(-1))return 0;for(var O=0,D=Math.min(p.length,W.length),y=D,w=0;O<y;)p.substring(p.length-y,p.length-w)==W.substring(W.length-y,W.length-w)?(O=y,w=O):D=y,y=Math.floor((D-O)/2+O);return fe(p.charCodeAt(p.length-y))&&y--,y}function c(p,W){var O=p.length>W.length?p:W,D=p.length>W.length?W:p;if(O.length<4||D.length*2<O.length)return null;function y(Ae,v,$){for(var K=Ae.substring($,$+Math.floor(Ae.length/4)),q=-1,z="",Y,ue,ae,H;(q=v.indexOf(K,q+1))!==-1;){var ne=a(Ae.substring($),v.substring(q)),oe=u(Ae.substring(0,$),v.substring(0,q));z.length<oe+ne&&(z=v.substring(q-oe,q)+v.substring(q,q+ne),Y=Ae.substring(0,$-oe),ue=Ae.substring($+ne),ae=v.substring(0,q-oe),H=v.substring(q+ne))}return z.length*2>=Ae.length?[Y,ue,ae,H,z]:null}var w=y(O,D,Math.ceil(O.length/4)),x=y(O,D,Math.ceil(O.length/2)),B;if(!w&&!x)return null;x?w?B=w[4].length>x[4].length?w:x:B=x:B=w;var G,ie,de,me;p.length>W.length?(G=B[0],ie=B[1],de=B[2],me=B[3]):(de=B[0],me=B[1],G=B[2],ie=B[3]);var Me=B[4];return[G,ie,de,me,Me]}function h(p){for(var W=!1,O=[],D=0,y=null,w=0,x=0,B=0,G=0,ie=0;w<p.length;)p[w][0]==n?(O[D++]=w,x=G,B=ie,G=0,ie=0,y=p[w][1]):(p[w][0]==t?G+=p[w][1].length:ie+=p[w][1].length,y&&y.length<=Math.max(x,B)&&y.length<=Math.max(G,ie)&&(p.splice(O[D-1],0,[e,y]),p[O[D-1]+1][0]=t,D--,D--,w=D>0?O[D-1]:-1,x=0,B=0,G=0,ie=0,y=null,W=!0)),w++;for(W&&Z(p),U(p),w=1;w<p.length;){if(p[w-1][0]==e&&p[w][0]==t){var de=p[w-1][1],me=p[w][1],Me=l(de,me),Ae=l(me,de);Me>=Ae?(Me>=de.length/2||Me>=me.length/2)&&(p.splice(w,0,[n,me.substring(0,Me)]),p[w-1][1]=de.substring(0,de.length-Me),p[w+1][1]=me.substring(Me),w++):(Ae>=de.length/2||Ae>=me.length/2)&&(p.splice(w,0,[n,de.substring(0,Ae)]),p[w-1][0]=t,p[w-1][1]=me.substring(0,me.length-Ae),p[w+1][0]=e,p[w+1][1]=de.substring(Ae),w++),w++}w++}}var d=/[^a-zA-Z0-9]/,g=/\s/,C=/[\r\n]/,I=/\n\r?\n$/,b=/^\r?\n\r?\n/;function U(p){function W(Ae,v){if(!Ae||!v)return 6;var $=Ae.charAt(Ae.length-1),K=v.charAt(0),q=$.match(d),z=K.match(d),Y=q&&$.match(g),ue=z&&K.match(g),ae=Y&&$.match(C),H=ue&&K.match(C),ne=ae&&Ae.match(I),oe=H&&v.match(b);return ne||oe?5:ae||H?4:q&&!Y&&ue?3:Y||ue?2:q||z?1:0}for(var O=1;O<p.length-1;){if(p[O-1][0]==n&&p[O+1][0]==n){var D=p[O-1][1],y=p[O][1],w=p[O+1][1],x=u(D,y);if(x){var B=y.substring(y.length-x);D=D.substring(0,D.length-x),y=B+y.substring(0,y.length-x),w=B+w}for(var G=D,ie=y,de=w,me=W(D,y)+W(y,w);y.charAt(0)===w.charAt(0);){D+=y.charAt(0),y=y.substring(1)+w.charAt(0),w=w.substring(1);var Me=W(D,y)+W(y,w);Me>=me&&(me=Me,G=D,ie=y,de=w)}p[O-1][1]!=G&&(G?p[O-1][1]=G:(p.splice(O-1,1),O--),p[O][1]=ie,de?p[O+1][1]=de:(p.splice(O+1,1),O--))}O++}}function Z(p,W){p.push([n,""]);for(var O=0,D=0,y=0,w="",x="",B;O<p.length;){if(O<p.length-1&&!p[O][1]){p.splice(O,1);continue}switch(p[O][0]){case t:y++,x+=p[O][1],O++;break;case e:D++,w+=p[O][1],O++;break;case n:var G=O-y-D-1;if(W){if(G>=0&&T(p[G][1])){var ie=p[G][1].slice(-1);if(p[G][1]=p[G][1].slice(0,-1),w=ie+w,x=ie+x,!p[G][1]){p.splice(G,1),O--;var de=G-1;p[de]&&p[de][0]===t&&(y++,x=p[de][1]+x,de--),p[de]&&p[de][0]===e&&(D++,w=p[de][1]+w,de--),G=de}}if(M(p[O][1])){var ie=p[O][1].charAt(0);p[O][1]=p[O][1].slice(1),w+=ie,x+=ie}}if(O<p.length-1&&!p[O][1]){p.splice(O,1);break}if(w.length>0||x.length>0){w.length>0&&x.length>0&&(B=a(x,w),B!==0&&(G>=0?p[G][1]+=x.substring(0,B):(p.splice(0,0,[n,x.substring(0,B)]),O++),x=x.substring(B),w=w.substring(B)),B=u(x,w),B!==0&&(p[O][1]=x.substring(x.length-B)+p[O][1],x=x.substring(0,x.length-B),w=w.substring(0,w.length-B)));var me=y+D;w.length===0&&x.length===0?(p.splice(O-me,me),O=O-me):w.length===0?(p.splice(O-me,me,[t,x]),O=O-me+1):x.length===0?(p.splice(O-me,me,[e,w]),O=O-me+1):(p.splice(O-me,me,[e,w],[t,x]),O=O-me+2)}O!==0&&p[O-1][0]===n?(p[O-1][1]+=p[O][1],p.splice(O,1)):O++,y=0,D=0,w="",x="";break}}p[p.length-1][1]===""&&p.pop();var Me=!1;for(O=1;O<p.length-1;)p[O-1][0]===n&&p[O+1][0]===n&&(p[O][1].substring(p[O][1].length-p[O-1][1].length)===p[O-1][1]?(p[O][1]=p[O-1][1]+p[O][1].substring(0,p[O][1].length-p[O-1][1].length),p[O+1][1]=p[O-1][1]+p[O+1][1],p.splice(O-1,1),Me=!0):p[O][1].substring(0,p[O+1][1].length)==p[O+1][1]&&(p[O-1][1]+=p[O+1][1],p[O][1]=p[O][1].substring(p[O+1][1].length)+p[O+1][1],p.splice(O+1,1),Me=!0)),O++;Me&&Z(p,W)}function V(p){return p>=55296&&p<=56319}function fe(p){return p>=56320&&p<=57343}function M(p){return fe(p.charCodeAt(0))}function T(p){return V(p.charCodeAt(p.length-1))}function j(p){for(var W=[],O=0;O<p.length;O++)p[O][1].length>0&&W.push(p[O]);return W}function Q(p,W,O,D){return T(p)||M(D)?null:j([[n,p],[e,W],[t,O],[n,D]])}function ge(p,W,O){var D=typeof O=="number"?{index:O,length:0}:O.oldRange,y=typeof O=="number"?null:O.newRange,w=p.length,x=W.length;if(D.length===0&&(y===null||y.length===0)){var B=D.index,G=p.slice(0,B),ie=p.slice(B),de=y?y.index:null;e:{var me=B+x-w;if(de!==null&&de!==me||me<0||me>x)break e;var Me=W.slice(0,me),Ae=W.slice(me);if(Ae!==ie)break e;var v=Math.min(B,me),$=G.slice(0,v),K=Me.slice(0,v);if($!==K)break e;var q=G.slice(v),z=Me.slice(v);return Q($,q,z,ie)}e:{if(de!==null&&de!==B)break e;var Y=B,Me=W.slice(0,Y),Ae=W.slice(Y);if(Me!==G)break e;var ue=Math.min(w-Y,x-Y),ae=ie.slice(ie.length-ue),H=Ae.slice(Ae.length-ue);if(ae!==H)break e;var q=ie.slice(0,ie.length-ue),z=Ae.slice(0,Ae.length-ue);return Q(G,q,z,ae)}}if(D.length>0&&y&&y.length===0)e:{var $=p.slice(0,D.index),ae=p.slice(D.index+D.length),v=$.length,ue=ae.length;if(x<v+ue)break e;var K=W.slice(0,v),H=W.slice(x-ue);if($!==K||ae!==H)break e;var q=p.slice(v,w-ue),z=W.slice(v,x-ue);return Q($,q,z,ae)}return null}function le(p,W,O,D){return r(p,W,O,D,!0)}return le.INSERT=t,le.DELETE=e,le.EQUAL=n,Es=le,Es}var ef=Qd();const Cs=pt(ef);function Pn(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function tf(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function nf(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function rf(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function sf(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function of(e){return Array.isArray(e)?e:[e]}const af=new Set(["true","false"]);function lf(e){return af.has(e.toLowerCase())}const Fn="__INTERNAL_EDITOR__",Rs=`${Fn}DOCS_NORMAL`,Is=`${Fn}DOCS_FORMULA_BAR`,io=`${Fn}ZEN_EDITOR`,oo=`\r
2
- `,ao="isRowStylePrecedeColumnStyle",lo=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function uf(e){return`${Fn}${e}`}function uo(e){return e.startsWith(Fn)}function cf(e,t){t.forEach(n=>e.add(n))}function co(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}function ho(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}class Ss extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class hf extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function fo(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function go(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function mo(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _o(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function po(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function xn(e){return typeof e=="function"}function df(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var vs=df(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
1
+ (function(d,Ie){typeof exports=="object"&&typeof module<"u"?Ie(exports,require("rxjs"),require("rxjs/operators"),require("@wendellhu/redi")):typeof define=="function"&&define.amd?define(["exports","rxjs","rxjs/operators","@wendellhu/redi"],Ie):(d=typeof globalThis<"u"?globalThis:d||self,Ie(d.UniverCore={},d.rxjs,d.rxjs.operators,d["@wendellhu/redi"]))})(this,function(d,Ie,Lt,We){"use strict";var NE=Object.defineProperty;var ME=(d,Ie,Lt)=>Ie in d?NE(d,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Lt}):d[Ie]=Lt;var R=(d,Ie,Lt)=>ME(d,typeof Ie!="symbol"?Ie+"":Ie,Lt);var Ku,Xu;function Ju(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const gr=typeof global<"u"?global:typeof self<"u"?self:window;function Zu(){const t=new Map;let n=0;typeof gr.requestIdleCallback!="function"&&(gr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof gr.cancelIdleCallback!="function"&&(gr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function Qu(){Zu()}function Ln(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function ec(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function tc(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function nc(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function rc(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function sc(e){return Array.isArray(e)?e:[e]}function ic(e,t){t.forEach(n=>e.add(n))}function Oi(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class is extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class oc extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function wi(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function bi(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function yi(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ai(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function Ti(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function Un(e){return typeof e=="function"}function ac(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var os=ac(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
3
2
  `+n.map(function(r,s){return s+1+") "+r.toString()}).join(`
4
- `):"",this.name="UnsubscriptionError",this.errors=n}});function Eo(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var ff=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=mo(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(I){t={error:I}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else o.remove(this);var c=this.initialTeardown;if(xn(c))try{c()}catch(I){i=I instanceof vs?I.errors:[I]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var d=mo(h),g=d.next();!g.done;g=d.next()){var C=g.value;try{Co(C)}catch(I){i=i!=null?i:[],I instanceof vs?i=po(po([],_o(i)),_o(I.errors)):i.push(I)}}}catch(I){r={error:I}}finally{try{g&&!g.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(i)throw new vs(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Co(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Eo(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Eo(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();function gf(e){return e instanceof ff||e&&"closed"in e&&xn(e.remove)&&xn(e.add)&&xn(e.unsubscribe)}function Co(e){xn(e)?e():e.unsubscribe()}function tt(e){let t=!1;return e?gf(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:tt(()=>{})}function mf(e){return tt(()=>{e.unsubscribe()})}class Rr{constructor(){R(this,"_disposables",new Set)}add(t){const n=tt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){R(this,"_disposed",!1);R(this,"_collection",new Rr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class _f extends st{constructor(){super(...arguments);R(this,"dispose$",new be.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class pf extends st{constructor(n){super();R(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const mn=ke.createIdentifier("univer.context-service");class Ro extends st{constructor(){super(...arguments);R(this,"_contextChanged$",new be.Subject);R(this,"contextChanged$",this._contextChanged$.asObservable());R(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new be.Observable(r=>{const s=this._contextChanged$.pipe(be.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var Io=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(Io||{});const It=ke.createIdentifier("univer.log");class So extends st{constructor(){super(...arguments);R(this,"_logLevel",3);R(this,"_deduction",new Set)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=Ef(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function Ef(...e){return e.map(t=>JSON.stringify(t)).join("")}var Cf=Object.getOwnPropertyDescriptor,Rf=(e,t,n,r)=>{for(var s=r>1?void 0:r?Cf(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vo=(e,t)=>(n,r)=>t(n,r,e),$n=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))($n||{});const Bn=ke.createIdentifier("anywhere.command-service");class If{constructor(){R(this,"_commands",new Map);R(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),tt(()=>{this._commands.delete(t.id),this._commandTypes.delete(t.id)})}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Oo={id:"nil",type:0,handler:()=>!0};f.CommandService=class extends st{constructor(n,r){super();R(this,"_commandRegistry");R(this,"_beforeCommandExecutionListeners",[]);R(this,"_commandExecutedListeners",[]);R(this,"_multiCommandDisposables",new Map);R(this,"_commandExecutingLevel",0);R(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new If,this._registerCommand(Oo)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),tt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),tt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof Ss)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=nf(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof Ss)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),tt(()=>Pn(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(n)}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{const o=new Rr;s=new Sf(n.id),o.add(this._commandRegistry.registerCommand(s)),o.add(tt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return tt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}},f.CommandService=Rf([vo(0,ke.Inject(ke.Injector)),vo(1,It)],f.CommandService);class Sf{constructor(t){R(this,"name");R(this,"multi",!0);R(this,"type",0);R(this,"priority",0);R(this,"_implementations",[]);R(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(It),s=t.get(mn),i=t.get(ke.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),tt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Os(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return go(r)}function vf(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return fo(r)}function wo(e){return new be.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function bo(e){return function(n){return new be.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Of(e=0){return t=>{let n=[];return t.pipe(be.tap(r=>n.push(r)),be.debounceTime(e),be.map(()=>n),be.tap(()=>n=[]))}}function wf(e){const t=new be.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(be.take(1))}const bf=e=>new Promise(t=>{be.merge(wo(e.onCommandExecuted.bind(e)).pipe(fr.filter(([n])=>n.type===$n.MUTATION)),be.timer(300)).pipe(fr.debounceTime(16),fr.first()).subscribe(()=>{t()})});function yo(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function yf(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Ao(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function Hn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=yo(e,t):r=Ao(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Af(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const Wn=2,To=1;function Tf(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,g=u,C=i,I=s;return Math.abs(a-n)>Wn||Math.abs(l-r)>Wn||Math.abs(d-C)>Wn||Math.abs(g-I)>Wn||Math.abs(h-o)>To}var No=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(No||{}),qe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(qe||{}),Mo=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Mo||{}),Et=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(Et||{}),Do=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Do||{}),Lo=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Lo||{}),Uo=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Uo||{}),ko=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(ko||{}),Po=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Po||{}),Fo=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Fo||{});function Nf(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var xo=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(xo||{}),jn=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(jn||{}),Ir=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Ir||{}),$o=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))($o||{}),Bo=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(Bo||{}),Ho=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(Ho||{}),Wo=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(Wo||{}),jo=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(jo||{}),Yo=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(Yo||{}),zo=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(zo||{}),Yn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Yn||{}),Vo=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(Vo||{}),St=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(St||{}),tn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(tn||{}),nn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(nn||{}),Sr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Sr||{}),vr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(vr||{}),Ut=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Ut||{}),Se=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Se||{}),Ht=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Ht||{}),ct=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ct||{}),Or=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Or||{});const Mf="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Df=e=>crypto.getRandomValues(new Uint8Array(e)),Lf=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Uf=(e,t=21)=>Lf(e,t|0,Df),kf=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Mf[n[e]&63];return t};const Go=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),Pf=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function Ff(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Pf.test(e)){if(Ko(e))return!0;try{const r=new URL(Xo(e)).hostname.split(".").pop();if(r&&Go.has(r))return!0}catch{return!1}}return!1}function Ko(e){return/^[a-zA-Z]+:\/\//.test(e)}function xf(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Xo(e){return Ko(e)?e:xf(e)?`mailto://${e}`:`https://${e}`}const $f=/^-ms-/,Bf=/-([a-z])/g,Wt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function ws(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Hf(e,t):re.isObject(e)?Wf(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Hf(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!ws(s,i))return!1}return!0}function Wf(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!ws(i,o))return!1}return!0}class re{static stringAt(t){let n="",r=t;for(;r>=Wt.length;)r/=Wt.length,r-=1,n+=Wt[r%Wt.length];const s=t%Wt.length;return n+=Wt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Wt.length**i+Wt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return kt(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return ws(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Ff(t)}static normalizeUrl(t){return Xo(t)}static topLevelDomainCombiningString(){return[...Go].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace($f,"ms-").replace(Bf,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function kt(e=21,t){return t?Uf(t,e)():kf(e)}function bs(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const jf=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function wr(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(ys(r,{...a,ed:Math.min(u,n)}))):o.push(ys(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function Yf(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,g=[];c!=null&&(typeof c=="number"?g.push(`margin-top: ${c}px`):g.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?g.push(`margin-bottom: ${h}px`):g.push(`margin-bottom: ${h.v}px`)),d!=null&&g.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}>${wr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=wr(e,o,r.length)),i}else return wr(e,0,e.dataStream.length)}function ys(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:g,va:C}=s;let I=e.slice(n,r);const b=[];return a===Se.TRUE&&(I=`<i>${I}</i>`),C===Ut.SUPERSCRIPT?I=`<sup>${I}</sup>`:C===Ut.SUBSCRIPT&&(I=`<sub>${I}</sub>`),(u==null?void 0:u.s)===Se.TRUE&&(I=`<u>${I}</u>`),(c==null?void 0:c.s)===Se.TRUE&&(I=`<s>${I}</s>`),l===Se.TRUE&&(I=`<strong>${I}</strong>`),i&&b.push(`font-family: ${i}`),g&&b.push(`color: ${g.rgb}`),o&&b.push(`font-size: ${o}pt`),h&&b.push("text-decoration: overline"),d&&b.push(`background: ${d.rgb}`),b.length?`<span style="${b.join("; ")};">${I}</span>`:I}const qo={[Or.OFFICE]:{[ct.ACCENT1]:"#4472C4",[ct.ACCENT2]:"#ED7D31",[ct.ACCENT3]:"#A5A5A5",[ct.ACCENT4]:"#70AD47",[ct.ACCENT5]:"#5B9BD5",[ct.ACCENT6]:"#70AD47",[ct.DARK1]:"#000000",[ct.DARK2]:"#44546A",[ct.LIGHT1]:"#FFFFFF",[ct.LIGHT2]:"#E7E6E6",[ct.HYPERLINK]:"#0563C1",[ct.FOLLOWED_HYPERLINK]:"#954F72"}};class br{constructor(){R(this,"_themeValue",ct.LIGHT1);R(this,"_themeColors");R(this,"_themeTint");R(this,"_rgbValue","");R(this,"_colorType");this._colorType=Et.UNSUPPORTED,this._themeColors=Or.OFFICE,this._themeTint=0}asRgbColor(){return new yr(this._rgbValue,this)}asThemeColor(){return new Ar(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Et.THEME:return this.asThemeColor();case Et.RGB:return this.asRgbColor();case Et.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=Et.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Et.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Et.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Et.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class rn{constructor(t){R(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new br().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new rn(this._builder)}equals(t){return!1}}class Jo{constructor(t){R(this,"_saturation",0);R(this,"_hue",0);R(this,"_lightness",0);R(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new br;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends rn{constructor(n,r){super(r);R(this,"_cssString");R(this,"_red");R(this,"_green");R(this,"_blue");R(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return rn.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return Et.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};R(Ct,"RGB_COLOR_AMT",0),R(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),R(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let yr=Ct;const qt=class qt extends rn{constructor(n,r,s,i){super(i);R(this,"_themeColorType");R(this,"_themeTint");R(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=qo[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(qt._cacheThemeColor.has(this._themeColors)){if(s=qt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,qt._cacheThemeColor.set(this._themeColors,s);const i=new Jo(rn.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new qt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof qt?n._themeColorType===this._themeColorType:!1}getColorType(){return Et.THEME}getThemeColorType(){return this._themeColorType}};R(qt,"_cacheThemeColor",new Map);let Ar=qt;const zf="rgb(",Vf="rgba(",As={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 vt{constructor(t){R(this,"_color");R(this,"_rgbColor");R(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof vt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=Zo(t);if(n==null){this._setNullColor();return}this._color=n;const r=Jf(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new vt(t).toRgb(),i=new vt(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new vt(l)}static getContrastRatio(t,n){const r=new vt(t).getLuminance(),s=new vt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[Tr(Math.round(n).toString(16)),Tr(Math.round(r).toString(16)),Tr(Math.round(s).toString(16)),Tr(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return tg(this.toRgb())}toHsl(){return eg(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}setAlpha(t){return new vt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=Ts(t),n=Ts(n),r=Ts(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const Tr=e=>e.length===1?`0${e}`:e,Ts=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),Zo=e=>{if(rg(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(As[t]){const n=As[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Gf(t);if(t.startsWith("rgb"))return Kf(t);if(t.startsWith("hsl"))return Xf(t);if(t.startsWith("hsv"))return qf(t)},Gf=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},Kf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Xf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},qf=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Jf=e=>{const t=Zo(e);if(t!=null)return"r"in t?t:"l"in t?Zf(t):Qf(t)},Ns=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Zf=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=Ns(u,l,t+1/3),i=Ns(u,l,t),o=Ns(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},Qf=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],g={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(g.a=e.a),g},eg=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},tg=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},ng=e=>e==null,rg=e=>!ng(e)&&typeof e=="object";function sg(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function ig(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var Pe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Pe||{});function og(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function ag(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Ht.STRING;if(typeof e.v=="number")return Ht.NUMBER;if(typeof e.v=="boolean")return Ht.BOOLEAN}function lg(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function ug(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),nt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(nt||{});function cg(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var Qo=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(Qo||{}),ea=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(ea||{});function hg(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:g}=n[u];if(e===c&&t===d){i=h,o=g,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=g){i=h,o=g,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var _n=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(_n||{});function ta(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,g=n;if(r&&i){const{startRow:C,startColumn:I,endRow:b,endColumn:U,startY:Z,endY:V,startX:fe,endX:M}=i;c=C,h=I,d=b,g=U,o=Z,a=V,l=fe,u=M}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,g=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:g,startY:o,endY:a,startX:l,endX:u}}const dg=ta;function fg(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function na(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Ms(e){return na(e)&&(e==null?void 0:e.coverable)!==!1}function Tt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new br().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function gg(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function mg(e){return re.isString(e)&&e.length>0}function _g(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Tt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,g,C,I,b,U;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${Nr((a=e.bd)==null?void 0:a.b.s)} ${(l=Tt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${Nr((c=e.bd)==null?void 0:c.t.s)} ${(h=Tt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${Nr((g=e.bd)==null?void 0:g.r.s)} ${(C=Tt(e.bd.r.cl))!=null?C:""}; `),(I=e.bd)!=null&&I.l&&(n+=`border-left: ${Nr((b=e.bd)==null?void 0:b.l.s)} ${(U=Tt(e.bd.l.cl))!=null?U:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Tt(e.cl)}; `)}],["va",()=>{e.va===Ut.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Ut.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Yn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Yn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===St.LEFT?n+="text-align: left; ":e.ht===St.RIGHT?n+="text-align: right; ":e.ht===St.CENTER?n+="text-align: center; ":e.ht===St.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===tn.BOTTOM?n+="vertical-align: bottom; ":e.vt===tn.TOP?n+="vertical-align: top; ":e.vt===tn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===nn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===nn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,g,C,I,b,U;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(g=e.pd)==null?void 0:g.r}pt`;(C=e.pd)!=null&&C.b&&(n+=`padding-bottom: ${o}; `),(I=e.pd)!=null&&I.t&&(n+=`padding-top: ${a}; `),(b=e.pd)!=null&&b.l&&(n+=`padding-left: ${l}; `),(U=e.pd)!=null&&U.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function Nr(e){let t="";return e===qe.NONE?t="none":e===qe.THIN?t="0.5pt solid":e===qe.HAIR?t="0.5pt double":e===qe.DOTTED?t="0.5pt dotted":e===qe.DASHED||e===qe.DASH_DOT?t="0.5pt dashed":e===qe.DASH_DOT_DOT?t="0.5pt dotted":e===qe.DOUBLE?t="0.5pt double":e===qe.MEDIUM?t="1pt solid":e===qe.MEDIUM_DASHED||e===qe.MEDIUM_DASH_DOT?t="1pt dashed":e===qe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===qe.SLANT_DASH_DOT?t="0.5pt dashed":e===qe.THICK&&(t="1.5pt solid"),t}function pg(e){let t=0;if(e=e.trim(),e==="none")t=qe.NONE;else if(e==="0.5pt solid")t=qe.THIN;else if(e==="0.5pt double")t=qe.HAIR;else if(e==="0.5pt dotted")t=qe.DOTTED;else if(e==="0.5pt dashed")t=qe.DASHED;else if(e==="1pt solid")t=qe.MEDIUM;else if(e==="1pt dashed")t=qe.MEDIUM_DASHED;else if(e==="1pt dotted")t=qe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=qe.THICK;else if(!e.includes("none"))t=qe.THIN;else return qe.NONE;return t}function Eg(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function Cg(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function Rg(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Ds(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>Ds(e[n],t[n])):e===t:!1}function ra(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Ds(n,r)}function Ig(e,t){return t.some(n=>e.indexOf(n)>-1)}var Mr={exports:{}},Sg=Mr.exports,sa;function vg(){return sa||(sa=1,function(e,t){(function(n,r){e.exports=r()})(Sg,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",g="year",C="date",I="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Z={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var y=["th","st","nd","rd"],w=D%100;return"["+D+(y[(w-20)%10]||y[w]||y[0])+"]"}},V=function(D,y,w){var x=String(D);return!x||x.length>=y?D:""+Array(y+1-x.length).join(w)+D},fe={s:V,z:function(D){var y=-D.utcOffset(),w=Math.abs(y),x=Math.floor(w/60),B=w%60;return(y<=0?"+":"-")+V(x,2,"0")+":"+V(B,2,"0")},m:function D(y,w){if(y.date()<w.date())return-D(w,y);var x=12*(w.year()-y.year())+(w.month()-y.month()),B=y.clone().add(x,h),G=w-B<0,ie=y.clone().add(x+(G?-1:1),h);return+(-(x+(w-B)/(G?B-ie:ie-B))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:h,y:g,w:c,d:u,D:C,h:l,m:a,s:o,ms:i,Q:d}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},M="en",T={};T[M]=Z;var j="$isDayjsObject",Q=function(D){return D instanceof W||!(!D||!D[j])},ge=function D(y,w,x){var B;if(!y)return M;if(typeof y=="string"){var G=y.toLowerCase();T[G]&&(B=G),w&&(T[G]=w,B=G);var ie=y.split("-");if(!B&&ie.length>1)return D(ie[0])}else{var de=y.name;T[de]=y,B=de}return!x&&B&&(M=B),B||!x&&M},le=function(D,y){if(Q(D))return D.clone();var w=typeof y=="object"?y:{};return w.date=D,w.args=arguments,new W(w)},p=fe;p.l=ge,p.i=Q,p.w=function(D,y){return le(D,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var W=function(){function D(w){this.$L=ge(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[j]=!0}var y=D.prototype;return y.parse=function(w){this.$d=function(x){var B=x.date,G=x.utc;if(B===null)return new Date(NaN);if(p.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var ie=B.match(b);if(ie){var de=ie[2]-1||0,me=(ie[7]||"0").substring(0,3);return G?new Date(Date.UTC(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,me)):new Date(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,me)}}return new Date(B)}(w),this.init()},y.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},y.$utils=function(){return p},y.isValid=function(){return this.$d.toString()!==I},y.isSame=function(w,x){var B=le(w);return this.startOf(x)<=B&&B<=this.endOf(x)},y.isAfter=function(w,x){return le(w)<this.startOf(x)},y.isBefore=function(w,x){return this.endOf(x)<le(w)},y.$g=function(w,x,B){return p.u(w)?this[x]:this.set(B,w)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(w,x){var B=this,G=!!p.u(x)||x,ie=p.p(w),de=function(z,Y){var ue=p.w(B.$u?Date.UTC(B.$y,Y,z):new Date(B.$y,Y,z),B);return G?ue:ue.endOf(u)},me=function(z,Y){return p.w(B.toDate()[z].apply(B.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(Y)),B)},Me=this.$W,Ae=this.$M,v=this.$D,$="set"+(this.$u?"UTC":"");switch(ie){case g:return G?de(1,0):de(31,11);case h:return G?de(1,Ae):de(0,Ae+1);case c:var K=this.$locale().weekStart||0,q=(Me<K?Me+7:Me)-K;return de(G?v-q:v+(6-q),Ae);case u:case C:return me($+"Hours",0);case l:return me($+"Minutes",1);case a:return me($+"Seconds",2);case o:return me($+"Milliseconds",3);default:return this.clone()}},y.endOf=function(w){return this.startOf(w,!1)},y.$set=function(w,x){var B,G=p.p(w),ie="set"+(this.$u?"UTC":""),de=(B={},B[u]=ie+"Date",B[C]=ie+"Date",B[h]=ie+"Month",B[g]=ie+"FullYear",B[l]=ie+"Hours",B[a]=ie+"Minutes",B[o]=ie+"Seconds",B[i]=ie+"Milliseconds",B)[G],me=G===u?this.$D+(x-this.$W):x;if(G===h||G===g){var Me=this.clone().set(C,1);Me.$d[de](me),Me.init(),this.$d=Me.set(C,Math.min(this.$D,Me.daysInMonth())).$d}else de&&this.$d[de](me);return this.init(),this},y.set=function(w,x){return this.clone().$set(w,x)},y.get=function(w){return this[p.p(w)]()},y.add=function(w,x){var B,G=this;w=Number(w);var ie=p.p(x),de=function(Ae){var v=le(G);return p.w(v.date(v.date()+Math.round(Ae*w)),G)};if(ie===h)return this.set(h,this.$M+w);if(ie===g)return this.set(g,this.$y+w);if(ie===u)return de(1);if(ie===c)return de(7);var me=(B={},B[a]=r,B[l]=s,B[o]=n,B)[ie]||1,Me=this.$d.getTime()+w*me;return p.w(Me,this)},y.subtract=function(w,x){return this.add(-1*w,x)},y.format=function(w){var x=this,B=this.$locale();if(!this.isValid())return B.invalidDate||I;var G=w||"YYYY-MM-DDTHH:mm:ssZ",ie=p.z(this),de=this.$H,me=this.$m,Me=this.$M,Ae=B.weekdays,v=B.months,$=B.meridiem,K=function(Y,ue,ae,H){return Y&&(Y[ue]||Y(x,G))||ae[ue].slice(0,H)},q=function(Y){return p.s(de%12||12,Y,"0")},z=$||function(Y,ue,ae){var H=Y<12?"AM":"PM";return ae?H.toLowerCase():H};return G.replace(U,function(Y,ue){return ue||function(ae){switch(ae){case"YY":return String(x.$y).slice(-2);case"YYYY":return p.s(x.$y,4,"0");case"M":return Me+1;case"MM":return p.s(Me+1,2,"0");case"MMM":return K(B.monthsShort,Me,v,3);case"MMMM":return K(v,Me);case"D":return x.$D;case"DD":return p.s(x.$D,2,"0");case"d":return String(x.$W);case"dd":return K(B.weekdaysMin,x.$W,Ae,2);case"ddd":return K(B.weekdaysShort,x.$W,Ae,3);case"dddd":return Ae[x.$W];case"H":return String(de);case"HH":return p.s(de,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return z(de,me,!0);case"A":return z(de,me,!1);case"m":return String(me);case"mm":return p.s(me,2,"0");case"s":return String(x.$s);case"ss":return p.s(x.$s,2,"0");case"SSS":return p.s(x.$ms,3,"0");case"Z":return ie}return null}(Y)||ie.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(w,x,B){var G,ie=this,de=p.p(x),me=le(w),Me=(me.utcOffset()-this.utcOffset())*r,Ae=this-me,v=function(){return p.m(ie,me)};switch(de){case g:G=v()/12;break;case h:G=v();break;case d:G=v()/3;break;case c:G=(Ae-Me)/6048e5;break;case u:G=(Ae-Me)/864e5;break;case l:G=Ae/s;break;case a:G=Ae/r;break;case o:G=Ae/n;break;default:G=Ae}return B?G:p.a(G)},y.daysInMonth=function(){return this.endOf(h).$D},y.$locale=function(){return T[this.$L]},y.locale=function(w,x){if(!w)return this.$L;var B=this.clone(),G=ge(w,x,!0);return G&&(B.$L=G),B},y.clone=function(){return p.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},D}(),O=W.prototype;return le.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",g],["$D",C]].forEach(function(D){O[D[1]]=function(y){return this.$g(y,D[0],D[1])}}),le.extend=function(D,y){return D.$i||(D(y,W,le),D.$i=!0),le},le.locale=ge,le.isDayjs=Q,le.unix=function(D){return le(1e3*D)},le.en=T[M],le.Ls=T,le.p={},le})}(Mr)),Mr.exports}var Og=vg();const Pt=pt(Og);var Dr={exports:{}},wg=Dr.exports,ia;function bg(){return ia||(ia=1,function(e,t){(function(n,r){e.exports=r()})(wg,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(Dr)),Dr.exports}var yg=bg();const Ag=pt(yg);var Lr={exports:{}},Tg=Lr.exports,oa;function Ng(){return oa||(oa=1,function(e,t){(function(n,r){e.exports=r()})(Tg,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(b){return(b=+b)+(b>68?1900:2e3)},c=function(b){return function(U){this[b]=+U}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(U){if(!U||U==="Z")return 0;var Z=U.match(/([+-]|\d\d)/g),V=60*Z[1]+(+Z[2]||0);return V===0?0:Z[0]==="+"?-V:V}(b)}],d=function(b){var U=l[b];return U&&(U.indexOf?U:U.s.concat(U.f))},g=function(b,U){var Z,V=l.meridiem;if(V){for(var fe=1;fe<=24;fe+=1)if(b.indexOf(V(fe,0,U))>-1){Z=fe>12;break}}else Z=b===(U?"pm":"PM");return Z},C={A:[a,function(b){this.afternoon=g(b,!1)}],a:[a,function(b){this.afternoon=g(b,!0)}],Q:[s,function(b){this.month=3*(b-1)+1}],S:[s,function(b){this.milliseconds=100*+b}],SS:[i,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(b){var U=l.ordinal,Z=b.match(/\d+/);if(this.day=Z[0],U)for(var V=1;V<=31;V+=1)U(V).replace(/\[|\]/g,"")===b&&(this.day=V)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(b){var U=d("months"),Z=(d("monthsShort")||U.map(function(V){return V.slice(0,3)})).indexOf(b)+1;if(Z<1)throw new Error;this.month=Z%12||Z}],MMMM:[a,function(b){var U=d("months").indexOf(b)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(b){this.year=u(b)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function I(b){var U,Z;U=b,Z=l&&l.formats;for(var V=(b=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,p,W){var O=W&&W.toUpperCase();return p||Z[W]||n[W]||Z[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,y,w){return y||w.slice(1)})})).match(r),fe=V.length,M=0;M<fe;M+=1){var T=V[M],j=C[T],Q=j&&j[0],ge=j&&j[1];V[M]=ge?{regex:Q,parser:ge}:T.replace(/^\[|\]$/g,"")}return function(le){for(var p={},W=0,O=0;W<fe;W+=1){var D=V[W];if(typeof D=="string")O+=D.length;else{var y=D.regex,w=D.parser,x=le.slice(O),B=y.exec(x)[0];w.call(p,B),le=le.replace(B,"")}}return function(G){var ie=G.afternoon;if(ie!==void 0){var de=G.hours;ie?de<12&&(G.hours+=12):de===12&&(G.hours=0),delete G.afternoon}}(p),p}}return function(b,U,Z){Z.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(u=b.parseTwoDigitYear);var V=U.prototype,fe=V.parse;V.parse=function(M){var T=M.date,j=M.utc,Q=M.args;this.$u=j;var ge=Q[1];if(typeof ge=="string"){var le=Q[2]===!0,p=Q[3]===!0,W=le||p,O=Q[2];p&&(O=Q[2]),l=this.$locale(),!le&&O&&(l=Z.Ls[O]),this.$d=function(x,B,G,ie){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*x);var de=I(B)(x),me=de.year,Me=de.month,Ae=de.day,v=de.hours,$=de.minutes,K=de.seconds,q=de.milliseconds,z=de.zone,Y=de.week,ue=new Date,ae=Ae||(me||Me?1:ue.getDate()),H=me||ue.getFullYear(),ne=0;me&&!Me||(ne=Me>0?Me-1:ue.getMonth());var oe,_e=v||0,ye=$||0,Ue=K||0,X=q||0;return z?new Date(Date.UTC(H,ne,ae,_e,ye,Ue,X+60*z.offset*1e3)):G?new Date(Date.UTC(H,ne,ae,_e,ye,Ue,X)):(oe=new Date(H,ne,ae,_e,ye,Ue,X),Y&&(oe=ie(oe).week(Y).toDate()),oe)}catch{return new Date("")}}(T,ge,j,Z),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),W&&T!=this.format(ge)&&(this.$d=new Date("")),l={}}else if(ge instanceof Array)for(var D=ge.length,y=1;y<=D;y+=1){Q[1]=ge[y-1];var w=Z.apply(this,Q);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}y===D&&(this.$d=new Date(""))}else fe.call(this,M)}}})}(Lr)),Lr.exports}var Mg=Ng();const Dg=pt(Mg);var Ur={exports:{}},Lg=Ur.exports,aa;function Ug(){return aa||(aa=1,function(e,t){(function(n,r){e.exports=r()})(Lg,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,g,C,I){var b=h.name?h:h.$locale(),U=o(b[d]),Z=o(b[g]),V=U||Z.map(function(M){return M.slice(0,C)});if(!I)return V;var fe=b.weekStart;return V.map(function(M,T){return V[(T+(fe||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(g){return g.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(C,I,b){return I||b.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Ur)),Ur.exports}var kg=Ug();const Pg=pt(kg);var kr={exports:{}},Fg=kr.exports,la;function xg(){return la||(la=1,function(e,t){(function(n,r){e.exports=r()})(Fg,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(g,C,I){var b=I&&I.toUpperCase();return C||d[I]||n[I]||d[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(U,Z,V){return Z||V.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(kr)),kr.exports}var $g=xg();const Bg=pt($g);var Pr={exports:{}},Hg=Pr.exports,ua;function Wg(){return ua||(ua=1,function(e,t){(function(n,r){e.exports=r()})(Hg,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(I){var b={date:I,utc:!0,args:arguments};return new o(b)},l.utc=function(I){var b=a(this.toDate(),{locale:this.$L,utc:!0});return I?b.add(this.utcOffset(),n):b},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(I){I.utc&&(this.$u=!0),this.$utils().u(I.$offset)||(this.$offset=I.$offset),u.call(this,I)};var c=l.init;l.init=function(){if(this.$u){var I=this.$d;this.$y=I.getUTCFullYear(),this.$M=I.getUTCMonth(),this.$D=I.getUTCDate(),this.$W=I.getUTCDay(),this.$H=I.getUTCHours(),this.$m=I.getUTCMinutes(),this.$s=I.getUTCSeconds(),this.$ms=I.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(I,b){var U=this.$utils().u;if(U(I))return this.$u?0:U(this.$offset)?h.call(this):this.$offset;if(typeof I=="string"&&(I=function(M){M===void 0&&(M="");var T=M.match(r);if(!T)return null;var j=(""+T[0]).match(s)||["-",0,0],Q=j[0],ge=60*+j[1]+ +j[2];return ge===0?0:Q==="+"?ge:-ge}(I),I===null))return this;var Z=Math.abs(I)<=16?60*I:I,V=this;if(b)return V.$offset=Z,V.$u=I===0,V;if(I!==0){var fe=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(V=this.local().add(Z+fe,n)).$offset=Z,V.$x.$localOffset=fe}else V=this.utc();return V};var d=l.format;l.format=function(I){var b=I||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,b)},l.valueOf=function(){var I=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*I},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var g=l.toDate;l.toDate=function(I){return I==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var C=l.diff;l.diff=function(I,b,U){if(I&&this.$u===I.$u)return C.call(this,I,b,U);var Z=this.local(),V=a(I).local();return C.call(Z,V,b,U)}}})}(Pr)),Pr.exports}var jg=Wg();const Yg=pt(jg);var Fr={exports:{}},zg=Fr.exports,ca;function Vg(){return ca||(ca=1,function(e,t){(function(n,r){e.exports=r()})(zg,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(Fr)),Fr.exports}var Gg=Vg();const Kg=pt(Gg);var xr={exports:{}},Xg=xr.exports,ha;function qg(){return ha||(ha=1,function(e,t){(function(n,r){e.exports=r()})(Xg,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),g=this.diff(d,n,!0);return g<0?o(this).startOf("week").week():Math.ceil(g)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(xr)),xr.exports}var Jg=qg();const Zg=pt(Jg);var $r={exports:{}},Qg=$r.exports,da;function em(){return da||(da=1,function(e,t){(function(n,r){e.exports=r()})(Qg,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}($r)),$r.exports}var tm=em();const nm=pt(tm);Pt.extend(Dg),Pt.extend(Ag),Pt.extend(Kg),Pt.extend(Pg),Pt.extend(Zg),Pt.extend(nm),Pt.extend(Yg),Pt.extend(Bg);function Br(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function rm(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function sm(e){if(e==null)return!1;const t=e.paragraphStyle;return fa(t)}function fa(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function ga(e,t,n){return e.slice(0,t)+n+e.slice(t)}function ma(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function im(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function om(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ve=Symbol("newer"),it=Symbol("older");class am{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:t.key}):{done:!0,value:void 0}}}class lm{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:t.value}):{done:!0,value:void 0}}}class um{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}Xu=Ve,Ku=it;class _a{constructor(t,n){R(this,"key");R(this,"value");R(this,Xu);R(this,Ku);this.key=t,this.value=n,this[Ve]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class zn{constructor(...t){R(this,"_keymap");R(this,"size",0);R(this,"limit");R(this,"oldest");R(this,"newest");R(this,"_onShiftListeners",[]);if(Vn.hasLength(t,1)){if(Vn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Vn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Vn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),tt(()=>Pn(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ve]&&(t===this.oldest&&(this.oldest=t[Ve]),t[Ve][it]=t[it]),t[it]&&(t[it][Ve]=t[Ve]),t[Ve]=void 0,t[it]=this.newest,this.newest&&(this.newest[Ve]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new _a(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ve]=o,o[it]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new _a(t,n)),this.newest?(this.newest[Ve]=r,r[it]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ve]?(this.oldest=this.oldest[Ve],this.oldest[it]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ve]=t[it]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ve]&&n[it]?(n[it][Ve]=n[Ve],n[Ve][it]=n[it]):n[Ve]?(n[Ve][it]=void 0,this.oldest=n[Ve]):n[it]?(n[it][Ve]=void 0,this.newest=n[it]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new am(this.oldest)}values(){return new lm(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new um(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ve]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ve];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ve],n&&(t+=" < ");return t}}class Vn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var Hr={exports:{}},cm=Hr.exports,pa;function hm(){return pa||(pa=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:cm,function(){return function(){var n={d:function(E,m){for(var _ in m)n.o(m,_)&&!n.o(E,_)&&Object.defineProperty(E,_,{enumerable:!0,get:m[_]})},o:function(E,m){return Object.prototype.hasOwnProperty.call(E,m)}},r={};n.d(r,{default:function(){return dt}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(E){const m=i.exec(E);if(!m)throw new SyntaxError("Malformed locale: ".concat(E));return{lang:m[1]+(m[2]?"_"+m[2]:""),language:m[1],territory:m[2]||"",codeset:m[3]||"",modifier:m[4]||""}}function u(E){if(typeof E=="number")return s[65535&E]||null;const m=parseInt(E,16);return isFinite(m)&&s[65535&m]?s[65535&m]||null:i.test(E)?E:null}function c(E){const m=u(E);let _=null;if(m){const A=l(m);_=o[A.lang]||o[A.language]||null}return _}function h(E){return Object.assign({},a,E)}function d(E,m){const _=typeof m=="object"?m:l(m);return o[_.lang]=h(E),_.language===_.lang||o[_.language]||(o[_.language]=h(E)),o[_.lang]}const g=h({group:","});function C(E,m){if(typeof E!="number")return E;if(E<0)return-C(-E,m);if(m){const _=10**(m||0)||1;return C(E*_,0)/_}return Math.round(E)}g.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function I(E,m,_){const A=E<0?-1:1,N=10**(m||2),P=10**(_||2);let k,F,S=Math.abs(E),ee=0,Ee=0,J=0,pe=1;if((E=S)%1==0)F=[E*A,1];else if(E<1e-19)F=[A,1e19];else if(E>1e19)F=[1e19*A,1];else{do if(S=1/(S-Math.floor(S)),k=pe,pe=pe*Math.floor(S)+ee,ee=k,Ee=J,J=Math.floor(E*pe+.5),J>=N||pe>=P)return[A*Ee,ee];while(Math.abs(E-J/pe)>=1e-10&&S!==Math.floor(S));F=[A*J,pe]}return F}const b={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},U=Object.assign({},b);function Z(E){if(E===null&&(E=b),E){for(const m in E)if(m in b){const _=E[m];U[m]=_==null?b[m]:_}}return{...U}}const V={"#":"",0:"0","?":" "},fe={"@":"text","-":"minus","+":"plus"},M=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],T=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+T.join("")+"]");function Q(E,m,_){return m[_+"_max"]=E.length,m[_+"_min"]=E.replace(/#/g,"").length,m}const ge={};function le(E){if(!(E in ge)){const m=[],_=E.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,A=>"?".repeat(A.length));for(let A=0;A<_.length;A++){const N=_.charAt(A);m[A]=N in V?V[N]:N}ge[E]=m.join("")}return ge[E]}function p(E,m){typeof E=="string"&&(E={type:"string",value:E=E.replace(/ /g,V["?"])}),m.push(E)}function W(E){const m=[],_={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:m};let A=E+"",N="int",P=!1,k=null;const F=[];let S,ee,Ee=!1;for(;A&&!P;){if(S=/^General/i.exec(A))_.general=!0,p({type:"general"},m);else if(N==="int"&&(S=/^[#?0]+(?:,[#?0]+)*/.exec(A))||N==="den"&&(S=/^[#?\d]+/.exec(A))||(S=/^[#?0]+/.exec(A)))_[N+"_pattern"].push(S[0]),k={type:N,num:S[0]},p(k,m);else if((S=/^\//.exec(A))&&_[N+"_pattern"].length){if(!k)throw new SyntaxError("Missing a numerator in pattern ".concat(E));_.fractions=!0,_.num_pattern.push(_[N+"_pattern"].pop()),k.type="num",N="den",p({type:"div"},m)}else if(S=/^,+/.exec(A)){const L=A.charAt(1)in V;ee.slice(-1)in V&&(S[0].length>1||!L)?_.scale=.001**S[0].length:_.dec_fractions||p(S[0],m)}else{if(S=/^;/.exec(A)){P=!0;break}if(S=/^[@+-]/.exec(A))S[0]==="@"&&(_.text=!0),p({type:fe[S[0]]},m);else if(S=/^(?:\[(h+|m+|s+)\])/i.exec(A)){const L=S[1].toLowerCase(),te=L[0],Re={type:"",size:0,date:1,raw:S[0],pad:L.length};te==="h"?(Re.size=16,Re.type="hour-elap"):te==="m"?(Re.size=32,Re.type="min-elap"):(Re.size=64,Re.type="sec-elap"),_.date=_.date|Re.size,F.push(Re),p(Re,m)}else if(S=/^(?:B2)/i.exec(A))Ee||(_.date_system=6);else if(S=/^(?:B1)/i.exec(A))Ee||(_.date_system=1);else if(S=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(A)){const L={type:"",size:0,date:1,raw:S[0]},te=S[0].toLowerCase(),Re=te[0];if(te==="y"||te==="yy")L.size=2,L.type="year-short";else if(Re==="y"||Re==="e")L.size=2,L.type="year";else if(te==="b"||te==="bb")L.size=2,L.type="b-year-short";else if(Re==="b")L.size=2,L.type="b-year";else if(te==="d"||te==="dd")L.size=8,L.type="day",L.pad=/dd/.test(te);else if(te==="ddd")L.size=8,L.type="weekday-short";else if(Re==="d")L.size=8,L.type="weekday";else if(Re==="h")L.size=16,L.type="hour",L.pad=/hh/i.test(te);else if(Re==="m"){te.length===3?(L.size=4,L.type="monthname-short"):te.length===5?(L.size=4,L.type="monthname-single"):te.length>=4&&(L.size=4,L.type="monthname");const Te=F[F.length-1];!L.type&&Te&&!Te.used&&80&Te.size&&(Te.used=!0,L.size=32,L.type="min",L.pad=/mm/.test(te)),L.type||(L.size=4,L.type="month",L.pad=/mm/.test(te),L.indeterminate=!0)}else if(Re==="s"){L.size=64,L.type="sec",L.pad=/ss/.test(te);const Te=F[F.length-1];Te&&32&Te.size?L.used=!0:Te&&Te.indeterminate&&(delete Te.indeterminate,Te.size=32,Te.type="min",L.used=!0)}_.date=_.date|L.size,_.date_eval=!0,F.push(L),p(L,m)}else if(S=/^(?:AM\/PM|am\/pm|A\/P)/.exec(A))_.clock=12,_.date=16|_.date,_.date_eval=!0,p({type:"am",short:S[0]==="A/P"},m);else if(_.date&&(S=/^\.0{1,3}/i.exec(A))){const L=S[0].length-1,te=[64,128,256,512][L];_.date=_.date|te,_.date_eval=!0,_.sec_decimals=Math.max(_.sec_decimals,L),p({type:"subsec",size:te,decimals:L,date:1,raw:S[0]},m)}else if((S=/^\\(.)/.exec(A))||(S=/^"([^"]*?)"/.exec(A)))p(S[1],m);else if(S=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(A))_.condition=[S[1],parseFloat(S[2],10)];else if(S=/^\[\$([^\]]+)\]/.exec(A)){const L=S[1].split("-"),te=L.length<2?"":L[L.length-1],Re=L[0];Re&&p(Re,m);const Te=u(te);Te&&(_.locale=Te);const xe=parseInt(te,16);isFinite(xe)&&16711680&xe&&(xe>>16&255)===6&&(_.date_system=6),Ee=!0}else if(S=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(A))_.color=S[2]?M[parseInt(S[2],10)]||"#000":S[1].toLowerCase();else if(!(S=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(A))){if(S=/^%/.exec(A))_.scale=100,_.percent=!0,p("%",m);else if(S=/^_(\\.|.)/.exec(A))p(" ",m);else if(S=/^\./.exec(A))p({type:"point",value:S[0]},m),_.dec_fractions=!0,N="frac";else if(S=/^[Ee]([+-]?|(?=[0#?]))/.exec(A))_.exponential=!0,_.exp_plus=S[1]==="+",N="man",p({type:"exp",plus:S[1]==="+"},m);else if(!(S=/^\*(\\.|.)/.exec(A))){if(S=/^[BENn[]/.exec(A))throw new SyntaxError("Unexpected char ".concat(A.charAt(0)," in pattern ").concat(E));A[0]==="("&&(_.parens=!0),S=[A[0]],p(S[0],m)}}}ee=S[0],A=A.slice(S?S[0].length:1)}if(_.pattern=E.slice(0,E.length-A.length),/^((?:\[[^\]]+\])+)(;|$)/.test(_.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(_.pattern)&&p({type:"text"},m),_.fractions&&_.dec_fractions||_.fractions&&_.exponential)throw new SyntaxError("Invalid pattern: ".concat(_.pattern));const J=_.int_pattern.join("");if(_.grouping=J.indexOf(",")>=0,_.grouping){const L=J.split(","),te=L.length;te===2?(_.group_pri=L[1].length,_.group_sec=_.group_pri):te>2&&(_.group_pri=L[te-1].length,_.group_sec=L[te-2].length)}else _.group_pri=0,_.group_sec=0;Q(J.replace(/[,]/g,""),_,"int"),Q(_.frac_pattern.join(""),_,"frac"),Q(_.man_pattern.join(""),_,"man");let pe=_.num_pattern.join(""),we=_.den_pattern.join("");const ce=/\?/.test(we)||/\?/.test(pe);return we=we.replace(/\d/g,ce?"?":"#"),ce&&(we=we.replace(/#$/g,"?")),Q(pe,_,"num"),Q(we,_,"den"),ce&&(pe=pe.replace(/#$/g,"?")),_.int_padding=le(_.int_pattern.join("")),_.man_padding=le(_.man_pattern.join("")),_.num_padding=le(pe),_.den_padding=le(we),_.den_pattern.length&&(_.denominator=parseInt(_.den_pattern.join("").replace(/\D/g,""),10)),_.integer=!!_.int_pattern.join("").length,_.fractions&&m.forEach((L,te)=>{const Re=m[te+1];L.type==="string"&&Re&&(Re.type==="num"?L.rule="num+int":Re.type==="div"?L.rule="num":Re.type==="den"&&(L.rule="den"))}),_}const O=E=>{const m=E.condition;m&&m[1]<0&&(m[0]==="<"||m[0]==="<="||m[0]==="=")||E.tokens.unshift({type:"minus",volatile:!0})};function D(E){const m=[];let _,A=!1,N=null,P=E,k=0,F=!1,S=0,ee=0;do{if(F=W(P),(F.date||F.general)&&(F.int_pattern.length||F.frac_pattern.length||F.scale!==1||F.text))throw new Error("Illegal format");if(F.condition&&(ee++,A=!0),F.text){if(N)throw new Error("Unexpected partition");N=F}F.locale&&(_=u(F.locale)),m.push(F),k=P.charAt(F.pattern.length)===";"?1:0,P=P.slice(F.pattern.length+k),S++}while(k&&S<4&&ee<3);if(k)throw new Error("Unexpected partition");if(ee>2)throw new Error("Unexpected condition");const Ee=m[3];if(Ee&&(Ee.int_pattern.length||Ee.frac_pattern.length||Ee.date))throw new Error("Unexpected partition");if(A){const J=m.length;if(J===1&&(m[1]=W("General"),m[1].generated=!0),J<3){const pe=m[0],we=m[1];if(O(pe),we.condition)O(we);else{const ce=pe.condition;(ce[0]==="="||ce[1]>=0&&(ce[0]===">"||ce[0]===">="))&&we.tokens.unshift({type:"minus",volatile:!0})}}else m.forEach(O)}else{if(m.length<4&&N)for(let J=0,pe=m.length;J<pe;J++)m[J]===N&&m.splice(J,1);if(m.length<1&&N&&(m[0]=W("General"),m[0].generated=!0),m.length<2){const J=W(m[0].pattern);J.tokens.unshift({type:"minus",volatile:!0}),J.generated=!0,m.push(J)}if(m.length<3){const J=W(m[0].pattern);J.generated=!0,m.push(J)}if(m.length<4)if(N)m.push(N);else{const J=W("@");J.generated=!0,m.push(J)}m[0].condition=[">",0],m[1].condition=["<",0],m[2].condition=null}return{pattern:E,partitions:m,locale:_}}const y=Math.floor;function w(E){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&E>=0){if(E===0)return[1900,1,0];if(E===60)return[1900,2,29];if(E<60)return[1900,E<32?1:2,(E-1)%31+1]}let _=E+68569+2415019;const A=y(4*_/146097);_-=y((146097*A+3)/4);const N=y(4e3*(_+1)/1461001);_=_-y(1461*N/4)+31;const P=y(80*_/2447),k=_-y(2447*P/80);_=y(P/11);const F=P+2-12*_;return[0|100*(A-49)+N+_,0|F,0|k]}function x(E){return w(E+1462)}function B(E){if(E===60)throw new Error("#VALUE!");if(E<=1)return[1317,8,29];if(E<60)return[1317,E<32?9:10,1+(E-2)%30];const m=10631/30,_=.1335;let A=E+466935;const N=y(A/10631);A-=10631*N;const P=y((A-_)/m);A-=y(P*m+_);const k=y((A+28.5001)/29.5);return k===13?[30*N+P,12,30]:[30*N+P,k,A-y(29.5001*k-29)]}function G(E){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const A=y(E);return m===6?B(A):m===-1?x(A):w(A,_)}const ie=Math.floor,de=86400;function me(E,m){let _=null;if(Array.isArray(E)){const[A,N,P,k,F,S]=E;_=Date.UTC(A,N==null?0:N-1,P!=null?P:1,k||0,F||0,S||0)}else if(E instanceof Date&&(_=1*E,!m||!m.ignoreTimezone)){const A=new Date;A.setUTCFullYear(E.getFullYear(),E.getMonth(),E.getDate()),A.setUTCHours(E.getHours(),E.getMinutes(),E.getSeconds(),E.getMilliseconds()),_=1*A}if(_!=null&&isFinite(_)){const A=_/864e5;return A-(A<=-25509?-25568:-25569)}return E}function Me(E,m){let _=0|E;const A=de*(E-_);let N=ie(A);A-N>.9999&&(N+=1,N===de&&(N=0,_+=1));const P=N<0?de+N:N,[k,F,S]=G(E,0,m&&m.leap1900),ee=ie(P/60/60)%60,Ee=ie(P/60)%60,J=ie(P)%60;if(m&&m.nativeDate){const pe=new Date(0);return pe.setUTCFullYear(k,F-1,S),pe.setUTCHours(ee,Ee,J),pe}return[k,F,S,ee,Ee,J]}function Ae(E){return!!(E[0]&&E[0].percent||E[1]&&E[1].percent||E[2]&&E[2].percent||E[3]&&E[3].percent)}function v(E){return!!(E[0]&&E[0].date||E[1]&&E[1].date||E[2]&&E[2].date||E[3]&&E[3].date)}function $(E){const[m,_,A,N]=E;return!(m&&!m.generated||_&&!_.generated||A&&!A.generated||!N||!N.text||N.generated)}const K={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],z={total:1,sign:0,period:0,int:1,frac:0},Y=(E,m)=>E.replace(/\./,m.decimal);function ue(E,m,_,A){const N=0|_;if(typeof _=="string")E.push(_);else if(_===N)E.push(Math.abs(N));else{const P=Math.abs(_);let k=P?Math.floor(Math.log10(P)):0,F=k<0?P*10**-k:P/10**k;F===10&&(F=1,k++);const S=function(Ee){let J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const pe=Math.abs(Ee);if(!pe)return z;const we=J&&Ee<0?1:0,ce=Math.floor(pe),L=Math.floor(Math.log10(pe)+1);let te=0,Re=0;if(ce!==pe){te=1;const Te=String(C(L<0?pe*10**-L:pe/10**L,15));let xe=Te.length,$e=!0,Ye=0;for(;Ye<=Te.length;){if(Te[Ye]==="."){xe--;break}Te[Ye]==="0"&&$e?xe--:$e=!1,Ye++}Re=xe-L,Re<0&&(Re=0,te=0)}return{total:we+Math.max(L,1)+te+Re,digits:Math.max(L,0)+Re,sign:we,period:te,int:Math.max(L,1),frac:Re}}(P),ee=()=>{const Ee=Math.abs(k);let J;J=F===1?F:C(F,5),E.push(Y(J+"",A),A.exponent,k<0?A.negative:A.positive,Ee<10?"0":"",Ee)};if(k>=-4&&k<=-1){const Ee=P.toPrecision(10+k).replace(/\.?0+$/,"");E.push(Y(Ee,A))}else if(k===10){const Ee=P.toFixed(10).slice(0,12).replace(/\.$/,"");E.push(Y(Ee,A))}else if(Math.abs(k)<=9)if(S.total<=11){const Ee=C(P,9).toFixed(S.frac);E.push(Y(Ee,A))}else k===9?E.push(Math.floor(P)):k>=0&&k<9?E.push(C(P,9-k)):ee();else S.total>=12?ee():Math.floor(P)===P?E.push(Math.floor(P)):E.push(Y(C(P,9).toFixed(S.frac),A))}return E}const ae=86400,H={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},ne=function(E){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const _=Math.floor(Math.log10(E));return m>1?Math.floor(_/m)*m:_};function oe(E,m,_,A){let N="",P="",k="",F="",S="",ee=0,Ee=0|E,J=0,pe=0,we=1,ce=0,L=0,te=0,Re=0,Te=0,xe=0;const $e=A||g;if(!m.text&&isFinite(m.scale)&&m.scale!==1&&(E=function(ve){if(ve===0)return ve;const De=Math.ceil(Math.log10(ve<0?-ve:ve)),se=10**(16-Math.floor(De));return Math.round(ve*se)/se}(E*m.scale)),m.exponential){let ve=Math.abs(E);if(ve){const De=10**-ne(ve,m.int_max),se=C(ve*De,m.frac_max)/De;ee=ne(se,m.int_max)}ve/=10**ee,E=E<0?-ve:ve,N+=Math.abs(ee)}if(m.integer){const ve=Math.abs(C(E,m.fractions?1:m.frac_max));S+=ve<1?"":Math.floor(ve)}if(m.grouping){let ve="",De=S.length;for(De>m.group_pri&&(De-=m.group_pri,ve=$e.group+S.slice(De,De+m.group_pri)+ve);De>m.group_sec;)De-=m.group_sec,ve=$e.group+S.slice(De,De+m.group_sec)+ve;S=De?S.slice(0,De)+ve:ve}m.dec_fractions&&(F=String(C(E,m.frac_max)).split(".")[1]||"");let Ye=!1;if(m.fractions){const ve=Math.abs(m.integer?E%1:E);if(ve)if(Ye=!0,isFinite(m.denominator))k+=m.denominator,P+=C(ve*m.denominator),P==="0"&&(P="",k="",Ye=!1,S||(S="0"));else{const De=I(ve,m.integer?m.num_max:1/0,m.den_max);P+=De[0],k+=De[1],m.integer&&P==="0"&&(S||(S="0"),P="",k="",Ye=!1)}}if(m.date){Ee=Math.trunc(E);const ve=ae*(E-Ee);if(J=Math.floor(ve),xe=ve-J,Math.abs(xe)<1e-6?xe=0:xe>.9999&&(xe=0,J+=1,J===ae&&(J=0,Ee+=1)),xe){const De=512&m.date||256&m.date||128&m.date;(De===512&&xe>.9995||De===256&&xe>.995||De===128&&xe>.95||!De&&xe>=.5)&&(J++,xe=0)}if(Ee||m.date_system){const De=G(E,m.date_system,_.leap1900);pe=De[0],we=De[1],ce=De[2]}if(J){const De=J<0?ae+J:J;Te=Math.floor(De)%60,Re=Math.floor(De/60)%60,te=Math.floor(De/60/60)%60}if(L=(6+Ee)%7,m.date_eval&&(ft=E,mt=Ee+J/ae,_.dateSpanLarge?ft<-694324||mt>=35830291:ft<0||mt>=2958466)){if(_.dateErrorThrows)throw new Error("Date out of bounds");return _.dateErrorNumber?ue(E<0?[$e.negative]:[],0,E,$e).join(""):_.overflow}}var ft,mt;if(m.int_padding&&(S=m.int_padding.length===1?S||m.int_padding:m.int_padding.substring(0,m.int_padding.length-S.length)+S),m.num_padding&&(P=m.num_padding.length===1?P||m.num_padding:m.num_padding.substring(0,m.num_padding.length-P.length)+P),m.den_padding&&(k=m.den_padding.length===1?k||m.den_padding:k+m.den_padding.slice(k.length)),m.man_padding){const ve=m.exp_plus?"+":"";N=m.man_padding.length===1?(ee<0?"-":ve)+(N||m.man_padding):(ee<0?"-":ve)+m.man_padding.slice(0,m.man_padding.length-N.length)+N}const Ce=[];let et=0;const Oe={int:0,frac:0,man:0,num:0,den:0};for(let ve=0,De=m.tokens.length;ve<De;ve++){const se=m.tokens[ve],ut=se.num?se.num.length:0;if(se.type==="string")se.rule?se.rule==="num"?Ye?Ce.push(se.value):(m.num_min>0||m.den_min>0)&&Ce.push(se.value.replace(/./g,V["?"])):se.rule==="num+int"?Ye&&S?Ce.push(se.value):m.den_min>0&&(S||m.num_min)&&Ce.push(se.value.replace(/./g,V["?"])):se.rule==="den"&&(Ye?Ce.push(se.value):(m.den_min>0||m.den_min>0)&&Ce.push(se.value.replace(/./g,V["?"]))):Ce.push(se.value);else if(se.type==="error")Ce.push(_.invalid);else if(se.type==="point")Ce.push(m.date?se.value:$e.decimal);else if(se.type==="general")ue(Ce,0,E,$e);else if(se.type==="exp")Ce.push($e.exponent);else if(se.type==="minus")se.volatile&&m.date||se.volatile&&(E>=0||typeof E!="number")||(se.volatile&&!m.fractions&&(m.integer||m.dec_fractions)?(E<0&&S&&S!=="0"||F)&&Ce.push($e.negative):Ce.push($e.negative));else if(se.type==="plus")Ce.push($e.positive);else if(se.type==="text")Ce.push(E);else if(se.type==="div")Ye?Ce.push("/"):m.num_min>0||m.den_min>0?Ce.push(V["?"]):Ce.push(V["#"]);else if(se.type==="int")if(m.int_pattern.length===1)Ce.push(S);else{const We=et?m.int_pattern.join("").length-Oe.int:1/0,Dt=et===m.int_pattern.length-1?0:m.int_pattern.join("").length-(Oe.int+se.num.length);Ce.push(S.substring(S.length-We,S.length-Dt)),et++,Oe.int+=se.num.length}else if(se.type==="frac"){const We=Oe.frac;for(let Dt=0;Dt<ut;Dt++)Ce.push(F[Dt+We]||V[se.num[Dt]]);Oe.frac+=ut}else if(se.type in H)m[se.type+"_pattern"].length===1?(se.type==="int"&&Ce.push(S),se.type==="frac"&&Ce.push(F),se.type==="man"&&Ce.push(N),se.type==="num"&&Ce.push(P),se.type==="den"&&Ce.push(k)):(Ce.push(H[se.type].slice(Oe[se.type],Oe[se.type]+ut)),Oe[se.type]+=ut);else if(se.type==="year")pe<0&&Ce.push($e.negative),Ce.push(String(Math.abs(pe)).padStart(4,"0"));else if(se.type==="year-short"){const We=pe%100;Ce.push(We<10?"0":"",We)}else if(se.type==="month")Ce.push(se.pad&&we<10?"0":"",we);else if(se.type==="monthname-single")m.date_system===6?Ce.push($e.mmmm6[we-1].charAt(0)):Ce.push($e.mmmm[we-1].charAt(0));else if(se.type==="monthname-short")m.date_system===6?Ce.push($e.mmm6[we-1]):Ce.push($e.mmm[we-1]);else if(se.type==="monthname")m.date_system===6?Ce.push($e.mmmm6[we-1]):Ce.push($e.mmmm[we-1]);else if(se.type==="weekday-short")Ce.push($e.ddd[L]);else if(se.type==="weekday")Ce.push($e.dddd[L]);else if(se.type==="day")Ce.push(se.pad&&ce<10?"0":"",ce);else if(se.type==="hour"){const We=te%m.clock||(m.clock<24?m.clock:0);Ce.push(se.pad&&We<10?"0":"",We)}else if(se.type==="min")Ce.push(se.pad&&Re<10?"0":"",Re);else if(se.type==="sec")Ce.push(se.pad&&Te<10?"0":"",Te);else if(se.type==="subsec"){Ce.push($e.decimal);const We=xe.toFixed(m.sec_decimals);Ce.push(We.slice(2,2+se.decimals))}else if(se.type==="am"){const We=te<12?0:1;se.short&&!A?Ce.push("AP"[We]):Ce.push($e.ampm[We])}else if(se.type==="hour-elap"){E<0&&Ce.push($e.negative);const We=24*Ee+Math.floor(Math.abs(J)/3600);Ce.push(String(Math.abs(We)).padStart(se.pad,"0"))}else if(se.type==="min-elap"){E<0&&Ce.push($e.negative);const We=1440*Ee+Math.floor(Math.abs(J)/60);Ce.push(String(Math.abs(We)).padStart(se.pad,"0"))}else if(se.type==="sec-elap"){E<0&&Ce.push($e.negative);const We=Ee*ae+Math.abs(J);Ce.push(String(Math.abs(We)).padStart(se.pad,"0"))}else if(se.type==="b-year")Ce.push(pe+543);else if(se.type==="b-year-short"){const We=(pe+543)%100;Ce.push(We<10?"0":"",We)}}return _.nbsp?Ce.join(""):Ce.join("").replace(/\u00a0/g," ")}function _e(E,m){for(let _=0;_<3;_++){const A=m[_];if(A){let N;if(A.condition){const P=A.condition[0],k=A.condition[1];P==="="?N=E===k:P===">"?N=E>k:P==="<"?N=E<k:P===">="?N=E>=k:P==="<="?N=E<=k:P==="<>"&&(N=E!==k)}else N=!0;if(N)return A}}}const ye=W("@"),Ue="black",X={};function Ie(E,m){if(E){const _=E[0];m[_]=m[_]||{},Ie(E.slice(1),m[_])}else m.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(E=>{Ie(E,X),Ie(E+" x",X),Ie(E+" l",X),Ie(E+" l x",X),Ie("l "+E,X),Ie("l "+E+" x",X),Ie(E+" D",X),Ie(E+" D x",X),Ie("D "+E,X),Ie("D "+E+" x",X)});const Ge={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},je={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Fe={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},Ze=new Date().getUTCFullYear();function Rt(E){const m=new RegExp("^([\\s+%"+T.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+T.join("")+")]*)$").exec(E);if(m){const[,_,A,N,P,k]=m;let F=1,S="",ee=!1,Ee=!1,J=!1,pe=!1,we=!1,ce=null,L=!1,te=parseFloat(A.replace(/,/g,""));if(!isFinite(te))return null;for(let Te=0;Te<_.length;Te++){const xe=_[Te];if(xe==="-"){if(ee||Ee)return null;ee=!0,F=-1}else if(j.test(xe)){if(we)return null;we=!0,ce=xe}else if(xe==="("){if(Ee||ee)return null;Ee=!0,F=-1}else if(xe==="%"){if(pe)return null;pe=!0}}for(let Te=0;Te<k.length;Te++){const xe=k[Te];if(j.test(xe)){if(we)return null;we=!0,ce=xe,L=!0}else if(xe===")"){if(J||!Ee)return null;J=!0}else if(xe==="%"){if(pe)return null;pe=!0}}if(P){if(pe||we)return null;S="0.00E+00"}else if(pe){if(we)return null;S=N.includes(".")?"0.00%":"0%",te*=.01}else if(we){const Te=N.includes(".")?"#,##0.00":"#,##0";S=L?Te+ce:ce+Te}else N.includes(",")&&(S=N.includes(".")?"#,##0.00":"#,##0");const Re={v:te*F};return S&&(Re.z=S),Re}}const Ke=(E,m,_)=>{const A=_.path||"",N=Object.keys(m);for(let P=0;P<N.length;P++){let k;const F=N[P];if(m[F]){if(F==="$"||F==="€")E||(k=_);else if(F==="-"){const S=/^(\s*([./-]|,\s)\s*|\s+)/.exec(E);if(S){const ee=S[1]==="-"||S[1]==="/"||S[1]==="."?S[1]:" ";if(!_.sep||_.sep===ee){const Ee=S[0].replace(/\s+/g," ");k=Ke(E.slice(S[0].length),m[F],{..._,sep:ee,path:A+Ee})}}}else if(F===" "){const S=/^[,.]?\s+/.exec(E);if(S){const ee=S[0].replace(/\s+/g," ");k=Ke(E.slice(S[0].length),m[F],{..._,path:A+ee})}}else if(F==="j"||F==="d"){const S=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,day:S[0],path:A+F}))}else if(F==="n"||F==="m"){const S=/^(0?[1-9]|1[012])\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,month:+S[0],_mon:S[0],path:A+F}))}else if(F==="F"||F==="M"){const S=/^([a-z]{3,9})\b/i.exec(E),ee=S&&(F==="F"?je:Ge)[S[0].toLowerCase()];ee&&(k=Ke(E.slice(S[0].length),m[F],{..._,month:ee,_mon:S[0],path:A+F}))}else if(F==="l"||F==="D"){const S=/^([a-z]{3,9})\b/i.exec(E);(S&&Fe[S[0].toLowerCase()])===F&&(k=Ke(E.slice(S[0].length),m[F],{..._,path:A+F}))}else if(F==="y"){const S=/^\d\d\b/.exec(E);if(S){const ee=+S[0]>=30?+S[0]+1900:+S[0]+2e3;k=Ke(E.slice(S[0].length),m[F],{..._,year:ee,path:A+F})}}else if(F==="Y"){const S=/^\d\d\d\d\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,year:+S[0],path:A+F}))}else{if(F!=="x")throw new Error('Unknown date token "'.concat(F,'"'));{const S=Xe(E);S&&(k=Ke("",m[F],{..._,time:S.v,tf:S.z,path:A+F}))}}if(k)return k}}};function rt(E,m){const _=Ke(E.trim(),X,{path:""});if(_){var A;if(_.sep==="."&&_.path.length===3)return null;const N=+((A=_.year)!==null&&A!==void 0?A:Ze);if(_.day||(_.day=1),!function(F,S,ee){if(ee<1||S<1||S>12)return!1;if(S===2){if(ee>(F%4==0&&F%100!=0||F%400==0||F===1900?29:28))return!1}else if((S===4||S===6||S===9||S===11)&&ee>30||(S===1||S===3||S===5||S===7||S===8||S===10||S===12)&&ee>31)return!1;return!0}(N,_.month,_.day))return null;let P=-1/0;if(N<1900)return null;N<=1900&&_.month<=2?P=25568:N<1e4&&(P=25569);const k=Date.UTC(N,_.month-1,_.day)/864e5+P+(_.time||0);if(k>=0&&k<=2958465){const F=_._mon[0]==="0"||_.day[0]==="0"||_._mon.length===2&&_.day.length===2,S=_.path.replace(/[jdlDnmMFyYx-]/g,ee=>ee==="j"||ee==="d"?F?"dd":"d":ee==="D"?"ddd":ee==="l"?"dddd":ee==="n"||ee==="m"?F?"mm":"m":ee==="M"?"mmm":ee==="F"?"mmmm":ee==="y"?"yy":ee==="x"?_.tf||"":ee==="Y"?"yyyy":ee);return m&&m.nativeDate?{v:Me(k,m),z:S}:{v:k,z:S}}}return null}function Xe(E){const m=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(E);if(m){const[,_,A,N,P,k]=m;if(P&&!N||!k&&!A&&!N)return null;let F=1*(_||0);if(k){if(F>=13)return null;k[0]!=="p"&&k[0]!=="P"||(F+=12)}return{v:(60*F*60+60*(1*(A||0))+1*(N||0)+1*(P||0))/86400,z:(_.length===2?"hh":"h")+":mm"+(N?":ss":"")+(k?" AM/PM":"")}}return null}function ht(E){return/^\s*true\s*$/i.test(E)?{v:!0}:/^\s*false\s*$/i.test(E)?{v:!1}:null}const at={};function $t(E,m){const{pattern:_,partitions:A,locale:N}=E,P=S=>{const ee=Object.assign({},Z(),m,S);return N&&(ee.locale=N),ee},k=(S,ee)=>{const Ee=P(ee);return function(J,pe,we){const ce=c(we.locale),L=pe[3]?pe[3]:ye;if(typeof J=="boolean"&&(J=J?"TRUE":"FALSE"),J==null)return"";if(typeof J!="number")return oe(J,L,we,ce);if(!isFinite(J)){const Re=ce||g;return isNaN(J)?Re.nan:(J<0?Re.negative:"")+Re.infinity}const te=_e(J,pe);return te?oe(J,te,we,ce):we.overflow}(me(S,Ee),A,Ee)};k.color=(S,ee)=>function(Ee,J){if(typeof Ee!="number"||!isFinite(Ee))return(J[3]?J[3].color:ye.color)||Ue;const pe=_e(Ee,J);return pe&&pe.color||Ue}(me(S,P(ee)),A);const F=function(S){var ee;let Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[J,pe]=S,we=J.frac_max,ce={type:"general",isDate:v(S),isText:$(S),isPercent:Ae(S),maxDecimals:J.general?9:we,scale:(ee=J.scale)!==null&&ee!==void 0?ee:1,color:0,parentheses:0,grouped:J.grouping?1:0,_partitions:S},L=!ce.isDate&&!ce.isText&&!J.error&&J.tokens.some($e=>$e.type==="string"&&(Ee?$e.value===Ee:j.test($e.value)));let te="G",Re=we>=0?Math.min(15,we):"",Te="",xe="";if(pe&&pe.color&&(xe="-",ce.color=1),J.parens&&(Te="()",ce.parentheses=1),L)te="C",ce.type="currency";else if(J.error)ce.type="error",ce.maxDecimals=0;else if(ce.isDate){let $e=0,Ye=0,ft="";J.tokens.forEach(Ce=>{const et=Ce.type;/^(b-)?year/.test(et)?(ft+="Y",Ye++):et.startsWith("month")?(ft+="M",Ye++):/^(week)?day/.test(et)?(ft+="D",Ye++):et!=="hour"&&et!=="min"&&et!=="sec"&&et!=="am"||(ft+=et[0],$e++)}),ce.type="date",Ye&&$e?ce.type="datetime":!Ye&&$e&&(ce.type="time");const mt=q.find(Ce=>ft.startsWith(Ce[0]));te=mt?"D":"G",Re=mt?mt[1]:""}else ce.isText?(te="G",ce.type="text",Re="",ce.maxDecimals=0):J.general?(te="G",ce.type="general",Re=""):J.fractions?(te="G",ce.type="fraction",Re=""):J.exponential?(te="S",ce.type="scientific"):ce.isPercent?(te="P",ce.type="percent"):J.grouping?(te=",",ce.type="grouped"):(J.int_max||we)&&(te="F",ce.type="number");return ce.code=te+Re+xe+Te,ce.level=K[ce.type],Object.freeze(ce)}(A,(m||{}).currency)||new SyntaxError;return k.info=F,k.dateInfo=function(S){const[ee]=S;return{year:!!(2&ee.date),month:!!(4&ee.date),day:!!(8&ee.date),hours:!!(16&ee.date),minutes:!!(32&ee.date),seconds:!!(64&ee.date),clockType:ee.clock===12?12:24}}(A),k.isPercent=()=>!!F.isPercent,k.isDate=()=>!!F.isDate,k.isText=()=>!!F.isText,k.pattern=_,E.error&&(k.error=E.error),k.options=P,k.locale=N||m&&m.locale||"",Object.freeze(k)}function Be(E,m){E||(E="General");let _=null;return at[E]?_=at[E]:(_=Object.assign({},Z(),m).throws?D(E):function(A){try{return D(A)}catch(N){const P={tokens:[{type:"error"}],error:N.message};return{pattern:A,partitions:[P,P,P,P],error:N.message,locale:null}}}(E),_.error||(at[E]=_)),$t(_,m)}Be.isDate=E=>Be(E,{throws:!1}).isDate(),Be.isPercent=E=>Be(E,{throws:!1}).isPercent(),Be.isText=E=>Be(E,{throws:!1}).isText(),Be.getInfo=(E,m)=>Be(E,{...m,throws:!1}).info,Be.getDateInfo=(E,m)=>Be(E,{...m,throws:!1}).dateInfo,Be.dateToSerial=me,Be.dateFromSerial=Me,Be.options=Z,Be.dec2frac=I,Be.round=C,Be.codeToLocale=s,Be.parseLocale=l,Be.getLocale=c,Be.addLocale=(E,m)=>{const _=l(m);return delete at[_.lang],delete at[_.language],d(E,_)},Be.format=function(E,m,_){let A=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const N=_&&typeof _=="object"?_:{locale:_,throws:!A};return Be(E,N)(me(m,N),N)},Be.is_date=Be.isDate,Be.parseNumber=Rt,Be.parseDate=rt,Be.parseTime=Xe,Be.parseBool=ht,Be.parseValue=function(E,m){var _,A,N;return(_=(A=(N=Rt(E))!==null&&N!==void 0?N:rt(E,m))!==null&&A!==void 0?A:Xe(E))!==null&&_!==void 0?_:ht(E)};var dt=Be;return r=r.default}()})}(Hr)),Hr.exports}var Ls,Ea;function dm(){return Ea||(Ea=1,Ls=hm()),Ls}var fm=dm();const gm=pt(fm);function jt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Us(e,t,n){const r=jt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function ks(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function mm(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function _m(e,t,n){const r=n;if(jt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Ps(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?pm(e,t,n,r):Em(e,t,n,r)}function pm(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function Em(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class Ot{constructor(t={}){R(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new Ot({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Ps(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Ps(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Us(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Us(r,void 0,i)})}removeRows(t,n){ks(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&ks(t,n,s)})}getFragment(t,n,r,s){const i=new Ot;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new Ot;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return jt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=jt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new Ot;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=jt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const Cm={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Rm={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Im={startRow:0,startColumn:0,endRow:0,endColumn:0},Sm={row:0,column:0},lt={ff:"Arial",fs:11,it:Se.FALSE,bl:Se.FALSE,ul:{s:Se.FALSE},st:{s:Se.FALSE},ol:{s:Se.FALSE},tr:{a:0,v:Se.FALSE},td:Yn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:St.UNSPECIFIED,vt:tn.UNSPECIFIED,tb:nn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},Ca={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},vm=[Rs,io,Is];var Ra=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(Ra||{});function Wr(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return Se.FALSE;switch(e){case"bl":case"it":{if(o[e]===Se.FALSE)return Se.FALSE;break}case"ul":case"st":{if(o[e].s===Se.FALSE)return Se.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
5
- `)===r?Se.TRUE:Se.FALSE}const dr=class dr{constructor(t,n,r){R(this,"_range");R(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Ot;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Ot;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||lt.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new dr(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||lt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Wr("ul",t.body)===Se.TRUE?{s:Se.TRUE}:{s:Se.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Wr("st",t.body)===Se.TRUE?{s:Se.TRUE}:{s:Se.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Wr("it",t.body)===Se.TRUE?Sr.ITALIC:Sr.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Wr("bl",t.body)===Se.TRUE?vr.BOLD:vr.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===nn.WRAP?Se.TRUE:Se.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){dr.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||lt[t]}))}};R(dr,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let pn=dr;function Om(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||nt.NONE,o=s.endAbsoluteRefType||nt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===nt.ALL&&o===nt.ALL)return s;const l=Ia(s.startRow,n,s.startColumn,t,a),u=Ia(s.endRow,n,s.endColumn,t,a);return r||i===nt.NONE&&o===nt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===nt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===nt.COLUMN?s={...s,startRow:l.row}:i===nt.ROW&&(s={...s,startColumn:l.column}),o===nt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===nt.COLUMN?s={...s,endRow:u.row}:o===nt.ROW&&(s={...s,endColumn:u.column}),s)}function Ia(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Fs(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function wm(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function bm(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function ym(e){const t=Fs(e),n=wm(t);return bm(n)}function Am(e,t){const n=[];return e.forEach(r=>{n.push(...Yt.subtract(r,t))}),Yt.mergeRanges(n)}function Sa(e,t){const n=va(e.startRow,e.endRow,t.startRow,t.endRow),r=va(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Tm(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function va(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function Tm(e,t,n,r,s,i){const o=e!==void 0?e:Oa(n,r,s,i),a=t!==void 0?t:Oa(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function Oa(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const xt=class xt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),g=Math.abs(o-a)+Math.abs(c-h),C=Math.abs(s+i-l-u),I=Math.abs(s-i)+Math.abs(l-u);return d<=g&&C<=I}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,g,C;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?C=s:C=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?g=o:g=c;else return null;return{startRow:d,endRow:C,startColumn:h,endColumn:g,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return xt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=xt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return ym(t)}static splitIntoGrid(t){return Fs(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Am(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};R(xt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),R(xt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[nt.ROW,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[nt.ROW,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[nt.COLUMN,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[nt.COLUMN,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),R(xt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),R(xt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),R(xt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Yt=xt;function Nm(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=Mm(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Mm(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Dm(e,t){pn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Lm(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Nm(n,t);if(!s)break;r.push(s),Dm(n,s)}return r}class Um{constructor(t,n){R(this,"_values",[]);R(this,"_keys",[]);R(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function xs(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function km(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const jr=65,wa=90,Pm=97;function Fm(e){const t=wa-jr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+jr)+n,e=Math.floor(e/t)-1;return n}function ba(e,t){let n="";for(;t>0;)n+=e,t--;return n}function xm(e,t=!1){const n=wa-jr+1;let r=Pm;t&&(r=jr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return ba(s,i)}function $m(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Bm(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Gn(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var ya=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(ya||{}),Aa=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Aa||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),Kn=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Kn||{}),zt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(zt||{}),sn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(sn||{}),Ta=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Ta||{}),$s=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))($s||{}),Na=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Na||{}),Ma=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Ma||{}),Da=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Da||{}),La=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(La||{}),Ua=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Ua||{}),ka=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(ka||{}),Pa=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(Pa||{}),Fa=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e[e.HEADING_6=9]="HEADING_6",e))(Fa||{}),xa=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(xa||{}),$a=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))($a||{}),Ba=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Ba||{}),Ha=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Ha||{}),Wa=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Wa||{}),ja=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(ja||{}),Ya=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Ya||{}),za=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(za||{}),Va=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Va||{}),En=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(En||{}),Ga=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(Ga||{}),Ka=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(Ka||{}),Xa=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Xa||{}),qa=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(qa||{}),Ja=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(Ja||{}),Za=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(Za||{}),Qa=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(Qa||{}),el=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(el||{}),tl=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(tl||{}),Bs=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(Bs||{}),nl=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(nl||{}),rl=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(rl||{}),He=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(He||{}),Nt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Nt||{}),Hs=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Hs||{});class Yr extends st{}function Hm(e=re.generateRandomId(6),t=jn.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
6
- `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:$s.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Se.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Se.TRUE,doNotHyphenateCaps:Se.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Se.FALSE,useFirstPageHeaderFooter:Se.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var on={},Xn={},zr={},sl;function Wm(){if(sl)return zr;sl=1,Object.defineProperty(zr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return zr.default=n,zr}var Vr={},il;function jm(){if(il)return Vr;il=1,Object.defineProperty(Vr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Vr.default=e,Vr}var Ws={},ol;function al(){return ol||(ol=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const g=d;h.write(g,c[g])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,g=this.parents.length-1,C=this.idx;for(;C>=0;)h.unshift(d[C]),C===0?(C=this.indexes[g*2],d=this.parents[g--]):C-=n(d[C-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,g,C){this.container=h,this.idx=d,this.parents=g.slice(),this.indexes=C.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const g=this.getComponent();g&&d(g,h);for(const C of this)h&&h.descend(C),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(g,C)=>{g.p!=null&&d(g.p,C)})}eachDrop(h,d){this.traverse(h,(g,C)=>{g.d!=null&&d(g.d,C)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let g=this.idx+1;if(g<this.container.length&&n(this.container[g])&&g++,t(g===this.container.length||!n(this.container[g])),g===this.container.length)this.container.push(d),this.idx=g;else if(this.container[g]===d)this.idx=g;else{if(!Array.isArray(this.container[g])){const C=this.container.splice(g,this.container.length-g);this.container.push(C),this.lcIdx>-1&&(this.lcIdx=g)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),g=this.lcIdx+1,this.lcIdx=-1);g<this.container.length&&r(d,this.container[g][0]);)g++;if(this.indexes.push(g),this.idx=0,g<this.container.length&&this.container[g][0]===d)this.container=this.container[g];else{const C=[d];this.container.splice(g,0,C),this.container=C}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const g=this.getComponent();t(g[h]==null||g[h]===d,"Internal consistency error: Overwritten component. File a bug"),g[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const g=this.lcIdx,C=this.parents.length;let I=0;for(let b=0;b<h.length;b++){const U=h[b];typeof U=="string"||typeof U=="number"?(I++,this.descend(U)):Array.isArray(U)?this.mergeTree(U,d):typeof U=="object"&&d(U,this)}for(;I--;)this.ascend();this.lcIdx=this.parents.length===C?g:-1}at(h,d){this.descendPath(h),d(this);for(let g=0;g<h.length;g++)this.ascend();return this}writeAtPath(h,d,g){return this.at(h,()=>this.write(d,g)),this.reset(),this}writeMove(h,d,g=0){return this.writeAtPath(h,"p",g).writeAtPath(d,"d",g)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let g,C;C=g=c?c.descendFirst():!1;function I(b){let U;for(;C;){const Z=U=c.getKey();if(b!=null){let V=!1;if(h&&typeof Z=="number"&&(U=h(Z,c.getComponent()),U<0&&(U=~U,V=!0)),r(U,b))return null;if(U===b&&!V)return c}d&&typeof U=="number"&&d(U,c.getComponent()),C=c.nextSibling()}return null}return I.end=()=>{g&&c.ascend()},I}e.advancer=l;function u(c,h,d){let g,C,I,b;for(g=C=c&&c.descendFirst(),I=b=h&&h.descendFirst();g||I;){let U=g?c.getKey():null,Z=I?h.getKey():null;U!==null&&Z!==null&&(r(Z,U)?Z=null:U!==Z&&(U=null)),d(U==null?Z:U,U!=null?c:null,Z!=null?h:null),U!=null&&g&&(g=c.nextSibling()),Z!=null&&I&&(I=h.nextSibling())}C&&c.ascend(),b&&h.ascend()}e.eachChildOf=u}(Ws)),Ws}var js={},ll;function ul(){return ll||(ll=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(js)),js}var wt={},an={},cl;function Ys(){return cl||(cl=1,Object.defineProperty(an,"__esModule",{value:!0}),an.uniToStrPos=an.strPosToUni=void 0,an.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},an.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),an}var zs={},hl;function Vs(){return hl||(hl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Ys(),n=M=>{if(!Array.isArray(M))throw Error("Op must be an array of components");let T=null;for(let j=0;j<M.length;j++){const Q=M[j];switch(typeof Q){case"object":if(typeof Q.d!="number"&&typeof Q.d!="string")throw Error("Delete must be number or string");if(e.dlen(Q.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Q.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Q>0))throw Error("Skip components must be >0");if(typeof T=="number")throw Error("Adjacent skip components should be combined");break}T=Q}if(typeof T=="number")throw Error("Op has a trailing skip")};function r(M,T){let j=0,Q=0;for(let ge=0;ge<M.length;ge++){const le=M[ge];switch(T(le,j,Q),typeof le){case"object":j+=e.dlen(le.d);break;case"string":Q+=t.strPosToUni(le);break;case"number":j+=le,Q+=le;break}}}e.eachOp=r;function s(M,T){const j=[],Q=a(j);return r(M,(ge,le,p)=>{Q(T(ge,le,p))}),h(j)}const i=M=>M,o=M=>s(M,i);e.dlen=M=>typeof M=="number"?M:t.strPosToUni(M);const a=M=>T=>{if(!(!T||T.d===0||T.d===""))if(M.length===0)M.push(T);else if(typeof T==typeof M[M.length-1])if(typeof T=="object"){const j=M[M.length-1];j.d=typeof j.d=="string"&&typeof T.d=="string"?j.d+T.d:e.dlen(j.d)+e.dlen(T.d)}else M[M.length-1]+=T;else M.push(T)},l=M=>typeof M=="number"?M:typeof M=="string"?t.strPosToUni(M):typeof M.d=="number"?M.d:t.strPosToUni(M.d);e.uniSlice=(M,T,j)=>{const Q=t.uniToStrPos(M,T),ge=j==null?1/0:t.uniToStrPos(M,j);return M.slice(Q,ge)};const u=(M,T,j)=>typeof M=="number"?j==null?M-T:Math.min(M,j)-T:e.uniSlice(M,T,j),c=M=>{let T=0,j=0;return{take:(le,p)=>{if(T===M.length)return le===-1?null:le;const W=M[T];let O;if(typeof W=="number")return le===-1||W-j<=le?(O=W-j,++T,j=0,O):(j+=le,le);if(typeof W=="string"){if(le===-1||p==="i"||t.strPosToUni(W.slice(j))<=le)return O=W.slice(j),++T,j=0,O;{const D=j+t.uniToStrPos(W.slice(j),le);return O=W.slice(j,D),j=D,O}}else{if(le===-1||p==="d"||e.dlen(W.d)-j<=le)return O={d:u(W.d,j)},++T,j=0,O;{let D=u(W.d,j,j+le);return j+=le,{d:D}}}},peek:()=>M[T]}},h=M=>(M.length>0&&typeof M[M.length-1]=="number"&&M.pop(),M);function d(M,T,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(M),n(T);const Q=[],ge=a(Q),{take:le,peek:p}=c(M);for(let O=0;O<T.length;O++){const D=T[O];let y,w;switch(typeof D){case"number":for(y=D;y>0;)w=le(y,"i"),ge(w),typeof w!="string"&&(y-=l(w));break;case"string":j==="left"&&typeof p()=="string"&&ge(le(-1)),ge(t.strPosToUni(D));break;case"object":for(y=e.dlen(D.d);y>0;)switch(w=le(y,"i"),typeof w){case"number":y-=w;break;case"string":ge(w);break;case"object":y-=e.dlen(w.d)}break}}let W;for(;W=le(-1);)ge(W);return h(Q)}function g(M,T){n(M),n(T);const j=[],Q=a(j),{take:ge}=c(M);for(let p=0;p<T.length;p++){const W=T[p];let O,D;switch(typeof W){case"number":for(O=W;O>0;)D=ge(O,"d"),Q(D),typeof D!="object"&&(O-=l(D));break;case"string":Q(W);break;case"object":O=e.dlen(W.d);let y=0;for(;y<O;)switch(D=ge(O-y,"d"),typeof D){case"number":Q({d:u(W.d,y,y+D)}),y+=D;break;case"string":y+=t.strPosToUni(D);break;case"object":Q(D)}break}}let le;for(;le=ge(-1);)Q(le);return h(j)}const C=(M,T)=>{let j=0;for(let Q=0;Q<T.length&&M>j;Q++){const ge=T[Q];switch(typeof ge){case"number":{j+=ge;break}case"string":const le=t.strPosToUni(ge);j+=le,M+=le;break;case"object":M-=Math.min(e.dlen(ge.d),M-j);break}}return M},I=(M,T)=>typeof M=="number"?C(M,T):M.map(j=>C(j,T));function b(M,T,j){return s(M,(Q,ge)=>typeof Q=="object"&&typeof Q.d=="number"?{d:j.slice(T,ge,ge+Q.d)}:Q)}function U(M){return s(M,T=>{switch(typeof T){case"object":if(typeof T.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return T.d;case"string":return{d:T};case"number":return T}})}function Z(M){return s(M,T=>typeof T=="object"&&typeof T.d=="string"?{d:t.strPosToUni(T.d)}:T)}function V(M){let T=!0;return r(M,j=>{typeof j=="object"&&typeof j.d=="number"&&(T=!1)}),T}function fe(M){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(T=""){if(typeof T!="string")throw Error("Initial data must be a string");return M.create(T)},apply(T,j){n(j);const Q=M.builder(T);for(let ge=0;ge<j.length;ge++){const le=j[ge];switch(typeof le){case"number":Q.skip(le);break;case"string":Q.append(le);break;case"object":Q.del(e.dlen(le.d));break}}return Q.build()},transform:d,compose:g,transformPosition:C,transformSelection:I,isInvertible:V,makeInvertible(T,j){return b(T,j,M)},stripInvertible:Z,invert:U,invertWithDoc(T,j){return U(b(T,j,M))},isNoop:T=>T.length===0}}e.default=fe}(zs)),zs}var Gr={},dl;function Ym(){if(dl)return Gr;dl=1,Object.defineProperty(Gr,"__esModule",{value:!0});const e=Vs(),t=Ys();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return Gr.default=n,n.provides={text:!0},Gr}var fl;function zm(){return fl||(fl=1,function(e){var t=wt&&wt.__createBinding||(Object.create?function(d,g,C,I){I===void 0&&(I=C),Object.defineProperty(d,I,{enumerable:!0,get:function(){return g[C]}})}:function(d,g,C,I){I===void 0&&(I=C),d[I]=g[C]}),n=wt&&wt.__setModuleDefault||(Object.create?function(d,g){Object.defineProperty(d,"default",{enumerable:!0,value:g})}:function(d,g){d.default=g}),r=wt&&wt.__importStar||function(d){if(d&&d.__esModule)return d;var g={};if(d!=null)for(var C in d)Object.hasOwnProperty.call(d,C)&&t(g,d,C);return n(g,d),g},s=wt&&wt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=Ys(),o=r(Vs()),a=s(Ym()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const g=[];return{skip(C){let I=i.uniToStrPos(d,C);if(I>d.length)throw Error("The op is too long for this document");g.push(d.slice(0,I)),d=d.slice(I)},append(C){g.push(C)},del(C){d=d.slice(i.uniToStrPos(d,C))},build(){return g.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,g)=>g.length===0?[]:d===0?[g]:[d,g],e.remove=(d,g)=>o.dlen(g)===0?[]:d===0?[{d:g}]:[d,{d:g}];var h=Vs();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(wt)),wt}var gl;function Vm(){return gl||(gl=1,function(e){var t=Xn&&Xn.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(Wm()),r=t(jm()),s=al(),i=ul();function o(v,$){if(!v)throw new Error($)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:v=>v,isNoop:v=>v==null,setDebug(v){},registerSubtype:U,checkValidOp:ge,normalize:le,apply:p,transformPosition:W,compose:O,tryTransform:G,transform:de,makeInvertible:w,invert:D,invertWithDoc:x,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(v,$,K)=>Ae(()=>!0,v,$,K),typeAllowingConflictsPred:v=>Object.assign(Object.assign({},e.type),{transform:($,K,q)=>Ae(v,$,K,q)})};const a=v=>v?v.getComponent():null;function l(v){return v&&typeof v=="object"&&!Array.isArray(v)}const u=v=>Array.isArray(v)?v.slice():v!==null&&typeof v=="object"?Object.assign({},v):v,c=v=>v&&(v.p!=null||v.r!==void 0),h=v=>v&&(v.d!=null||v.i!==void 0);function d(v,$){return o(v!=null),typeof $=="number"?(o(Array.isArray(v),"Invalid key - child is not an array"),(v=v.slice()).splice($,1)):(o(l(v),"Invalid key - child is not an object"),delete(v=Object.assign({},v))[$]),v}function g(v,$,K){return typeof $=="number"?(o(v!=null,"Container is missing for key"),o(Array.isArray(v),"Cannot use numerical key for object container"),o(v.length>=$,"Cannot insert into out of bounds index"),v.splice($,0,K)):(o(l(v),"Cannot insert into missing item"),o(v[$]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),v[$]=K),K}e.removeOp=(v,$=!0)=>s.writeCursor().writeAtPath(v,"r",$).get(),e.moveOp=(v,$)=>s.writeCursor().writeMove(v,$).get(),e.insertOp=(v,$)=>s.writeCursor().writeAtPath(v,"i",$).get(),e.replaceOp=(v,$,K)=>s.writeCursor().at(v,q=>{q.write("r",$),q.write("i",K)}).get(),e.editOp=(v,$,K,q=!1)=>s.writeCursor().at(v,z=>T(z,$,K,q)).get();const C=(v,$)=>v!=null&&(typeof $=="number"?Array.isArray(v):typeof v=="object"),I=(v,$)=>C(v,$)?v[$]:void 0,b={};function U(v){let $=v.type?v.type:v;$.name&&(b[$.name]=$),$.uri&&(b[$.uri]=$)}const Z=v=>{const $=b[v];if($)return $;throw Error("Missing type: "+v)};U(zm());const V=(v,$)=>v+$;U({name:"number",apply:V,compose:V,invert:v=>-v,transform:v=>v});const fe=v=>v==null?null:v.et?Z(v.et):v.es?b["text-unicode"]:v.ena!=null?b.number:null,M=v=>v.es?v.es:v.ena!=null?v.ena:v.e,T=(v,$,K,q=!1)=>{const[z,Y]=typeof $=="string"?[Z($),$]:[$,$.name];!q&&z.isNoop&&z.isNoop(K)||(Y==="number"?v.write("ena",K):Y==="text-unicode"?v.write("es",K):(v.write("et",Y),v.write("e",K)))};function j(v){o(typeof v=="number"),o(v>=0),o(v===(0|v))}function Q(v){typeof v=="number"?j(v):o(typeof v=="string")}function ge(v){if(v===null)return;const $=new Set,K=new Set,q=Y=>{let ue=!0,ae=!1;for(let H in Y){const ne=Y[H];if(ue=!1,o(H==="p"||H==="r"||H==="d"||H==="i"||H==="e"||H==="es"||H==="ena"||H==="et","Invalid component item '"+H+"'"),H==="p")j(ne),o(!$.has(ne)),$.add(ne),o(Y.r===void 0);else if(H==="d")j(ne),o(!K.has(ne)),K.add(ne),o(Y.i===void 0);else if(H==="e"||H==="es"||H==="ena"){o(!ae),ae=!0;const oe=fe(Y);o(oe,"Missing type in edit"),oe.checkValidOp&&oe.checkValidOp(M(Y))}}o(!ue)},z=(Y,ue,ae)=>{if(!Array.isArray(Y))throw Error("Op must be null or a list");if(Y.length===0)throw Error("Empty descent");ue||Q(Y[0]);let H=1,ne=0,oe=0;for(let _e=0;_e<Y.length;_e++){const ye=Y[_e];if(o(ye!=null),Array.isArray(ye)){const Ue=z(ye,!1);if(ne){const X=typeof oe,Ie=typeof Ue;X===Ie?o(oe<Ue,"descent keys are not in order"):o(X==="number"&&Ie==="string")}oe=Ue,ne++,H=3}else typeof ye=="object"?(o(H===1,`Prev not scalar - instead ${H}`),q(ye),H=2):(o(H!==3),Q(ye),o(s.isValidPathItem(ye),"Invalid path key"),H=1)}return o(ne!==1,"Operation makes multiple descents. Remove some []"),o(H===2||H===3),Y[0]};z(v,!0),o($.size===K.size,"Mismatched picks and drops in op");for(let Y=0;Y<$.size;Y++)o($.has(Y)),o(K.has(Y))}function le(v){let $=0,K=[];const q=s.writeCursor();return q.mergeTree(v,(z,Y)=>{const ue=fe(z);if(ue){const H=M(z);T(Y,ue,ue.normalize?ue.normalize(H):H)}for(const H of["r","p","i","d"])if(z[H]!==void 0){const ne=H==="p"||H==="d"?(ae=z[H],K[ae]==null&&(K[ae]=$++),K[ae]):z[H];Y.write(H,ne)}var ae}),q.get()}function p(v,$){if(ge($),$===null)return v;const K=[];return function q(z,Y){let ue=z,ae=0,H={root:z},ne=0,oe=H,_e="root";function ye(){for(;ne<ae;ne++){let Ue=Y[ne];typeof Ue!="object"&&(o(C(oe,_e)),oe=oe[_e]=u(oe[_e]),_e=Ue)}}for(;ae<Y.length;ae++){const Ue=Y[ae];if(Array.isArray(Ue)){const X=q(ue,Ue);X!==ue&&X!==void 0&&(ye(),ue=oe[_e]=X)}else if(typeof Ue=="object"){Ue.d!=null?(ye(),ue=g(oe,_e,K[Ue.d])):Ue.i!==void 0&&(ye(),ue=g(oe,_e,Ue.i));const X=fe(Ue);if(X)ye(),ue=oe[_e]=X.apply(ue,M(Ue));else if(Ue.e!==void 0)throw Error("Subtype "+Ue.et+" undefined")}else ue=I(ue,Ue)}return H.root}(v=function q(z,Y){const ue=[];let ae=0;for(;ae<Y.length;ae++){const _e=Y[ae];if(Array.isArray(_e))break;typeof _e!="object"&&(ue.push(z),z=I(z,_e))}for(let _e=Y.length-1;_e>=ae;_e--)z=q(z,Y[_e]);for(--ae;ae>=0;ae--){const _e=Y[ae];if(typeof _e!="object"){const ye=ue.pop();z=z===I(ye,_e)?ye:z===void 0?d(ye,_e):(ne=_e,oe=z,(H=u(H=ye))[ne]=oe,H)}else c(_e)&&(o(z!==void 0,"Cannot pick up or remove undefined"),_e.p!=null&&(K[_e.p]=z),z=void 0)}var H,ne,oe;return z}(v,$),$)}function W(v,$){v=v.slice(),ge($);const K=s.readCursor($);let q,z,Y=!1;const ue=[];for(let H=0;;H++){const ne=v[H],oe=K.getComponent();if(oe&&(oe.r!==void 0?Y=!0:oe.p!=null&&(Y=!1,q=oe.p,z=H)),H>=v.length)break;let _e=0;const ye=s.advancer(K,void 0,(X,Ie)=>{c(Ie)&&_e++});ue.unshift(ye);const Ue=ye(ne);if(typeof ne=="number"&&(v[H]-=_e),!Ue)break}if(ue.forEach(H=>H.end()),Y)return null;const ae=()=>{let H=0;if(q!=null){const ne=K.getPath();H=ne.length,v=ne.concat(v.slice(z))}for(;H<v.length;H++){const ne=v[H],oe=a(K),_e=fe(oe);if(_e){const X=M(oe);_e.transformPosition&&(v[H]=_e.transformPosition(v[H],X));break}let ye=0;const Ue=s.advancer(K,(X,Ie)=>h(Ie)?~(X-ye):X-ye,(X,Ie)=>{h(Ie)&&ye++})(ne);if(typeof ne=="number"&&(v[H]+=ye),!Ue)break}};return q!=null?K.eachDrop(null,H=>{H===q&&ae()}):ae(),v}function O(v,$){if(ge(v),ge($),v==null)return $;if($==null)return v;let K=0;const q=s.readCursor(v),z=s.readCursor($),Y=s.writeCursor(),ue=[],ae=[],H=[],ne=[],oe=[],_e=[],ye=new Set;q.traverse(null,X=>{X.p!=null&&(H[X.p]=q.clone())}),z.traverse(null,X=>{X.d!=null&&(ne[X.d]=z.clone())});const Ue=s.writeCursor();return function X(Ie,Ge,je,Fe,Ze,Rt,Ke,rt){o(Ge||je);const Xe=a(Ge),ht=a(je),at=!!ht&&ht.r!==void 0,$t=!!Xe&&Xe.i!==void 0,Be=Xe?Xe.d:null,dt=ht?ht.p:null,E=(Rt||at)&&dt==null;if(dt!=null)Fe=ne[dt],Ke=ae[dt]=new s.WriteCursor;else if(ht&&ht.r!==void 0)Fe=null;else{const L=a(Fe);L&&L.d!=null&&(Fe=null)}const m=a(Fe);if(Be!=null)if(Ie=H[Be],rt=ue[Be]=new s.WriteCursor,E)Rt&&!at&&rt.write("r",!0);else{const L=oe[Be]=K++;Ke.write("d",L)}else if(Xe&&Xe.i!==void 0)Ie=null;else{const L=a(Ie);L&&L.p!=null&&(Ie=null)}let _;$t?(o(Ze===void 0),_=Xe.i):_=Ze;const A=(dt==null?!$t||Rt||at:_===void 0)?null:Ke.getComponent();if(dt!=null){if(!(Ze!==void 0||$t)){const L=Be!=null?oe[Be]:K++;_e[dt]=L,rt.write("p",L)}}else at&&($t||Ze!==void 0||(ht.r,rt.write("r",ht.r)));const N=E?null:fe(Xe),P=fe(m);if((N||P)&&(N&&N.name,P&&P.name),N&&P){o(N===P);const L=M(Xe),te=M(m),Re=N.compose(L,te);T(Ke,N,Re),ye.add(m)}else N?T(Ke,N,M(Xe)):P&&(T(Ke,P,M(m)),ye.add(m));const k=typeof _=="object"&&_!=null;let F=!1,S=0,ee=0,Ee=0,J=0,pe=0;const we=s.advancer(Fe,(L,te)=>h(te)?J-L-1:L-J,(L,te)=>{h(te)&&J++}),ce=s.advancer(Ie,(L,te)=>c(te)?S-L-1:L-S,(L,te)=>{c(te)&&S++});if(s.eachChildOf(Ge,je,(L,te,Re)=>{let Te,xe,$e=L,Ye=L,ft=L;if(typeof L=="number"){let De=L+Ee;xe=we(De),Ye=De+J;let se=L+ee;Te=ce(se),h(a(xe))&&(Te=null),$e=se+S,ft=L+pe,o($e>=0,"p1PickKey is negative"),o(Ye>=0,"p2DropKey is negative");const ut=h(a(te)),We=c(a(Re));(ut||We&&!E)&&pe--,ut&&ee--,We&&Ee--}else Te=ce(L),xe=we(L);rt.descend($e),Ke.descend(Ye);const mt=k&&!h(a(te))?_[ft]:void 0,Ce=X(Te,te,Re,xe,mt,E,Ke,rt);var et,Oe,ve;k&&!E?mt!==Ce&&(F||(_=Array.isArray(_)?_.slice():Object.assign({},_),F=!0),et=_,ve=Ce,typeof(Oe=ft)=="number"?(o(Array.isArray(et)),o(Oe<et.length)):(o(!Array.isArray(et)),o(et[Oe]!==void 0)),ve===void 0?typeof Oe=="number"?et.splice(Oe,1):delete et[Oe]:et[Oe]=ve):o(Ce===void 0),Ke.ascend(),rt.ascend()}),ce.end(),we.end(),A!=null)A.i=_;else if(!Rt&&!at&&dt==null)return _}(q,q.clone(),z,z.clone(),void 0,!1,Y,Ue),Y.reset(),Y.mergeTree(Ue.get()),Y.reset(),Y.get(),ue.map(X=>X.get()),ae.map(X=>X.get()),q.traverse(Y,(X,Ie)=>{const Ge=X.p;if(Ge!=null){const je=oe[Ge];je!=null&&Ie.write("p",je);const Fe=ue[Ge];Fe&&Fe.get(),Fe&&Ie.mergeTree(Fe.get())}else X.r!==void 0&&Ie.write("r",X.r)}),Y.reset(),Y.get(),z.traverse(Y,(X,Ie)=>{const Ge=X.d;if(Ge!=null){const Fe=_e[Ge];Fe!=null&&Ie.write("d",Fe);const Ze=ae[Ge];Ze&&Ie.mergeTree(Ze.get())}else X.i!==void 0&&Ie.write("i",X.i);const je=fe(X);je&&!ye.has(X)&&T(Ie,je,M(X))}),Y.get()}function D(v){if(v==null)return null;const $=new s.ReadCursor(v),K=new s.WriteCursor;let q;const z=[],Y=[];return function ue(ae,H,ne){const oe=ae.getComponent();let _e,ye=!1;if(oe){oe.p!=null&&(H.write("d",oe.p),z[oe.p]=ae.clone()),oe.r!==void 0&&H.write("i",oe.r),oe.d!=null&&(H.write("p",oe.d),ne=void 0),oe.i!==void 0&&(ne=_e=oe.i);const X=fe(oe);X&&(ne===void 0?(q||(q=new Set),q.add(oe)):(M(oe),ne=X.apply(ne,M(oe)),ye=!0))}let Ue=0;for(const X of ae){H.descend(X);const Ie=typeof X=="number"?X-Ue:X,Ge=I(ne,Ie);h(ae.getComponent())&&Ue++;const je=ue(ae,H,Ge);if(ne!==void 0&&je!==void 0){if(ye||(ye=!0,ne=u(ne)),!C(ne,Ie))throw Error("Cannot modify child - invalid operation");ne[Ie]=je}H.ascend()}if(_e===void 0)return ye?ne:void 0;H.write("r",ne)}($,K,void 0),q&&(K.reset(),function ue(ae,H,ne){const oe=H.getComponent();if(oe){const X=oe.d;if(X!=null&&(ae=z[X],ne=Y[X]=s.writeCursor()),q.has(oe)){const Ie=fe(oe);if(!Ie.invert)throw Error(`Cannot invert subtype ${Ie.name}`);T(ne,Ie,Ie.invert(M(oe)))}}let _e=0,ye=0;const Ue=s.advancer(ae,(X,Ie)=>c(Ie)?_e-X-1:X-_e,(X,Ie)=>{c(Ie)&&_e++});for(const X of H)if(typeof X=="number"){const Ie=X-ye,Ge=Ue(Ie),je=Ie+_e;ne.descend(je),ue(Ge,H,ne),h(H.getComponent())&&ye++,ne.ascend()}else ne.descend(X),ue(Ue(X),H,ne),ne.ascend();Ue.end()}($.clone(),$,K),Y.length&&(K.reset(),$.traverse(K,(ue,ae)=>{const H=ue.p;if(H!=null){const ne=Y[H];ne&&ne.get(),ne&&ae.mergeTree(ne.get())}}))),K.get()}const y=(v,$)=>v.some(K=>typeof K=="object"&&(Array.isArray(K)?y(K,$):$(K)));function w(v,$){if(v==null||!y(v,H=>{var ne;return H.r!==void 0||((ne=fe(H))===null||ne===void 0?void 0:ne.makeInvertible)!=null}))return v;const K=new s.ReadCursor(v),q=new s.WriteCursor;let z=!1;const Y=[],ue=[],ae=(H,ne,oe)=>{const _e=H.getComponent();let ye=!1;if(_e){_e.d!=null&&ne.write("d",_e.d),_e.i!==void 0&&ne.write("i",_e.i);const X=_e.p;if(X!=null&&(Y[X]=H.clone(),o(oe!==void 0,"Operation picks up at an invalid key"),ue[X]=oe,ne.write("p",_e.p)),_e.r!==void 0&&oe===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Ie=fe(_e);Ie&&(Ie.makeInvertible?z=!0:T(ne,Ie,M(_e),!0))}let Ue=0;for(const X of H){ne.descend(X);const Ie=typeof X=="number"?X-Ue:X,Ge=I(oe,Ie),je=ae(H,ne,Ge);Ge!==je&&(ye||(ye=!0,oe=u(oe)),je===void 0?(oe=d(oe,Ie),typeof X=="number"&&Ue++):oe[Ie]=je),ne.ascend()}return _e&&(_e.r!==void 0?(ne.write("r",r.default(oe)),oe=void 0):_e.p!=null&&(oe=void 0)),oe};return ae(K,q,$),q.get(),z&&(q.reset(),function H(ne,oe,_e,ye,Ue){const X=oe.getComponent();if(X){X.i!==void 0?(ye=X.i,Ue=!0):X.d!=null&&(ye=ue[X.d],ne=Y[X.d],Ue=!1,X.d);let Fe=fe(X);if(Fe&&Fe.makeInvertible){const Ze=M(X);T(_e,Fe,Fe.makeInvertible(Ze,ye),!0)}}let Ie=0,Ge=0;const je=s.advancer(ne,(Fe,Ze)=>c(Ze)?Ie-Fe-1:Fe-Ie,(Fe,Ze)=>{c(Ze)&&Ie++});for(const Fe of oe)if(typeof Fe=="number"){const Ze=Fe-Ge,Rt=je(Ze),Ke=Ze+Ie,rt=I(ye,Ue?Ze:Ke);_e.descend(Fe),H(Rt,oe,_e,rt,Ue),h(oe.getComponent())&&Ge++,_e.ascend()}else{const Ze=I(ye,Fe);_e.descend(Fe),H(je(Fe),oe,_e,Ze,Ue),_e.ascend()}je.end()}(K.clone(),K,q,$,!1)),q.get()}function x(v,$){return D(w(v,$))}const B=v=>{if(v==null)return null;const $=v.slice();for(let K=0;K<v.length;K++){const q=$[K];Array.isArray(q)&&($[K]=B(q))}return $};function G(v,$,K){o(K==="left"||K==="right","Direction must be left or right");const q=K==="left"?0:1;if($==null)return{ok:!0,result:v};ge(v),ge($);let z=null;const Y=[],ue=[],ae=[],H=[],ne=[],oe=[],_e=[],ye=[],Ue=[],X=[],Ie=[],Ge=[],je=[],Fe=[],Ze=[];let Rt=0;const Ke=s.readCursor(v),rt=s.readCursor($),Xe=s.writeCursor();if(function m(_,A=null,N){const P=a(A);P&&(P.r!==void 0?N=A.clone():P.p!=null&&(N=null,oe[P.p]=_.clone()));const k=_.getComponent();let F;k&&(F=k.p)!=null&&(ne[F]=A?A.clone():null,ae[F]=_.clone(),N&&(X[F]=!0,Ue[F]=N),P&&P.p!=null&&(Fe[F]=P.p));const S=s.advancer(A);for(const ee of _)m(_,S(ee),N);S.end()}(rt,Ke,null),function m(_,A,N,P,k){const F=N.getComponent();let S,ee=!1;F&&((S=F.d)!=null?(H[S]=N.clone(),P!=null&&(Ze[P]==null&&(Ze[P]=[]),Ze[P].push(S)),X[S],_=ne[S]||null,A=ae[S]||null,X[S]?(k&&(Ie[S]=!0),k=Ue[S]||null):!k||q!==1&&Fe[S]!=null||z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.moveOp(A.getPath(),N.getPath())}),ee=!0):F.i!==void 0&&(_=A=null,ee=!0,k&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.insertOp(N.getPath(),F.i)})));const Ee=a(_);Ee&&(Ee.r!==void 0?k=_.clone():Ee.p!=null&&(Ee.p,P=Ee.p,k=null));const J=fe(F);J&&k&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.editOp(N.getPath(),J,M(F),!0)});let pe=0,we=0;const ce=s.advancer(A,(te,Re)=>c(Re)?pe-te-1:te-pe,(te,Re)=>{c(Re)&&pe++}),L=s.advancer(_);for(const te of N)if(typeof te=="number"){const Re=te-we,Te=ce(Re);we+=+m(L(Re+pe),Te,N,P,k)}else{const Re=ce(te);m(L(te),Re,N,P,k)}return ce.end(),L.end(),ee}(Ke,rt,rt.clone(),null,null),H.map(m=>m&&m.get()),z)return{ok:!1,conflict:z};Ie.map(m=>!!m);const ht=[];let at=null;(function m(_,A,N,P,k){let F=!1;const S=a(A);if(c(S)){const ce=S.p;ce!=null?(N=H[ce],P=Ge[ce]=s.writeCursor(),F=!0,k=null):(N=null,k=A.clone())}else h(a(N))&&(N=null);const ee=_.getComponent();if(ee){const ce=ee.p;ce!=null?(k&&(ye[ce]=k),ht[ce]=k||q===1&&F?null:P.getComponent(),Y[ce]=_.clone(),N&&(_e[ce]=N.clone())):ee.r!==void 0&&(k||P.write("r",!0),(k||F)&&(at==null&&(at=new Set),at.add(ee)))}let Ee=0,J=0;const pe=s.advancer(A,void 0,(ce,L)=>{c(L)&&Ee++}),we=s.advancer(N,(ce,L)=>h(L)?~(ce-J):ce-J,(ce,L)=>{h(L)&&J++});if(_)for(const ce of _)if(typeof ce=="string"){const L=pe(ce),te=we(ce);P.descend(ce),m(_,L,te,P,k),P.ascend()}else{const L=pe(ce),te=ce-Ee,Re=c(a(L))?null:we(te),Te=te+J;o(Te>=0),P.descend(Te),m(_,L,Re,P,k),P.ascend()}pe.end(),we.end()})(Ke,rt,rt.clone(),Xe,null),Xe.reset();let $t=[];if(function m(_,A,N,P,k,F){o(A);const S=A.getComponent();let ee=a(P),Ee=!1;const J=(Oe,ve,De)=>Oe?e.moveOp(Oe.getPath(),ve.getPath()):e.insertOp(ve.getPath(),De.i);if(h(S)){const Oe=S.d;Oe!=null&&(ue[Oe]=A.clone());const ve=Oe!=null?ht[Oe]:null;let De=!1;if(S.i!==void 0||Oe!=null&&ve){let se;ee&&(ee.i!==void 0||(se=ee.d)!=null&&!X[se])&&(De=se!=null?Oe!=null&&Oe===Fe[se]:n.default(ee.i,S.i),De||se!=null&&q!==1&&Fe[se]!=null||z==null&&(z={type:i.ConflictType.DROP_COLLISION,op1:J(Oe!=null?Y[Oe]:null,A,S),op2:J(se!=null?ae[se]:null,P,ee)})),De||(F?z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:J(Oe!=null?Y[Oe]:null,A,S),op2:e.removeOp(F.getPath())}):(Oe!=null?($t[Rt]=Oe,k.write("d",ve.p=Rt++)):k.write("i",r.default(S.i)),Ee=!0))}else if(Oe!=null&&!ve){const se=ye[Oe];se&&(F=se.clone())}Oe!=null?(_=Y[Oe],N=oe[Oe],P=_e[Oe]):S.i!==void 0&&(_=N=null,De||(P=null))}else c(a(_))&&(_=N=P=null);const pe=a(_),we=a(N);if(c(we)){const Oe=we.p;we.r!==void 0&&(!pe||pe.r===void 0)||X[Oe]?(P=null,F=N.clone()):Oe!=null&&(P=H[Oe],q!==1&&Fe[Oe]!=null||((k=je[Oe])||(k=je[Oe]=s.writeCursor()),k.reset(),F=null))}else!h(S)&&h(ee)&&(P=null);ee=P!=null?P.getComponent():null;const ce=fe(S);if(ce){const Oe=M(S);if(F)z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(A.getPath(),ce,Oe,!0),op2:e.removeOp(F.getPath())});else{const ve=fe(ee);let De;if(ve){if(ce!==ve)throw Error("Transforming incompatible types");const se=M(ee);De=ce.transform(Oe,se,K)}else De=r.default(Oe);T(k,ce,De)}}let L=0,te=0,Re=0,Te=0,xe=0,$e=0,Ye=_!=null&&_.descendFirst(),ft=Ye;const mt=s.advancer(N,void 0,(Oe,ve)=>{c(ve)&&Re++});let Ce=P!=null&&P.descendFirst(),et=Ce;for(const Oe of A)if(typeof Oe=="number"){let ve;const De=h(A.getComponent()),se=Oe-te;{let Jt;for(;Ye&&typeof(Jt=_.getKey())=="number";){Jt+=L;const At=_.getComponent(),Mn=c(At);if(Jt>se||Jt===se&&(!Mn||q===0&&De))break;if(Mn){L--;const cn=At.p;Fe.includes(cn),At.d,a(je[At.d]),c(a(je[At.d])),(At.r===void 0||at&&at.has(At))&&(cn==null||!ht[cn]||q!==1&&Fe.includes(cn))||xe--}Ye=_.nextSibling()}ve=Ye&&Jt===se?_:null}const ut=se-L;let We=mt(ut);const Dt=ut-Re;let rs=null;{let Jt,At;for(;Ce&&typeof(Jt=P.getKey())=="number";){At=Jt-Te;const Mn=P.getComponent(),cn=h(Mn);if(At>Dt)break;if(At===Dt){if(!cn){rs=P;break}{if(q===0&&De){rs=P;break}const Zt=We&&c(We.getComponent());if(q===0&&Zt)break}}if(cn){const Zt=Mn.d;X[Zt],Fe[Zt],Mn.i===void 0&&(X[Zt]||Fe[Zt]!=null&&q!==1)?(X[Zt]||Fe[Zt]!=null&&q===0)&&(Te++,$e--):Te++}Ce=P.nextSibling()}}const qu=Dt+Te+xe+$e;o(qu>=0,"trying to descend to a negative index"),k.descend(qu),De&&(ve=We=rs=null,te++),m(ve,A,We,rs,k,F)&&$e++,k.ascend()}else{let ve;for(;Ye&&(ve=_.getKey(),typeof ve!="string"||!(ve>Oe||ve===Oe));)Ye=_.nextSibling();const De=Ye&&ve===Oe?_:null,se=mt(Oe);let ut;for(;Ce&&(ut=P.getKey(),typeof ut!="string"||!(ut>Oe||ut===Oe));)Ce=P.nextSibling();const We=Ce&&ut===Oe?P:null;k.descend(Oe),m(De,A,se,We,k,F),k.ascend()}return mt.end(),ft&&_.ascend(),et&&P.ascend(),Ee}(Ke,Ke.clone(),rt,rt.clone(),Xe,null),z)return{ok:!1,conflict:z};Xe.reset();const Be=(m,_,A)=>m.traverse(_,(N,P)=>{N.d!=null&&A(N.d,m,P)});(X.length||Ge.length)&&(Be(rt,Xe,(m,_,A)=>{X[m]&&!Ie[m]&&A.write("r",!0),Ge[m]&&A.mergeTree(Ge[m].get())}),Xe.reset());const dt=[],E=[];if((je.length||X.length)&&!z){const m=s.readCursor(B(Xe.get()));if(Be(m,null,(_,A)=>{dt[_]=A.clone()}),je.forEach(_=>{_&&Be(s.readCursor(_.get()),null,(A,N)=>{dt[A]=N.clone()})}),function _(A,N,P,k,F,S){const ee=a(N);if(ee&&c(ee))if(ee.p!=null){const L=ee.p;dt[L].getPath(),P=dt[L],k=E[L]=s.writeCursor()}else ee.r!==void 0&&(P=null);else h(a(P))&&(P=null);const Ee=A.getComponent();if(Ee){let L;if((L=Ee.d)!=null){const te=je[L];te&&(te.get(),k.mergeTree(te.get()),P=s.readCursor(te.get()))}}let J=0,pe=0;const we=s.advancer(N,void 0,(L,te)=>{c(te)&&J--}),ce=s.advancer(P,(L,te)=>h(te)?-(L-pe)-1:L-pe,(L,te)=>{h(te)&&pe++});for(const L of A)if(typeof L=="number"){const te=we(L),Re=L+J,Te=ce(Re),xe=Re+pe;k.descend(xe),_(A,te,Te,k),k.ascend()}else k.descend(L),_(A,we(L),ce(L),k),k.ascend();we.end(),ce.end()}(rt,m,m.clone(),Xe),Xe.reset(),z)return{ok:!1,conflict:z};if(Xe.get(),E.length){const _=E.map(N=>N?N.get():null),A=s.readCursor(B(Xe.get()));if(Be(A,Xe,(N,P,k)=>{const F=_[N];F&&(k.mergeTree(F),_[N]=null)}),_.find(N=>N)){const N=s.writeCursor(),P=s.writeCursor();let k=0,F=0;_.forEach(S=>{S!=null&&Be(s.readCursor(S),null,ee=>{const Ee=$t[ee];N.writeMove(Y[Ee].getPath(),ue[Ee].getPath(),k++);const J=Ze[Ee];J&&J.forEach(pe=>{X[pe]||q!==1&&Fe[pe]!=null||P.writeMove(ae[pe].getPath(),H[pe].getPath(),F++)})})}),z={type:i.ConflictType.BLACKHOLE,op1:N.get(),op2:P.get()}}}}return z?{ok:!1,conflict:z}:{ok:!0,result:Xe.get()}}const ie=v=>{const $=new Error("Transform detected write conflict");throw $.conflict=v,$.type=$.name="writeConflict",$};function de(v,$,K){const q=G(v,$,K);if(q.ok)return q.result;ie(q.conflict)}const me=v=>{const $=s.writeCursor();return s.readCursor(v).traverse($,(K,q)=>{(h(K)||fe(K))&&q.write("r",!0)}),$.get()},Me=(v,$)=>{const{type:K,op1:q,op2:z}=v;switch(K){case i.ConflictType.DROP_COLLISION:return $==="left"?[null,me(z)]:[me(q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let Y=!1;return s.readCursor(q).traverse(null,ue=>{ue.r!==void 0&&(Y=!0)}),Y?[null,me(z)]:[me(q),null];case i.ConflictType.BLACKHOLE:return[me(q),me(z)];default:throw Error("Unrecognised conflict: "+K)}};function Ae(v,$,K,q){let z=null;for(;;){const Y=G($,K,q);if(Y.ok)return O(z,Y.result);{const{conflict:ue}=Y;v(ue)||ie(ue);const[ae,H]=Me(ue,q);$=O(le($),ae),K=O(le(K),H),z=O(z,H)}}}}(Xn)),Xn}var ml;function Gm(){return ml||(ml=1,function(e){var t=on&&on.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=on&&on.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(Vm(),e);var r=al();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=ul();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(on)),on}var gt=Gm();const Km=Ju({__proto__:null,default:pt(gt)},[gt]);var he=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(he||{});function qn(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();ra(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function _l(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:g}=h;if(g<=r)i.push(h);else if(r>d&&r<g){a=!0;const C={...h,ed:r};i.push(C),l.length&&i.push(...l);const I={...h,st:r+n,ed:g+n};i.push(I)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=qn(i)}function pl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Gn("startIndex"))}}function El(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Gn("startIndex"))}}function Cl(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Gn("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Rl(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Gn("startIndex"))}}const Il="$",Sl=e=>e.split(Il)[0];function Gs(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Sl(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Sl(i.rangeId),i.rangeId===n.rangeId&&ho(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Il}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Ks(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function vl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Xs(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function Xm(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Ks(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=Gs(s)}function qm(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Xs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=vl(s)}function Ol(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function wl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function bl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function yl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Al(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const g=Br(h,d,s,i);if(g.length===0||(c.startIndex=g[0],c.endIndex=g[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function Jm(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const g=Br(h,d,s,i);if(g.length===0)continue;c.startIndex=g[0],c.endIndex=g[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=Gs(a)}return o}function Zm(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:g}=h;if(d>=i&&g<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,g)){const C=Br(d,g,i,o);if(C.length===0)continue;h.startIndex=C[0],h.endIndex=C[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Tl=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e))(Tl||{}),Mt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Mt||{});const Kr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},Cn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Kn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Rn=e=>e.map((t,n)=>({...t,bulletAlignment:Kn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Nl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Kn.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),Jn={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Cn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Cn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Cn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Cn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Cn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Cn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:Rn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:Rn([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:Rn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:Rn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:Rn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:Rn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Nl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Nl("☑",{st:{s:Se.TRUE}})}},Xr=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(Jn.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},Qm={ORDER_LIST_QUICK_2:Xr(Kr["a)"]),ORDER_LIST_QUICK_3:Xr(Kr["a."]),ORDER_LIST_QUICK_4:Xr(Kr["i."]),ORDER_LIST_QUICK_6:Xr(Kr["I."])};Object.assign(Jn,Qm);const e_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5"};function t_(e,t,n,r,s){const i=n_(e,t,n,r,s),o=r_(e,t,n,r,s),a=s_(e,t,n,r,s),l=i_(e,t,n,r,s),u=o_(e,t,n,r,s),c=a_(e,t,n,r),h=l_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function n_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Ol(e,n,r);if(s!==Pe.REPLACE){const l=Ml(o,a,s);t.textRuns=l}return _l(e,t,n,r),a}function Ml(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:g,ed:C,ts:I}=e[o],{st:b,ed:U,ts:Z,sId:V}=t[a];let fe;if(n===Pe.COVER?fe={...Z,...I}:fe={...I},C<b)u()||r.push(e[o]),o++;else if(U<g)u()||r.push(t[a]),a++;else{const M={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...I}:{...Z},sId:g<b?void 0:V};M.ed>M.st&&r.push(M),r.push({st:Math.max(g,b),ed:Math.min(C,U),ts:fe,sId:V}),C<U?(o++,t[a].st=C,t[a].st===t[a].ed&&a++):(a++,e[o].st=U,e[o].st===e[o].ed&&o++);const T={st:Math.min(C,U),ed:Math.max(C,U),ts:C<U?{...Z}:{...I},sId:C<U?V:void 0};l=T.ed>T.st?T:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),qn(r)}function r_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=wl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let g=[];for(const C of a){const{startIndex:I,paragraphStyle:b,bullet:U}=C;let Z,V;if(s===Pe.COVER?(Z={...b,...h},V={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...U,...d}):(Z={...h,...b},V={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...U}),c===I){g.push({startIndex:c,paragraphStyle:Z,bullet:V});break}}l.push(...g),g=[]}t.paragraphs=l}return pl(e,t,n,r),a}function s_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=bl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:g}=d;if(c===g){s===Pe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return El(e,t,n,r),a}function i_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=yl(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:g}=d;if(c===g){s===Pe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return Cl(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function o_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Al(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const g of a){const{startIndex:C,endIndex:I}=g;if(C>=c&&I<=h){s===Pe.COVER?d.push({...g,...u}):d.push({...u,...g});break}}l.push(...d),d=[]}t.tables=l}return Rl(e,t,n,r),a}function a_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Ks(e.customRanges,r),Ks(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:g}=h;d>=i&&g<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:g}=h;l.push({...h,startIndex:d+r,endIndex:g+r})}),e.customRanges=Gs(l),c):[]}function l_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Xs(e.customDecorations,r),Xs(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Pe.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===sn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=vl(o),i}var qs=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(qs||{});function qr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return qn(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Dl(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Ll(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function u_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Ul(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function bt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=qr(e,t,n,r);const a=Dl(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Ll(e,t,n),s===1){const u=Pl(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=kl(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Ul(e,t,n),o}function c_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function kl(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Pl(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function h_(e,t,n){return e==null||t==null?e!=null?e:t:Ml(e,t,n)}function d_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Pe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function f_(e,t,n){return t.length===0||e.length===0||n===Pe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Js(e,t,n=Pe.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=h_(l,s,n),r.customRanges=d_(c,o,n);const d=f_(h,a,n);d.length&&(r.customDecorations=d);const g=[];let C=0,I=0;for(;C<i.length&&I<u.length;){const b=i[C],U=u[I],{startIndex:Z}=b,{startIndex:V}=U;Z===V?(g.push(re.deepMerge(b,U)),C++,I++):Z<V?(g.push(re.deepClone(b)),C++):(g.push(re.deepClone(U)),I++)}return C<i.length&&g.push(...i.slice(C)),I<u.length&&g.push(...u.slice(I)),g.length&&(r.paragraphs=g),r}function g_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class In{constructor(t){R(this,"_index",0);R(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===he.DELETE||n.t===he.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:bt(n.body,r,r+t,!1)})}else return{t:he.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:he.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class Sn{constructor(){R(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function Fl(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Ol(e,t,n),a=wl(e,t,n),l=bl(e,t,n),u=yl(e,t,n),c=Al(e,t,n),h=Jm(e,t,n),d=Zm(e,t,n);let g="";return r&&(e.dataStream=ma(r,s,i),g=r.slice(s,i)),{dataStream:g,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function xl(e,t,n,r){e.dataStream=ga(e.dataStream,r,t.dataStream),_l(e,t,n,r),pl(e,t,n,r),El(e,t,n,r),Cl(e,t,n,r),Rl(e,t,n,r),Xm(e,t,n,r),qm(e,t,n,r)}function m_(e,t,n,r,s=Pe.COVER){return t_(e,t,n,r,s)}function __(e,t,n){return t<=0?{dataStream:""}:Fl(e,t,n)}function p_(e,t,n,r){n!==0&&xl(e,t,n,r)}function E_(e,t){const n=new Sn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case he.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&m_(e,o,a,n.cursor,i),n.moveCursor(a);break}case he.INSERT:{const{body:i,len:o}=s;p_(e,i,o,n.cursor),n.moveCursor(o);break}case he.DELETE:{const{len:i}=s;__(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function C_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:I,ed:b,ts:U}=t[l],{st:Z,ed:V,ts:fe,sId:M}=e[u];let T={};if(s===0)T={...U},n===Pe.COVER&&r===Pe.REPLACE&&fe&&(T=Object.assign({},fe,T));else if(T={...U},n===Pe.REPLACE){if(r===Pe.REPLACE)T={...fe};else if(U&&fe){const j=Object.keys(U);for(const Q of j)fe[Q]&&delete T[Q]}}else if(r===Pe.REPLACE){if(fe){const j=Object.keys(fe);for(const Q of j)fe[Q]!==void 0&&(T[Q]=fe[Q])}}else if(fe){const j=Object.keys(fe);for(const Q of j)T[Q]!==void 0&&delete T[Q]}if(b<Z)h()||i.push(t[l]),l++;else if(V<I)h()||i.push(e[u]),u++;else{const j={st:Math.min(I,Z),ed:Math.max(I,Z),ts:I<Z?{...U}:{...fe}};j.ed>j.st&&i.push(),i.push({st:Math.max(I,Z),ed:Math.min(b,V),ts:T,sId:M}),b<V?(l++,e[u].st=b,e[u].st===e[u].ed&&u++):(u++,t[l].st=V,t[l].st===t[l].ed&&l++);const Q={st:Math.min(b,V),ed:Math.max(b,V),ts:b<V?{...fe}:{...U},sId:b<V?M:void 0};c=Q.ed>Q.st?Q:null}}h();const d=i[i.length-1],g=t[o-1],C=e[a-1];return d.ed!==Math.max(g.ed,C.ed)&&(g.ed>C.ed?i.push(g):i.push(C)),qn(i,!0)}function R_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Pe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===Pe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function $l(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Pe.REPLACE)if(r===Pe.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Pe.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Pe.REPLACE&&r===Pe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===Pe.REPLACE||r===Pe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function I_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===sn.DELETED||i===sn.DELETED)&&(o=!0,n.push({...r,type:sn.DELETED}));break}o||n.push(r)}return n}function S_(e,t,n=!1){const{body:r,coverType:s=Pe.COVER}=e,{body:i,coverType:o=Pe.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:g,paragraphs:C=[],customRanges:I,customDecorations:b}=i,U=C_(u,g,s,o,n?1:0);U&&(a.textRuns=U);const Z=R_(h,I,s,o,n?1:0);Z&&(a.customRanges=Z);const V=I_(d,b);V&&(a.customDecorations=V);const fe=[];let M=0,T=0;for(;M<c.length&&T<C.length;){const j=c[M],Q=C[T],{startIndex:ge}=j,{startIndex:le}=Q;if(ge===le){let p={startIndex:ge};n?p=$l(j,Q,s,o,1):p=$l(j,Q,s,o,0),fe.push(p),M++,T++}else ge<le?M++:(fe.push(re.deepClone(Q)),T++)}return T<C.length&&fe.push(...C.slice(T)),fe.length&&(a.paragraphs=fe),{coverType:l,body:a}}function Bl(e){return Object.keys(e).length===1}const Tn=class Tn{constructor(){R(this,"_actions",[])}static apply(t,n){return E_(t,n)}static compose(t,n){const r=new In(t),s=new In(n),i=new Tn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===he.INSERT)i.push(s.next());else if(r.peekType()===he.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===he.INSERT&&l.t===he.RETAIN)l.body==null?i.push(a):i.push({...a,body:Js(a.body,l.body,l.coverType)});else if(a.t===he.RETAIN&&l.t===he.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===Pe.REPLACE||l.coverType===Pe.REPLACE?Pe.REPLACE:Pe.COVER;i.push({...a,t:he.RETAIN,coverType:u,body:Js(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===he.RETAIN&&l.t===he.DELETE?i.push(l):a.t===he.INSERT&&(l.t,he.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new In(t),i=new In(n),o=new Tn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===he.INSERT&&(r==="left"||i.peekType()!==he.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===he.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===he.DELETE)continue;if(u.t===he.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=S_(l,u,r==="left");o.push({...u,t:he.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new In(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===he.DELETE){n-=Math.min(o,n-i);continue}else a===he.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===he.INSERT)n.push({t:he.DELETE,len:r.len,body:r.body});else if(r.t===he.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:he.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:he.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Pe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===he.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=bt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===he.RETAIN&&i.body!=null){const o=bt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==he.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:he.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:he.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:he.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===he.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===he.DELETE&&s.t===he.DELETE)return r.len+=s.len,this;if(r.t===he.DELETE&&s.t===he.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===he.RETAIN&&s.t===he.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===he.INSERT&&Bl(r.body)&&s.t===he.INSERT&&Bl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===he.RETAIN&&g_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};R(Tn,"id","text-x"),R(Tn,"uri","https://github.com/dream-num/univer#text-x");let ze=Tn;Object.defineProperty(ze,"name",{value:"text-x"});const Nn=class Nn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==ze.id||(this._subTypes.set(t.name,t),gt.type.registerSubtype(t))}static apply(t,n){if(!gt.type.isNoop(n))return gt.type.apply(t,n)}static compose(t,n){return gt.type.compose(t,n)}static transform(t,n,r){return gt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===ze.name?ze.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return gt.type.invertWithDoc(t,n)}static isNoop(t){return gt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Nn),this._instance}removeOp(t,n){return gt.removeOp(t,n)}moveOp(t,n){return gt.moveOp(t,n)}insertOp(t,n){return gt.insertOp(t,n)}replaceOp(t,n,r){return gt.replaceOp(t,n,r)}editOp(t,n=["body"]){return gt.editOp(n,ze.name,t)}};R(Nn,"uri","https://github.com/dream-num/univer#json-x"),R(Nn,"_subTypes",new Map),R(Nn,"_instance",null);let Ft=Nn;Ft.registerSubtype(ze);const Zs={id:"default_doc",documentStyle:{}};class v_ extends Yr{constructor(n){var r;super();R(this,"type",He.UNIVER_DOC);R(this,"_name$",new be.BehaviorSubject(""));R(this,"name$",this._name$.asObservable());R(this,"snapshot");this.snapshot={...Zs,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...Jn,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class yt extends v_{constructor(n){var s,i;super(re.isEmptyObject(n)?Hm():n);R(this,"_unitId");R(this,"headerModelMap",new Map);R(this,"footerModelMap",new Map);R(this,"change$",new be.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Zs,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Ft.isNoop(n))return this.snapshot=Ft.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=qs.copy){const i=this.getBody();if(i!=null)return bt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new yt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new yt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}function O_(e){const{ranges:t,id:n,type:r}=e,s=new ze;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:he.RETAIN,len:l-i}),s.push({t:he.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function w_(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(g=>g.id===t);if(!i)return!1;const o=new ze,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:he.RETAIN,len:a}),o.push({t:he.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:sn.DELETED}]}}),o}function Hl(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function b_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Hl(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function y_(e){return{...re.deepClone(e),rangeId:kt()}}function A_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Wl(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function T_(e,t){var i,o,a,l,u;const n=Wl(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function N_(e){var h,d,g;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(C=>C.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new ze,u=a-o+1;l.push({t:he.RETAIN,len:o}),l.push({t:he.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:he.INSERT,body:s,len:s.dataStream.length});const c=a+1+((g=s==null?void 0:s.dataStream.length)!=null?g:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function M_(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new ze;let u=!1;return t.forEach(c=>{var V,fe,M;const h=T_(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:g}=h,C=(V=o.customRanges)!=null?V:[],I=(T,j,Q)=>{var O,D,y,w;const ge=Wl(T,j,C,r),le=Math.min((D=(O=ge[0])==null?void 0:O.startIndex)!=null?D:1/0,T),p=Math.max((w=(y=ge[ge.length-1])==null?void 0:y.endIndex)!=null?w:-1/0,j),W={rangeId:Q?`${n}$${Q}`:n,rangeType:r,startIndex:0,endIndex:p-le,wholeEntity:s,properties:{...i}};l.push({t:he.RETAIN,len:le-a}),l.push({t:he.RETAIN,len:p-le+1,body:{dataStream:"",customRanges:[W]},coverType:Pe.COVER}),a=p+1},b=((fe=o.paragraphs)!=null?fe:[]).filter(T=>T.startIndex<g&&T.startIndex>d),U=((M=o.customBlocks)!=null?M:[]).filter(T=>T.startIndex<g&&T.startIndex>d);A_([d,g-1],[...b.map(T=>T.startIndex),...U.map(T=>T.startIndex)]).forEach(([T,j],Q)=>I(T,j,Q)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function jl(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:he.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:he.DELETE,len:h-l}),l=h)}),r&&i.push({t:he.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:he.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Pe.REPLACE}))}return i}function D_(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:he.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:he.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const L_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=Cs(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,g])=>{switch(d){case 0:{const C={t:he.RETAIN,body:{...bt(n,l,l+g.length,!1),dataStream:""},len:g.length};return l+=g.length,C}case 1:{const C={t:he.INSERT,body:bt(n,l,l+g.length),len:g.length};return l+=g.length,C}default:return{t:he.DELETE,len:g.length}}}),c=new ze;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function U_(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const k_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=Cs(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,g])=>{switch(d){case 0:{const C=qr(n,l,l+g.length,!1),I=qr(o,l,l+g.length,!1),b={t:he.RETAIN,body:U_(C,I)?void 0:{textRuns:C,dataStream:""},len:g.length};return l+=g.length,b}case 1:{const C={t:he.INSERT,body:bt(n,l,l+g.length),len:g.length};return l+=g.length,C}default:return{t:he.DELETE,len:g.length}}});if(u.every(d=>d.t===he.RETAIN&&!d.body))return!1;const c=new ze;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function P_(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function F_(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const x_=e=>{var I,b,U,Z;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new ze,l=Ft.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(b=(I=n.getSnapshot().drawingsOrder)==null?void 0:I.length)!=null?b:0;let d=0;if(s)i>0&&a.push({t:he.RETAIN,len:i});else{const V=jl([t],c,0,null,!1);a.push(...V);const fe=P_(c,[t]),M=(U=n.getDrawings())!=null?U:{},T=(Z=n.getDrawingsOrder())!=null?Z:[],j=fe.sort((Q,ge)=>T.indexOf(Q)>T.indexOf(ge)?-1:T.indexOf(Q)<T.indexOf(ge)?1:0);if(j.length>0)for(const Q of j){const ge=M[Q],le=T.indexOf(Q);if(ge==null||le<0)continue;const p=l.removeOp(["drawings",Q],ge),W=l.removeOp(["drawingsOrder",le],Q);u.push(p),u.push(W),d++}}a.push({t:he.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((V,fe)=>({startIndex:fe,blockId:V.drawingId}))},len:r.length});const g=F_(n,o),C=l.editOp(a.serialize(),g);u.push(C);for(const V of r){const{drawingId:fe}=V,M=l.insertOp(["drawings",fe],V),T=l.insertOp(["drawingsOrder",h-d],fe);u.push(M),u.push(T)}return u.reduce((V,fe)=>Ft.compose(V,fe),null)},$_=e=>{var h,d,g;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(C=>{var I;return((I=C.bullet)==null?void 0:I.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const C=i.indexOf(t[0]),I=i[C-1],b=i[C+1];I&&I.bullet&&I.bullet.listType.indexOf(s)===0?(l=I.bullet.listId,s!==Mt.CHECK_LIST&&(s=I.bullet.listType)):b&&b.bullet&&b.bullet.listType.indexOf(s)===0&&(l=b.bullet.listId,s!==Mt.CHECK_LIST&&(s=b.bullet.listType))}const u=new Sn;u.reset();const c=new ze;for(const C of t){const{startIndex:I,paragraphStyle:b={},bullet:U}=C;c.push({t:he.RETAIN,len:I-u.cursor}),c.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:b,startIndex:0}:{startIndex:0,paragraphStyle:{...b},bullet:{nestingLevel:(g=U==null?void 0:U.nestingLevel)!=null?g:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Pe.REPLACE}),u.moveCursorTo(I+1)}return c},B_=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Mt.CHECK_LIST)===-1)return!1;const o=new Sn;o.reset();const a=new ze,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Mt.CHECK_LIST?Mt.CHECK_LIST_CHECKED:Mt.CHECK_LIST;return a.push({t:he.RETAIN,len:l-o.cursor}),a.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:Pe.REPLACE}),o.moveCursorTo(l+1),a},H_=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new Sn;l.reset();const u=new ze;for(const d of t){const{startIndex:g,paragraphStyle:C={},bullet:I}=d;u.push({t:he.RETAIN,len:g-l.cursor}),u.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:C,bullet:{nestingLevel:(h=I==null?void 0:I.nestingLevel)!=null?h:0,textStyle:(I==null?void 0:I.listType)===n?I.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Pe.REPLACE}),l.moveCursorTo(g+1)}return u};function W_(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const j_=e=>{var c,h,d;const{paragraphs:t,segmentId:n,document:r,type:s}=e,i=new Sn;i.reset();const o=new ze,a=(c=r.getSnapshot().lists)!=null?c:{},l=(d=(h=r.getBody())==null?void 0:h.tables)!=null?d:[],u={...Jn,...a};for(const g of t){const{startIndex:C,paragraphStyle:I={},bullet:b}=g,U=W_(g,l);if(o.push({t:he.RETAIN,len:C-i.cursor}),b){const Z=b.listType;let V=u[Z].nestingLevel.length-1;U&&(V=Math.min(V,2)),o.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...I},bullet:{...b,nestingLevel:Math.max(Math.min(b.nestingLevel+s,V),0)}}]},coverType:Pe.REPLACE})}else o.push({t:he.RETAIN,len:1});i.moveCursorTo(C+1)}return o};var Yl=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Yl||{}),Vt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
7
- `,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(Vt||{});function Y_(e){return`${e}`}const z_=[Vt.TABLE_START,Vt.TABLE_ROW_START,Vt.TABLE_CELL_START,Vt.TABLE_CELL_END,Vt.TABLE_ROW_END,Vt.TABLE_END],zl=e=>{const t=e.endsWith(`\r
8
- `)?e.slice(0,-2):e;return z_.reduce((n,r)=>n.replaceAll(r,""),t)},V_=e=>e?zl(e).replaceAll("\r","")==="":!0,G_=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=kt(),d=`${c}`,g={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:zt.HYPERLINK,properties:{url:e}};r.push(g),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};function K_(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function X_(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function q_(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}class ot{}R(ot,"customRange",{add:M_,delete:N_,copyCustomRange:y_,getCustomRangesInterestsWithSelection:b_,isIntersecting:Hl}),R(ot,"customDecoration",{add:O_,delete:w_}),R(ot,"selection",{replace:L_,makeSelection:K_,normalizeSelection:X_,delete:jl,replaceTextRuns:k_,retain:D_}),R(ot,"range",{isIntersects:q_}),R(ot,"transform",{getPlainText:zl,fromPlainText:G_,isEmptyDocument:V_}),R(ot,"paragraph",{bullet:{set:H_,switch:$_,toggleChecklist:B_,changeNestLevel:j_}}),R(ot,"drawing",{add:x_});function J_(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function Vl(e){var t;return e.body=J_((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Zn{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new Zn(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Se.TRUE}get bold(){return this._style.bl===Se.TRUE}get underline(){return this._style.ul&&Kt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Kt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Kt.create(this._style.st)}get overline(){return this._style.ol&&Kt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return Gt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Gt extends Zn{static create(t={}){return new Gt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Gt.create(re.deepClone(this._style))}build(){return this.getValue()}}class Kt{constructor(t={s:1}){R(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Kt(t)}get show(){return this._decoration.s===Se.TRUE}get followFontColor(){return this._decoration.c===Se.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return Kt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class Qn{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new Qn(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===Se.TRUE}get keepNext(){return this._style.keepNext===Se.TRUE}get wordWrap(){return this._style.wordWrap===Se.TRUE}get widowControl(){return this._style.widowControl===Se.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Se.TRUE}copy(){return er.create(re.deepClone(this._style))}getValue(){return this._style}}class er extends Qn{static create(t={}){return new er(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return er.create(re.deepClone(this._style))}build(){return this.getValue()}}class Xt{constructor(t){R(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Vl(t)}static create(t){return new Xt(t)}static createByBody(t){return new Xt({body:t,id:"d",documentStyle:{}})}copy(){return ln.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return ln.create({...re.deepClone(s),body:bt(r,t,n)})}toPlainText(){var t,n;return ot.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
9
- `)}getParagraphStyle(){var t,n;return Qn.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Zn.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===zt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class ln extends Xt{constructor(n){super(n);R(this,"_doc");this._doc=new yt(n)}static newEmptyData(){return Vl({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
10
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new ln(n!=null?n:ln.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Gt?r.build():r:a=s instanceof Gt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=ot.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Xt?n.getData():n:(s=Math.min(n,s),i=r instanceof Xt?r.getData():r);const o=ot.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=ot.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);ze.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Gt?s.build():s,st:0,ed:r-n}]},o=ot.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return ze.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=ot.customRange.add({rangeType:zt.HYPERLINK,rangeId:kt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=ot.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");ze.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=ot.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");ze.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Xt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=ln.createByBody({dataStream:i,customRanges:[{rangeType:zt.HYPERLINK,rangeId:kt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function Z_(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var vn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(vn||{});function Q_(e){return`sheet_interceptor_${e}`}const Gl=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class ep{constructor(t){R(this,"_interceptorsByName",new Map);R(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),Gl(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Pn(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function tp(e){return`sheet_async_interceptor_${e}`}const np=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class rp{constructor(t){R(this,"_asyncInterceptorsByName",new Map);R(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),np(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Pn(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function sp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function Kl(e){return/^-?\d+(\.\d+)?$/.test(e)}function ip(e){return Kl(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class Qs{constructor(){R(this,"_data",[])}static create(){return new Qs}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class ei{constructor(){R(this,"_data",new Map)}static create(){return new ei}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function op(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.close(),t.port2.close()}}function ap(e,t){return t.forEach(n=>e.add(n)),e}function lp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new yt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new ze,h=Ft.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),g={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(g.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const C=d.customRanges[0];g.customRanges=[{...C,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,g)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const up="__default_document_sub_component_id20231101__";class Xl{constructor(){R(this,"skipNextObservers",!1);R(this,"lastReturnValue");R(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class cp extends be.Subject{constructor(){super(...arguments);R(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new Xl;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function hp(e){return new be.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const Jr=ke.createIdentifier("core.resource-manager.service"),ti={[Nt.Editor]:"Editor",[Nt.Owner]:"Owner",[Nt.Reader]:"Reader",[Nt.UNRECOGNIZED]:"UNRECOGNIZED"},Zr=e=>e?{userID:`${ti[e]}_${re.generateRandomId(8)}`,name:ti[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},dp=(e,t)=>e.startsWith(ti[t]);class tr{constructor(){R(this,"_model",new Map);R(this,"_userChange$",new be.Subject);R(this,"userChange$",this._userChange$.asObservable());R(this,"_currentUser$",new be.BehaviorSubject(Zr()));R(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var fp=Object.getOwnPropertyDescriptor,gp=(e,t,n,r)=>{for(var s=r>1?void 0:r?fp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ql=(e,t)=>(n,r)=>t(n,r,e);f.AuthzIoLocalService=class{constructor(t,n){R(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Zr(Nt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?dp(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[He.UNIVER_SHEET,He.UNIVER_DOC,He.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return kt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Nt.Owner,shareScope:-1,scope:{read:Hs.AllCollaborator,edit:Hs.AllCollaborator},creator:Zr(Nt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Nt.Owner)||this._getRole(Nt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}},f.AuthzIoLocalService=gp([ql(0,Jr),ql(1,ke.Inject(tr))],f.AuthzIoLocalService);const Jl=ke.createIdentifier("IAuthzIoIoService");var mp=Object.getOwnPropertyDescriptor,_p=(e,t,n,r)=>{for(var s=r>1?void 0:r?mp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},pp=(e,t)=>(n,r)=>t(n,r,e);f.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Ir.PERSON,mentions:[{objectType:Ir.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}},f.MentionIOLocalService=_p([pp(0,ke.Inject(tr))],f.MentionIOLocalService);const Zl=ke.createIdentifier("univer.service.mention-io"),ni=ke.createIdentifier("univer.config-service");class Ql{constructor(){R(this,"_configChanged$",new be.Subject);R(this,"configChanged$",this._configChanged$.asObservable());R(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=ps(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new be.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(be.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const nr="FOCUSING_UNIT",On="FOCUSING_SHEET",rr="FOCUSING_DOC",sr="FOCUSING_SLIDE",Ep="FOCUSING_EDITOR_BUT_HIDDEN",eu="EDITOR_ACTIVATED",Cp="FOCUSING_EDITOR_INPUT_FORMULA",tu="FOCUSING_FX_BAR_EDITOR",Rp="FOCUSING_UNIVER_EDITOR",Ip="FOCUSING_EDITOR_INPUT_FORMULA",Sp="FOCUSING_PANEL_EDITOR",vp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Op="FOCUSING_COMMON_DRAWINGS",wp="FORMULA_EDITOR_ACTIVATED";class nu extends st{constructor(){super(...arguments);R(this,"_error$",new be.Subject);R(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const bp="0.6.1";function yp(e="",t=jn.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:bp,locale:t,styles:{},sheets:{},resources:[]}}class ru{constructor(t={}){R(this,"_styles");R(this,"_cacheMap",new zn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const Ap=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Yt.equals(r,n))),Tp=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Yt.equals(n.range,s.range)}),ri={t:0,b:2,l:2,r:2},Np=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),su=90;function ir(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=St.UNSPECIFIED,verticalAlign:a=tn.UNSPECIFIED,wrapStrategy:l=nn.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:g}=i||ri,{vertexAngle:C,centerAngle:I}=uu(s),b={id:"d",body:{dataStream:`${e}${oo}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:g,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:I,vertexAngle:C,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new yt(b)}function Mp(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function iu(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function ou(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===zt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:zt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&ze.apply(r,s.serialize())}function au(e){return e!=null}const Dp='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function lu(e){const t=lt.ff,n=lt.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=En.ITALIC;(e.it===0||e.it===void 0)&&(r=En.NORMAL);let s=En.BOLD;(e.bl===0||e.bl===void 0)&&(s=En.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Ut.SUBSCRIPT||a===Ut.SUPERSCRIPT){const h=Lp(o,l),{sbr:d,spr:g}=h;l*=a===Ut.SUBSCRIPT?d:g}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${Dp} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function Lp(e,t){return Np(t)}function uu(e){const{a:t=0,v:n=Se.FALSE}=e||{a:0,v:Se.FALSE};let r=0,s=t;return n===Se.TRUE&&(r=su,s=su),{centerAngle:r,vertexAngle:s}}class Up{constructor(t,n){R(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==Se.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return jt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Se.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class kp{constructor(t,n,r){R(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:Se.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===Se.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Se.TRUE:!0}getSize(){return jt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const Pp="DEFAULT_WORKSHEET_ROW_COUNT",cu=1e3,Fp="DEFAULT_WORKSHEET_COLUMN_COUNT",hu=20,xp="DEFAULT_WORKSHEET_ROW_HEIGHT",du=24,$p="DEFAULT_WORKSHEET_COLUMN_WIDTH",fu=88,Bp="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",gu=46,Hp="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",mu=20;function _u(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Se.FALSE,rowCount:cu,columnCount:hu,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:fu,defaultRowHeight:du,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Se.TRUE,rowHeader:{width:gu,hidden:Se.FALSE},columnHeader:{height:mu,hidden:Se.FALSE},rightToLeft:Se.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class Wp extends st{constructor(n){super();R(this,"_cellCache",new Map);R(this,"_rowCache",new Map);R(this,"_columnCache",new Map);R(this,"_hasRow",!1);R(this,"_hasColumn",!1);R(this,"_hasAll",!1);R(this,"_allIndex",-1);R(this,"_mergeData");R(this,"_rangeMap",new zn(5e4));R(this,"_skeletonCache",new zn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Yt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:g,endColumn:C}=a[c];for(let I=n;I<=s;I++){let b=!1;for(let U=r;U<=i;U++)if(I>=h&&I<=d&&U>=g&&U<=C){o.push({startRow:h,endRow:d,startColumn:g,endColumn:C}),u.push(c),b=!0;break}if(b)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class pu extends st{constructor(n){super();R(this,"_cellContentInterceptor",null);R(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Value|vn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,vn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,tt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,tt(()=>this._rowFilteredInterceptor=null)}}const Eu={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class or{constructor(t,n,r){R(this,"_sheetId");R(this,"_snapshot");R(this,"_cellData");R(this,"_rowManager");R(this,"_columnManager");R(this,"_viewModel");R(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=_u(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new Ot(o),this._viewModel=new pu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new kp(this._snapshot,this._viewModel,i),this._columnManager=new Up(this._snapshot,s),this._spanModel=new Wp(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}mixinDefaultStyleToCellRaw(t,n,r,s){const i=this.getColumnStyle(n),o=this.getRowStyle(t),a=this.getDefaultCellStyleInternal();if(a||i||o){let l=r==null?void 0:r.s;typeof l=="string"&&(l=this._styles.get(l));const u=s?bs(a,i,o,l):bs(a,o,i,l);r||(r={}),r.s=u}}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,g=t.getValue(u,d),C=g!=null&&g.s?this._styles.get(g.s):null,I=(C==null?void 0:C.bd)&&(C.bd.b||C.bd.l||C.bd.r||C.bd.t||C.bd.bc_tr||C.bd.bl_tr||C.bd.ml_tr||C.bd.tl_bc||C.bd.tl_br||C.bd.tl_mr);(g&&(g.v||g.p)||C!=null&&C.bg||I)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new or(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:g}=r;t===c&&n===d?(o=h,a=g,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=g&&(o=h,a=g,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=_n.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new Ot;return xs(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===_n.Raw)h=this.getCellRaw(u,c);else if(i===_n.Intercepted)h=this.getCell(u,c);else if(i===_n.Both){const g=this.getCellRaw(u,c);if(g){h={...g};const C=(d=this.getCell(u,c))==null?void 0:d.v;au(C)&&h&&(h.displayV=String(C))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:g}=u;xs(h,g,c,d).forEach((C,I)=>{C===h&&I===c&&l.setValue(C,I,{...o.getValue(C,I),rowSpan:g-h+1,colSpan:d-c+1}),(C!==h||I!==c)&&l.realDeleteValue(C,I)})}),l}getRange(t,n,r,s){return typeof t=="object"?new pn(this,t,{getStyles:()=>this._styles}):new pn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const C={row:l,col:u,value:c};return C.colSpan=d.endColumn-d.startColumn+1,C.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:C}}if(h&&n)u+=1;else{const g={row:l,col:u,value:c};return u+=1,{done:!1,value:g}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const C=u!==h.startRow,I=C||c!==h.startColumn;if(r&&I||!r&&C){u=h.endRow+1;continue}const b=l.getCell(h.startRow,h.startColumn);if(!b&&n){u=h.endRow+1;continue}const Z={row:u,col:h.startColumn,value:b};return Z.colSpan=h.endColumn-h.startColumn+1,Z.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:Z}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const C={row:u,col:c,value:d};return u+=1,{done:!1,value:C}}}}}}}}_getCellDocumentModel(t,n=Eu){var I;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Eu,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=Mp(o),c=i?lt.tr:u.textRotation||lt.tr;let h=u.horizontalAlign||lt.ht;const d=u.verticalAlign||lt.vt,g=u.wrapStrategy||lt.tb,C=u.paddingData||ri;if(t.f&&s)a=ir(t.f.toString(),{},{verticalAlign:d}),h=lt.ht;else if(t.p){const{centerAngle:b,vertexAngle:U}=uu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,C,{horizontalAlign:h,verticalAlign:d,centerAngle:b,vertexAngle:U,wrapStrategy:g,zeroWidthParagraphBreak:1})}else if(t.v!=null){const b=iu(o);l=lu(b).fontCache;let U=Cu(t);t.t===Ht.FORCE_STRING&&s&&(U=`'${U}`),a=ir(U,b,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&ou(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:g,verticalAlign:d,horizontalAlign:h,paddingData:C,fill:(I=o==null?void 0:o.bg)==null?void 0:I.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new yt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=iu(r);if(n!=null)return n.documentModel==null&&(n.documentModel=ir("",s)),n;const i="";let o="document";const a=lt.tr,l=lt.ht,u=lt.vt,c=lt.tb,h=ri;return o=lu({}).fontCache,{documentModel:ir(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Cu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return ot.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Ht.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Ht.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function jp(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return ot.transform.getPlainText(n)}return e==null?void 0:e.v}var Yp=Object.getOwnPropertyDescriptor,zp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Yp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Vp=(e,t)=>(n,r)=>t(n,r,e);function Gp(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}f.Workbook=class extends Yr{constructor(n={},r){super();R(this,"type",He.UNIVER_SHEET);R(this,"_sheetCreated$",new be.Subject);R(this,"sheetCreated$",this._sheetCreated$.asObservable());R(this,"_sheetDisposed$",new be.Subject);R(this,"sheetDisposed$",this._sheetDisposed$.asObservable());R(this,"_activeSheet$",new be.BehaviorSubject(null));R(this,"activeSheet$",this._activeSheet$.asObservable());R(this,"_worksheets");R(this,"_styles");R(this,"_snapshot");R(this,"_unitId");R(this,"_count");R(this,"_name$");R(this,"name$");this._logService=r;const s=yp();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new ru(i),this._count=1,this._worksheets=new Map,this._name$=new be.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new or(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==Se.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===Se.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Se.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new or(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}},f.Workbook=zp([Vp(1,It)],f.Workbook);class si extends Yr{constructor(n){var r;super();R(this,"type",He.UNIVER_SLIDE);R(this,"_activePage$",new be.BehaviorSubject(null));R(this,"activePage$",this._activePage$.asObservable());R(this,"_name$");R(this,"name$");R(this,"_snapshot");R(this,"_unitId");this._snapshot={...Ca,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new be.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:kt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=kt(6);return{id:n,pageType:Bs.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var Kp=Object.getOwnPropertyDescriptor,Xp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Kp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ru=(e,t)=>(n,r)=>t(n,r,e);const wn=ke.createIdentifier("univer.current");f.UniverInstanceService=class extends st{constructor(n,r){super();R(this,"_unitsByType",new Map);R(this,"_createHandler");R(this,"_ctorByType",new Map);R(this,"_currentUnits",new Map);R(this,"_currentUnits$",new be.BehaviorSubject(this._currentUnits));R(this,"currentUnits$",this._currentUnits$.asObservable());R(this,"_unitAdded$",new be.Subject);R(this,"unitAdded$",this._unitAdded$.asObservable());R(this,"_unitDisposed$",new be.Subject);R(this,"unitDisposed$",this._unitDisposed$.asObservable());R(this,"_focused$",new be.BehaviorSubject(null));R(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(be.map(r=>{var s;return(s=r.get(n))!=null?s:null}),be.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(be.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(be.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(He.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,He.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,He.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(He.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof f.Workbook?(this._contextService.setContextValue(nr,!0),this._contextService.setContextValue(rr,!1),this._contextService.setContextValue(On,!0),this._contextService.setContextValue(sr,!1),this.setCurrentUnitForType(n)):this.focused instanceof yt?(this._contextService.setContextValue(nr,!0),this._contextService.setContextValue(rr,!0),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(sr,!1),this.setCurrentUnitForType(n)):this.focused instanceof si?(this._contextService.setContextValue(nr,!0),this._contextService.setContextValue(rr,!1),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(sr,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(nr,!1),this._contextService.setContextValue(rr,!1),this._contextService.setContextValue(On,!1),this._contextService.setContextValue(sr,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:He.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryRemoveCurrentUnitForType(n,i),this._tryBlurUnitOnRemoval(n),this._unitDisposed$.next(s),!0}_tryRemoveCurrentUnitForType(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryBlurUnitOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}},f.UniverInstanceService=Xp([Ru(0,ke.Inject(ke.Injector)),Ru(1,mn)],f.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const qp={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var Jp=Object.getOwnPropertyDescriptor,Zp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Jp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Qp=(e,t)=>(n,r)=>t(n,r,e);f.LifecycleService=class extends st{constructor(n){super();R(this,"_lifecycle$",new be.BehaviorSubject(Je.Starting));R(this,"lifecycle$",this._lifecycle$.asObservable());R(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return be.merge(Iu(this.stage),this._lifecycle$.pipe(be.skip(1))).pipe(bo(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${qp[n]}".`)}},f.LifecycleService=Zp([Qp(0,It)],f.LifecycleService);function Iu(e){switch(e){case Je.Starting:return be.of(Je.Starting);case Je.Ready:return be.of(Je.Starting,Je.Ready);case Je.Rendered:return be.of(Je.Starting,Je.Ready,Je.Rendered);default:return be.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const eE=ke.createIdentifier("ILocalStorageService");class un extends st{constructor(){super();R(this,"_currentLocale$",new be.BehaviorSubject(jn.ZH_CN));R(this,"currentLocale$",this._currentLocale$.asObservable());R(this,"_locales",null);R(this,"localeChanged$",new be.Subject);R(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(tt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=ps((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var ii=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(ii||{});const Su=ke.createIdentifier("univer.permission-service");class vu extends st{constructor(){super(...arguments);R(this,"_permissionPointMap",new Map);R(this,"_permissionPointUpdate$",new be.Subject);R(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());R(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof be.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new be.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=ii.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return be.combineLatest(r).pipe(fr.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var tE=Object.getOwnPropertyDescriptor,nE=(e,t,n,r)=>{for(var s=r>1?void 0:r?tE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},oi=(e,t)=>(n,r)=>t(n,r,e);const rE=4,Ou=Symbol("DependentOn");class ai extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}R(ai,"pluginName"),R(ai,"type",He.UNIVER_UNKNOWN);class sE{constructor(){R(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function iE(...e){return function(t){t[Ou]=e}}f.PluginService=class{constructor(t,n,r){R(this,"_pluginRegistry",new Map);R(this,"_pluginStore",new sE);R(this,"_seenPlugins",new Set);R(this,"_loadedPlugins",new Set);R(this,"_loadedPluginTypes",new Set([He.UNIVER_UNKNOWN]));R(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===He.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===He.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},rE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Ou];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===He.UNIVER_UNKNOWN&&c.type!==He.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==He.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Iu(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(be.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}},f.PluginService=nE([oi(0,ke.Inject(ke.Injector)),oi(1,ke.Inject(f.LifecycleService)),oi(2,It)],f.PluginService);function wu(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const li=ke.createIdentifier("resource-loader-service");class bu extends st{constructor(){super(...arguments);R(this,"_resourceMap",new Map);R(this,"_register$",new be.Subject);R(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),tt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class ui extends st{constructor(){super();R(this,"_currentTheme");R(this,"_currentTheme$",new be.BehaviorSubject({}));R(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(tt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}var oE=Object.getOwnPropertyDescriptor,aE=(e,t,n,r)=>{for(var s=r>1?void 0:r?oE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ci=(e,t)=>(n,r)=>t(n,r,e);const Qr=ke.createIdentifier("univer.undo-redo.service"),lE=20;class yu{dispose(){}async dispatchToHandlers(){return!1}}const Au="univer.command.redo",Tu="univer.command.undo",Nu=new class extends yu{constructor(){super(...arguments);R(this,"type",$n.COMMAND);R(this,"id",Tu)}handler(t){const n=t.get(Qr),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Bn);return Os(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Mu=new class extends yu{constructor(){super(...arguments);R(this,"type",$n.COMMAND);R(this,"id",Au)}handler(t){const n=t.get(Qr),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Bn);return Os(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};f.LocalUndoRedoService=class extends st{constructor(n,r,s){super();R(this,"undoRedoStatus$");R(this,"_undoRedoStatus$",new be.BehaviorSubject({undos:0,redos:0}));R(this,"_undoStacks",new Map);R(this,"_redoStacks",new Map);R(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Nu)),this.disposeWithMe(this._commandService.registerCommand(Mu)),this.disposeWithMe(tt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(tt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>lE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),tt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(On),s=this._contextService.getContextValue(tu),i=this._contextService.getContextValue(eu);return r?s?n=Is:i?n=Rs:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}},f.LocalUndoRedoService=aE([ci(0,wn),ci(1,Bn),ci(2,mn)],f.LocalUndoRedoService);function uE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function cE(e){return new Promise(t=>setTimeout(t,e))}function hE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var hi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(hi||{}),Du=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Du||{});const di=ke.createIdentifier("core.image-io.service");class Lu{constructor(t,n=100){R(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new zn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(di)?this._injector.get(di):null;if(t===hi.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const dE=["script","style","meta","comment","link"];var Uu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Uu||{}),ku=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(ku||{}),Pu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Pu||{}),Fu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Fu||{}),xu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(xu||{}),$u=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))($u||{}),fE=Object.getOwnPropertyDescriptor,gE=(e,t,n,r)=>{for(var s=r>1?void 0:r?fE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},mE=(e,t)=>(n,r)=>t(n,r,e);f.Skeleton=class extends st{constructor(n){super();R(this,"_fontLocale");R(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}},f.Skeleton=gE([mE(0,ke.Inject(un))],f.Skeleton);var _E=Object.getOwnPropertyDescriptor,pE=(e,t,n,r)=>{for(var s=r>1?void 0:r?_E(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},es=(e,t)=>(n,r)=>t(n,r,e);f.SheetSkeleton=class extends f.Skeleton{constructor(n,r,s,i,o,a){super(s);R(this,"_worksheetData");R(this,"_renderRawFormula",!1);R(this,"_cellData");R(this,"_imageCacheMap");R(this,"_isRowStylePrecedeColumnStyle",!1);R(this,"_skipAutoHeightForMergedCells",!0);R(this,"_rowTotalHeight",0);R(this,"_columnTotalWidth",0);R(this,"_rowHeaderWidth",0);R(this,"_columnHeaderHeight",0);R(this,"_rowHeightAccumulation",[]);R(this,"_columnWidthAccumulation",[]);R(this,"_marginTop",0);R(this,"_marginLeft",0);R(this,"_scaleX");R(this,"_scaleY");R(this,"_scrollX");R(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Lu(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(lo))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(ao))!=null?r:!1}_resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:g}=c;(g==null||g===Se.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===Se.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===Se.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=St.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!Ms(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:g}=bn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&c===r?a+=(g-d)/2:a+=g-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!Ms(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=bn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:g}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==Se.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==Se.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=g,this.makeDirty(!1)}calculate(){return this._resetCache(),this._updateLayout(),this}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new Ot;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:g,endColumn:C}=a[c];if(u.getValue(h,d))continue;Sa({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:C,endRow:g})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,g),o=Math.max(o,C),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=bn(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=bn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Hu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=Hn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Bu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=Hn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=bn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:g,startX:C,endX:I,mergeInfo:b}=u,U=a,Z=l;return s===!1&&(U=0,Z=0),d+=Z,g+=Z,C+=U,I+=U,b.startY+=Z,b.endY+=Z,b.startX+=U,b.endX+=U,{actualRow:n,actualColumn:r,startX:C,startY:d,endX:I,endY:g,isMerged:c,isMergedMainCell:h,mergeInfo:b}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=Hn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=Hn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new yt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}},f.SheetSkeleton=pE([es(2,ke.Inject(un)),es(3,mn),es(4,ni),es(5,ke.Inject(ke.Injector))],f.SheetSkeleton);function fi(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function EE(e,t,n,r){return fi(e,t,n,r)}function bn(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=fi(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:g,endColumn:C}=s;let I={startRow:h,startColumn:d,endRow:g,endColumn:C,startY:i,endY:o,startX:a,endX:l};const b=n.length-1,U=r.length-1;if(u&&h!==-1&&d!==-1){const Z=n[h-1]||0,V=n[g]||n[b],fe=r[d-1]||0,M=r[C]||r[U];I={...I,startY:Z,endY:V,startX:fe,endX:M}}else if(!u&&g!==-1&&C!==-1){const Z=n[g]||n[b],V=r[C]||r[U];I={...I,startY:i,endY:Z,startX:a,endX:V}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:I}}function Bu(e,t,n,r){const{x:s}=n;return e/t+s-r}function Hu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Wu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],gi=1,ar=8;class mi{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==gi)throw new Error(`Got v${s} data when expected v${gi}.`);const i=Wu[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new mi(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Wu.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ar+o+a+l),this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(gi<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return _i(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let b=d;b<=h;b++){const U=o[2*b],Z=o[2*b+1];U>=t&&U<=r&&Z>=n&&Z<=s&&u.push(i[b])}continue}const g=d+h>>1,C=o[2*g],I=o[2*g+1];C>=t&&C<=r&&I>=n&&I<=s&&u.push(i[g]),(c===0?t<=C:n<=I)&&(l.push(d),l.push(g-1),l.push(1-c)),(c===0?r>=C:s>=I)&&(l.push(g+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let b=d;b<=h;b++)Yu(i[2*b],i[2*b+1],t,n)<=u&&l.push(s[b]);continue}const g=d+h>>1,C=i[2*g],I=i[2*g+1];Yu(C,I,t,n)<=u&&l.push(s[g]),(c===0?t-r<=C:n-r<=I)&&(a.push(d),a.push(g-1),a.push(1-c)),(c===0?t+r>=C:n+r>=I)&&(a.push(g+1),a.push(h),a.push(1-c))}return l}}function _i(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;ju(e,t,o,r,s,i),_i(e,t,n,r,o-1,1-i),_i(e,t,n,o+1,s,1-i)}function ju(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),C=Math.max(r,Math.floor(n-c*d/u+g)),I=Math.min(s,Math.floor(n+(u-c)*d/u+g));ju(e,t,n,C,I,i)}const o=t[2*n+i];let a=r,l=s;for(lr(e,t,r,n),t[2*s+i]>o&&lr(e,t,r,s);a<l;){for(lr(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?lr(e,t,r,l):(l++,lr(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function lr(e,t,n,r){pi(e,n,r),pi(t,2*n,2*r),pi(t,2*n+1,2*r+1)}function pi(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Yu(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}function zu(e,t,n=0,r=e.length-1,s=CE){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),g=Math.max(n,Math.floor(t-u*h/l+d)),C=Math.min(r,Math.floor(t+(l-u)*h/l+d));zu(e,t,g,C,s)}const i=e[t];let o=n,a=r;for(ur(e,n,t),s(e[r],i)>0&&ur(e,n,r);o<a;){for(ur(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?ur(e,n,a):(a++,ur(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function ur(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function CE(e,t){return e<t?-1:e>t?1:0}class Ei{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!ns(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;ns(t,l)&&(n.leaf?r.push(a):Ri(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!ns(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(ns(t,o)){if(n.leaf||Ri(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=An([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=RE(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&Ri(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=An(t.slice(n,r+1)),yn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=An([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));Vu(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);Vu(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const g=Math.min(d+l-1,h);a.children.push(this._build(t,d,g,s-1))}}return yn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=Ci(u),h=vE(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),hr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=An(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,yn(r,this.toBBox),yn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=An([t,n]),this.data.height=t.height+1,this.data.leaf=!1,yn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=cr(t,0,a,this.toBBox),u=cr(t,a,r,this.toBBox),c=OE(l,u),h=Ci(l)+Ci(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:IE,i=t.leaf?this.compareMinY:SE,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=cr(t,0,n,i),a=cr(t,r-n,r,i);let l=ts(o)+ts(a);for(let u=n;u<r-n;u++){const c=t.children[u];hr(o,t.leaf?i(c):c),l+=ts(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];hr(a,t.leaf?i(c):c),l+=ts(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)hr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():yn(t[n],this.toBBox)}}function RE(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function yn(e,t){cr(e,0,e.children.length,t,e)}function cr(e,t,n,r,s){s||(s=An(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];hr(s,e.leaf?r(o):o)}return s}function hr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function IE(e,t){return e.minX-t.minX}function SE(e,t){return e.minY-t.minY}function Ci(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ts(e){return e.maxX-e.minX+(e.maxY-e.minY)}function vE(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function OE(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function Ri(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function ns(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function An(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vu(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;zu(e,o,t,n,s),i.push(t,o,o,n)}}class wE{constructor(t=!1){R(this,"_tree",new Map);R(this,"_oneCellCache",new Map);R(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Ei),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const g=a.get(d);if(g)for(let C=u;C<=h;C++){const I=g.get(C);I&&I.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var C;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(C=this._kdTree.get(n))==null?void 0:C.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),g=[];for(const I of d){const b=h[I];g.push(...Array.from(b.ids))}return g}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new mi(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Ei;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var bE=Object.getOwnPropertyDescriptor,yE=(e,t,n,r)=>{for(var s=r>1?void 0:r?bE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Gu=(e,t)=>(n,r)=>t(n,r,e);let Ii=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case He.UNRECOGNIZED:case He.UNIVER_UNKNOWN:case He.UNIVER_SLIDE:case He.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(He.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case He.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(He.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(He.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(He.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();uo(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(He.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(He.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Ii=yE([Gu(0,ke.Inject(Jr)),Gu(1,ke.Inject(wn))],Ii);class AE{constructor(t={},n){R(this,"_startedTypes",new Set);R(this,"_injector");R(this,"_disposingCallbacks",new Rr);const r=this._injector=TE(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(ui).setTheme(s),o&&this._injector.get(un).load(o),i&&this._injector.get(un).setLocale(i),a&&this._injector.get(It).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(wn)}get _pluginService(){return this._injector.get(f.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(tt(t));return tt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(un).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(He.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(He.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(He.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(He.UNIVER_SHEET,f.Workbook),this._univerInstanceService.registerCtorForType(He.UNIVER_DOC,yt),this._univerInstanceService.registerCtorForType(He.UNIVER_SLIDE,si);const n=t.get(wn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(f.LifecycleService).stage<Je.Ready&&(this._injector.get(f.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function TE(e,t){const n=wu([[nu],[un],[ui],[f.LifecycleService],[f.PluginService],[tr],[wn,{useClass:f.UniverInstanceService}],[Su,{useClass:vu}],[It,{useClass:So,lazy:!0}],[Bn,{useClass:f.CommandService}],[Qr,{useClass:f.LocalUndoRedoService,lazy:!0}],[ni,{useClass:Ql}],[mn,{useClass:Ro}],[Jr,{useClass:bu,lazy:!0}],[li,{useClass:Ii,lazy:!0}],[Jl,{useClass:f.AuthzIoLocalService}],[Zl,{useClass:f.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new ke.Injector(n);return co(r,[[tr],[li]]),r}Qu(),f.ABCToNumber=km,f.AUTO_HEIGHT_FOR_MERGED_CELLS=lo,f.AbsoluteRefType=nt,f.ActionIterator=In,f.AlignTypeH=qa,f.AlignTypeV=Ja,f.ArrangeTypeEnum=el,f.ArrowsAndMarkersShapes=Ho,f.AsyncInterceptorManager=rp,f.AutoFillSeries=No,f.BaselineOffset=Ut,f.BasicShapes=Bo,f.BlockType=Ta,f.BooleanNumber=Se,f.BorderStyleTypes=qe,f.BorderType=Mo,f.BuildTextUtils=ot,f.BulletAlignment=Kn,f.COLORS=As,f.CanceledError=hf,f.CellModeEnum=_n,f.CellValueType=Ht,f.Color=rn,f.ColorBuilder=br,f.ColorKit=vt,f.ColorType=Et,f.ColumnSeparatorType=Da,f.CommandType=$n,f.CommonHideTypes=Do,f.ConfigService=Ql,f.ContextService=Ro,f.CopyPasteType=Lo,f.CustomCommandExecutionError=Ss,f.CustomDecorationType=sn,f.CustomRangeType=zt,f.DEFAULT_CELL=Sm,f.DEFAULT_DOC=Zs,f.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=up,f.DEFAULT_EMPTY_DOCUMENT_VALUE=oo,f.DEFAULT_RANGE=Rm,f.DEFAULT_RANGE_ARRAY=Cm,f.DEFAULT_SELECTION=Im,f.DEFAULT_SLIDE=Ca,f.DEFAULT_STYLES=lt,f.DEFAULT_WORKSHEET_COLUMN_COUNT=hu,f.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Fp,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=mu,f.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=Hp,f.DEFAULT_WORKSHEET_COLUMN_WIDTH=fu,f.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=$p,f.DEFAULT_WORKSHEET_ROW_COUNT=cu,f.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Pp,f.DEFAULT_WORKSHEET_ROW_HEIGHT=du,f.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=xp,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=gu,f.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Bp,f.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Is,f.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Rs,f.DOCS_ZEN_EDITOR_UNIT_ID_KEY=io,f.DOC_RANGE_TYPE=ea,f.DashStyleType=$a,f.DataStreamTreeNodeType=Yl,f.DataStreamTreeTokenType=Vt,f.DataValidationErrorStyle=Uu,f.DataValidationImeMode=ku,f.DataValidationOperator=Pu,f.DataValidationRenderMode=Fu,f.DataValidationStatus=xu,f.DataValidationType=$u,f.DeleteDirection=Uo,f.DependentOn=iE,f.DesktopLogService=So,f.DeveloperMetadataVisibility=ko,f.Dimension=Po,f.Direction=Fo,f.Disposable=st,f.DisposableCollection=Rr,f.DocStyleType=ya,f.DocumentDataModel=yt,f.DocumentFlavor=$s,f.DrawingTypeEnum=tl,f.EDITOR_ACTIVATED=eu,f.EXTENSION_NAMES=Ra,f.ErrorService=nu,f.EventState=Xl,f.EventSubject=cp,f.FOCUSING_COMMON_DRAWINGS=Op,f.FOCUSING_DOC=rr,f.FOCUSING_EDITOR_BUT_HIDDEN=Ep,f.FOCUSING_EDITOR_INPUT_FORMULA=Cp,f.FOCUSING_EDITOR_STANDALONE=Ip,f.FOCUSING_FX_BAR_EDITOR=tu,f.FOCUSING_PANEL_EDITOR=Sp,f.FOCUSING_SHEET=On,f.FOCUSING_SLIDE=sr,f.FOCUSING_UNIT=nr,f.FOCUSING_UNIVER_EDITOR=Rp,f.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=vp,f.FORMULA_EDITOR_ACTIVATED=wp,f.FollowNumberWithType=Aa,f.FontItalic=Sr,f.FontStyleType=En,f.FontWeight=vr,f.GridType=Na,f.HLSColor=Jo,f.HorizontalAlign=St,f.IAuthzIoService=Jl,f.ICommandService=Bn,f.IConfigService=ni,f.IContextService=mn,f.IImageIoService=di,f.ILocalStorageService=eE,f.ILogService=It,f.IMentionIOService=Zl,f.IPermissionService=Su,f.IResourceLoaderService=li,f.IResourceManagerService=Jr,f.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=ao,f.IUndoRedoService=Qr,f.IUniverInstanceService=wn,f.ImageCacheMap=Lu,f.ImageSourceType=hi,f.ImageUploadStatusType=Du,f.InterceptorEffectEnum=vn,f.InterceptorManager=ep,f.InterpolationPointType=xo,f.JSON1=Km,f.JSONX=Ft,f.LRUHelper=Vn,f.LRUMap=zn,f.LifecycleStages=Je,f.ListGlyphType=Ne,f.LocaleService=un,f.LocaleType=jn,f.LogLevel=Io,f.MOVE_BUFFER_VALUE=Wn,f.MemoryCursor=Sn,f.MentionType=Ir,f.NamedStyleType=Fa,f.NilCommand=Oo,f.NumberUnitType=Xa,f.ObjectMatrix=Ot,f.ObjectRelativeFromH=Ga,f.ObjectRelativeFromV=Ka,f.OtherShapes=Wo,f.PRESET_LIST_TYPE=Jn,f.PageElementType=nl,f.PageOrientType=Qa,f.PageType=Bs,f.ParagraphElementType=Ua,f.ParagraphStyleBuilder=er,f.ParagraphStyleValue=Qn,f.PermissionService=vu,f.PermissionStatus=ii,f.Plugin=ai,f.PositionedObjectLayoutType=Pa,f.PresetListType=Mt,f.ProtectionType=$o,f.QuickListType=Tl,f.QuickListTypeMap=e_,f.RANGE_DIRECTION=Qo,f.RANGE_TYPE=Le,f.RBush=Ei,f.RCDisposable=pf,f.RGBA_PAREN=Vf,f.RGB_PAREN=zf,f.ROTATE_BUFFER_VALUE=To,f.RTree=wE,f.Range=pn,f.Rectangle=Yt,f.RedoCommand=Mu,f.RedoCommandId=Au,f.RefAlias=Um,f.Registry=Qs,f.RegistryAsMap=ei,f.RelativeDate=Yo,f.RelativeSlideLink=rl,f.ResourceManagerService=bu,f.RgbColor=yr,f.RichTextBuilder=ln,f.RichTextValue=Xt,f.RxDisposable=_f,f.SHEET_EDITOR_UNITS=vm,f.SectionType=Ma,f.SheetTypes=zo,f.SheetViewModel=pu,f.SliceBodyType=qs,f.SlideDataModel=si,f.SpacingRule=xa,f.SpecialShapes=jo,f.Styles=ru,f.THEME_COLORS=qo,f.TabStopAlignment=Ba,f.TableAlignmentType=Wa,f.TableLayoutType=ja,f.TableRowHeightRule=za,f.TableSizeType=Ha,f.TableTextWrapType=Ya,f.TextDecoration=Vo,f.TextDecorationBuilder=Kt,f.TextDirection=Yn,f.TextDirectionType=La,f.TextStyleBuilder=Gt,f.TextStyleValue=Zn,f.TextX=ze,f.TextXActionType=he,f.ThemeColor=Ar,f.ThemeColorType=ct,f.ThemeColors=Or,f.ThemeService=ui,f.Tools=re,f.UndoCommand=Nu,f.UndoCommandId=Tu,f.UnitModel=Yr,f.Univer=AE,f.UniverInstanceType=He,f.UpdateDocsAttributeType=Pe,f.UserManagerService=tr,f.VerticalAlign=tn,f.VerticalAlignmentType=Va,f.Worksheet=or,f.WrapStrategy=nn,f.WrapTextType=ka,f.addLinkToDocumentModel=ou,f.afterInitApply=bf,f.afterTime=wf,f.awaitTime=cE,f.binSearchFirstGreaterThanTarget=Ao,f.binarySearchArray=yf,f.bufferDebounceTime=Of,f.cellToRange=Rg,f.characterSpacingControlType=Za,f.checkForSubstrings=Ig,f.checkIfMove=Tf,f.checkParagraphHasBullet=rm,f.checkParagraphHasIndent=sm,f.checkParagraphHasIndentByStyle=fa,f.codeToBlob=Af,f.composeBody=Js,f.composeInterceptors=Gl,f.composeStyles=bs,f.concatMatrixArray=mm,f.convertBodyToHtml=Yf,f.convertCellToRange=ta,f.covertTextRunToHtml=ys,f.createAsyncInterceptorKey=tp,f.createDefaultUser=Zr,f.createDocumentModelWithStyle=ir,f.createInterceptorKey=Q_,f.createInternalEditorID=uf,f.createRowColIter=xs,f.dayjs=Pt,f.debounce=Vd,f.dedupe=tf,f.deepCompare=Ds,f.delayAnimationFrame=hE,f.deleteContent=ma,f.extractPureTextFromCell=Cu,f.fromCallback=wo,f.fromEventSubject=hp,f.fromObservable=mf,f.generateRandomId=kt,f.get=vd,f.getArrayLength=jt,f.getBodySlice=bt,f.getBodySliceHtml=wr,f.getBorderStyleType=pg,f.getCellCoordByIndexSimple=fi,f.getCellInfoInMergeData=hg,f.getCellPositionByIndexSimple=EE,f.getCellValueType=ag,f.getCellWithCoordByIndexCore=bn,f.getColorStyle=Tt,f.getCustomBlockSlice=Ul,f.getCustomDecorationSlice=Pl,f.getCustomRangeSlice=kl,f.getDocsUpdateBody=Eg,f.getIntersectRange=Sa,f.getOriginCellValue=jp,f.getParagraphsSlice=Ll,f.getReverseDirection=Nf,f.getSectionBreakSlice=u_,f.getTableSlice=Dl,f.getTextRunSlice=qr,f.getTransformOffsetX=Bu,f.getTransformOffsetY=Hu,f.getWorksheetUID=Gp,f.groupBy=sf,f.handleStyleToString=_g,f.hashAlgorithm=om,f.horizontalLineSegmentsSubtraction=Br,f.insertMatrixArray=Us,f.insertTextToContent=ga,f.isBlackColor=sg,f.isBooleanString=lf,f.isCellCoverable=Ms,f.isCellV=ug,f.isEmptyCell=na,f.isFormulaId=mg,f.isFormulaString=gg,f.isICellData=og,f.isInternalEditorID=uo,f.isNodeEnv=jf,f.isNotNullOrUndefined=au,f.isNullCell=lg,f.isNumeric=Kl,f.isRangesEqual=Ap,f.isRealNum=im,f.isSafeNumeric=ip,f.isSameStyleTextRun=ra,f.isUnitRangesEqual=Tp,f.isValidRange=Cg,f.isWhiteColor=ig,f.makeArray=of,f.makeCellRangeToRangeData=fg,f.makeCellToSelection=dg,f.makeCustomRangeStream=Y_,f.merge=ps,f.mergeOverrideWithDependencies=wu,f.mergeSets=ap,f.mergeWith=qd,f.mergeWorksheetSnapshotWithDefault=_u,f.mixinClass=sp,f.moveMatrixArray=Ps,f.moveRangeByOffset=Om,f.nameCharacterCheck=uE,f.normalizeBody=c_,f.normalizeTextRuns=qn,f.numberToABC=Fm,f.numberToListABC=xm,f.numfmt=gm,f.queryObjectMatrix=Lm,f.registerDependencies=cf,f.remove=Pn,f.repeatStringNumTimes=ba,f.replaceInDocumentBody=lp,f.requestImmediateMacroTask=op,f.rotate=rf,f.searchArray=Hn,f.searchInOrderedArray=yo,f.selectionToArray=cg,f.sequence=go,f.sequenceAsync=fo,f.sequenceExecute=Os,f.sequenceExecuteAsync=vf,f.set=Zd,f.shallowEqual=ho,f.skipParseTagNames=dE,f.sliceMatrixArray=_m,f.sortRules=$m,f.sortRulesByDesc=Bm,f.sortRulesFactory=Gn,f.spliceArray=ks,f.splitIntoGrid=Fs,f.takeAfter=bo,f.textDiff=Cs,f.throttle=Z_,f.toDisposable=tt,f.touchDependencies=co,f.updateAttributeByDelete=Fl,f.updateAttributeByInsert=xl,Object.keys(ke).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(f,e)&&Object.defineProperty(f,e,{enumerable:!0,get:()=>ke[e]})}),Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})});
3
+ `):"",this.name="UnsubscriptionError",this.errors=n}});function Ni(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var lc=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=yi(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(I){t={error:I}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else o.remove(this);var c=this.initialTeardown;if(Un(c))try{c()}catch(I){i=I instanceof os?I.errors:[I]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var f=yi(h),g=f.next();!g.done;g=f.next()){var C=g.value;try{Mi(C)}catch(I){i=i!=null?i:[],I instanceof os?i=Ti(Ti([],Ai(i)),Ai(I.errors)):i.push(I)}}}catch(I){r={error:I}}finally{try{g&&!g.done&&(s=f.return)&&s.call(f)}finally{if(r)throw r.error}}}if(i)throw new os(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Mi(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Ni(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Ni(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();function uc(e){return e instanceof lc||e&&"closed"in e&&Un(e.remove)&&Un(e.add)&&Un(e.unsubscribe)}function Mi(e){Un(e)?e():e.unsubscribe()}function tt(e){let t=!1;return e?uc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:tt(()=>{})}function cc(e){return tt(()=>{e.unsubscribe()})}class mr{constructor(){R(this,"_disposables",new Set)}add(t){const n=tt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){R(this,"_disposed",!1);R(this,"_collection",new mr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class hc extends st{constructor(){super(...arguments);R(this,"dispose$",new Ie.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class dc extends st{constructor(n){super();R(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const dn=We.createIdentifier("univer.context-service");class Di extends st{constructor(){super(...arguments);R(this,"_contextChanged$",new Ie.Subject);R(this,"contextChanged$",this._contextChanged$.asObservable());R(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new Ie.Observable(r=>{const s=this._contextChanged$.pipe(Ie.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var Li=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(Li||{});const It=We.createIdentifier("univer.log");class Ui extends st{constructor(){super(...arguments);R(this,"_logLevel",3);R(this,"_deduction",new Set)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=fc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function fc(...e){return e.map(t=>JSON.stringify(t)).join("")}var gc=Object.getOwnPropertyDescriptor,mc=(e,t,n,r)=>{for(var s=r>1?void 0:r?gc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ki=(e,t)=>(n,r)=>t(n,r,e),kn=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(kn||{});const Pn=We.createIdentifier("anywhere.command-service");class _c{constructor(){R(this,"_commands",new Map);R(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),tt(()=>{this._commands.delete(t.id),this._commandTypes.delete(t.id)})}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Pi={id:"nil",type:0,handler:()=>!0};d.CommandService=class extends st{constructor(n,r){super();R(this,"_commandRegistry");R(this,"_beforeCommandExecutionListeners",[]);R(this,"_commandExecutedListeners",[]);R(this,"_multiCommandDisposables",new Map);R(this,"_commandExecutingLevel",0);R(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new _c,this._registerCommand(Pi)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),tt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),tt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof is)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=tc(this._commandExecutionStack,f=>f.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof is)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),tt(()=>Ln(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(n)}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{const o=new mr;s=new pc(n.id),o.add(this._commandRegistry.registerCommand(s)),o.add(tt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return tt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}},d.CommandService=mc([ki(0,We.Inject(We.Injector)),ki(1,It)],d.CommandService);class pc{constructor(t){R(this,"name");R(this,"multi",!0);R(this,"type",0);R(this,"priority",0);R(this,"_implementations",[]);R(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(It),s=t.get(dn),i=t.get(We.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),tt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function as(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return bi(r)}function Ec(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return wi(r)}function Fi(e){return new Ie.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function ls(e){return function(n){return new Ie.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Cc(e=0){return t=>{let n=[];return t.pipe(Ie.tap(r=>n.push(r)),Ie.debounceTime(e),Ie.map(()=>n),Ie.tap(()=>n=[]))}}function Rc(e){const t=new Ie.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(Ie.take(1))}const Ic=e=>new Promise(t=>{Ie.merge(Fi(e.onCommandExecuted.bind(e)).pipe(Lt.filter(([n])=>n.type===kn.MUTATION)),Ie.timer(300)).pipe(Lt.debounceTime(16),Lt.first()).subscribe(()=>{t()})});function xi(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function Sc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function $i(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function Fn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=xi(e,t):r=$i(e,t),n){const s=e[r];return e.indexOf(s)}return r}function vc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const xn=2,Bi=1;function Oc(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,f=c,g=u,C=i,I=s;return Math.abs(a-n)>xn||Math.abs(l-r)>xn||Math.abs(f-C)>xn||Math.abs(g-I)>xn||Math.abs(h-o)>Bi}var Hi=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Hi||{}),qe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(qe||{}),Wi=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Wi||{}),_t=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(_t||{}),ji=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(ji||{}),Yi=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Yi||{}),zi=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(zi||{}),Vi=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Vi||{}),Gi=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Gi||{}),Ki=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Ki||{});function wc(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Xi=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(Xi||{}),$n=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))($n||{}),_r=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(_r||{}),qi=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(qi||{}),Ji=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(Ji||{}),Zi=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(Zi||{}),Qi=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(Qi||{}),eo=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(eo||{}),to=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(to||{}),no=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(no||{}),Bn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Bn||{}),ro=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(ro||{}),St=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(St||{}),en=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(en||{}),tn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(tn||{}),pr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(pr||{}),Er=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Er||{}),Ut=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Ut||{}),ve=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ve||{}),Ht=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Ht||{}),ct=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ct||{}),Cr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Cr||{});const bc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let yc=e=>crypto.getRandomValues(new Uint8Array(e)),Ac=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Tc=(e,t=21)=>Ac(e,t|0,yc),Nc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=bc[n[e]&63];return t};const so=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),Mc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function Dc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Mc.test(e)){if(io(e))return!0;try{const r=new URL(oo(e)).hostname.split(".").pop();if(r&&so.has(r))return!0}catch{return!1}}return!1}function io(e){return/^[a-zA-Z]+:\/\//.test(e)}function Lc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function oo(e){return io(e)?e:Lc(e)?`mailto://${e}`:`https://${e}`}const Uc=/^-ms-/,kc=/-([a-z])/g,Wt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function us(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Pc(e,t):re.isObject(e)?Fc(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Pc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!us(s,i))return!1}return!0}function Fc(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!us(i,o))return!1}return!0}class re{static stringAt(t){let n="",r=t;for(;r>=Wt.length;)r/=Wt.length,r-=1,n+=Wt[r%Wt.length];const s=t%Wt.length;return n+=Wt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Wt.length**i+Wt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return kt(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const f=(c=a[u])!=null?c:[];a[u]=f,r(l,f);return}if(re.isObject(l)){const f=(h=a[u])!=null?h:{};a[u]=f,s(l,f);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const f=(c=a[l])!=null?c:{};a[l]=f,s(u,f);return}if(re.isArray(u)){const f=(h=a[l])!=null?h:[];a[l]=f,r(u,f);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return us(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Dc(t)}static normalizeUrl(t){return oo(t)}static topLevelDomainCombiningString(){return[...so].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Uc,"ms-").replace(kc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function kt(e=21,t){return t?Tc(t,e)():Nc(e)}function cs(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const xc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Rr(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(hs(r,{...a,ed:Math.min(u,n)}))):o.push(hs(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function $c(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:f}=u,g=[];c!=null&&(typeof c=="number"?g.push(`margin-top: ${c}px`):g.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?g.push(`margin-bottom: ${h}px`):g.push(`margin-bottom: ${h.v}px`)),f!=null&&g.push(`line-height: ${f}`),l>o+1?i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}>${Rr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${g.length?`style="${g.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=Rr(e,o,r.length)),i}else return Rr(e,0,e.dataStream.length)}function hs(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:f,cl:g,va:C}=s;let I=e.slice(n,r);const b=[];return a===ve.TRUE&&(I=`<i>${I}</i>`),C===Ut.SUPERSCRIPT?I=`<sup>${I}</sup>`:C===Ut.SUBSCRIPT&&(I=`<sub>${I}</sub>`),(u==null?void 0:u.s)===ve.TRUE&&(I=`<u>${I}</u>`),(c==null?void 0:c.s)===ve.TRUE&&(I=`<s>${I}</s>`),l===ve.TRUE&&(I=`<strong>${I}</strong>`),i&&b.push(`font-family: ${i}`),g&&b.push(`color: ${g.rgb}`),o&&b.push(`font-size: ${o}pt`),h&&b.push("text-decoration: overline"),f&&b.push(`background: ${f.rgb}`),b.length?`<span style="${b.join("; ")};">${I}</span>`:I}const ao={[Cr.OFFICE]:{[ct.ACCENT1]:"#4472C4",[ct.ACCENT2]:"#ED7D31",[ct.ACCENT3]:"#A5A5A5",[ct.ACCENT4]:"#70AD47",[ct.ACCENT5]:"#5B9BD5",[ct.ACCENT6]:"#70AD47",[ct.DARK1]:"#000000",[ct.DARK2]:"#44546A",[ct.LIGHT1]:"#FFFFFF",[ct.LIGHT2]:"#E7E6E6",[ct.HYPERLINK]:"#0563C1",[ct.FOLLOWED_HYPERLINK]:"#954F72"}};class Ir{constructor(){R(this,"_themeValue",ct.LIGHT1);R(this,"_themeColors");R(this,"_themeTint");R(this,"_rgbValue","");R(this,"_colorType");this._colorType=_t.UNSUPPORTED,this._themeColors=Cr.OFFICE,this._themeTint=0}asRgbColor(){return new Sr(this._rgbValue,this)}asThemeColor(){return new vr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case _t.THEME:return this.asThemeColor();case _t.RGB:return this.asRgbColor();case _t.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=_t.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=_t.THEME,this._themeColors=t}setThemeTint(t){this._colorType=_t.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=_t.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class nn{constructor(t){R(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new Ir().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new nn(this._builder)}equals(t){return!1}}class lo{constructor(t){R(this,"_saturation",0);R(this,"_hue",0);R(this,"_lightness",0);R(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new Ir;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends nn{constructor(n,r){super(r);R(this,"_cssString");R(this,"_red");R(this,"_green");R(this,"_blue");R(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return nn.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return _t.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};R(Ct,"RGB_COLOR_AMT",0),R(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),R(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Sr=Ct;const Jt=class Jt extends nn{constructor(n,r,s,i){super(i);R(this,"_themeColorType");R(this,"_themeTint");R(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=ao[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Jt._cacheThemeColor.has(this._themeColors)){if(s=Jt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Jt._cacheThemeColor.set(this._themeColors,s);const i=new lo(nn.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Jt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Jt?n._themeColorType===this._themeColorType:!1}getColorType(){return _t.THEME}getThemeColorType(){return this._themeColorType}};R(Jt,"_cacheThemeColor",new Map);let vr=Jt;const Bc="rgb(",Hc="rgba(",ds={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 vt{constructor(t){R(this,"_color");R(this,"_rgbColor");R(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof vt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=uo(t);if(n==null){this._setNullColor();return}this._color=n;const r=Vc(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new vt(t).toRgb(),i=new vt(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new vt(l)}static getContrastRatio(t,n){const r=new vt(t).getLuminance(),s=new vt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[Or(Math.round(n).toString(16)),Or(Math.round(r).toString(16)),Or(Math.round(s).toString(16)),Or(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return qc(this.toRgb())}toHsl(){return Xc(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}setAlpha(t){return new vt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=fs(t),n=fs(n),r=fs(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const Or=e=>e.length===1?`0${e}`:e,fs=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),uo=e=>{if(Zc(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ds[t]){const n=ds[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Wc(t);if(t.startsWith("rgb"))return jc(t);if(t.startsWith("hsl"))return Yc(t);if(t.startsWith("hsv"))return zc(t)},Wc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},jc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Yc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},zc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Vc=e=>{const t=uo(e);if(t!=null)return"r"in t?t:"l"in t?Gc(t):Kc(t)},gs=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Gc=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=gs(u,l,t+1/3),i=gs(u,l,t),o=gs(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},Kc=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],f=[o,o,l,r,r,a][u],g={r:c*255,g:h*255,b:f*255};return e.a!==void 0&&(g.a=e.a),g},Xc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},qc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},Jc=e=>e==null,Zc=e=>!Jc(e)&&typeof e=="object";function Qc(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function eh(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var ke=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(ke||{});function th(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function nh(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Ht.STRING;if(typeof e.v=="number")return Ht.NUMBER;if(typeof e.v=="boolean")return Ht.BOOLEAN}function rh(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function sh(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),nt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(nt||{});function ih(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var co=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(co||{}),ho=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(ho||{});function oh(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:f,endColumn:g}=n[u];if(e===c&&t===f){i=h,o=g,a=c,l=f,s=!0;break}if(e>=c&&e<=h&&t>=f&&t<=g){i=h,o=g,a=c,l=f,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var fn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(fn||{});function fo(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,f=t,g=n;if(r&&i){const{startRow:C,startColumn:I,endRow:b,endColumn:U,startY:Z,endY:V,startX:fe,endX:M}=i;c=C,h=I,f=b,g=U,o=Z,a=V,l=fe,u=M}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,f=i.endRow,g=i.endColumn),{startRow:c,startColumn:h,endRow:f,endColumn:g,startY:o,endY:a,startX:l,endX:u}}const ah=fo;function lh(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,f=n;return(r||s)&&(u=i,c=o,h=a,f=l),{startRow:u,startColumn:c,endRow:h,endColumn:f}}function go(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function ms(e){return go(e)&&(e==null?void 0:e.coverable)!==!1}function Tt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new Ir().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function uh(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function ch(e){return re.isString(e)&&e.length>0}function hh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Tt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,f,g,C,I,b,U;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${wr((a=e.bd)==null?void 0:a.b.s)} ${(l=Tt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${wr((c=e.bd)==null?void 0:c.t.s)} ${(h=Tt(e.bd.t.cl))!=null?h:""}; `),(f=e.bd)!=null&&f.r&&(n+=`border-right: ${wr((g=e.bd)==null?void 0:g.r.s)} ${(C=Tt(e.bd.r.cl))!=null?C:""}; `),(I=e.bd)!=null&&I.l&&(n+=`border-left: ${wr((b=e.bd)==null?void 0:b.l.s)} ${(U=Tt(e.bd.l.cl))!=null?U:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Tt(e.cl)}; `)}],["va",()=>{e.va===Ut.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Ut.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Bn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Bn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===St.LEFT?n+="text-align: left; ":e.ht===St.RIGHT?n+="text-align: right; ":e.ht===St.CENTER?n+="text-align: center; ":e.ht===St.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===en.BOTTOM?n+="vertical-align: bottom; ":e.vt===en.TOP?n+="vertical-align: top; ":e.vt===en.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===tn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===tn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,f,g,C,I,b,U;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(f=e.pd)==null?void 0:f.l}pt`,u=`${(g=e.pd)==null?void 0:g.r}pt`;(C=e.pd)!=null&&C.b&&(n+=`padding-bottom: ${o}; `),(I=e.pd)!=null&&I.t&&(n+=`padding-top: ${a}; `),(b=e.pd)!=null&&b.l&&(n+=`padding-left: ${l}; `),(U=e.pd)!=null&&U.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function wr(e){let t="";return e===qe.NONE?t="none":e===qe.THIN?t="0.5pt solid":e===qe.HAIR?t="0.5pt double":e===qe.DOTTED?t="0.5pt dotted":e===qe.DASHED||e===qe.DASH_DOT?t="0.5pt dashed":e===qe.DASH_DOT_DOT?t="0.5pt dotted":e===qe.DOUBLE?t="0.5pt double":e===qe.MEDIUM?t="1pt solid":e===qe.MEDIUM_DASHED||e===qe.MEDIUM_DASH_DOT?t="1pt dashed":e===qe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===qe.SLANT_DASH_DOT?t="0.5pt dashed":e===qe.THICK&&(t="1.5pt solid"),t}function dh(e){let t=0;if(e=e.trim(),e==="none")t=qe.NONE;else if(e==="0.5pt solid")t=qe.THIN;else if(e==="0.5pt double")t=qe.HAIR;else if(e==="0.5pt dotted")t=qe.DOTTED;else if(e==="0.5pt dashed")t=qe.DASHED;else if(e==="1pt solid")t=qe.MEDIUM;else if(e==="1pt dashed")t=qe.MEDIUM_DASHED;else if(e==="1pt dotted")t=qe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=qe.THICK;else if(!e.includes("none"))t=qe.THIN;else return qe.NONE;return t}function fh(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function gh(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function mh(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function _s(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>_s(e[n],t[n])):e===t:!1}function mo(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:_s(n,r)}function _h(e,t){return t.some(n=>e.indexOf(n)>-1)}function pt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var br={exports:{}},ph=br.exports,_o;function Eh(){return _o||(_o=1,function(e,t){(function(n,r){e.exports=r()})(ph,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",f="quarter",g="year",C="date",I="Invalid Date",b=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,U=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Z={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var y=["th","st","nd","rd"],w=D%100;return"["+D+(y[(w-20)%10]||y[w]||y[0])+"]"}},V=function(D,y,w){var x=String(D);return!x||x.length>=y?D:""+Array(y+1-x.length).join(w)+D},fe={s:V,z:function(D){var y=-D.utcOffset(),w=Math.abs(y),x=Math.floor(w/60),B=w%60;return(y<=0?"+":"-")+V(x,2,"0")+":"+V(B,2,"0")},m:function D(y,w){if(y.date()<w.date())return-D(w,y);var x=12*(w.year()-y.year())+(w.month()-y.month()),B=y.clone().add(x,h),G=w-B<0,ie=y.clone().add(x+(G?-1:1),h);return+(-(x+(w-B)/(G?B-ie:ie-B))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:h,y:g,w:c,d:u,D:C,h:l,m:a,s:o,ms:i,Q:f}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},M="en",T={};T[M]=Z;var j="$isDayjsObject",Q=function(D){return D instanceof W||!(!D||!D[j])},ge=function D(y,w,x){var B;if(!y)return M;if(typeof y=="string"){var G=y.toLowerCase();T[G]&&(B=G),w&&(T[G]=w,B=G);var ie=y.split("-");if(!B&&ie.length>1)return D(ie[0])}else{var de=y.name;T[de]=y,B=de}return!x&&B&&(M=B),B||!x&&M},le=function(D,y){if(Q(D))return D.clone();var w=typeof y=="object"?y:{};return w.date=D,w.args=arguments,new W(w)},p=fe;p.l=ge,p.i=Q,p.w=function(D,y){return le(D,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var W=function(){function D(w){this.$L=ge(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[j]=!0}var y=D.prototype;return y.parse=function(w){this.$d=function(x){var B=x.date,G=x.utc;if(B===null)return new Date(NaN);if(p.u(B))return new Date;if(B instanceof Date)return new Date(B);if(typeof B=="string"&&!/Z$/i.test(B)){var ie=B.match(b);if(ie){var de=ie[2]-1||0,me=(ie[7]||"0").substring(0,3);return G?new Date(Date.UTC(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,me)):new Date(ie[1],de,ie[3]||1,ie[4]||0,ie[5]||0,ie[6]||0,me)}}return new Date(B)}(w),this.init()},y.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},y.$utils=function(){return p},y.isValid=function(){return this.$d.toString()!==I},y.isSame=function(w,x){var B=le(w);return this.startOf(x)<=B&&B<=this.endOf(x)},y.isAfter=function(w,x){return le(w)<this.startOf(x)},y.isBefore=function(w,x){return this.endOf(x)<le(w)},y.$g=function(w,x,B){return p.u(w)?this[x]:this.set(B,w)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(w,x){var B=this,G=!!p.u(x)||x,ie=p.p(w),de=function(z,Y){var ue=p.w(B.$u?Date.UTC(B.$y,Y,z):new Date(B.$y,Y,z),B);return G?ue:ue.endOf(u)},me=function(z,Y){return p.w(B.toDate()[z].apply(B.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(Y)),B)},Me=this.$W,Ae=this.$M,v=this.$D,$="set"+(this.$u?"UTC":"");switch(ie){case g:return G?de(1,0):de(31,11);case h:return G?de(1,Ae):de(0,Ae+1);case c:var K=this.$locale().weekStart||0,q=(Me<K?Me+7:Me)-K;return de(G?v-q:v+(6-q),Ae);case u:case C:return me($+"Hours",0);case l:return me($+"Minutes",1);case a:return me($+"Seconds",2);case o:return me($+"Milliseconds",3);default:return this.clone()}},y.endOf=function(w){return this.startOf(w,!1)},y.$set=function(w,x){var B,G=p.p(w),ie="set"+(this.$u?"UTC":""),de=(B={},B[u]=ie+"Date",B[C]=ie+"Date",B[h]=ie+"Month",B[g]=ie+"FullYear",B[l]=ie+"Hours",B[a]=ie+"Minutes",B[o]=ie+"Seconds",B[i]=ie+"Milliseconds",B)[G],me=G===u?this.$D+(x-this.$W):x;if(G===h||G===g){var Me=this.clone().set(C,1);Me.$d[de](me),Me.init(),this.$d=Me.set(C,Math.min(this.$D,Me.daysInMonth())).$d}else de&&this.$d[de](me);return this.init(),this},y.set=function(w,x){return this.clone().$set(w,x)},y.get=function(w){return this[p.p(w)]()},y.add=function(w,x){var B,G=this;w=Number(w);var ie=p.p(x),de=function(Ae){var v=le(G);return p.w(v.date(v.date()+Math.round(Ae*w)),G)};if(ie===h)return this.set(h,this.$M+w);if(ie===g)return this.set(g,this.$y+w);if(ie===u)return de(1);if(ie===c)return de(7);var me=(B={},B[a]=r,B[l]=s,B[o]=n,B)[ie]||1,Me=this.$d.getTime()+w*me;return p.w(Me,this)},y.subtract=function(w,x){return this.add(-1*w,x)},y.format=function(w){var x=this,B=this.$locale();if(!this.isValid())return B.invalidDate||I;var G=w||"YYYY-MM-DDTHH:mm:ssZ",ie=p.z(this),de=this.$H,me=this.$m,Me=this.$M,Ae=B.weekdays,v=B.months,$=B.meridiem,K=function(Y,ue,ae,H){return Y&&(Y[ue]||Y(x,G))||ae[ue].slice(0,H)},q=function(Y){return p.s(de%12||12,Y,"0")},z=$||function(Y,ue,ae){var H=Y<12?"AM":"PM";return ae?H.toLowerCase():H};return G.replace(U,function(Y,ue){return ue||function(ae){switch(ae){case"YY":return String(x.$y).slice(-2);case"YYYY":return p.s(x.$y,4,"0");case"M":return Me+1;case"MM":return p.s(Me+1,2,"0");case"MMM":return K(B.monthsShort,Me,v,3);case"MMMM":return K(v,Me);case"D":return x.$D;case"DD":return p.s(x.$D,2,"0");case"d":return String(x.$W);case"dd":return K(B.weekdaysMin,x.$W,Ae,2);case"ddd":return K(B.weekdaysShort,x.$W,Ae,3);case"dddd":return Ae[x.$W];case"H":return String(de);case"HH":return p.s(de,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return z(de,me,!0);case"A":return z(de,me,!1);case"m":return String(me);case"mm":return p.s(me,2,"0");case"s":return String(x.$s);case"ss":return p.s(x.$s,2,"0");case"SSS":return p.s(x.$ms,3,"0");case"Z":return ie}return null}(Y)||ie.replace(":","")})},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(w,x,B){var G,ie=this,de=p.p(x),me=le(w),Me=(me.utcOffset()-this.utcOffset())*r,Ae=this-me,v=function(){return p.m(ie,me)};switch(de){case g:G=v()/12;break;case h:G=v();break;case f:G=v()/3;break;case c:G=(Ae-Me)/6048e5;break;case u:G=(Ae-Me)/864e5;break;case l:G=Ae/s;break;case a:G=Ae/r;break;case o:G=Ae/n;break;default:G=Ae}return B?G:p.a(G)},y.daysInMonth=function(){return this.endOf(h).$D},y.$locale=function(){return T[this.$L]},y.locale=function(w,x){if(!w)return this.$L;var B=this.clone(),G=ge(w,x,!0);return G&&(B.$L=G),B},y.clone=function(){return p.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},D}(),O=W.prototype;return le.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",g],["$D",C]].forEach(function(D){O[D[1]]=function(y){return this.$g(y,D[0],D[1])}}),le.extend=function(D,y){return D.$i||(D(y,W,le),D.$i=!0),le},le.locale=ge,le.isDayjs=Q,le.unix=function(D){return le(1e3*D)},le.en=T[M],le.Ls=T,le.p={},le})}(br)),br.exports}var Ch=Eh();const Pt=pt(Ch);var yr={exports:{}},Rh=yr.exports,po;function Ih(){return po||(po=1,function(e,t){(function(n,r){e.exports=r()})(Rh,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(yr)),yr.exports}var Sh=Ih();const vh=pt(Sh);var Ar={exports:{}},Oh=Ar.exports,Eo;function wh(){return Eo||(Eo=1,function(e,t){(function(n,r){e.exports=r()})(Oh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(b){return(b=+b)+(b>68?1900:2e3)},c=function(b){return function(U){this[b]=+U}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(b){(this.zone||(this.zone={})).offset=function(U){if(!U||U==="Z")return 0;var Z=U.match(/([+-]|\d\d)/g),V=60*Z[1]+(+Z[2]||0);return V===0?0:Z[0]==="+"?-V:V}(b)}],f=function(b){var U=l[b];return U&&(U.indexOf?U:U.s.concat(U.f))},g=function(b,U){var Z,V=l.meridiem;if(V){for(var fe=1;fe<=24;fe+=1)if(b.indexOf(V(fe,0,U))>-1){Z=fe>12;break}}else Z=b===(U?"pm":"PM");return Z},C={A:[a,function(b){this.afternoon=g(b,!1)}],a:[a,function(b){this.afternoon=g(b,!0)}],Q:[s,function(b){this.month=3*(b-1)+1}],S:[s,function(b){this.milliseconds=100*+b}],SS:[i,function(b){this.milliseconds=10*+b}],SSS:[/\d{3}/,function(b){this.milliseconds=+b}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(b){var U=l.ordinal,Z=b.match(/\d+/);if(this.day=Z[0],U)for(var V=1;V<=31;V+=1)U(V).replace(/\[|\]/g,"")===b&&(this.day=V)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(b){var U=f("months"),Z=(f("monthsShort")||U.map(function(V){return V.slice(0,3)})).indexOf(b)+1;if(Z<1)throw new Error;this.month=Z%12||Z}],MMMM:[a,function(b){var U=f("months").indexOf(b)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(b){this.year=u(b)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function I(b){var U,Z;U=b,Z=l&&l.formats;for(var V=(b=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,p,W){var O=W&&W.toUpperCase();return p||Z[W]||n[W]||Z[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,y,w){return y||w.slice(1)})})).match(r),fe=V.length,M=0;M<fe;M+=1){var T=V[M],j=C[T],Q=j&&j[0],ge=j&&j[1];V[M]=ge?{regex:Q,parser:ge}:T.replace(/^\[|\]$/g,"")}return function(le){for(var p={},W=0,O=0;W<fe;W+=1){var D=V[W];if(typeof D=="string")O+=D.length;else{var y=D.regex,w=D.parser,x=le.slice(O),B=y.exec(x)[0];w.call(p,B),le=le.replace(B,"")}}return function(G){var ie=G.afternoon;if(ie!==void 0){var de=G.hours;ie?de<12&&(G.hours+=12):de===12&&(G.hours=0),delete G.afternoon}}(p),p}}return function(b,U,Z){Z.p.customParseFormat=!0,b&&b.parseTwoDigitYear&&(u=b.parseTwoDigitYear);var V=U.prototype,fe=V.parse;V.parse=function(M){var T=M.date,j=M.utc,Q=M.args;this.$u=j;var ge=Q[1];if(typeof ge=="string"){var le=Q[2]===!0,p=Q[3]===!0,W=le||p,O=Q[2];p&&(O=Q[2]),l=this.$locale(),!le&&O&&(l=Z.Ls[O]),this.$d=function(x,B,G,ie){try{if(["x","X"].indexOf(B)>-1)return new Date((B==="X"?1e3:1)*x);var de=I(B)(x),me=de.year,Me=de.month,Ae=de.day,v=de.hours,$=de.minutes,K=de.seconds,q=de.milliseconds,z=de.zone,Y=de.week,ue=new Date,ae=Ae||(me||Me?1:ue.getDate()),H=me||ue.getFullYear(),ne=0;me&&!Me||(ne=Me>0?Me-1:ue.getMonth());var oe,_e=v||0,ye=$||0,Ue=K||0,X=q||0;return z?new Date(Date.UTC(H,ne,ae,_e,ye,Ue,X+60*z.offset*1e3)):G?new Date(Date.UTC(H,ne,ae,_e,ye,Ue,X)):(oe=new Date(H,ne,ae,_e,ye,Ue,X),Y&&(oe=ie(oe).week(Y).toDate()),oe)}catch{return new Date("")}}(T,ge,j,Z),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),W&&T!=this.format(ge)&&(this.$d=new Date("")),l={}}else if(ge instanceof Array)for(var D=ge.length,y=1;y<=D;y+=1){Q[1]=ge[y-1];var w=Z.apply(this,Q);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}y===D&&(this.$d=new Date(""))}else fe.call(this,M)}}})}(Ar)),Ar.exports}var bh=wh();const yh=pt(bh);var Tr={exports:{}},Ah=Tr.exports,Co;function Th(){return Co||(Co=1,function(e,t){(function(n,r){e.exports=r()})(Ah,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,f,g,C,I){var b=h.name?h:h.$locale(),U=o(b[f]),Z=o(b[g]),V=U||Z.map(function(M){return M.slice(0,C)});if(!I)return V;var fe=b.weekStart;return V.map(function(M,T){return V[(T+(fe||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,f){return h.formats[f]||function(g){return g.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(C,I,b){return I||b.slice(1)})}(h.formats[f.toUpperCase()])},c=function(){var h=this;return{months:function(f){return f?f.format("MMMM"):a(h,"months")},monthsShort:function(f){return f?f.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(f){return f?f.format("dddd"):a(h,"weekdays")},weekdaysMin:function(f){return f?f.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(f){return f?f.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(f){return u(h.$locale(),f)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(f){return u(h,f)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Tr)),Tr.exports}var Nh=Th();const Mh=pt(Nh);var Nr={exports:{}},Dh=Nr.exports,Ro;function Lh(){return Ro||(Ro=1,function(e,t){(function(n,r){e.exports=r()})(Dh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,f){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(g,C,I){var b=I&&I.toUpperCase();return C||f[I]||n[I]||f[b].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(U,Z,V){return Z||V.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Nr)),Nr.exports}var Uh=Lh();const kh=pt(Uh);var Mr={exports:{}},Ph=Mr.exports,Io;function Fh(){return Io||(Io=1,function(e,t){(function(n,r){e.exports=r()})(Ph,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(I){var b={date:I,utc:!0,args:arguments};return new o(b)},l.utc=function(I){var b=a(this.toDate(),{locale:this.$L,utc:!0});return I?b.add(this.utcOffset(),n):b},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(I){I.utc&&(this.$u=!0),this.$utils().u(I.$offset)||(this.$offset=I.$offset),u.call(this,I)};var c=l.init;l.init=function(){if(this.$u){var I=this.$d;this.$y=I.getUTCFullYear(),this.$M=I.getUTCMonth(),this.$D=I.getUTCDate(),this.$W=I.getUTCDay(),this.$H=I.getUTCHours(),this.$m=I.getUTCMinutes(),this.$s=I.getUTCSeconds(),this.$ms=I.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(I,b){var U=this.$utils().u;if(U(I))return this.$u?0:U(this.$offset)?h.call(this):this.$offset;if(typeof I=="string"&&(I=function(M){M===void 0&&(M="");var T=M.match(r);if(!T)return null;var j=(""+T[0]).match(s)||["-",0,0],Q=j[0],ge=60*+j[1]+ +j[2];return ge===0?0:Q==="+"?ge:-ge}(I),I===null))return this;var Z=Math.abs(I)<=16?60*I:I,V=this;if(b)return V.$offset=Z,V.$u=I===0,V;if(I!==0){var fe=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(V=this.local().add(Z+fe,n)).$offset=Z,V.$x.$localOffset=fe}else V=this.utc();return V};var f=l.format;l.format=function(I){var b=I||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return f.call(this,b)},l.valueOf=function(){var I=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*I},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var g=l.toDate;l.toDate=function(I){return I==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():g.call(this)};var C=l.diff;l.diff=function(I,b,U){if(I&&this.$u===I.$u)return C.call(this,I,b,U);var Z=this.local(),V=a(I).local();return C.call(Z,V,b,U)}}})}(Mr)),Mr.exports}var xh=Fh();const $h=pt(xh);var Dr={exports:{}},Bh=Dr.exports,So;function Hh(){return So||(So=1,function(e,t){(function(n,r){e.exports=r()})(Bh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(Dr)),Dr.exports}var Wh=Hh();const jh=pt(Wh);var Lr={exports:{}},Yh=Lr.exports,vo;function zh(){return vo||(vo=1,function(e,t){(function(n,r){e.exports=r()})(Yh,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var f=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),g=this.diff(f,n,!0);return g<0?o(this).startOf("week").week():Math.ceil(g)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(Lr)),Lr.exports}var Vh=zh();const Gh=pt(Vh);var Ur={exports:{}},Kh=Ur.exports,Oo;function Xh(){return Oo||(Oo=1,function(e,t){(function(n,r){e.exports=r()})(Kh,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(Ur)),Ur.exports}var qh=Xh();const Jh=pt(qh);Pt.extend(yh),Pt.extend(vh),Pt.extend(jh),Pt.extend(Mh),Pt.extend(Gh),Pt.extend(Jh),Pt.extend($h),Pt.extend(kh);function kr(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function Zh(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function Qh(e){if(e==null)return!1;const t=e.paragraphStyle;return wo(t)}function wo(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function bo(e,t,n){return e.slice(0,t)+n+e.slice(t)}function yo(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function ed(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function td(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ve=Symbol("newer"),it=Symbol("older");class nd{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:t.key}):{done:!0,value:void 0}}}class rd{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:t.value}):{done:!0,value:void 0}}}class sd{constructor(t){R(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ve],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}Xu=Ve,Ku=it;class Ao{constructor(t,n){R(this,"key");R(this,"value");R(this,Xu);R(this,Ku);this.key=t,this.value=n,this[Ve]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Hn{constructor(...t){R(this,"_keymap");R(this,"size",0);R(this,"limit");R(this,"oldest");R(this,"newest");R(this,"_onShiftListeners",[]);if(Wn.hasLength(t,1)){if(Wn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Wn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Wn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),tt(()=>Ln(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ve]&&(t===this.oldest&&(this.oldest=t[Ve]),t[Ve][it]=t[it]),t[it]&&(t[it][Ve]=t[Ve]),t[Ve]=void 0,t[it]=this.newest,this.newest&&(this.newest[Ve]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new Ao(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ve]=o,o[it]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new Ao(t,n)),this.newest?(this.newest[Ve]=r,r[it]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ve]?(this.oldest=this.oldest[Ve],this.oldest[it]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ve]=t[it]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ve]&&n[it]?(n[it][Ve]=n[Ve],n[Ve][it]=n[it]):n[Ve]?(n[Ve][it]=void 0,this.oldest=n[Ve]):n[it]?(n[it][Ve]=void 0,this.newest=n[it]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new nd(this.oldest)}values(){return new rd(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new sd(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ve]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ve];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ve],n&&(t+=" < ");return t}}class Wn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var Pr={exports:{}},id=Pr.exports,To;function od(){return To||(To=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:id,function(){return function(){var n={d:function(E,m){for(var _ in m)n.o(m,_)&&!n.o(E,_)&&Object.defineProperty(E,_,{enumerable:!0,get:m[_]})},o:function(E,m){return Object.prototype.hasOwnProperty.call(E,m)}},r={};n.d(r,{default:function(){return dt}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(E){const m=i.exec(E);if(!m)throw new SyntaxError("Malformed locale: ".concat(E));return{lang:m[1]+(m[2]?"_"+m[2]:""),language:m[1],territory:m[2]||"",codeset:m[3]||"",modifier:m[4]||""}}function u(E){if(typeof E=="number")return s[65535&E]||null;const m=parseInt(E,16);return isFinite(m)&&s[65535&m]?s[65535&m]||null:i.test(E)?E:null}function c(E){const m=u(E);let _=null;if(m){const A=l(m);_=o[A.lang]||o[A.language]||null}return _}function h(E){return Object.assign({},a,E)}function f(E,m){const _=typeof m=="object"?m:l(m);return o[_.lang]=h(E),_.language===_.lang||o[_.language]||(o[_.language]=h(E)),o[_.lang]}const g=h({group:","});function C(E,m){if(typeof E!="number")return E;if(E<0)return-C(-E,m);if(m){const _=10**(m||0)||1;return C(E*_,0)/_}return Math.round(E)}g.isDefault=!0,f({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),f({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),f({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),f({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),f({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),f({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),f({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),f({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),f({group:","},"en"),f({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),f({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),f({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),f({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),f({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),f({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),f({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),f({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),f({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),f({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),f({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),f({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),f({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),f({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),f({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),f({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function I(E,m,_){const A=E<0?-1:1,N=10**(m||2),P=10**(_||2);let k,F,S=Math.abs(E),ee=0,Ee=0,J=0,pe=1;if((E=S)%1==0)F=[E*A,1];else if(E<1e-19)F=[A,1e19];else if(E>1e19)F=[1e19*A,1];else{do if(S=1/(S-Math.floor(S)),k=pe,pe=pe*Math.floor(S)+ee,ee=k,Ee=J,J=Math.floor(E*pe+.5),J>=N||pe>=P)return[A*Ee,ee];while(Math.abs(E-J/pe)>=1e-10&&S!==Math.floor(S));F=[A*J,pe]}return F}const b={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},U=Object.assign({},b);function Z(E){if(E===null&&(E=b),E){for(const m in E)if(m in b){const _=E[m];U[m]=_==null?b[m]:_}}return{...U}}const V={"#":"",0:"0","?":" "},fe={"@":"text","-":"minus","+":"plus"},M=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],T=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+T.join("")+"]");function Q(E,m,_){return m[_+"_max"]=E.length,m[_+"_min"]=E.replace(/#/g,"").length,m}const ge={};function le(E){if(!(E in ge)){const m=[],_=E.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,A=>"?".repeat(A.length));for(let A=0;A<_.length;A++){const N=_.charAt(A);m[A]=N in V?V[N]:N}ge[E]=m.join("")}return ge[E]}function p(E,m){typeof E=="string"&&(E={type:"string",value:E=E.replace(/ /g,V["?"])}),m.push(E)}function W(E){const m=[],_={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:m};let A=E+"",N="int",P=!1,k=null;const F=[];let S,ee,Ee=!1;for(;A&&!P;){if(S=/^General/i.exec(A))_.general=!0,p({type:"general"},m);else if(N==="int"&&(S=/^[#?0]+(?:,[#?0]+)*/.exec(A))||N==="den"&&(S=/^[#?\d]+/.exec(A))||(S=/^[#?0]+/.exec(A)))_[N+"_pattern"].push(S[0]),k={type:N,num:S[0]},p(k,m);else if((S=/^\//.exec(A))&&_[N+"_pattern"].length){if(!k)throw new SyntaxError("Missing a numerator in pattern ".concat(E));_.fractions=!0,_.num_pattern.push(_[N+"_pattern"].pop()),k.type="num",N="den",p({type:"div"},m)}else if(S=/^,+/.exec(A)){const L=A.charAt(1)in V;ee.slice(-1)in V&&(S[0].length>1||!L)?_.scale=.001**S[0].length:_.dec_fractions||p(S[0],m)}else{if(S=/^;/.exec(A)){P=!0;break}if(S=/^[@+-]/.exec(A))S[0]==="@"&&(_.text=!0),p({type:fe[S[0]]},m);else if(S=/^(?:\[(h+|m+|s+)\])/i.exec(A)){const L=S[1].toLowerCase(),te=L[0],Re={type:"",size:0,date:1,raw:S[0],pad:L.length};te==="h"?(Re.size=16,Re.type="hour-elap"):te==="m"?(Re.size=32,Re.type="min-elap"):(Re.size=64,Re.type="sec-elap"),_.date=_.date|Re.size,F.push(Re),p(Re,m)}else if(S=/^(?:B2)/i.exec(A))Ee||(_.date_system=6);else if(S=/^(?:B1)/i.exec(A))Ee||(_.date_system=1);else if(S=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(A)){const L={type:"",size:0,date:1,raw:S[0]},te=S[0].toLowerCase(),Re=te[0];if(te==="y"||te==="yy")L.size=2,L.type="year-short";else if(Re==="y"||Re==="e")L.size=2,L.type="year";else if(te==="b"||te==="bb")L.size=2,L.type="b-year-short";else if(Re==="b")L.size=2,L.type="b-year";else if(te==="d"||te==="dd")L.size=8,L.type="day",L.pad=/dd/.test(te);else if(te==="ddd")L.size=8,L.type="weekday-short";else if(Re==="d")L.size=8,L.type="weekday";else if(Re==="h")L.size=16,L.type="hour",L.pad=/hh/i.test(te);else if(Re==="m"){te.length===3?(L.size=4,L.type="monthname-short"):te.length===5?(L.size=4,L.type="monthname-single"):te.length>=4&&(L.size=4,L.type="monthname");const Te=F[F.length-1];!L.type&&Te&&!Te.used&&80&Te.size&&(Te.used=!0,L.size=32,L.type="min",L.pad=/mm/.test(te)),L.type||(L.size=4,L.type="month",L.pad=/mm/.test(te),L.indeterminate=!0)}else if(Re==="s"){L.size=64,L.type="sec",L.pad=/ss/.test(te);const Te=F[F.length-1];Te&&32&Te.size?L.used=!0:Te&&Te.indeterminate&&(delete Te.indeterminate,Te.size=32,Te.type="min",L.used=!0)}_.date=_.date|L.size,_.date_eval=!0,F.push(L),p(L,m)}else if(S=/^(?:AM\/PM|am\/pm|A\/P)/.exec(A))_.clock=12,_.date=16|_.date,_.date_eval=!0,p({type:"am",short:S[0]==="A/P"},m);else if(_.date&&(S=/^\.0{1,3}/i.exec(A))){const L=S[0].length-1,te=[64,128,256,512][L];_.date=_.date|te,_.date_eval=!0,_.sec_decimals=Math.max(_.sec_decimals,L),p({type:"subsec",size:te,decimals:L,date:1,raw:S[0]},m)}else if((S=/^\\(.)/.exec(A))||(S=/^"([^"]*?)"/.exec(A)))p(S[1],m);else if(S=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(A))_.condition=[S[1],parseFloat(S[2],10)];else if(S=/^\[\$([^\]]+)\]/.exec(A)){const L=S[1].split("-"),te=L.length<2?"":L[L.length-1],Re=L[0];Re&&p(Re,m);const Te=u(te);Te&&(_.locale=Te);const Fe=parseInt(te,16);isFinite(Fe)&&16711680&Fe&&(Fe>>16&255)===6&&(_.date_system=6),Ee=!0}else if(S=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(A))_.color=S[2]?M[parseInt(S[2],10)]||"#000":S[1].toLowerCase();else if(!(S=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(A))){if(S=/^%/.exec(A))_.scale=100,_.percent=!0,p("%",m);else if(S=/^_(\\.|.)/.exec(A))p(" ",m);else if(S=/^\./.exec(A))p({type:"point",value:S[0]},m),_.dec_fractions=!0,N="frac";else if(S=/^[Ee]([+-]?|(?=[0#?]))/.exec(A))_.exponential=!0,_.exp_plus=S[1]==="+",N="man",p({type:"exp",plus:S[1]==="+"},m);else if(!(S=/^\*(\\.|.)/.exec(A))){if(S=/^[BENn[]/.exec(A))throw new SyntaxError("Unexpected char ".concat(A.charAt(0)," in pattern ").concat(E));A[0]==="("&&(_.parens=!0),S=[A[0]],p(S[0],m)}}}ee=S[0],A=A.slice(S?S[0].length:1)}if(_.pattern=E.slice(0,E.length-A.length),/^((?:\[[^\]]+\])+)(;|$)/.test(_.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(_.pattern)&&p({type:"text"},m),_.fractions&&_.dec_fractions||_.fractions&&_.exponential)throw new SyntaxError("Invalid pattern: ".concat(_.pattern));const J=_.int_pattern.join("");if(_.grouping=J.indexOf(",")>=0,_.grouping){const L=J.split(","),te=L.length;te===2?(_.group_pri=L[1].length,_.group_sec=_.group_pri):te>2&&(_.group_pri=L[te-1].length,_.group_sec=L[te-2].length)}else _.group_pri=0,_.group_sec=0;Q(J.replace(/[,]/g,""),_,"int"),Q(_.frac_pattern.join(""),_,"frac"),Q(_.man_pattern.join(""),_,"man");let pe=_.num_pattern.join(""),be=_.den_pattern.join("");const ce=/\?/.test(be)||/\?/.test(pe);return be=be.replace(/\d/g,ce?"?":"#"),ce&&(be=be.replace(/#$/g,"?")),Q(pe,_,"num"),Q(be,_,"den"),ce&&(pe=pe.replace(/#$/g,"?")),_.int_padding=le(_.int_pattern.join("")),_.man_padding=le(_.man_pattern.join("")),_.num_padding=le(pe),_.den_padding=le(be),_.den_pattern.length&&(_.denominator=parseInt(_.den_pattern.join("").replace(/\D/g,""),10)),_.integer=!!_.int_pattern.join("").length,_.fractions&&m.forEach((L,te)=>{const Re=m[te+1];L.type==="string"&&Re&&(Re.type==="num"?L.rule="num+int":Re.type==="div"?L.rule="num":Re.type==="den"&&(L.rule="den"))}),_}const O=E=>{const m=E.condition;m&&m[1]<0&&(m[0]==="<"||m[0]==="<="||m[0]==="=")||E.tokens.unshift({type:"minus",volatile:!0})};function D(E){const m=[];let _,A=!1,N=null,P=E,k=0,F=!1,S=0,ee=0;do{if(F=W(P),(F.date||F.general)&&(F.int_pattern.length||F.frac_pattern.length||F.scale!==1||F.text))throw new Error("Illegal format");if(F.condition&&(ee++,A=!0),F.text){if(N)throw new Error("Unexpected partition");N=F}F.locale&&(_=u(F.locale)),m.push(F),k=P.charAt(F.pattern.length)===";"?1:0,P=P.slice(F.pattern.length+k),S++}while(k&&S<4&&ee<3);if(k)throw new Error("Unexpected partition");if(ee>2)throw new Error("Unexpected condition");const Ee=m[3];if(Ee&&(Ee.int_pattern.length||Ee.frac_pattern.length||Ee.date))throw new Error("Unexpected partition");if(A){const J=m.length;if(J===1&&(m[1]=W("General"),m[1].generated=!0),J<3){const pe=m[0],be=m[1];if(O(pe),be.condition)O(be);else{const ce=pe.condition;(ce[0]==="="||ce[1]>=0&&(ce[0]===">"||ce[0]===">="))&&be.tokens.unshift({type:"minus",volatile:!0})}}else m.forEach(O)}else{if(m.length<4&&N)for(let J=0,pe=m.length;J<pe;J++)m[J]===N&&m.splice(J,1);if(m.length<1&&N&&(m[0]=W("General"),m[0].generated=!0),m.length<2){const J=W(m[0].pattern);J.tokens.unshift({type:"minus",volatile:!0}),J.generated=!0,m.push(J)}if(m.length<3){const J=W(m[0].pattern);J.generated=!0,m.push(J)}if(m.length<4)if(N)m.push(N);else{const J=W("@");J.generated=!0,m.push(J)}m[0].condition=[">",0],m[1].condition=["<",0],m[2].condition=null}return{pattern:E,partitions:m,locale:_}}const y=Math.floor;function w(E){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&E>=0){if(E===0)return[1900,1,0];if(E===60)return[1900,2,29];if(E<60)return[1900,E<32?1:2,(E-1)%31+1]}let _=E+68569+2415019;const A=y(4*_/146097);_-=y((146097*A+3)/4);const N=y(4e3*(_+1)/1461001);_=_-y(1461*N/4)+31;const P=y(80*_/2447),k=_-y(2447*P/80);_=y(P/11);const F=P+2-12*_;return[0|100*(A-49)+N+_,0|F,0|k]}function x(E){return w(E+1462)}function B(E){if(E===60)throw new Error("#VALUE!");if(E<=1)return[1317,8,29];if(E<60)return[1317,E<32?9:10,1+(E-2)%30];const m=10631/30,_=.1335;let A=E+466935;const N=y(A/10631);A-=10631*N;const P=y((A-_)/m);A-=y(P*m+_);const k=y((A+28.5001)/29.5);return k===13?[30*N+P,12,30]:[30*N+P,k,A-y(29.5001*k-29)]}function G(E){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,_=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const A=y(E);return m===6?B(A):m===-1?x(A):w(A,_)}const ie=Math.floor,de=86400;function me(E,m){let _=null;if(Array.isArray(E)){const[A,N,P,k,F,S]=E;_=Date.UTC(A,N==null?0:N-1,P!=null?P:1,k||0,F||0,S||0)}else if(E instanceof Date&&(_=1*E,!m||!m.ignoreTimezone)){const A=new Date;A.setUTCFullYear(E.getFullYear(),E.getMonth(),E.getDate()),A.setUTCHours(E.getHours(),E.getMinutes(),E.getSeconds(),E.getMilliseconds()),_=1*A}if(_!=null&&isFinite(_)){const A=_/864e5;return A-(A<=-25509?-25568:-25569)}return E}function Me(E,m){let _=0|E;const A=de*(E-_);let N=ie(A);A-N>.9999&&(N+=1,N===de&&(N=0,_+=1));const P=N<0?de+N:N,[k,F,S]=G(E,0,m&&m.leap1900),ee=ie(P/60/60)%60,Ee=ie(P/60)%60,J=ie(P)%60;if(m&&m.nativeDate){const pe=new Date(0);return pe.setUTCFullYear(k,F-1,S),pe.setUTCHours(ee,Ee,J),pe}return[k,F,S,ee,Ee,J]}function Ae(E){return!!(E[0]&&E[0].percent||E[1]&&E[1].percent||E[2]&&E[2].percent||E[3]&&E[3].percent)}function v(E){return!!(E[0]&&E[0].date||E[1]&&E[1].date||E[2]&&E[2].date||E[3]&&E[3].date)}function $(E){const[m,_,A,N]=E;return!(m&&!m.generated||_&&!_.generated||A&&!A.generated||!N||!N.text||N.generated)}const K={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],z={total:1,sign:0,period:0,int:1,frac:0},Y=(E,m)=>E.replace(/\./,m.decimal);function ue(E,m,_,A){const N=0|_;if(typeof _=="string")E.push(_);else if(_===N)E.push(Math.abs(N));else{const P=Math.abs(_);let k=P?Math.floor(Math.log10(P)):0,F=k<0?P*10**-k:P/10**k;F===10&&(F=1,k++);const S=function(Ee){let J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const pe=Math.abs(Ee);if(!pe)return z;const be=J&&Ee<0?1:0,ce=Math.floor(pe),L=Math.floor(Math.log10(pe)+1);let te=0,Re=0;if(ce!==pe){te=1;const Te=String(C(L<0?pe*10**-L:pe/10**L,15));let Fe=Te.length,xe=!0,Ye=0;for(;Ye<=Te.length;){if(Te[Ye]==="."){Fe--;break}Te[Ye]==="0"&&xe?Fe--:xe=!1,Ye++}Re=Fe-L,Re<0&&(Re=0,te=0)}return{total:be+Math.max(L,1)+te+Re,digits:Math.max(L,0)+Re,sign:be,period:te,int:Math.max(L,1),frac:Re}}(P),ee=()=>{const Ee=Math.abs(k);let J;J=F===1?F:C(F,5),E.push(Y(J+"",A),A.exponent,k<0?A.negative:A.positive,Ee<10?"0":"",Ee)};if(k>=-4&&k<=-1){const Ee=P.toPrecision(10+k).replace(/\.?0+$/,"");E.push(Y(Ee,A))}else if(k===10){const Ee=P.toFixed(10).slice(0,12).replace(/\.$/,"");E.push(Y(Ee,A))}else if(Math.abs(k)<=9)if(S.total<=11){const Ee=C(P,9).toFixed(S.frac);E.push(Y(Ee,A))}else k===9?E.push(Math.floor(P)):k>=0&&k<9?E.push(C(P,9-k)):ee();else S.total>=12?ee():Math.floor(P)===P?E.push(Math.floor(P)):E.push(Y(C(P,9).toFixed(S.frac),A))}return E}const ae=86400,H={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},ne=function(E){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const _=Math.floor(Math.log10(E));return m>1?Math.floor(_/m)*m:_};function oe(E,m,_,A){let N="",P="",k="",F="",S="",ee=0,Ee=0|E,J=0,pe=0,be=1,ce=0,L=0,te=0,Re=0,Te=0,Fe=0;const xe=A||g;if(!m.text&&isFinite(m.scale)&&m.scale!==1&&(E=function(Oe){if(Oe===0)return Oe;const De=Math.ceil(Math.log10(Oe<0?-Oe:Oe)),se=10**(16-Math.floor(De));return Math.round(Oe*se)/se}(E*m.scale)),m.exponential){let Oe=Math.abs(E);if(Oe){const De=10**-ne(Oe,m.int_max),se=C(Oe*De,m.frac_max)/De;ee=ne(se,m.int_max)}Oe/=10**ee,E=E<0?-Oe:Oe,N+=Math.abs(ee)}if(m.integer){const Oe=Math.abs(C(E,m.fractions?1:m.frac_max));S+=Oe<1?"":Math.floor(Oe)}if(m.grouping){let Oe="",De=S.length;for(De>m.group_pri&&(De-=m.group_pri,Oe=xe.group+S.slice(De,De+m.group_pri)+Oe);De>m.group_sec;)De-=m.group_sec,Oe=xe.group+S.slice(De,De+m.group_sec)+Oe;S=De?S.slice(0,De)+Oe:Oe}m.dec_fractions&&(F=String(C(E,m.frac_max)).split(".")[1]||"");let Ye=!1;if(m.fractions){const Oe=Math.abs(m.integer?E%1:E);if(Oe)if(Ye=!0,isFinite(m.denominator))k+=m.denominator,P+=C(Oe*m.denominator),P==="0"&&(P="",k="",Ye=!1,S||(S="0"));else{const De=I(Oe,m.integer?m.num_max:1/0,m.den_max);P+=De[0],k+=De[1],m.integer&&P==="0"&&(S||(S="0"),P="",k="",Ye=!1)}}if(m.date){Ee=Math.trunc(E);const Oe=ae*(E-Ee);if(J=Math.floor(Oe),Fe=Oe-J,Math.abs(Fe)<1e-6?Fe=0:Fe>.9999&&(Fe=0,J+=1,J===ae&&(J=0,Ee+=1)),Fe){const De=512&m.date||256&m.date||128&m.date;(De===512&&Fe>.9995||De===256&&Fe>.995||De===128&&Fe>.95||!De&&Fe>=.5)&&(J++,Fe=0)}if(Ee||m.date_system){const De=G(E,m.date_system,_.leap1900);pe=De[0],be=De[1],ce=De[2]}if(J){const De=J<0?ae+J:J;Te=Math.floor(De)%60,Re=Math.floor(De/60)%60,te=Math.floor(De/60/60)%60}if(L=(6+Ee)%7,m.date_eval&&(ft=E,mt=Ee+J/ae,_.dateSpanLarge?ft<-694324||mt>=35830291:ft<0||mt>=2958466)){if(_.dateErrorThrows)throw new Error("Date out of bounds");return _.dateErrorNumber?ue(E<0?[xe.negative]:[],0,E,xe).join(""):_.overflow}}var ft,mt;if(m.int_padding&&(S=m.int_padding.length===1?S||m.int_padding:m.int_padding.substring(0,m.int_padding.length-S.length)+S),m.num_padding&&(P=m.num_padding.length===1?P||m.num_padding:m.num_padding.substring(0,m.num_padding.length-P.length)+P),m.den_padding&&(k=m.den_padding.length===1?k||m.den_padding:k+m.den_padding.slice(k.length)),m.man_padding){const Oe=m.exp_plus?"+":"";N=m.man_padding.length===1?(ee<0?"-":Oe)+(N||m.man_padding):(ee<0?"-":Oe)+m.man_padding.slice(0,m.man_padding.length-N.length)+N}const Ce=[];let et=0;const we={int:0,frac:0,man:0,num:0,den:0};for(let Oe=0,De=m.tokens.length;Oe<De;Oe++){const se=m.tokens[Oe],ut=se.num?se.num.length:0;if(se.type==="string")se.rule?se.rule==="num"?Ye?Ce.push(se.value):(m.num_min>0||m.den_min>0)&&Ce.push(se.value.replace(/./g,V["?"])):se.rule==="num+int"?Ye&&S?Ce.push(se.value):m.den_min>0&&(S||m.num_min)&&Ce.push(se.value.replace(/./g,V["?"])):se.rule==="den"&&(Ye?Ce.push(se.value):(m.den_min>0||m.den_min>0)&&Ce.push(se.value.replace(/./g,V["?"]))):Ce.push(se.value);else if(se.type==="error")Ce.push(_.invalid);else if(se.type==="point")Ce.push(m.date?se.value:xe.decimal);else if(se.type==="general")ue(Ce,0,E,xe);else if(se.type==="exp")Ce.push(xe.exponent);else if(se.type==="minus")se.volatile&&m.date||se.volatile&&(E>=0||typeof E!="number")||(se.volatile&&!m.fractions&&(m.integer||m.dec_fractions)?(E<0&&S&&S!=="0"||F)&&Ce.push(xe.negative):Ce.push(xe.negative));else if(se.type==="plus")Ce.push(xe.positive);else if(se.type==="text")Ce.push(E);else if(se.type==="div")Ye?Ce.push("/"):m.num_min>0||m.den_min>0?Ce.push(V["?"]):Ce.push(V["#"]);else if(se.type==="int")if(m.int_pattern.length===1)Ce.push(S);else{const He=et?m.int_pattern.join("").length-we.int:1/0,Dt=et===m.int_pattern.length-1?0:m.int_pattern.join("").length-(we.int+se.num.length);Ce.push(S.substring(S.length-He,S.length-Dt)),et++,we.int+=se.num.length}else if(se.type==="frac"){const He=we.frac;for(let Dt=0;Dt<ut;Dt++)Ce.push(F[Dt+He]||V[se.num[Dt]]);we.frac+=ut}else if(se.type in H)m[se.type+"_pattern"].length===1?(se.type==="int"&&Ce.push(S),se.type==="frac"&&Ce.push(F),se.type==="man"&&Ce.push(N),se.type==="num"&&Ce.push(P),se.type==="den"&&Ce.push(k)):(Ce.push(H[se.type].slice(we[se.type],we[se.type]+ut)),we[se.type]+=ut);else if(se.type==="year")pe<0&&Ce.push(xe.negative),Ce.push(String(Math.abs(pe)).padStart(4,"0"));else if(se.type==="year-short"){const He=pe%100;Ce.push(He<10?"0":"",He)}else if(se.type==="month")Ce.push(se.pad&&be<10?"0":"",be);else if(se.type==="monthname-single")m.date_system===6?Ce.push(xe.mmmm6[be-1].charAt(0)):Ce.push(xe.mmmm[be-1].charAt(0));else if(se.type==="monthname-short")m.date_system===6?Ce.push(xe.mmm6[be-1]):Ce.push(xe.mmm[be-1]);else if(se.type==="monthname")m.date_system===6?Ce.push(xe.mmmm6[be-1]):Ce.push(xe.mmmm[be-1]);else if(se.type==="weekday-short")Ce.push(xe.ddd[L]);else if(se.type==="weekday")Ce.push(xe.dddd[L]);else if(se.type==="day")Ce.push(se.pad&&ce<10?"0":"",ce);else if(se.type==="hour"){const He=te%m.clock||(m.clock<24?m.clock:0);Ce.push(se.pad&&He<10?"0":"",He)}else if(se.type==="min")Ce.push(se.pad&&Re<10?"0":"",Re);else if(se.type==="sec")Ce.push(se.pad&&Te<10?"0":"",Te);else if(se.type==="subsec"){Ce.push(xe.decimal);const He=Fe.toFixed(m.sec_decimals);Ce.push(He.slice(2,2+se.decimals))}else if(se.type==="am"){const He=te<12?0:1;se.short&&!A?Ce.push("AP"[He]):Ce.push(xe.ampm[He])}else if(se.type==="hour-elap"){E<0&&Ce.push(xe.negative);const He=24*Ee+Math.floor(Math.abs(J)/3600);Ce.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="min-elap"){E<0&&Ce.push(xe.negative);const He=1440*Ee+Math.floor(Math.abs(J)/60);Ce.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="sec-elap"){E<0&&Ce.push(xe.negative);const He=Ee*ae+Math.abs(J);Ce.push(String(Math.abs(He)).padStart(se.pad,"0"))}else if(se.type==="b-year")Ce.push(pe+543);else if(se.type==="b-year-short"){const He=(pe+543)%100;Ce.push(He<10?"0":"",He)}}return _.nbsp?Ce.join(""):Ce.join("").replace(/\u00a0/g," ")}function _e(E,m){for(let _=0;_<3;_++){const A=m[_];if(A){let N;if(A.condition){const P=A.condition[0],k=A.condition[1];P==="="?N=E===k:P===">"?N=E>k:P==="<"?N=E<k:P===">="?N=E>=k:P==="<="?N=E<=k:P==="<>"&&(N=E!==k)}else N=!0;if(N)return A}}}const ye=W("@"),Ue="black",X={};function Se(E,m){if(E){const _=E[0];m[_]=m[_]||{},Se(E.slice(1),m[_])}else m.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(E=>{Se(E,X),Se(E+" x",X),Se(E+" l",X),Se(E+" l x",X),Se("l "+E,X),Se("l "+E+" x",X),Se(E+" D",X),Se(E+" D x",X),Se("D "+E,X),Se("D "+E+" x",X)});const Ge={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},je={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Pe={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},Ze=new Date().getUTCFullYear();function Rt(E){const m=new RegExp("^([\\s+%"+T.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+T.join("")+")]*)$").exec(E);if(m){const[,_,A,N,P,k]=m;let F=1,S="",ee=!1,Ee=!1,J=!1,pe=!1,be=!1,ce=null,L=!1,te=parseFloat(A.replace(/,/g,""));if(!isFinite(te))return null;for(let Te=0;Te<_.length;Te++){const Fe=_[Te];if(Fe==="-"){if(ee||Ee)return null;ee=!0,F=-1}else if(j.test(Fe)){if(be)return null;be=!0,ce=Fe}else if(Fe==="("){if(Ee||ee)return null;Ee=!0,F=-1}else if(Fe==="%"){if(pe)return null;pe=!0}}for(let Te=0;Te<k.length;Te++){const Fe=k[Te];if(j.test(Fe)){if(be)return null;be=!0,ce=Fe,L=!0}else if(Fe===")"){if(J||!Ee)return null;J=!0}else if(Fe==="%"){if(pe)return null;pe=!0}}if(P){if(pe||be)return null;S="0.00E+00"}else if(pe){if(be)return null;S=N.includes(".")?"0.00%":"0%",te*=.01}else if(be){const Te=N.includes(".")?"#,##0.00":"#,##0";S=L?Te+ce:ce+Te}else N.includes(",")&&(S=N.includes(".")?"#,##0.00":"#,##0");const Re={v:te*F};return S&&(Re.z=S),Re}}const Ke=(E,m,_)=>{const A=_.path||"",N=Object.keys(m);for(let P=0;P<N.length;P++){let k;const F=N[P];if(m[F]){if(F==="$"||F==="€")E||(k=_);else if(F==="-"){const S=/^(\s*([./-]|,\s)\s*|\s+)/.exec(E);if(S){const ee=S[1]==="-"||S[1]==="/"||S[1]==="."?S[1]:" ";if(!_.sep||_.sep===ee){const Ee=S[0].replace(/\s+/g," ");k=Ke(E.slice(S[0].length),m[F],{..._,sep:ee,path:A+Ee})}}}else if(F===" "){const S=/^[,.]?\s+/.exec(E);if(S){const ee=S[0].replace(/\s+/g," ");k=Ke(E.slice(S[0].length),m[F],{..._,path:A+ee})}}else if(F==="j"||F==="d"){const S=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,day:S[0],path:A+F}))}else if(F==="n"||F==="m"){const S=/^(0?[1-9]|1[012])\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,month:+S[0],_mon:S[0],path:A+F}))}else if(F==="F"||F==="M"){const S=/^([a-z]{3,9})\b/i.exec(E),ee=S&&(F==="F"?je:Ge)[S[0].toLowerCase()];ee&&(k=Ke(E.slice(S[0].length),m[F],{..._,month:ee,_mon:S[0],path:A+F}))}else if(F==="l"||F==="D"){const S=/^([a-z]{3,9})\b/i.exec(E);(S&&Pe[S[0].toLowerCase()])===F&&(k=Ke(E.slice(S[0].length),m[F],{..._,path:A+F}))}else if(F==="y"){const S=/^\d\d\b/.exec(E);if(S){const ee=+S[0]>=30?+S[0]+1900:+S[0]+2e3;k=Ke(E.slice(S[0].length),m[F],{..._,year:ee,path:A+F})}}else if(F==="Y"){const S=/^\d\d\d\d\b/.exec(E);S&&(k=Ke(E.slice(S[0].length),m[F],{..._,year:+S[0],path:A+F}))}else{if(F!=="x")throw new Error('Unknown date token "'.concat(F,'"'));{const S=Xe(E);S&&(k=Ke("",m[F],{..._,time:S.v,tf:S.z,path:A+F}))}}if(k)return k}}};function rt(E,m){const _=Ke(E.trim(),X,{path:""});if(_){var A;if(_.sep==="."&&_.path.length===3)return null;const N=+((A=_.year)!==null&&A!==void 0?A:Ze);if(_.day||(_.day=1),!function(F,S,ee){if(ee<1||S<1||S>12)return!1;if(S===2){if(ee>(F%4==0&&F%100!=0||F%400==0||F===1900?29:28))return!1}else if((S===4||S===6||S===9||S===11)&&ee>30||(S===1||S===3||S===5||S===7||S===8||S===10||S===12)&&ee>31)return!1;return!0}(N,_.month,_.day))return null;let P=-1/0;if(N<1900)return null;N<=1900&&_.month<=2?P=25568:N<1e4&&(P=25569);const k=Date.UTC(N,_.month-1,_.day)/864e5+P+(_.time||0);if(k>=0&&k<=2958465){const F=_._mon[0]==="0"||_.day[0]==="0"||_._mon.length===2&&_.day.length===2,S=_.path.replace(/[jdlDnmMFyYx-]/g,ee=>ee==="j"||ee==="d"?F?"dd":"d":ee==="D"?"ddd":ee==="l"?"dddd":ee==="n"||ee==="m"?F?"mm":"m":ee==="M"?"mmm":ee==="F"?"mmmm":ee==="y"?"yy":ee==="x"?_.tf||"":ee==="Y"?"yyyy":ee);return m&&m.nativeDate?{v:Me(k,m),z:S}:{v:k,z:S}}}return null}function Xe(E){const m=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(E);if(m){const[,_,A,N,P,k]=m;if(P&&!N||!k&&!A&&!N)return null;let F=1*(_||0);if(k){if(F>=13)return null;k[0]!=="p"&&k[0]!=="P"||(F+=12)}return{v:(60*F*60+60*(1*(A||0))+1*(N||0)+1*(P||0))/86400,z:(_.length===2?"hh":"h")+":mm"+(N?":ss":"")+(k?" AM/PM":"")}}return null}function ht(E){return/^\s*true\s*$/i.test(E)?{v:!0}:/^\s*false\s*$/i.test(E)?{v:!1}:null}const at={};function Bt(E,m){const{pattern:_,partitions:A,locale:N}=E,P=S=>{const ee=Object.assign({},Z(),m,S);return N&&(ee.locale=N),ee},k=(S,ee)=>{const Ee=P(ee);return function(J,pe,be){const ce=c(be.locale),L=pe[3]?pe[3]:ye;if(typeof J=="boolean"&&(J=J?"TRUE":"FALSE"),J==null)return"";if(typeof J!="number")return oe(J,L,be,ce);if(!isFinite(J)){const Re=ce||g;return isNaN(J)?Re.nan:(J<0?Re.negative:"")+Re.infinity}const te=_e(J,pe);return te?oe(J,te,be,ce):be.overflow}(me(S,Ee),A,Ee)};k.color=(S,ee)=>function(Ee,J){if(typeof Ee!="number"||!isFinite(Ee))return(J[3]?J[3].color:ye.color)||Ue;const pe=_e(Ee,J);return pe&&pe.color||Ue}(me(S,P(ee)),A);const F=function(S){var ee;let Ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[J,pe]=S,be=J.frac_max,ce={type:"general",isDate:v(S),isText:$(S),isPercent:Ae(S),maxDecimals:J.general?9:be,scale:(ee=J.scale)!==null&&ee!==void 0?ee:1,color:0,parentheses:0,grouped:J.grouping?1:0,_partitions:S},L=!ce.isDate&&!ce.isText&&!J.error&&J.tokens.some(xe=>xe.type==="string"&&(Ee?xe.value===Ee:j.test(xe.value)));let te="G",Re=be>=0?Math.min(15,be):"",Te="",Fe="";if(pe&&pe.color&&(Fe="-",ce.color=1),J.parens&&(Te="()",ce.parentheses=1),L)te="C",ce.type="currency";else if(J.error)ce.type="error",ce.maxDecimals=0;else if(ce.isDate){let xe=0,Ye=0,ft="";J.tokens.forEach(Ce=>{const et=Ce.type;/^(b-)?year/.test(et)?(ft+="Y",Ye++):et.startsWith("month")?(ft+="M",Ye++):/^(week)?day/.test(et)?(ft+="D",Ye++):et!=="hour"&&et!=="min"&&et!=="sec"&&et!=="am"||(ft+=et[0],xe++)}),ce.type="date",Ye&&xe?ce.type="datetime":!Ye&&xe&&(ce.type="time");const mt=q.find(Ce=>ft.startsWith(Ce[0]));te=mt?"D":"G",Re=mt?mt[1]:""}else ce.isText?(te="G",ce.type="text",Re="",ce.maxDecimals=0):J.general?(te="G",ce.type="general",Re=""):J.fractions?(te="G",ce.type="fraction",Re=""):J.exponential?(te="S",ce.type="scientific"):ce.isPercent?(te="P",ce.type="percent"):J.grouping?(te=",",ce.type="grouped"):(J.int_max||be)&&(te="F",ce.type="number");return ce.code=te+Re+Fe+Te,ce.level=K[ce.type],Object.freeze(ce)}(A,(m||{}).currency)||new SyntaxError;return k.info=F,k.dateInfo=function(S){const[ee]=S;return{year:!!(2&ee.date),month:!!(4&ee.date),day:!!(8&ee.date),hours:!!(16&ee.date),minutes:!!(32&ee.date),seconds:!!(64&ee.date),clockType:ee.clock===12?12:24}}(A),k.isPercent=()=>!!F.isPercent,k.isDate=()=>!!F.isDate,k.isText=()=>!!F.isText,k.pattern=_,E.error&&(k.error=E.error),k.options=P,k.locale=N||m&&m.locale||"",Object.freeze(k)}function $e(E,m){E||(E="General");let _=null;return at[E]?_=at[E]:(_=Object.assign({},Z(),m).throws?D(E):function(A){try{return D(A)}catch(N){const P={tokens:[{type:"error"}],error:N.message};return{pattern:A,partitions:[P,P,P,P],error:N.message,locale:null}}}(E),_.error||(at[E]=_)),Bt(_,m)}$e.isDate=E=>$e(E,{throws:!1}).isDate(),$e.isPercent=E=>$e(E,{throws:!1}).isPercent(),$e.isText=E=>$e(E,{throws:!1}).isText(),$e.getInfo=(E,m)=>$e(E,{...m,throws:!1}).info,$e.getDateInfo=(E,m)=>$e(E,{...m,throws:!1}).dateInfo,$e.dateToSerial=me,$e.dateFromSerial=Me,$e.options=Z,$e.dec2frac=I,$e.round=C,$e.codeToLocale=s,$e.parseLocale=l,$e.getLocale=c,$e.addLocale=(E,m)=>{const _=l(m);return delete at[_.lang],delete at[_.language],f(E,_)},$e.format=function(E,m,_){let A=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const N=_&&typeof _=="object"?_:{locale:_,throws:!A};return $e(E,N)(me(m,N),N)},$e.is_date=$e.isDate,$e.parseNumber=Rt,$e.parseDate=rt,$e.parseTime=Xe,$e.parseBool=ht,$e.parseValue=function(E,m){var _,A,N;return(_=(A=(N=Rt(E))!==null&&N!==void 0?N:rt(E,m))!==null&&A!==void 0?A:Xe(E))!==null&&_!==void 0?_:ht(E)};var dt=$e;return r=r.default}()})}(Pr)),Pr.exports}var ps,No;function ad(){return No||(No=1,ps=od()),ps}var ld=ad();const ud=pt(ld);function jt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Es(e,t,n){const r=jt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Cs(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function cd(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function hd(e,t,n){const r=n;if(jt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Rs(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?dd(e,t,n,r):fd(e,t,n,r)}function dd(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function fd(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class Ot{constructor(t={}){R(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new Ot({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Rs(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Rs(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Es(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Es(r,void 0,i)})}removeRows(t,n){Cs(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Cs(t,n,s)})}getFragment(t,n,r,s){const i=new Ot;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new Ot;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return jt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=jt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new Ot;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=jt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const jn="__INTERNAL_EDITOR__",Is=`${jn}DOCS_NORMAL`,Ss=`${jn}DOCS_FORMULA_BAR`,Mo=`${jn}ZEN_EDITOR`,Do=`\r
4
+ `,Lo="isRowStylePrecedeColumnStyle",Uo=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function gd(e){return`${jn}${e}`}function ko(e){return e.startsWith(jn)}const md={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},_d={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},pd={startRow:0,startColumn:0,endRow:0,endColumn:0},Ed={row:0,column:0},lt={ff:"Arial",fs:11,it:ve.FALSE,bl:ve.FALSE,ul:{s:ve.FALSE},st:{s:ve.FALSE},ol:{s:ve.FALSE},tr:{a:0,v:ve.FALSE},td:Bn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:St.UNSPECIFIED,vt:en.UNSPECIFIED,tb:tn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},Po={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},Cd=[Is,Mo,Ss];var Fo=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(Fo||{});function Fr(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ve.FALSE;switch(e){case"bl":case"it":{if(o[e]===ve.FALSE)return ve.FALSE;break}case"ul":case"st":{if(o[e].s===ve.FALSE)return ve.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
5
+ `)===r?ve.TRUE:ve.FALSE}const fr=class fr{constructor(t,n,r){R(this,"_range");R(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Ot;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new Ot;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||lt.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new fr(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||lt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Fr("ul",t.body)===ve.TRUE?{s:ve.TRUE}:{s:ve.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Fr("st",t.body)===ve.TRUE?{s:ve.TRUE}:{s:ve.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Fr("it",t.body)===ve.TRUE?pr.ITALIC:pr.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?Fr("bl",t.body)===ve.TRUE?Er.BOLD:Er.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===tn.WRAP?ve.TRUE:ve.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){fr.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||lt[t]}))}};R(fr,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let gn=fr;function Rd(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||nt.NONE,o=s.endAbsoluteRefType||nt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===nt.ALL&&o===nt.ALL)return s;const l=xo(s.startRow,n,s.startColumn,t,a),u=xo(s.endRow,n,s.endColumn,t,a);return r||i===nt.NONE&&o===nt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===nt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===nt.COLUMN?s={...s,startRow:l.row}:i===nt.ROW&&(s={...s,startColumn:l.column}),o===nt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===nt.COLUMN?s={...s,endRow:u.row}:o===nt.ROW&&(s={...s,endColumn:u.column}),s)}function xo(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function vs(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const f of e){if(f.startRow>h)break;if(f.startRow<=c&&f.endRow>=h&&f.startColumn<=l&&f.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function Id(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function Sd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function vd(e){const t=vs(e),n=Id(t);return Sd(n)}function Od(e,t){const n=[];return e.forEach(r=>{n.push(...Yt.subtract(r,t))}),Yt.mergeRanges(n)}function $o(e,t){const n=Bo(e.startRow,e.endRow,t.startRow,t.endRow),r=Bo(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=wd(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Bo(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function wd(e,t,n,r,s,i){const o=e!==void 0?e:Ho(n,r,s,i),a=t!==void 0?t:Ho(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function Ho(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const $t=class $t{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,f=i<=c&&o>=u;return h&&f}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,f=Math.abs(o+a-c-h),g=Math.abs(o-a)+Math.abs(c-h),C=Math.abs(s+i-l-u),I=Math.abs(s-i)+Math.abs(l-u);return f<=g&&C<=I}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,f,g,C;if(a<=s)a>=r?f=a:f=r;else return null;if(l>=r)l>=s?C=s:C=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?g=o:g=c;else return null;return{startRow:f,endRow:C,startColumn:h,endColumn:g,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return $t.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=$t.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return vd(t)}static splitIntoGrid(t){return vs(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Od(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};R($t,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),R($t,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[nt.ROW,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[nt.ROW,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[nt.COLUMN,nt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[nt.COLUMN,nt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),R($t,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),R($t,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),R($t,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Yt=$t;function bd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=yd(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function yd(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Ad(e,t){gn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Td(e,t){const n=e.toFullArray(),r=[];for(;;){const s=bd(n,t);if(!s)break;r.push(s),Ad(n,s)}return r}class Nd{constructor(t,n){R(this,"_values",[]);R(this,"_keys",[]);R(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Os(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function Md(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const xr=65,Wo=90,Dd=97;function Ld(e){const t=Wo-xr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+xr)+n,e=Math.floor(e/t)-1;return n}function jo(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Ud(e,t=!1){const n=Wo-xr+1;let r=Dd;t&&(r=xr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return jo(s,i)}function kd(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Pd(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Yn(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var Yo=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Yo||{}),zo=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(zo||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),zn=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(zn||{}),zt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(zt||{}),rn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(rn||{}),Vo=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Vo||{}),ws=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(ws||{}),Go=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Go||{}),Ko=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Ko||{}),Xo=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Xo||{}),qo=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(qo||{}),Jo=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Jo||{}),Zo=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Zo||{}),Qo=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(Qo||{}),ea=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e[e.HEADING_6=9]="HEADING_6",e))(ea||{}),ta=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(ta||{}),na=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(na||{}),ra=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(ra||{}),sa=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(sa||{}),ia=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(ia||{}),oa=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(oa||{}),aa=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(aa||{}),la=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(la||{}),ua=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(ua||{}),mn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(mn||{}),ca=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(ca||{}),ha=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(ha||{}),da=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(da||{}),fa=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(fa||{}),ga=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(ga||{}),ma=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(ma||{}),_a=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(_a||{}),pa=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(pa||{}),Ea=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(Ea||{}),bs=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(bs||{}),Ca=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(Ca||{}),Ra=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(Ra||{}),Ia=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Ia||{}),Vt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
6
+ `,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(Vt||{});function Fd(e){return`${e}`}const xd=[Vt.TABLE_START,Vt.TABLE_ROW_START,Vt.TABLE_CELL_START,Vt.TABLE_CELL_END,Vt.TABLE_ROW_END,Vt.TABLE_END],$r=e=>{const t=e.endsWith(`\r
7
+ `)?e.slice(0,-2):e;return xd.reduce((n,r)=>n.replaceAll(r,""),t)},$d=e=>e?$r(e).replaceAll("\r","")==="":!0,Bd=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=kt(),f=`${c}`,g={startIndex:s,endIndex:s+f.length-1,rangeId:h,rangeType:zt.HYPERLINK,properties:{url:e}};r.push(g),i+=f,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var Sa=typeof global=="object"&&global&&global.Object===Object&&global,Hd=typeof self=="object"&&self&&self.Object===Object&&self,sn=Sa||Hd||Function("return this")(),_n=sn.Symbol,va=Object.prototype,Wd=va.hasOwnProperty,jd=va.toString,Vn=_n?_n.toStringTag:void 0;function Yd(e){var t=Wd.call(e,Vn),n=e[Vn];try{e[Vn]=void 0;var r=!0}catch{}var s=jd.call(e);return r&&(t?e[Vn]=n:delete e[Vn]),s}var zd=Object.prototype,Vd=zd.toString;function Gd(e){return Vd.call(e)}var Kd="[object Null]",Xd="[object Undefined]",Oa=_n?_n.toStringTag:void 0;function Gn(e){return e==null?e===void 0?Xd:Kd:Oa&&Oa in Object(e)?Yd(e):Gd(e)}function pn(e){return e!=null&&typeof e=="object"}var qd="[object Symbol]";function Br(e){return typeof e=="symbol"||pn(e)&&Gn(e)==qd}function Jd(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var En=Array.isArray,wa=_n?_n.prototype:void 0,ba=wa?wa.toString:void 0;function ya(e){if(typeof e=="string")return e;if(En(e))return Jd(e,ya)+"";if(Br(e))return ba?ba.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Zd=/\s/;function Qd(e){for(var t=e.length;t--&&Zd.test(e.charAt(t)););return t}var ef=/^\s+/;function tf(e){return e&&e.slice(0,Qd(e)+1).replace(ef,"")}function Et(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Aa=NaN,nf=/^[-+]0x[0-9a-f]+$/i,rf=/^0b[01]+$/i,sf=/^0o[0-7]+$/i,of=parseInt;function Ta(e){if(typeof e=="number")return e;if(Br(e))return Aa;if(Et(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Et(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=tf(e);var n=rf.test(e);return n||sf.test(e)?of(e.slice(2),n?2:8):nf.test(e)?Aa:+e}function Na(e){return e}var af="[object AsyncFunction]",lf="[object Function]",uf="[object GeneratorFunction]",cf="[object Proxy]";function ys(e){if(!Et(e))return!1;var t=Gn(e);return t==lf||t==uf||t==af||t==cf}var As=sn["__core-js_shared__"],Ma=function(){var e=/[^.]+$/.exec(As&&As.keys&&As.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function hf(e){return!!Ma&&Ma in e}var df=Function.prototype,ff=df.toString;function gf(e){if(e!=null){try{return ff.call(e)}catch{}try{return e+""}catch{}}return""}var mf=/[\\^$.*+?()[\]{}|]/g,_f=/^\[object .+?Constructor\]$/,pf=Function.prototype,Ef=Object.prototype,Cf=pf.toString,Rf=Ef.hasOwnProperty,If=RegExp("^"+Cf.call(Rf).replace(mf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Sf(e){if(!Et(e)||hf(e))return!1;var t=ys(e)?If:_f;return t.test(gf(e))}function vf(e,t){return e==null?void 0:e[t]}function Ts(e,t){var n=vf(e,t);return Sf(n)?n:void 0}var Da=Object.create,Of=function(){function e(){}return function(t){if(!Et(t))return{};if(Da)return Da(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function wf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function bf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var yf=800,Af=16,Tf=Date.now;function Nf(e){var t=0,n=0;return function(){var r=Tf(),s=Af-(r-n);if(n=r,s>0){if(++t>=yf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Mf(e){return function(){return e}}var Hr=function(){try{var e=Ts(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Df=Hr?function(e,t){return Hr(e,"toString",{configurable:!0,enumerable:!1,value:Mf(t),writable:!0})}:Na,Lf=Nf(Df),Uf=9007199254740991,kf=/^(?:0|[1-9]\d*)$/;function Ns(e,t){var n=typeof e;return t=t==null?Uf:t,!!t&&(n=="number"||n!="symbol"&&kf.test(e))&&e>-1&&e%1==0&&e<t}function Ms(e,t,n){t=="__proto__"&&Hr?Hr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Wr(e,t){return e===t||e!==e&&t!==t}var Pf=Object.prototype,Ff=Pf.hasOwnProperty;function La(e,t,n){var r=e[t];(!(Ff.call(e,t)&&Wr(r,n))||n===void 0&&!(t in e))&&Ms(e,t,n)}function xf(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?Ms(n,a,l):La(n,a,l)}return n}var Ua=Math.max;function $f(e,t,n){return t=Ua(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Ua(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),wf(e,this,a)}}function Bf(e,t){return Lf($f(e,t,Na),e+"")}var Hf=9007199254740991;function ka(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Hf}function Ds(e){return e!=null&&ka(e.length)&&!ys(e)}function Wf(e,t,n){if(!Et(n))return!1;var r=typeof t;return(r=="number"?Ds(n)&&Ns(t,n.length):r=="string"&&t in n)?Wr(n[t],e):!1}function Pa(e){return Bf(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&Wf(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var jf=Object.prototype;function Fa(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||jf;return e===n}function Yf(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var zf="[object Arguments]";function xa(e){return pn(e)&&Gn(e)==zf}var $a=Object.prototype,Vf=$a.hasOwnProperty,Gf=$a.propertyIsEnumerable,Ls=xa(function(){return arguments}())?xa:function(e){return pn(e)&&Vf.call(e,"callee")&&!Gf.call(e,"callee")};function Kf(){return!1}var Ba=typeof d=="object"&&d&&!d.nodeType&&d,Ha=Ba&&typeof module=="object"&&module&&!module.nodeType&&module,Xf=Ha&&Ha.exports===Ba,Wa=Xf?sn.Buffer:void 0,qf=Wa?Wa.isBuffer:void 0,ja=qf||Kf,Jf="[object Arguments]",Zf="[object Array]",Qf="[object Boolean]",eg="[object Date]",tg="[object Error]",ng="[object Function]",rg="[object Map]",sg="[object Number]",ig="[object Object]",og="[object RegExp]",ag="[object Set]",lg="[object String]",ug="[object WeakMap]",cg="[object ArrayBuffer]",hg="[object DataView]",dg="[object Float32Array]",fg="[object Float64Array]",gg="[object Int8Array]",mg="[object Int16Array]",_g="[object Int32Array]",pg="[object Uint8Array]",Eg="[object Uint8ClampedArray]",Cg="[object Uint16Array]",Rg="[object Uint32Array]",Qe={};Qe[dg]=Qe[fg]=Qe[gg]=Qe[mg]=Qe[_g]=Qe[pg]=Qe[Eg]=Qe[Cg]=Qe[Rg]=!0,Qe[Jf]=Qe[Zf]=Qe[cg]=Qe[Qf]=Qe[hg]=Qe[eg]=Qe[tg]=Qe[ng]=Qe[rg]=Qe[sg]=Qe[ig]=Qe[og]=Qe[ag]=Qe[lg]=Qe[ug]=!1;function Ig(e){return pn(e)&&ka(e.length)&&!!Qe[Gn(e)]}function Sg(e){return function(t){return e(t)}}var Ya=typeof d=="object"&&d&&!d.nodeType&&d,Kn=Ya&&typeof module=="object"&&module&&!module.nodeType&&module,vg=Kn&&Kn.exports===Ya,Us=vg&&Sa.process,za=function(){try{var e=Kn&&Kn.require&&Kn.require("util").types;return e||Us&&Us.binding&&Us.binding("util")}catch{}}(),Va=za&&za.isTypedArray,Ga=Va?Sg(Va):Ig;function Og(e,t){var n=En(e),r=!n&&Ls(e),s=!n&&!r&&ja(e),i=!n&&!r&&!s&&Ga(e),o=n||r||s||i,a=o?Yf(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Ns(u,l))||a.push(u);return a}function wg(e,t){return function(n){return e(t(n))}}function bg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var yg=Object.prototype,Ag=yg.hasOwnProperty;function Tg(e){if(!Et(e))return bg(e);var t=Fa(e),n=[];for(var r in e)r=="constructor"&&(t||!Ag.call(e,r))||n.push(r);return n}function Ka(e){return Ds(e)?Og(e):Tg(e)}var Ng=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mg=/^\w*$/;function Dg(e,t){if(En(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Br(e)?!0:Mg.test(e)||!Ng.test(e)||t!=null&&e in Object(t)}var Xn=Ts(Object,"create");function Lg(){this.__data__=Xn?Xn(null):{},this.size=0}function Ug(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var kg="__lodash_hash_undefined__",Pg=Object.prototype,Fg=Pg.hasOwnProperty;function xg(e){var t=this.__data__;if(Xn){var n=t[e];return n===kg?void 0:n}return Fg.call(t,e)?t[e]:void 0}var $g=Object.prototype,Bg=$g.hasOwnProperty;function Hg(e){var t=this.__data__;return Xn?t[e]!==void 0:Bg.call(t,e)}var Wg="__lodash_hash_undefined__";function jg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Xn&&t===void 0?Wg:t,this}function on(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}on.prototype.clear=Lg,on.prototype.delete=Ug,on.prototype.get=xg,on.prototype.has=Hg,on.prototype.set=jg;function Yg(){this.__data__=[],this.size=0}function jr(e,t){for(var n=e.length;n--;)if(Wr(e[n][0],t))return n;return-1}var zg=Array.prototype,Vg=zg.splice;function Gg(e){var t=this.__data__,n=jr(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Vg.call(t,n,1),--this.size,!0}function Kg(e){var t=this.__data__,n=jr(t,e);return n<0?void 0:t[n][1]}function Xg(e){return jr(this.__data__,e)>-1}function qg(e,t){var n=this.__data__,r=jr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ft.prototype.clear=Yg,Ft.prototype.delete=Gg,Ft.prototype.get=Kg,Ft.prototype.has=Xg,Ft.prototype.set=qg;var Xa=Ts(sn,"Map");function Jg(){this.size=0,this.__data__={hash:new on,map:new(Xa||Ft),string:new on}}function Zg(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Yr(e,t){var n=e.__data__;return Zg(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Qg(e){var t=Yr(this,e).delete(e);return this.size-=t?1:0,t}function em(e){return Yr(this,e).get(e)}function tm(e){return Yr(this,e).has(e)}function nm(e,t){var n=Yr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Gt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Gt.prototype.clear=Jg,Gt.prototype.delete=Qg,Gt.prototype.get=em,Gt.prototype.has=tm,Gt.prototype.set=nm;var rm="Expected a function";function ks(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(rm);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(ks.Cache||Gt),n}ks.Cache=Gt;var sm=500;function im(e){var t=ks(e,function(r){return n.size===sm&&n.clear(),r}),n=t.cache;return t}var om=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,am=/\\(\\)?/g,lm=im(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(om,function(n,r,s,i){t.push(s?i.replace(am,"$1"):r||n)}),t});function um(e){return e==null?"":ya(e)}function qa(e,t){return En(e)?e:Dg(e,t)?[e]:lm(um(e))}function Ja(e){if(typeof e=="string"||Br(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function cm(e,t){t=qa(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ja(t[n++])];return n&&n==r?e:void 0}function hm(e,t,n){var r=e==null?void 0:cm(e,t);return r===void 0?n:r}var Za=wg(Object.getPrototypeOf,Object),dm="[object Object]",fm=Function.prototype,gm=Object.prototype,Qa=fm.toString,mm=gm.hasOwnProperty,_m=Qa.call(Object);function pm(e){if(!pn(e)||Gn(e)!=dm)return!1;var t=Za(e);if(t===null)return!0;var n=mm.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Qa.call(n)==_m}function Em(){this.__data__=new Ft,this.size=0}function Cm(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Rm(e){return this.__data__.get(e)}function Im(e){return this.__data__.has(e)}var Sm=200;function vm(e,t){var n=this.__data__;if(n instanceof Ft){var r=n.__data__;if(!Xa||r.length<Sm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Gt(r)}return n.set(e,t),this.size=n.size,this}function Cn(e){var t=this.__data__=new Ft(e);this.size=t.size}Cn.prototype.clear=Em,Cn.prototype.delete=Cm,Cn.prototype.get=Rm,Cn.prototype.has=Im,Cn.prototype.set=vm;var el=typeof d=="object"&&d&&!d.nodeType&&d,tl=el&&typeof module=="object"&&module&&!module.nodeType&&module,Om=tl&&tl.exports===el,nl=Om?sn.Buffer:void 0;nl&&nl.allocUnsafe;function wm(e,t){return e.slice()}var rl=sn.Uint8Array;function bm(e){var t=new e.constructor(e.byteLength);return new rl(t).set(new rl(e)),t}function ym(e,t){var n=bm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Am(e){return typeof e.constructor=="function"&&!Fa(e)?Of(Za(e)):{}}function Tm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Nm=Tm(),Ps=function(){return sn.Date.now()},Mm="Expected a function",Dm=Math.max,Lm=Math.min;function Um(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,f=!0;if(typeof e!="function")throw new TypeError(Mm);t=Ta(t)||0,Et(n)&&(c=!!n.leading,h="maxWait"in n,i=h?Dm(Ta(n.maxWait)||0,t):i,f="trailing"in n?!!n.trailing:f);function g(T){var j=r,Q=s;return r=s=void 0,u=T,o=e.apply(Q,j),o}function C(T){return u=T,a=setTimeout(U,t),c?g(T):o}function I(T){var j=T-l,Q=T-u,ge=t-j;return h?Lm(ge,i-Q):ge}function b(T){var j=T-l,Q=T-u;return l===void 0||j>=t||j<0||h&&Q>=i}function U(){var T=Ps();if(b(T))return Z(T);a=setTimeout(U,I(T))}function Z(T){return a=void 0,f&&r?g(T):(r=s=void 0,o)}function V(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function fe(){return a===void 0?o:Z(Ps())}function M(){var T=Ps(),j=b(T);if(r=arguments,s=this,l=T,j){if(a===void 0)return C(l);if(h)return clearTimeout(a),a=setTimeout(U,t),g(l)}return a===void 0&&(a=setTimeout(U,t)),o}return M.cancel=V,M.flush=fe,M}function Fs(e,t,n){(n!==void 0&&!Wr(e[t],n)||n===void 0&&!(t in e))&&Ms(e,t,n)}function km(e){return pn(e)&&Ds(e)}function xs(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Pm(e){return xf(e,Ka(e))}function Fm(e,t,n,r,s,i,o){var a=xs(e,n),l=xs(t,n),u=o.get(l);if(u){Fs(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var f=En(l),g=!f&&ja(l),C=!f&&!g&&Ga(l);c=l,f||g||C?En(a)?c=a:km(a)?c=bf(a):g?(h=!1,c=wm(l)):C?(h=!1,c=ym(l)):c=[]:pm(l)||Ls(l)?(c=a,Ls(a)?c=Pm(a):(!Et(a)||ys(a))&&(c=Am(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),Fs(e,n,c)}function $s(e,t,n,r,s){e!==t&&Nm(t,function(i,o){if(s||(s=new Cn),Et(i))Fm(e,t,o,n,$s,r,s);else{var a=r?r(xs(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Fs(e,o,a)}},Ka)}var xm=Pa(function(e,t,n,r){$s(e,t,n,r)}),Bs=Pa(function(e,t,n){$s(e,t,n)});function $m(e,t,n,r){if(!Et(e))return e;t=qa(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Ja(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=Et(c)?c:Ns(t[s+1])?[]:{})}La(a,l,u),a=a[l]}return e}function Bm(e,t,n){return e==null?e:$m(e,t,n)}var Hs,sl;function Hm(){if(sl)return Hs;sl=1;var e=-1,t=1,n=0;function r(p,W,O,D,y){if(p===W)return p?[[n,p]]:[];if(O!=null){var w=ge(p,W,O);if(w)return w}var x=a(p,W),B=p.substring(0,x);p=p.substring(x),W=W.substring(x),x=u(p,W);var G=p.substring(p.length-x);p=p.substring(0,p.length-x),W=W.substring(0,W.length-x);var ie=s(p,W);return B&&ie.unshift([n,B]),G&&ie.push([n,G]),Z(ie,y),D&&h(ie),ie}function s(p,W){var O;if(!p)return[[t,W]];if(!W)return[[e,p]];var D=p.length>W.length?p:W,y=p.length>W.length?W:p,w=D.indexOf(y);if(w!==-1)return O=[[t,D.substring(0,w)],[n,y],[t,D.substring(w+y.length)]],p.length>W.length&&(O[0][0]=O[2][0]=e),O;if(y.length===1)return[[e,p],[t,W]];var x=c(p,W);if(x){var B=x[0],G=x[1],ie=x[2],de=x[3],me=x[4],Me=r(B,ie),Ae=r(G,de);return Me.concat([[n,me]],Ae)}return i(p,W)}function i(p,W){for(var O=p.length,D=W.length,y=Math.ceil((O+D)/2),w=y,x=2*y,B=new Array(x),G=new Array(x),ie=0;ie<x;ie++)B[ie]=-1,G[ie]=-1;B[w+1]=0,G[w+1]=0;for(var de=O-D,me=de%2!==0,Me=0,Ae=0,v=0,$=0,K=0;K<y;K++){for(var q=-K+Me;q<=K-Ae;q+=2){var z=w+q,Y;q===-K||q!==K&&B[z-1]<B[z+1]?Y=B[z+1]:Y=B[z-1]+1;for(var ue=Y-q;Y<O&&ue<D&&p.charAt(Y)===W.charAt(ue);)Y++,ue++;if(B[z]=Y,Y>O)Ae+=2;else if(ue>D)Me+=2;else if(me){var ae=w+de-q;if(ae>=0&&ae<x&&G[ae]!==-1){var H=O-G[ae];if(Y>=H)return o(p,W,Y,ue)}}}for(var ne=-K+v;ne<=K-$;ne+=2){var ae=w+ne,H;ne===-K||ne!==K&&G[ae-1]<G[ae+1]?H=G[ae+1]:H=G[ae-1]+1;for(var oe=H-ne;H<O&&oe<D&&p.charAt(O-H-1)===W.charAt(D-oe-1);)H++,oe++;if(G[ae]=H,H>O)$+=2;else if(oe>D)v+=2;else if(!me){var z=w+de-ne;if(z>=0&&z<x&&B[z]!==-1){var Y=B[z],ue=w+Y-z;if(H=O-H,Y>=H)return o(p,W,Y,ue)}}}}return[[e,p],[t,W]]}function o(p,W,O,D){var y=p.substring(0,O),w=W.substring(0,D),x=p.substring(O),B=W.substring(D),G=r(y,w),ie=r(x,B);return G.concat(ie)}function a(p,W){if(!p||!W||p.charAt(0)!==W.charAt(0))return 0;for(var O=0,D=Math.min(p.length,W.length),y=D,w=0;O<y;)p.substring(w,y)==W.substring(w,y)?(O=y,w=O):D=y,y=Math.floor((D-O)/2+O);return V(p.charCodeAt(y-1))&&y--,y}function l(p,W){var O=p.length,D=W.length;if(O==0||D==0)return 0;O>D?p=p.substring(O-D):O<D&&(W=W.substring(0,O));var y=Math.min(O,D);if(p==W)return y;for(var w=0,x=1;;){var B=p.substring(y-x),G=W.indexOf(B);if(G==-1)return w;x+=G,(G==0||p.substring(y-x)==W.substring(0,x))&&(w=x,x++)}}function u(p,W){if(!p||!W||p.slice(-1)!==W.slice(-1))return 0;for(var O=0,D=Math.min(p.length,W.length),y=D,w=0;O<y;)p.substring(p.length-y,p.length-w)==W.substring(W.length-y,W.length-w)?(O=y,w=O):D=y,y=Math.floor((D-O)/2+O);return fe(p.charCodeAt(p.length-y))&&y--,y}function c(p,W){var O=p.length>W.length?p:W,D=p.length>W.length?W:p;if(O.length<4||D.length*2<O.length)return null;function y(Ae,v,$){for(var K=Ae.substring($,$+Math.floor(Ae.length/4)),q=-1,z="",Y,ue,ae,H;(q=v.indexOf(K,q+1))!==-1;){var ne=a(Ae.substring($),v.substring(q)),oe=u(Ae.substring(0,$),v.substring(0,q));z.length<oe+ne&&(z=v.substring(q-oe,q)+v.substring(q,q+ne),Y=Ae.substring(0,$-oe),ue=Ae.substring($+ne),ae=v.substring(0,q-oe),H=v.substring(q+ne))}return z.length*2>=Ae.length?[Y,ue,ae,H,z]:null}var w=y(O,D,Math.ceil(O.length/4)),x=y(O,D,Math.ceil(O.length/2)),B;if(!w&&!x)return null;x?w?B=w[4].length>x[4].length?w:x:B=x:B=w;var G,ie,de,me;p.length>W.length?(G=B[0],ie=B[1],de=B[2],me=B[3]):(de=B[0],me=B[1],G=B[2],ie=B[3]);var Me=B[4];return[G,ie,de,me,Me]}function h(p){for(var W=!1,O=[],D=0,y=null,w=0,x=0,B=0,G=0,ie=0;w<p.length;)p[w][0]==n?(O[D++]=w,x=G,B=ie,G=0,ie=0,y=p[w][1]):(p[w][0]==t?G+=p[w][1].length:ie+=p[w][1].length,y&&y.length<=Math.max(x,B)&&y.length<=Math.max(G,ie)&&(p.splice(O[D-1],0,[e,y]),p[O[D-1]+1][0]=t,D--,D--,w=D>0?O[D-1]:-1,x=0,B=0,G=0,ie=0,y=null,W=!0)),w++;for(W&&Z(p),U(p),w=1;w<p.length;){if(p[w-1][0]==e&&p[w][0]==t){var de=p[w-1][1],me=p[w][1],Me=l(de,me),Ae=l(me,de);Me>=Ae?(Me>=de.length/2||Me>=me.length/2)&&(p.splice(w,0,[n,me.substring(0,Me)]),p[w-1][1]=de.substring(0,de.length-Me),p[w+1][1]=me.substring(Me),w++):(Ae>=de.length/2||Ae>=me.length/2)&&(p.splice(w,0,[n,de.substring(0,Ae)]),p[w-1][0]=t,p[w-1][1]=me.substring(0,me.length-Ae),p[w+1][0]=e,p[w+1][1]=de.substring(Ae),w++),w++}w++}}var f=/[^a-zA-Z0-9]/,g=/\s/,C=/[\r\n]/,I=/\n\r?\n$/,b=/^\r?\n\r?\n/;function U(p){function W(Ae,v){if(!Ae||!v)return 6;var $=Ae.charAt(Ae.length-1),K=v.charAt(0),q=$.match(f),z=K.match(f),Y=q&&$.match(g),ue=z&&K.match(g),ae=Y&&$.match(C),H=ue&&K.match(C),ne=ae&&Ae.match(I),oe=H&&v.match(b);return ne||oe?5:ae||H?4:q&&!Y&&ue?3:Y||ue?2:q||z?1:0}for(var O=1;O<p.length-1;){if(p[O-1][0]==n&&p[O+1][0]==n){var D=p[O-1][1],y=p[O][1],w=p[O+1][1],x=u(D,y);if(x){var B=y.substring(y.length-x);D=D.substring(0,D.length-x),y=B+y.substring(0,y.length-x),w=B+w}for(var G=D,ie=y,de=w,me=W(D,y)+W(y,w);y.charAt(0)===w.charAt(0);){D+=y.charAt(0),y=y.substring(1)+w.charAt(0),w=w.substring(1);var Me=W(D,y)+W(y,w);Me>=me&&(me=Me,G=D,ie=y,de=w)}p[O-1][1]!=G&&(G?p[O-1][1]=G:(p.splice(O-1,1),O--),p[O][1]=ie,de?p[O+1][1]=de:(p.splice(O+1,1),O--))}O++}}function Z(p,W){p.push([n,""]);for(var O=0,D=0,y=0,w="",x="",B;O<p.length;){if(O<p.length-1&&!p[O][1]){p.splice(O,1);continue}switch(p[O][0]){case t:y++,x+=p[O][1],O++;break;case e:D++,w+=p[O][1],O++;break;case n:var G=O-y-D-1;if(W){if(G>=0&&T(p[G][1])){var ie=p[G][1].slice(-1);if(p[G][1]=p[G][1].slice(0,-1),w=ie+w,x=ie+x,!p[G][1]){p.splice(G,1),O--;var de=G-1;p[de]&&p[de][0]===t&&(y++,x=p[de][1]+x,de--),p[de]&&p[de][0]===e&&(D++,w=p[de][1]+w,de--),G=de}}if(M(p[O][1])){var ie=p[O][1].charAt(0);p[O][1]=p[O][1].slice(1),w+=ie,x+=ie}}if(O<p.length-1&&!p[O][1]){p.splice(O,1);break}if(w.length>0||x.length>0){w.length>0&&x.length>0&&(B=a(x,w),B!==0&&(G>=0?p[G][1]+=x.substring(0,B):(p.splice(0,0,[n,x.substring(0,B)]),O++),x=x.substring(B),w=w.substring(B)),B=u(x,w),B!==0&&(p[O][1]=x.substring(x.length-B)+p[O][1],x=x.substring(0,x.length-B),w=w.substring(0,w.length-B)));var me=y+D;w.length===0&&x.length===0?(p.splice(O-me,me),O=O-me):w.length===0?(p.splice(O-me,me,[t,x]),O=O-me+1):x.length===0?(p.splice(O-me,me,[e,w]),O=O-me+1):(p.splice(O-me,me,[e,w],[t,x]),O=O-me+2)}O!==0&&p[O-1][0]===n?(p[O-1][1]+=p[O][1],p.splice(O,1)):O++,y=0,D=0,w="",x="";break}}p[p.length-1][1]===""&&p.pop();var Me=!1;for(O=1;O<p.length-1;)p[O-1][0]===n&&p[O+1][0]===n&&(p[O][1].substring(p[O][1].length-p[O-1][1].length)===p[O-1][1]?(p[O][1]=p[O-1][1]+p[O][1].substring(0,p[O][1].length-p[O-1][1].length),p[O+1][1]=p[O-1][1]+p[O+1][1],p.splice(O-1,1),Me=!0):p[O][1].substring(0,p[O+1][1].length)==p[O+1][1]&&(p[O-1][1]+=p[O+1][1],p[O][1]=p[O][1].substring(p[O+1][1].length)+p[O+1][1],p.splice(O+1,1),Me=!0)),O++;Me&&Z(p,W)}function V(p){return p>=55296&&p<=56319}function fe(p){return p>=56320&&p<=57343}function M(p){return fe(p.charCodeAt(0))}function T(p){return V(p.charCodeAt(p.length-1))}function j(p){for(var W=[],O=0;O<p.length;O++)p[O][1].length>0&&W.push(p[O]);return W}function Q(p,W,O,D){return T(p)||M(D)?null:j([[n,p],[e,W],[t,O],[n,D]])}function ge(p,W,O){var D=typeof O=="number"?{index:O,length:0}:O.oldRange,y=typeof O=="number"?null:O.newRange,w=p.length,x=W.length;if(D.length===0&&(y===null||y.length===0)){var B=D.index,G=p.slice(0,B),ie=p.slice(B),de=y?y.index:null;e:{var me=B+x-w;if(de!==null&&de!==me||me<0||me>x)break e;var Me=W.slice(0,me),Ae=W.slice(me);if(Ae!==ie)break e;var v=Math.min(B,me),$=G.slice(0,v),K=Me.slice(0,v);if($!==K)break e;var q=G.slice(v),z=Me.slice(v);return Q($,q,z,ie)}e:{if(de!==null&&de!==B)break e;var Y=B,Me=W.slice(0,Y),Ae=W.slice(Y);if(Me!==G)break e;var ue=Math.min(w-Y,x-Y),ae=ie.slice(ie.length-ue),H=Ae.slice(Ae.length-ue);if(ae!==H)break e;var q=ie.slice(0,ie.length-ue),z=Ae.slice(0,Ae.length-ue);return Q(G,q,z,ae)}}if(D.length>0&&y&&y.length===0)e:{var $=p.slice(0,D.index),ae=p.slice(D.index+D.length),v=$.length,ue=ae.length;if(x<v+ue)break e;var K=W.slice(0,v),H=W.slice(x-ue);if($!==K||ae!==H)break e;var q=p.slice(v,w-ue),z=W.slice(v,x-ue);return Q($,q,z,ae)}return null}function le(p,W,O,D){return r(p,W,O,D,!0)}return le.INSERT=t,le.DELETE=e,le.EQUAL=n,Hs=le,Hs}var Wm=Hm();const Ws=pt(Wm),jm=new Set(["true","false"]);function Ym(e){return jm.has(e.toLowerCase())}function il(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var Be=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Be||{}),Nt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Nt||{}),js=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(js||{});class zr extends st{}function zm(e=re.generateRandomId(6),t=$n.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
8
+ `,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:ws.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ve.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ve.TRUE,doNotHyphenateCaps:ve.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ve.FALSE,useFirstPageHeaderFooter:ve.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var an={},qn={},Vr={},ol;function Vm(){if(ol)return Vr;ol=1,Object.defineProperty(Vr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Vr.default=n,Vr}var Gr={},al;function Gm(){if(al)return Gr;al=1,Object.defineProperty(Gr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Gr.default=e,Gr}var Ys={},ll;function ul(){return ll||(ll=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let f in c){const g=f;h.write(g,c[g])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let f=this.container,g=this.parents.length-1,C=this.idx;for(;C>=0;)h.unshift(f[C]),C===0?(C=this.indexes[g*2],f=this.parents[g--]):C-=n(f[C-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const f=this.container[h];return Array.isArray(f)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=f):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,f=this.parents[this.parents.length-1];return h>=f.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=f[h],!0)}_init(h,f,g,C){this.container=h,this.idx=f,this.parents=g.slice(),this.indexes=C.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,f){const g=this.getComponent();g&&f(g,h);for(const C of this)h&&h.descend(C),this.traverse(h,f),h&&h.ascend()}eachPick(h,f){this.traverse(h,(g,C)=>{g.p!=null&&f(g.p,C)})}eachDrop(h,f){this.traverse(h,(g,C)=>{g.d!=null&&f(g.d,C)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const f=this.pendingDescent[h];let g=this.idx+1;if(g<this.container.length&&n(this.container[g])&&g++,t(g===this.container.length||!n(this.container[g])),g===this.container.length)this.container.push(f),this.idx=g;else if(this.container[g]===f)this.idx=g;else{if(!Array.isArray(this.container[g])){const C=this.container.splice(g,this.container.length-g);this.container.push(C),this.lcIdx>-1&&(this.lcIdx=g)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(f,this.container[this.lcIdx][0])),g=this.lcIdx+1,this.lcIdx=-1);g<this.container.length&&r(f,this.container[g][0]);)g++;if(this.indexes.push(g),this.idx=0,g<this.container.length&&this.container[g][0]===f)this.container=this.container[g];else{const C=[f];this.container.splice(g,0,C),this.container=C}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const f={};return this.container.splice(h,0,f),f}}write(h,f){const g=this.getComponent();t(g[h]==null||g[h]===f,"Internal consistency error: Overwritten component. File a bug"),g[h]=f}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,f=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const g=this.lcIdx,C=this.parents.length;let I=0;for(let b=0;b<h.length;b++){const U=h[b];typeof U=="string"||typeof U=="number"?(I++,this.descend(U)):Array.isArray(U)?this.mergeTree(U,f):typeof U=="object"&&f(U,this)}for(;I--;)this.ascend();this.lcIdx=this.parents.length===C?g:-1}at(h,f){this.descendPath(h),f(this);for(let g=0;g<h.length;g++)this.ascend();return this}writeAtPath(h,f,g){return this.at(h,()=>this.write(f,g)),this.reset(),this}writeMove(h,f,g=0){return this.writeAtPath(h,"p",g).writeAtPath(f,"d",g)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,f){let g,C;C=g=c?c.descendFirst():!1;function I(b){let U;for(;C;){const Z=U=c.getKey();if(b!=null){let V=!1;if(h&&typeof Z=="number"&&(U=h(Z,c.getComponent()),U<0&&(U=~U,V=!0)),r(U,b))return null;if(U===b&&!V)return c}f&&typeof U=="number"&&f(U,c.getComponent()),C=c.nextSibling()}return null}return I.end=()=>{g&&c.ascend()},I}e.advancer=l;function u(c,h,f){let g,C,I,b;for(g=C=c&&c.descendFirst(),I=b=h&&h.descendFirst();g||I;){let U=g?c.getKey():null,Z=I?h.getKey():null;U!==null&&Z!==null&&(r(Z,U)?Z=null:U!==Z&&(U=null)),f(U==null?Z:U,U!=null?c:null,Z!=null?h:null),U!=null&&g&&(g=c.nextSibling()),Z!=null&&I&&(I=h.nextSibling())}C&&c.ascend(),b&&h.ascend()}e.eachChildOf=u}(Ys)),Ys}var zs={},cl;function hl(){return cl||(cl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(zs)),zs}var wt={},ln={},dl;function Vs(){return dl||(dl=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.uniToStrPos=ln.strPosToUni=void 0,ln.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},ln.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),ln}var Gs={},fl;function Ks(){return fl||(fl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Vs(),n=M=>{if(!Array.isArray(M))throw Error("Op must be an array of components");let T=null;for(let j=0;j<M.length;j++){const Q=M[j];switch(typeof Q){case"object":if(typeof Q.d!="number"&&typeof Q.d!="string")throw Error("Delete must be number or string");if(e.dlen(Q.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Q.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Q>0))throw Error("Skip components must be >0");if(typeof T=="number")throw Error("Adjacent skip components should be combined");break}T=Q}if(typeof T=="number")throw Error("Op has a trailing skip")};function r(M,T){let j=0,Q=0;for(let ge=0;ge<M.length;ge++){const le=M[ge];switch(T(le,j,Q),typeof le){case"object":j+=e.dlen(le.d);break;case"string":Q+=t.strPosToUni(le);break;case"number":j+=le,Q+=le;break}}}e.eachOp=r;function s(M,T){const j=[],Q=a(j);return r(M,(ge,le,p)=>{Q(T(ge,le,p))}),h(j)}const i=M=>M,o=M=>s(M,i);e.dlen=M=>typeof M=="number"?M:t.strPosToUni(M);const a=M=>T=>{if(!(!T||T.d===0||T.d===""))if(M.length===0)M.push(T);else if(typeof T==typeof M[M.length-1])if(typeof T=="object"){const j=M[M.length-1];j.d=typeof j.d=="string"&&typeof T.d=="string"?j.d+T.d:e.dlen(j.d)+e.dlen(T.d)}else M[M.length-1]+=T;else M.push(T)},l=M=>typeof M=="number"?M:typeof M=="string"?t.strPosToUni(M):typeof M.d=="number"?M.d:t.strPosToUni(M.d);e.uniSlice=(M,T,j)=>{const Q=t.uniToStrPos(M,T),ge=j==null?1/0:t.uniToStrPos(M,j);return M.slice(Q,ge)};const u=(M,T,j)=>typeof M=="number"?j==null?M-T:Math.min(M,j)-T:e.uniSlice(M,T,j),c=M=>{let T=0,j=0;return{take:(le,p)=>{if(T===M.length)return le===-1?null:le;const W=M[T];let O;if(typeof W=="number")return le===-1||W-j<=le?(O=W-j,++T,j=0,O):(j+=le,le);if(typeof W=="string"){if(le===-1||p==="i"||t.strPosToUni(W.slice(j))<=le)return O=W.slice(j),++T,j=0,O;{const D=j+t.uniToStrPos(W.slice(j),le);return O=W.slice(j,D),j=D,O}}else{if(le===-1||p==="d"||e.dlen(W.d)-j<=le)return O={d:u(W.d,j)},++T,j=0,O;{let D=u(W.d,j,j+le);return j+=le,{d:D}}}},peek:()=>M[T]}},h=M=>(M.length>0&&typeof M[M.length-1]=="number"&&M.pop(),M);function f(M,T,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(M),n(T);const Q=[],ge=a(Q),{take:le,peek:p}=c(M);for(let O=0;O<T.length;O++){const D=T[O];let y,w;switch(typeof D){case"number":for(y=D;y>0;)w=le(y,"i"),ge(w),typeof w!="string"&&(y-=l(w));break;case"string":j==="left"&&typeof p()=="string"&&ge(le(-1)),ge(t.strPosToUni(D));break;case"object":for(y=e.dlen(D.d);y>0;)switch(w=le(y,"i"),typeof w){case"number":y-=w;break;case"string":ge(w);break;case"object":y-=e.dlen(w.d)}break}}let W;for(;W=le(-1);)ge(W);return h(Q)}function g(M,T){n(M),n(T);const j=[],Q=a(j),{take:ge}=c(M);for(let p=0;p<T.length;p++){const W=T[p];let O,D;switch(typeof W){case"number":for(O=W;O>0;)D=ge(O,"d"),Q(D),typeof D!="object"&&(O-=l(D));break;case"string":Q(W);break;case"object":O=e.dlen(W.d);let y=0;for(;y<O;)switch(D=ge(O-y,"d"),typeof D){case"number":Q({d:u(W.d,y,y+D)}),y+=D;break;case"string":y+=t.strPosToUni(D);break;case"object":Q(D)}break}}let le;for(;le=ge(-1);)Q(le);return h(j)}const C=(M,T)=>{let j=0;for(let Q=0;Q<T.length&&M>j;Q++){const ge=T[Q];switch(typeof ge){case"number":{j+=ge;break}case"string":const le=t.strPosToUni(ge);j+=le,M+=le;break;case"object":M-=Math.min(e.dlen(ge.d),M-j);break}}return M},I=(M,T)=>typeof M=="number"?C(M,T):M.map(j=>C(j,T));function b(M,T,j){return s(M,(Q,ge)=>typeof Q=="object"&&typeof Q.d=="number"?{d:j.slice(T,ge,ge+Q.d)}:Q)}function U(M){return s(M,T=>{switch(typeof T){case"object":if(typeof T.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return T.d;case"string":return{d:T};case"number":return T}})}function Z(M){return s(M,T=>typeof T=="object"&&typeof T.d=="string"?{d:t.strPosToUni(T.d)}:T)}function V(M){let T=!0;return r(M,j=>{typeof j=="object"&&typeof j.d=="number"&&(T=!1)}),T}function fe(M){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(T=""){if(typeof T!="string")throw Error("Initial data must be a string");return M.create(T)},apply(T,j){n(j);const Q=M.builder(T);for(let ge=0;ge<j.length;ge++){const le=j[ge];switch(typeof le){case"number":Q.skip(le);break;case"string":Q.append(le);break;case"object":Q.del(e.dlen(le.d));break}}return Q.build()},transform:f,compose:g,transformPosition:C,transformSelection:I,isInvertible:V,makeInvertible(T,j){return b(T,j,M)},stripInvertible:Z,invert:U,invertWithDoc(T,j){return U(b(T,j,M))},isNoop:T=>T.length===0}}e.default=fe}(Gs)),Gs}var Kr={},gl;function Km(){if(gl)return Kr;gl=1,Object.defineProperty(Kr,"__esModule",{value:!0});const e=Ks(),t=Vs();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return Kr.default=n,n.provides={text:!0},Kr}var ml;function Xm(){return ml||(ml=1,function(e){var t=wt&&wt.__createBinding||(Object.create?function(f,g,C,I){I===void 0&&(I=C),Object.defineProperty(f,I,{enumerable:!0,get:function(){return g[C]}})}:function(f,g,C,I){I===void 0&&(I=C),f[I]=g[C]}),n=wt&&wt.__setModuleDefault||(Object.create?function(f,g){Object.defineProperty(f,"default",{enumerable:!0,value:g})}:function(f,g){f.default=g}),r=wt&&wt.__importStar||function(f){if(f&&f.__esModule)return f;var g={};if(f!=null)for(var C in f)Object.hasOwnProperty.call(f,C)&&t(g,f,C);return n(g,f),g},s=wt&&wt.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=Vs(),o=r(Ks()),a=s(Km()),l={create(f){return f},toString(f){return f},builder(f){if(typeof f!="string")throw Error("Invalid document snapshot: "+f);const g=[];return{skip(C){let I=i.uniToStrPos(f,C);if(I>f.length)throw Error("The op is too long for this document");g.push(f.slice(0,I)),f=f.slice(I)},append(C){g.push(C)},del(C){f=f.slice(i.uniToStrPos(f,C))},build(){return g.join("")+f}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(f,g)=>g.length===0?[]:f===0?[g]:[f,g],e.remove=(f,g)=>o.dlen(g)===0?[]:f===0?[{d:g}]:[f,{d:g}];var h=Ks();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(wt)),wt}var _l;function qm(){return _l||(_l=1,function(e){var t=qn&&qn.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(Vm()),r=t(Gm()),s=ul(),i=hl();function o(v,$){if(!v)throw new Error($)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:v=>v,isNoop:v=>v==null,setDebug(v){},registerSubtype:U,checkValidOp:ge,normalize:le,apply:p,transformPosition:W,compose:O,tryTransform:G,transform:de,makeInvertible:w,invert:D,invertWithDoc:x,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(v,$,K)=>Ae(()=>!0,v,$,K),typeAllowingConflictsPred:v=>Object.assign(Object.assign({},e.type),{transform:($,K,q)=>Ae(v,$,K,q)})};const a=v=>v?v.getComponent():null;function l(v){return v&&typeof v=="object"&&!Array.isArray(v)}const u=v=>Array.isArray(v)?v.slice():v!==null&&typeof v=="object"?Object.assign({},v):v,c=v=>v&&(v.p!=null||v.r!==void 0),h=v=>v&&(v.d!=null||v.i!==void 0);function f(v,$){return o(v!=null),typeof $=="number"?(o(Array.isArray(v),"Invalid key - child is not an array"),(v=v.slice()).splice($,1)):(o(l(v),"Invalid key - child is not an object"),delete(v=Object.assign({},v))[$]),v}function g(v,$,K){return typeof $=="number"?(o(v!=null,"Container is missing for key"),o(Array.isArray(v),"Cannot use numerical key for object container"),o(v.length>=$,"Cannot insert into out of bounds index"),v.splice($,0,K)):(o(l(v),"Cannot insert into missing item"),o(v[$]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),v[$]=K),K}e.removeOp=(v,$=!0)=>s.writeCursor().writeAtPath(v,"r",$).get(),e.moveOp=(v,$)=>s.writeCursor().writeMove(v,$).get(),e.insertOp=(v,$)=>s.writeCursor().writeAtPath(v,"i",$).get(),e.replaceOp=(v,$,K)=>s.writeCursor().at(v,q=>{q.write("r",$),q.write("i",K)}).get(),e.editOp=(v,$,K,q=!1)=>s.writeCursor().at(v,z=>T(z,$,K,q)).get();const C=(v,$)=>v!=null&&(typeof $=="number"?Array.isArray(v):typeof v=="object"),I=(v,$)=>C(v,$)?v[$]:void 0,b={};function U(v){let $=v.type?v.type:v;$.name&&(b[$.name]=$),$.uri&&(b[$.uri]=$)}const Z=v=>{const $=b[v];if($)return $;throw Error("Missing type: "+v)};U(Xm());const V=(v,$)=>v+$;U({name:"number",apply:V,compose:V,invert:v=>-v,transform:v=>v});const fe=v=>v==null?null:v.et?Z(v.et):v.es?b["text-unicode"]:v.ena!=null?b.number:null,M=v=>v.es?v.es:v.ena!=null?v.ena:v.e,T=(v,$,K,q=!1)=>{const[z,Y]=typeof $=="string"?[Z($),$]:[$,$.name];!q&&z.isNoop&&z.isNoop(K)||(Y==="number"?v.write("ena",K):Y==="text-unicode"?v.write("es",K):(v.write("et",Y),v.write("e",K)))};function j(v){o(typeof v=="number"),o(v>=0),o(v===(0|v))}function Q(v){typeof v=="number"?j(v):o(typeof v=="string")}function ge(v){if(v===null)return;const $=new Set,K=new Set,q=Y=>{let ue=!0,ae=!1;for(let H in Y){const ne=Y[H];if(ue=!1,o(H==="p"||H==="r"||H==="d"||H==="i"||H==="e"||H==="es"||H==="ena"||H==="et","Invalid component item '"+H+"'"),H==="p")j(ne),o(!$.has(ne)),$.add(ne),o(Y.r===void 0);else if(H==="d")j(ne),o(!K.has(ne)),K.add(ne),o(Y.i===void 0);else if(H==="e"||H==="es"||H==="ena"){o(!ae),ae=!0;const oe=fe(Y);o(oe,"Missing type in edit"),oe.checkValidOp&&oe.checkValidOp(M(Y))}}o(!ue)},z=(Y,ue,ae)=>{if(!Array.isArray(Y))throw Error("Op must be null or a list");if(Y.length===0)throw Error("Empty descent");ue||Q(Y[0]);let H=1,ne=0,oe=0;for(let _e=0;_e<Y.length;_e++){const ye=Y[_e];if(o(ye!=null),Array.isArray(ye)){const Ue=z(ye,!1);if(ne){const X=typeof oe,Se=typeof Ue;X===Se?o(oe<Ue,"descent keys are not in order"):o(X==="number"&&Se==="string")}oe=Ue,ne++,H=3}else typeof ye=="object"?(o(H===1,`Prev not scalar - instead ${H}`),q(ye),H=2):(o(H!==3),Q(ye),o(s.isValidPathItem(ye),"Invalid path key"),H=1)}return o(ne!==1,"Operation makes multiple descents. Remove some []"),o(H===2||H===3),Y[0]};z(v,!0),o($.size===K.size,"Mismatched picks and drops in op");for(let Y=0;Y<$.size;Y++)o($.has(Y)),o(K.has(Y))}function le(v){let $=0,K=[];const q=s.writeCursor();return q.mergeTree(v,(z,Y)=>{const ue=fe(z);if(ue){const H=M(z);T(Y,ue,ue.normalize?ue.normalize(H):H)}for(const H of["r","p","i","d"])if(z[H]!==void 0){const ne=H==="p"||H==="d"?(ae=z[H],K[ae]==null&&(K[ae]=$++),K[ae]):z[H];Y.write(H,ne)}var ae}),q.get()}function p(v,$){if(ge($),$===null)return v;const K=[];return function q(z,Y){let ue=z,ae=0,H={root:z},ne=0,oe=H,_e="root";function ye(){for(;ne<ae;ne++){let Ue=Y[ne];typeof Ue!="object"&&(o(C(oe,_e)),oe=oe[_e]=u(oe[_e]),_e=Ue)}}for(;ae<Y.length;ae++){const Ue=Y[ae];if(Array.isArray(Ue)){const X=q(ue,Ue);X!==ue&&X!==void 0&&(ye(),ue=oe[_e]=X)}else if(typeof Ue=="object"){Ue.d!=null?(ye(),ue=g(oe,_e,K[Ue.d])):Ue.i!==void 0&&(ye(),ue=g(oe,_e,Ue.i));const X=fe(Ue);if(X)ye(),ue=oe[_e]=X.apply(ue,M(Ue));else if(Ue.e!==void 0)throw Error("Subtype "+Ue.et+" undefined")}else ue=I(ue,Ue)}return H.root}(v=function q(z,Y){const ue=[];let ae=0;for(;ae<Y.length;ae++){const _e=Y[ae];if(Array.isArray(_e))break;typeof _e!="object"&&(ue.push(z),z=I(z,_e))}for(let _e=Y.length-1;_e>=ae;_e--)z=q(z,Y[_e]);for(--ae;ae>=0;ae--){const _e=Y[ae];if(typeof _e!="object"){const ye=ue.pop();z=z===I(ye,_e)?ye:z===void 0?f(ye,_e):(ne=_e,oe=z,(H=u(H=ye))[ne]=oe,H)}else c(_e)&&(o(z!==void 0,"Cannot pick up or remove undefined"),_e.p!=null&&(K[_e.p]=z),z=void 0)}var H,ne,oe;return z}(v,$),$)}function W(v,$){v=v.slice(),ge($);const K=s.readCursor($);let q,z,Y=!1;const ue=[];for(let H=0;;H++){const ne=v[H],oe=K.getComponent();if(oe&&(oe.r!==void 0?Y=!0:oe.p!=null&&(Y=!1,q=oe.p,z=H)),H>=v.length)break;let _e=0;const ye=s.advancer(K,void 0,(X,Se)=>{c(Se)&&_e++});ue.unshift(ye);const Ue=ye(ne);if(typeof ne=="number"&&(v[H]-=_e),!Ue)break}if(ue.forEach(H=>H.end()),Y)return null;const ae=()=>{let H=0;if(q!=null){const ne=K.getPath();H=ne.length,v=ne.concat(v.slice(z))}for(;H<v.length;H++){const ne=v[H],oe=a(K),_e=fe(oe);if(_e){const X=M(oe);_e.transformPosition&&(v[H]=_e.transformPosition(v[H],X));break}let ye=0;const Ue=s.advancer(K,(X,Se)=>h(Se)?~(X-ye):X-ye,(X,Se)=>{h(Se)&&ye++})(ne);if(typeof ne=="number"&&(v[H]+=ye),!Ue)break}};return q!=null?K.eachDrop(null,H=>{H===q&&ae()}):ae(),v}function O(v,$){if(ge(v),ge($),v==null)return $;if($==null)return v;let K=0;const q=s.readCursor(v),z=s.readCursor($),Y=s.writeCursor(),ue=[],ae=[],H=[],ne=[],oe=[],_e=[],ye=new Set;q.traverse(null,X=>{X.p!=null&&(H[X.p]=q.clone())}),z.traverse(null,X=>{X.d!=null&&(ne[X.d]=z.clone())});const Ue=s.writeCursor();return function X(Se,Ge,je,Pe,Ze,Rt,Ke,rt){o(Ge||je);const Xe=a(Ge),ht=a(je),at=!!ht&&ht.r!==void 0,Bt=!!Xe&&Xe.i!==void 0,$e=Xe?Xe.d:null,dt=ht?ht.p:null,E=(Rt||at)&&dt==null;if(dt!=null)Pe=ne[dt],Ke=ae[dt]=new s.WriteCursor;else if(ht&&ht.r!==void 0)Pe=null;else{const L=a(Pe);L&&L.d!=null&&(Pe=null)}const m=a(Pe);if($e!=null)if(Se=H[$e],rt=ue[$e]=new s.WriteCursor,E)Rt&&!at&&rt.write("r",!0);else{const L=oe[$e]=K++;Ke.write("d",L)}else if(Xe&&Xe.i!==void 0)Se=null;else{const L=a(Se);L&&L.p!=null&&(Se=null)}let _;Bt?(o(Ze===void 0),_=Xe.i):_=Ze;const A=(dt==null?!Bt||Rt||at:_===void 0)?null:Ke.getComponent();if(dt!=null){if(!(Ze!==void 0||Bt)){const L=$e!=null?oe[$e]:K++;_e[dt]=L,rt.write("p",L)}}else at&&(Bt||Ze!==void 0||(ht.r,rt.write("r",ht.r)));const N=E?null:fe(Xe),P=fe(m);if((N||P)&&(N&&N.name,P&&P.name),N&&P){o(N===P);const L=M(Xe),te=M(m),Re=N.compose(L,te);T(Ke,N,Re),ye.add(m)}else N?T(Ke,N,M(Xe)):P&&(T(Ke,P,M(m)),ye.add(m));const k=typeof _=="object"&&_!=null;let F=!1,S=0,ee=0,Ee=0,J=0,pe=0;const be=s.advancer(Pe,(L,te)=>h(te)?J-L-1:L-J,(L,te)=>{h(te)&&J++}),ce=s.advancer(Se,(L,te)=>c(te)?S-L-1:L-S,(L,te)=>{c(te)&&S++});if(s.eachChildOf(Ge,je,(L,te,Re)=>{let Te,Fe,xe=L,Ye=L,ft=L;if(typeof L=="number"){let De=L+Ee;Fe=be(De),Ye=De+J;let se=L+ee;Te=ce(se),h(a(Fe))&&(Te=null),xe=se+S,ft=L+pe,o(xe>=0,"p1PickKey is negative"),o(Ye>=0,"p2DropKey is negative");const ut=h(a(te)),He=c(a(Re));(ut||He&&!E)&&pe--,ut&&ee--,He&&Ee--}else Te=ce(L),Fe=be(L);rt.descend(xe),Ke.descend(Ye);const mt=k&&!h(a(te))?_[ft]:void 0,Ce=X(Te,te,Re,Fe,mt,E,Ke,rt);var et,we,Oe;k&&!E?mt!==Ce&&(F||(_=Array.isArray(_)?_.slice():Object.assign({},_),F=!0),et=_,Oe=Ce,typeof(we=ft)=="number"?(o(Array.isArray(et)),o(we<et.length)):(o(!Array.isArray(et)),o(et[we]!==void 0)),Oe===void 0?typeof we=="number"?et.splice(we,1):delete et[we]:et[we]=Oe):o(Ce===void 0),Ke.ascend(),rt.ascend()}),ce.end(),be.end(),A!=null)A.i=_;else if(!Rt&&!at&&dt==null)return _}(q,q.clone(),z,z.clone(),void 0,!1,Y,Ue),Y.reset(),Y.mergeTree(Ue.get()),Y.reset(),Y.get(),ue.map(X=>X.get()),ae.map(X=>X.get()),q.traverse(Y,(X,Se)=>{const Ge=X.p;if(Ge!=null){const je=oe[Ge];je!=null&&Se.write("p",je);const Pe=ue[Ge];Pe&&Pe.get(),Pe&&Se.mergeTree(Pe.get())}else X.r!==void 0&&Se.write("r",X.r)}),Y.reset(),Y.get(),z.traverse(Y,(X,Se)=>{const Ge=X.d;if(Ge!=null){const Pe=_e[Ge];Pe!=null&&Se.write("d",Pe);const Ze=ae[Ge];Ze&&Se.mergeTree(Ze.get())}else X.i!==void 0&&Se.write("i",X.i);const je=fe(X);je&&!ye.has(X)&&T(Se,je,M(X))}),Y.get()}function D(v){if(v==null)return null;const $=new s.ReadCursor(v),K=new s.WriteCursor;let q;const z=[],Y=[];return function ue(ae,H,ne){const oe=ae.getComponent();let _e,ye=!1;if(oe){oe.p!=null&&(H.write("d",oe.p),z[oe.p]=ae.clone()),oe.r!==void 0&&H.write("i",oe.r),oe.d!=null&&(H.write("p",oe.d),ne=void 0),oe.i!==void 0&&(ne=_e=oe.i);const X=fe(oe);X&&(ne===void 0?(q||(q=new Set),q.add(oe)):(M(oe),ne=X.apply(ne,M(oe)),ye=!0))}let Ue=0;for(const X of ae){H.descend(X);const Se=typeof X=="number"?X-Ue:X,Ge=I(ne,Se);h(ae.getComponent())&&Ue++;const je=ue(ae,H,Ge);if(ne!==void 0&&je!==void 0){if(ye||(ye=!0,ne=u(ne)),!C(ne,Se))throw Error("Cannot modify child - invalid operation");ne[Se]=je}H.ascend()}if(_e===void 0)return ye?ne:void 0;H.write("r",ne)}($,K,void 0),q&&(K.reset(),function ue(ae,H,ne){const oe=H.getComponent();if(oe){const X=oe.d;if(X!=null&&(ae=z[X],ne=Y[X]=s.writeCursor()),q.has(oe)){const Se=fe(oe);if(!Se.invert)throw Error(`Cannot invert subtype ${Se.name}`);T(ne,Se,Se.invert(M(oe)))}}let _e=0,ye=0;const Ue=s.advancer(ae,(X,Se)=>c(Se)?_e-X-1:X-_e,(X,Se)=>{c(Se)&&_e++});for(const X of H)if(typeof X=="number"){const Se=X-ye,Ge=Ue(Se),je=Se+_e;ne.descend(je),ue(Ge,H,ne),h(H.getComponent())&&ye++,ne.ascend()}else ne.descend(X),ue(Ue(X),H,ne),ne.ascend();Ue.end()}($.clone(),$,K),Y.length&&(K.reset(),$.traverse(K,(ue,ae)=>{const H=ue.p;if(H!=null){const ne=Y[H];ne&&ne.get(),ne&&ae.mergeTree(ne.get())}}))),K.get()}const y=(v,$)=>v.some(K=>typeof K=="object"&&(Array.isArray(K)?y(K,$):$(K)));function w(v,$){if(v==null||!y(v,H=>{var ne;return H.r!==void 0||((ne=fe(H))===null||ne===void 0?void 0:ne.makeInvertible)!=null}))return v;const K=new s.ReadCursor(v),q=new s.WriteCursor;let z=!1;const Y=[],ue=[],ae=(H,ne,oe)=>{const _e=H.getComponent();let ye=!1;if(_e){_e.d!=null&&ne.write("d",_e.d),_e.i!==void 0&&ne.write("i",_e.i);const X=_e.p;if(X!=null&&(Y[X]=H.clone(),o(oe!==void 0,"Operation picks up at an invalid key"),ue[X]=oe,ne.write("p",_e.p)),_e.r!==void 0&&oe===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Se=fe(_e);Se&&(Se.makeInvertible?z=!0:T(ne,Se,M(_e),!0))}let Ue=0;for(const X of H){ne.descend(X);const Se=typeof X=="number"?X-Ue:X,Ge=I(oe,Se),je=ae(H,ne,Ge);Ge!==je&&(ye||(ye=!0,oe=u(oe)),je===void 0?(oe=f(oe,Se),typeof X=="number"&&Ue++):oe[Se]=je),ne.ascend()}return _e&&(_e.r!==void 0?(ne.write("r",r.default(oe)),oe=void 0):_e.p!=null&&(oe=void 0)),oe};return ae(K,q,$),q.get(),z&&(q.reset(),function H(ne,oe,_e,ye,Ue){const X=oe.getComponent();if(X){X.i!==void 0?(ye=X.i,Ue=!0):X.d!=null&&(ye=ue[X.d],ne=Y[X.d],Ue=!1,X.d);let Pe=fe(X);if(Pe&&Pe.makeInvertible){const Ze=M(X);T(_e,Pe,Pe.makeInvertible(Ze,ye),!0)}}let Se=0,Ge=0;const je=s.advancer(ne,(Pe,Ze)=>c(Ze)?Se-Pe-1:Pe-Se,(Pe,Ze)=>{c(Ze)&&Se++});for(const Pe of oe)if(typeof Pe=="number"){const Ze=Pe-Ge,Rt=je(Ze),Ke=Ze+Se,rt=I(ye,Ue?Ze:Ke);_e.descend(Pe),H(Rt,oe,_e,rt,Ue),h(oe.getComponent())&&Ge++,_e.ascend()}else{const Ze=I(ye,Pe);_e.descend(Pe),H(je(Pe),oe,_e,Ze,Ue),_e.ascend()}je.end()}(K.clone(),K,q,$,!1)),q.get()}function x(v,$){return D(w(v,$))}const B=v=>{if(v==null)return null;const $=v.slice();for(let K=0;K<v.length;K++){const q=$[K];Array.isArray(q)&&($[K]=B(q))}return $};function G(v,$,K){o(K==="left"||K==="right","Direction must be left or right");const q=K==="left"?0:1;if($==null)return{ok:!0,result:v};ge(v),ge($);let z=null;const Y=[],ue=[],ae=[],H=[],ne=[],oe=[],_e=[],ye=[],Ue=[],X=[],Se=[],Ge=[],je=[],Pe=[],Ze=[];let Rt=0;const Ke=s.readCursor(v),rt=s.readCursor($),Xe=s.writeCursor();if(function m(_,A=null,N){const P=a(A);P&&(P.r!==void 0?N=A.clone():P.p!=null&&(N=null,oe[P.p]=_.clone()));const k=_.getComponent();let F;k&&(F=k.p)!=null&&(ne[F]=A?A.clone():null,ae[F]=_.clone(),N&&(X[F]=!0,Ue[F]=N),P&&P.p!=null&&(Pe[F]=P.p));const S=s.advancer(A);for(const ee of _)m(_,S(ee),N);S.end()}(rt,Ke,null),function m(_,A,N,P,k){const F=N.getComponent();let S,ee=!1;F&&((S=F.d)!=null?(H[S]=N.clone(),P!=null&&(Ze[P]==null&&(Ze[P]=[]),Ze[P].push(S)),X[S],_=ne[S]||null,A=ae[S]||null,X[S]?(k&&(Se[S]=!0),k=Ue[S]||null):!k||q!==1&&Pe[S]!=null||z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.moveOp(A.getPath(),N.getPath())}),ee=!0):F.i!==void 0&&(_=A=null,ee=!0,k&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.insertOp(N.getPath(),F.i)})));const Ee=a(_);Ee&&(Ee.r!==void 0?k=_.clone():Ee.p!=null&&(Ee.p,P=Ee.p,k=null));const J=fe(F);J&&k&&z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(k.getPath()),op2:e.editOp(N.getPath(),J,M(F),!0)});let pe=0,be=0;const ce=s.advancer(A,(te,Re)=>c(Re)?pe-te-1:te-pe,(te,Re)=>{c(Re)&&pe++}),L=s.advancer(_);for(const te of N)if(typeof te=="number"){const Re=te-be,Te=ce(Re);be+=+m(L(Re+pe),Te,N,P,k)}else{const Re=ce(te);m(L(te),Re,N,P,k)}return ce.end(),L.end(),ee}(Ke,rt,rt.clone(),null,null),H.map(m=>m&&m.get()),z)return{ok:!1,conflict:z};Se.map(m=>!!m);const ht=[];let at=null;(function m(_,A,N,P,k){let F=!1;const S=a(A);if(c(S)){const ce=S.p;ce!=null?(N=H[ce],P=Ge[ce]=s.writeCursor(),F=!0,k=null):(N=null,k=A.clone())}else h(a(N))&&(N=null);const ee=_.getComponent();if(ee){const ce=ee.p;ce!=null?(k&&(ye[ce]=k),ht[ce]=k||q===1&&F?null:P.getComponent(),Y[ce]=_.clone(),N&&(_e[ce]=N.clone())):ee.r!==void 0&&(k||P.write("r",!0),(k||F)&&(at==null&&(at=new Set),at.add(ee)))}let Ee=0,J=0;const pe=s.advancer(A,void 0,(ce,L)=>{c(L)&&Ee++}),be=s.advancer(N,(ce,L)=>h(L)?~(ce-J):ce-J,(ce,L)=>{h(L)&&J++});if(_)for(const ce of _)if(typeof ce=="string"){const L=pe(ce),te=be(ce);P.descend(ce),m(_,L,te,P,k),P.ascend()}else{const L=pe(ce),te=ce-Ee,Re=c(a(L))?null:be(te),Te=te+J;o(Te>=0),P.descend(Te),m(_,L,Re,P,k),P.ascend()}pe.end(),be.end()})(Ke,rt,rt.clone(),Xe,null),Xe.reset();let Bt=[];if(function m(_,A,N,P,k,F){o(A);const S=A.getComponent();let ee=a(P),Ee=!1;const J=(we,Oe,De)=>we?e.moveOp(we.getPath(),Oe.getPath()):e.insertOp(Oe.getPath(),De.i);if(h(S)){const we=S.d;we!=null&&(ue[we]=A.clone());const Oe=we!=null?ht[we]:null;let De=!1;if(S.i!==void 0||we!=null&&Oe){let se;ee&&(ee.i!==void 0||(se=ee.d)!=null&&!X[se])&&(De=se!=null?we!=null&&we===Pe[se]:n.default(ee.i,S.i),De||se!=null&&q!==1&&Pe[se]!=null||z==null&&(z={type:i.ConflictType.DROP_COLLISION,op1:J(we!=null?Y[we]:null,A,S),op2:J(se!=null?ae[se]:null,P,ee)})),De||(F?z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:J(we!=null?Y[we]:null,A,S),op2:e.removeOp(F.getPath())}):(we!=null?(Bt[Rt]=we,k.write("d",Oe.p=Rt++)):k.write("i",r.default(S.i)),Ee=!0))}else if(we!=null&&!Oe){const se=ye[we];se&&(F=se.clone())}we!=null?(_=Y[we],N=oe[we],P=_e[we]):S.i!==void 0&&(_=N=null,De||(P=null))}else c(a(_))&&(_=N=P=null);const pe=a(_),be=a(N);if(c(be)){const we=be.p;be.r!==void 0&&(!pe||pe.r===void 0)||X[we]?(P=null,F=N.clone()):we!=null&&(P=H[we],q!==1&&Pe[we]!=null||((k=je[we])||(k=je[we]=s.writeCursor()),k.reset(),F=null))}else!h(S)&&h(ee)&&(P=null);ee=P!=null?P.getComponent():null;const ce=fe(S);if(ce){const we=M(S);if(F)z==null&&(z={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(A.getPath(),ce,we,!0),op2:e.removeOp(F.getPath())});else{const Oe=fe(ee);let De;if(Oe){if(ce!==Oe)throw Error("Transforming incompatible types");const se=M(ee);De=ce.transform(we,se,K)}else De=r.default(we);T(k,ce,De)}}let L=0,te=0,Re=0,Te=0,Fe=0,xe=0,Ye=_!=null&&_.descendFirst(),ft=Ye;const mt=s.advancer(N,void 0,(we,Oe)=>{c(Oe)&&Re++});let Ce=P!=null&&P.descendFirst(),et=Ce;for(const we of A)if(typeof we=="number"){let Oe;const De=h(A.getComponent()),se=we-te;{let Zt;for(;Ye&&typeof(Zt=_.getKey())=="number";){Zt+=L;const At=_.getComponent(),Dn=c(At);if(Zt>se||Zt===se&&(!Dn||q===0&&De))break;if(Dn){L--;const hn=At.p;Pe.includes(hn),At.d,a(je[At.d]),c(a(je[At.d])),(At.r===void 0||at&&at.has(At))&&(hn==null||!ht[hn]||q!==1&&Pe.includes(hn))||Fe--}Ye=_.nextSibling()}Oe=Ye&&Zt===se?_:null}const ut=se-L;let He=mt(ut);const Dt=ut-Re;let ss=null;{let Zt,At;for(;Ce&&typeof(Zt=P.getKey())=="number";){At=Zt-Te;const Dn=P.getComponent(),hn=h(Dn);if(At>Dt)break;if(At===Dt){if(!hn){ss=P;break}{if(q===0&&De){ss=P;break}const Qt=He&&c(He.getComponent());if(q===0&&Qt)break}}if(hn){const Qt=Dn.d;X[Qt],Pe[Qt],Dn.i===void 0&&(X[Qt]||Pe[Qt]!=null&&q!==1)?(X[Qt]||Pe[Qt]!=null&&q===0)&&(Te++,xe--):Te++}Ce=P.nextSibling()}}const qu=Dt+Te+Fe+xe;o(qu>=0,"trying to descend to a negative index"),k.descend(qu),De&&(Oe=He=ss=null,te++),m(Oe,A,He,ss,k,F)&&xe++,k.ascend()}else{let Oe;for(;Ye&&(Oe=_.getKey(),typeof Oe!="string"||!(Oe>we||Oe===we));)Ye=_.nextSibling();const De=Ye&&Oe===we?_:null,se=mt(we);let ut;for(;Ce&&(ut=P.getKey(),typeof ut!="string"||!(ut>we||ut===we));)Ce=P.nextSibling();const He=Ce&&ut===we?P:null;k.descend(we),m(De,A,se,He,k,F),k.ascend()}return mt.end(),ft&&_.ascend(),et&&P.ascend(),Ee}(Ke,Ke.clone(),rt,rt.clone(),Xe,null),z)return{ok:!1,conflict:z};Xe.reset();const $e=(m,_,A)=>m.traverse(_,(N,P)=>{N.d!=null&&A(N.d,m,P)});(X.length||Ge.length)&&($e(rt,Xe,(m,_,A)=>{X[m]&&!Se[m]&&A.write("r",!0),Ge[m]&&A.mergeTree(Ge[m].get())}),Xe.reset());const dt=[],E=[];if((je.length||X.length)&&!z){const m=s.readCursor(B(Xe.get()));if($e(m,null,(_,A)=>{dt[_]=A.clone()}),je.forEach(_=>{_&&$e(s.readCursor(_.get()),null,(A,N)=>{dt[A]=N.clone()})}),function _(A,N,P,k,F,S){const ee=a(N);if(ee&&c(ee))if(ee.p!=null){const L=ee.p;dt[L].getPath(),P=dt[L],k=E[L]=s.writeCursor()}else ee.r!==void 0&&(P=null);else h(a(P))&&(P=null);const Ee=A.getComponent();if(Ee){let L;if((L=Ee.d)!=null){const te=je[L];te&&(te.get(),k.mergeTree(te.get()),P=s.readCursor(te.get()))}}let J=0,pe=0;const be=s.advancer(N,void 0,(L,te)=>{c(te)&&J--}),ce=s.advancer(P,(L,te)=>h(te)?-(L-pe)-1:L-pe,(L,te)=>{h(te)&&pe++});for(const L of A)if(typeof L=="number"){const te=be(L),Re=L+J,Te=ce(Re),Fe=Re+pe;k.descend(Fe),_(A,te,Te,k),k.ascend()}else k.descend(L),_(A,be(L),ce(L),k),k.ascend();be.end(),ce.end()}(rt,m,m.clone(),Xe),Xe.reset(),z)return{ok:!1,conflict:z};if(Xe.get(),E.length){const _=E.map(N=>N?N.get():null),A=s.readCursor(B(Xe.get()));if($e(A,Xe,(N,P,k)=>{const F=_[N];F&&(k.mergeTree(F),_[N]=null)}),_.find(N=>N)){const N=s.writeCursor(),P=s.writeCursor();let k=0,F=0;_.forEach(S=>{S!=null&&$e(s.readCursor(S),null,ee=>{const Ee=Bt[ee];N.writeMove(Y[Ee].getPath(),ue[Ee].getPath(),k++);const J=Ze[Ee];J&&J.forEach(pe=>{X[pe]||q!==1&&Pe[pe]!=null||P.writeMove(ae[pe].getPath(),H[pe].getPath(),F++)})})}),z={type:i.ConflictType.BLACKHOLE,op1:N.get(),op2:P.get()}}}}return z?{ok:!1,conflict:z}:{ok:!0,result:Xe.get()}}const ie=v=>{const $=new Error("Transform detected write conflict");throw $.conflict=v,$.type=$.name="writeConflict",$};function de(v,$,K){const q=G(v,$,K);if(q.ok)return q.result;ie(q.conflict)}const me=v=>{const $=s.writeCursor();return s.readCursor(v).traverse($,(K,q)=>{(h(K)||fe(K))&&q.write("r",!0)}),$.get()},Me=(v,$)=>{const{type:K,op1:q,op2:z}=v;switch(K){case i.ConflictType.DROP_COLLISION:return $==="left"?[null,me(z)]:[me(q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let Y=!1;return s.readCursor(q).traverse(null,ue=>{ue.r!==void 0&&(Y=!0)}),Y?[null,me(z)]:[me(q),null];case i.ConflictType.BLACKHOLE:return[me(q),me(z)];default:throw Error("Unrecognised conflict: "+K)}};function Ae(v,$,K,q){let z=null;for(;;){const Y=G($,K,q);if(Y.ok)return O(z,Y.result);{const{conflict:ue}=Y;v(ue)||ie(ue);const[ae,H]=Me(ue,q);$=O(le($),ae),K=O(le(K),H),z=O(z,H)}}}}(qn)),qn}var pl;function Jm(){return pl||(pl=1,function(e){var t=an&&an.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=an&&an.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(qm(),e);var r=ul();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=hl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(an)),an}var gt=Jm();const Zm=Ju({__proto__:null,default:pt(gt)},[gt]);var he=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(he||{});function Jn(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();mo(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function El(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:f,ed:g}=h;if(g<=r)i.push(h);else if(r>f&&r<g){a=!0;const C={...h,ed:r};i.push(C),l.length&&i.push(...l);const I={...h,st:r+n,ed:g+n};i.push(I)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=Jn(i)}function Cl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Yn("startIndex"))}}function Rl(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yn("startIndex"))}}function Il(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yn("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Sl(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Yn("startIndex"))}}const vl="$",Ol=e=>e.split(vl)[0];function Xs(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Ol(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Ol(i.rangeId),i.rangeId===n.rangeId&&il(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${vl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function qs(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function wl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Js(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function Qm(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;qs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=Xs(s)}function e_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Js(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=wl(s)}function bl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:f}=c;if(s<=h&&i>=f){o.push({...c,st:h-s,ed:f-s});continue}else h<=s&&f>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<f?(o.push({...c,st:s-s,ed:f-s}),c.ed=s):i>h&&i<=f?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function yl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function Al(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function Tl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Nl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:f}=c;if(s<=h&&i>=f){o.push({...c,startIndex:h-n,endIndex:f-n});continue}else if(h<=s&&f>=i){const g=kr(h,f,s,i);if(g.length===0||(c.startIndex=g[0],c.endIndex=g[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function t_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:f}=c;if(h>=s&&f<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,f)){const g=kr(h,f,s,i);if(g.length===0)continue;c.startIndex=g[0],c.endIndex=g[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=Xs(a)}return o}function n_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:f,endIndex:g}=h;if(f>=i&&g<=o){a.push(h);continue}else if(Math.max(i,f)<=Math.min(o,g)){const C=kr(f,g,i,o);if(C.length===0)continue;h.startIndex=C[0],h.endIndex=C[1]}else o<f&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Ml=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e))(Ml||{}),Mt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Mt||{});const Xr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},Rn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:zn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),In=e=>e.map((t,n)=>({...t,bulletAlignment:zn.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Dl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:zn.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),Zn={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Rn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Rn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Rn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Rn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Rn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Rn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:In([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:In([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:In(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:In([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:In([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:In([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Dl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Dl("☑",{st:{s:ve.TRUE}})}},qr=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(Zn.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},r_={ORDER_LIST_QUICK_2:qr(Xr["a)"]),ORDER_LIST_QUICK_3:qr(Xr["a."]),ORDER_LIST_QUICK_4:qr(Xr["i."]),ORDER_LIST_QUICK_6:qr(Xr["I."])};Object.assign(Zn,r_);const s_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5"};function i_(e,t,n,r,s){const i=o_(e,t,n,r,s),o=a_(e,t,n,r,s),a=l_(e,t,n,r,s),l=u_(e,t,n,r,s),u=c_(e,t,n,r,s),c=h_(e,t,n,r),h=d_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function o_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=bl(e,n,r);if(s!==ke.REPLACE){const l=Ll(o,a,s);t.textRuns=l}return El(e,t,n,r),a}function Ll(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:g,ed:C,ts:I}=e[o],{st:b,ed:U,ts:Z,sId:V}=t[a];let fe;if(n===ke.COVER?fe={...Z,...I}:fe={...I},C<b)u()||r.push(e[o]),o++;else if(U<g)u()||r.push(t[a]),a++;else{const M={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...I}:{...Z},sId:g<b?void 0:V};M.ed>M.st&&r.push(M),r.push({st:Math.max(g,b),ed:Math.min(C,U),ts:fe,sId:V}),C<U?(o++,t[a].st=C,t[a].st===t[a].ed&&a++):(a++,e[o].st=U,e[o].st===e[o].ed&&o++);const T={st:Math.min(C,U),ed:Math.max(C,U),ts:C<U?{...Z}:{...I},sId:C<U?V:void 0};l=T.ed>T.st?T:null}}u();const c=r[r.length-1],h=e[s-1],f=t[i-1];return c&&c.ed!==Math.max(h.ed,f.ed)&&(h.ed>f.ed?r.push(h):r.push(f)),Jn(r)}function a_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=yl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:f}=u;let g=[];for(const C of a){const{startIndex:I,paragraphStyle:b,bullet:U}=C;let Z,V;if(s===ke.COVER?(Z={...b,...h},V={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...U,...f}):(Z={...h,...b},V={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...U}),c===I){g.push({startIndex:c,paragraphStyle:Z,bullet:V});break}}l.push(...g),g=[]}t.paragraphs=l}return Cl(e,t,n,r),a}function l_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Al(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const f of a){const{startIndex:g}=f;if(c===g){s===ke.COVER?h.push({...f,...u}):h.push({...u,...f});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Rl(e,t,n,r),a}function u_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Tl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const f of a){const{startIndex:g}=f;if(c===g){s===ke.COVER?h.push({...f,...u}):h.push({...u,...f});break}}l.push(...h),h=[]}t.customBlocks=l}return Il(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function c_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Nl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let f=[];for(const g of a){const{startIndex:C,endIndex:I}=g;if(C>=c&&I<=h){s===ke.COVER?f.push({...g,...u}):f.push({...u,...g});break}}l.push(...f),f=[]}t.tables=l}return Sl(e,t,n,r),a}function h_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),qs(e.customRanges,r),qs(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:f,endIndex:g}=h;f>=i&&g<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:f,endIndex:g}=h;l.push({...h,startIndex:f+r,endIndex:g+r})}),e.customRanges=Xs(l),c):[]}function d_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Js(e.customDecorations,r),Js(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===ke.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===rn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=wl(o),i}var Zs=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(Zs||{});function Jr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return Jn(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Ul(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function kl(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function f_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Pl(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function bt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Jr(e,t,n,r);const a=Ul(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=kl(e,t,n),s===1){const u=xl(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=Fl(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Pl(e,t,n),o}function g_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Fl(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function xl(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function m_(e,t,n){return e==null||t==null?e!=null?e:t:Ll(e,t,n)}function __(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===ke.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function p_(e,t,n){return t.length===0||e.length===0||n===ke.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Qs(e,t,n=ke.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=m_(l,s,n),r.customRanges=__(c,o,n);const f=p_(h,a,n);f.length&&(r.customDecorations=f);const g=[];let C=0,I=0;for(;C<i.length&&I<u.length;){const b=i[C],U=u[I],{startIndex:Z}=b,{startIndex:V}=U;Z===V?(g.push(re.deepMerge(b,U)),C++,I++):Z<V?(g.push(re.deepClone(b)),C++):(g.push(re.deepClone(U)),I++)}return C<i.length&&g.push(...i.slice(C)),I<u.length&&g.push(...u.slice(I)),g.length&&(r.paragraphs=g),r}function E_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Sn{constructor(t){R(this,"_index",0);R(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===he.DELETE||n.t===he.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:bt(n.body,r,r+t,!1)})}else return{t:he.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:he.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class vn{constructor(){R(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function $l(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=bl(e,t,n),a=yl(e,t,n),l=Al(e,t,n),u=Tl(e,t,n),c=Nl(e,t,n),h=t_(e,t,n),f=n_(e,t,n);let g="";return r&&(e.dataStream=yo(r,s,i),g=r.slice(s,i)),{dataStream:g,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:f}}function Bl(e,t,n,r){e.dataStream=bo(e.dataStream,r,t.dataStream),El(e,t,n,r),Cl(e,t,n,r),Rl(e,t,n,r),Il(e,t,n,r),Sl(e,t,n,r),Qm(e,t,n,r),e_(e,t,n,r)}function C_(e,t,n,r,s=ke.COVER){return i_(e,t,n,r,s)}function R_(e,t,n){return t<=0?{dataStream:""}:$l(e,t,n)}function I_(e,t,n,r){n!==0&&Bl(e,t,n,r)}function S_(e,t){const n=new vn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case he.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&C_(e,o,a,n.cursor,i),n.moveCursor(a);break}case he.INSERT:{const{body:i,len:o}=s;I_(e,i,o,n.cursor),n.moveCursor(o);break}case he.DELETE:{const{len:i}=s;R_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function v_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:I,ed:b,ts:U}=t[l],{st:Z,ed:V,ts:fe,sId:M}=e[u];let T={};if(s===0)T={...U},n===ke.COVER&&r===ke.REPLACE&&fe&&(T=Object.assign({},fe,T));else if(T={...U},n===ke.REPLACE){if(r===ke.REPLACE)T={...fe};else if(U&&fe){const j=Object.keys(U);for(const Q of j)fe[Q]&&delete T[Q]}}else if(r===ke.REPLACE){if(fe){const j=Object.keys(fe);for(const Q of j)fe[Q]!==void 0&&(T[Q]=fe[Q])}}else if(fe){const j=Object.keys(fe);for(const Q of j)T[Q]!==void 0&&delete T[Q]}if(b<Z)h()||i.push(t[l]),l++;else if(V<I)h()||i.push(e[u]),u++;else{const j={st:Math.min(I,Z),ed:Math.max(I,Z),ts:I<Z?{...U}:{...fe}};j.ed>j.st&&i.push(),i.push({st:Math.max(I,Z),ed:Math.min(b,V),ts:T,sId:M}),b<V?(l++,e[u].st=b,e[u].st===e[u].ed&&u++):(u++,t[l].st=V,t[l].st===t[l].ed&&l++);const Q={st:Math.min(b,V),ed:Math.max(b,V),ts:b<V?{...fe}:{...U},sId:b<V?M:void 0};c=Q.ed>Q.st?Q:null}}h();const f=i[i.length-1],g=t[o-1],C=e[a-1];return f.ed!==Math.max(g.ed,C.ed)&&(g.ed>C.ed?i.push(g):i.push(C)),Jn(i,!0)}function O_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===ke.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===ke.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function Hl(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===ke.REPLACE)if(r===ke.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===ke.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===ke.REPLACE&&r===ke.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===ke.REPLACE||r===ke.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function w_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===rn.DELETED||i===rn.DELETED)&&(o=!0,n.push({...r,type:rn.DELETED}));break}o||n.push(r)}return n}function b_(e,t,n=!1){const{body:r,coverType:s=ke.COVER}=e,{body:i,coverType:o=ke.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:f}=r,{textRuns:g,paragraphs:C=[],customRanges:I,customDecorations:b}=i,U=v_(u,g,s,o,n?1:0);U&&(a.textRuns=U);const Z=O_(h,I,s,o,n?1:0);Z&&(a.customRanges=Z);const V=w_(f,b);V&&(a.customDecorations=V);const fe=[];let M=0,T=0;for(;M<c.length&&T<C.length;){const j=c[M],Q=C[T],{startIndex:ge}=j,{startIndex:le}=Q;if(ge===le){let p={startIndex:ge};n?p=Hl(j,Q,s,o,1):p=Hl(j,Q,s,o,0),fe.push(p),M++,T++}else ge<le?M++:(fe.push(re.deepClone(Q)),T++)}return T<C.length&&fe.push(...C.slice(T)),fe.length&&(a.paragraphs=fe),{coverType:l,body:a}}function Wl(e){return Object.keys(e).length===1}const Nn=class Nn{constructor(){R(this,"_actions",[])}static apply(t,n){return S_(t,n)}static compose(t,n){const r=new Sn(t),s=new Sn(n),i=new Nn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===he.INSERT)i.push(s.next());else if(r.peekType()===he.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===he.INSERT&&l.t===he.RETAIN)l.body==null?i.push(a):i.push({...a,body:Qs(a.body,l.body,l.coverType)});else if(a.t===he.RETAIN&&l.t===he.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===ke.REPLACE||l.coverType===ke.REPLACE?ke.REPLACE:ke.COVER;i.push({...a,t:he.RETAIN,coverType:u,body:Qs(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===he.RETAIN&&l.t===he.DELETE?i.push(l):a.t===he.INSERT&&(l.t,he.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Sn(t),i=new Sn(n),o=new Nn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===he.INSERT&&(r==="left"||i.peekType()!==he.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===he.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===he.DELETE)continue;if(u.t===he.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=b_(l,u,r==="left");o.push({...u,t:he.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Sn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===he.DELETE){n-=Math.min(o,n-i);continue}else a===he.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===he.INSERT)n.push({t:he.DELETE,len:r.len,body:r.body});else if(r.t===he.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:he.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:he.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:ke.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===he.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=bt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===he.RETAIN&&i.body!=null){const o=bt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==he.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:he.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:he.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:he.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===he.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===he.DELETE&&s.t===he.DELETE)return r.len+=s.len,this;if(r.t===he.DELETE&&s.t===he.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===he.RETAIN&&s.t===he.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===he.INSERT&&Wl(r.body)&&s.t===he.INSERT&&Wl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===he.RETAIN&&E_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};R(Nn,"id","text-x"),R(Nn,"uri","https://github.com/dream-num/univer#text-x");let ze=Nn;Object.defineProperty(ze,"name",{value:"text-x"});const Mn=class Mn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==ze.id||(this._subTypes.set(t.name,t),gt.type.registerSubtype(t))}static apply(t,n){if(!gt.type.isNoop(n))return gt.type.apply(t,n)}static compose(t,n){return gt.type.compose(t,n)}static transform(t,n,r){return gt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===ze.name?ze.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return gt.type.invertWithDoc(t,n)}static isNoop(t){return gt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Mn),this._instance}removeOp(t,n){return gt.removeOp(t,n)}moveOp(t,n){return gt.moveOp(t,n)}insertOp(t,n){return gt.insertOp(t,n)}replaceOp(t,n,r){return gt.replaceOp(t,n,r)}editOp(t,n=["body"]){return gt.editOp(n,ze.name,t)}};R(Mn,"uri","https://github.com/dream-num/univer#json-x"),R(Mn,"_subTypes",new Map),R(Mn,"_instance",null);let xt=Mn;xt.registerSubtype(ze);const ei={id:"default_doc",documentStyle:{}};class y_ extends zr{constructor(n){var r;super();R(this,"type",Be.UNIVER_DOC);R(this,"_name$",new Ie.BehaviorSubject(""));R(this,"name$",this._name$.asObservable());R(this,"snapshot");this.snapshot={...ei,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...Zn,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class yt extends y_{constructor(n){var s,i;super(re.isEmptyObject(n)?zm():n);R(this,"_unitId");R(this,"headerModelMap",new Map);R(this,"footerModelMap",new Map);R(this,"change$",new Ie.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...ei,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!xt.isNoop(n))return this.snapshot=xt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=Zs.copy){const i=this.getBody();if(i!=null)return bt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new yt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new yt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return $r((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function A_(e){const{ranges:t,id:n,type:r}=e,s=new ze;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:he.RETAIN,len:l-i}),s.push({t:he.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function T_(e){var c,h,f;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(f=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:f.find(g=>g.id===t);if(!i)return!1;const o=new ze,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:he.RETAIN,len:a}),o.push({t:he.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:rn.DELETED}]}}),o}function jl(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function N_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):jl(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function M_(e){return{...re.deepClone(e),rangeId:kt()}}function D_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Yl(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function L_(e,t){var i,o,a,l,u;const n=Yl(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function U_(e){var h,f,g;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(f=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:f.find(C=>C.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new ze,u=a-o+1;l.push({t:he.RETAIN,len:o}),l.push({t:he.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:he.INSERT,body:s,len:s.dataStream.length});const c=a+1+((g=s==null?void 0:s.dataStream.length)!=null?g:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function k_(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new ze;let u=!1;return t.forEach(c=>{var V,fe,M;const h=L_(c,o);if(!h||!o)return!1;const{startOffset:f,endOffset:g}=h,C=(V=o.customRanges)!=null?V:[],I=(T,j,Q)=>{var O,D,y,w;const ge=Yl(T,j,C,r),le=Math.min((D=(O=ge[0])==null?void 0:O.startIndex)!=null?D:1/0,T),p=Math.max((w=(y=ge[ge.length-1])==null?void 0:y.endIndex)!=null?w:-1/0,j),W={rangeId:Q?`${n}$${Q}`:n,rangeType:r,startIndex:0,endIndex:p-le,wholeEntity:s,properties:{...i}};l.push({t:he.RETAIN,len:le-a}),l.push({t:he.RETAIN,len:p-le+1,body:{dataStream:"",customRanges:[W]},coverType:ke.COVER}),a=p+1},b=((fe=o.paragraphs)!=null?fe:[]).filter(T=>T.startIndex<g&&T.startIndex>f),U=((M=o.customBlocks)!=null?M:[]).filter(T=>T.startIndex<g&&T.startIndex>f);D_([f,g-1],[...b.map(T=>T.startIndex),...U.map(T=>T.startIndex)]).forEach(([T,j],Q)=>I(T,j,Q)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function zl(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:he.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:he.DELETE,len:h-l}),l=h)}),r&&i.push({t:he.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:he.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:ke.REPLACE}))}return i}function P_(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:he.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:he.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const F_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=Ws(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([f,g])=>{switch(f){case 0:{const C={t:he.RETAIN,body:{...bt(n,l,l+g.length,!1),dataStream:""},len:g.length};return l+=g.length,C}case 1:{const C={t:he.INSERT,body:bt(n,l,l+g.length),len:g.length};return l+=g.length,C}default:return{t:he.DELETE,len:g.length}}}),c=new ze;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function x_(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const $_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=Ws(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([f,g])=>{switch(f){case 0:{const C=Jr(n,l,l+g.length,!1),I=Jr(o,l,l+g.length,!1),b={t:he.RETAIN,body:x_(C,I)?void 0:{textRuns:C,dataStream:""},len:g.length};return l+=g.length,b}case 1:{const C={t:he.INSERT,body:bt(n,l,l+g.length),len:g.length};return l+=g.length,C}default:return{t:he.DELETE,len:g.length}}});if(u.every(f=>f.t===he.RETAIN&&!f.body))return!1;const c=new ze;return c.push({t:he.RETAIN,len:t.startOffset}),c.push(...u),c};function B_(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function H_(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const W_=e=>{var I,b,U,Z;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new ze,l=xt.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(b=(I=n.getSnapshot().drawingsOrder)==null?void 0:I.length)!=null?b:0;let f=0;if(s)i>0&&a.push({t:he.RETAIN,len:i});else{const V=zl([t],c,0,null,!1);a.push(...V);const fe=B_(c,[t]),M=(U=n.getDrawings())!=null?U:{},T=(Z=n.getDrawingsOrder())!=null?Z:[],j=fe.sort((Q,ge)=>T.indexOf(Q)>T.indexOf(ge)?-1:T.indexOf(Q)<T.indexOf(ge)?1:0);if(j.length>0)for(const Q of j){const ge=M[Q],le=T.indexOf(Q);if(ge==null||le<0)continue;const p=l.removeOp(["drawings",Q],ge),W=l.removeOp(["drawingsOrder",le],Q);u.push(p),u.push(W),f++}}a.push({t:he.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((V,fe)=>({startIndex:fe,blockId:V.drawingId}))},len:r.length});const g=H_(n,o),C=l.editOp(a.serialize(),g);u.push(C);for(const V of r){const{drawingId:fe}=V,M=l.insertOp(["drawings",fe],V),T=l.insertOp(["drawingsOrder",h-f],fe);u.push(M),u.push(T)}return u.reduce((V,fe)=>xt.compose(V,fe),null)},j_=e=>{var h,f,g;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(f=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?f:[],o=t.every(C=>{var I;return((I=C.bullet)==null?void 0:I.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const C=i.indexOf(t[0]),I=i[C-1],b=i[C+1];I&&I.bullet&&I.bullet.listType.indexOf(s)===0?(l=I.bullet.listId,s!==Mt.CHECK_LIST&&(s=I.bullet.listType)):b&&b.bullet&&b.bullet.listType.indexOf(s)===0&&(l=b.bullet.listId,s!==Mt.CHECK_LIST&&(s=b.bullet.listType))}const u=new vn;u.reset();const c=new ze;for(const C of t){const{startIndex:I,paragraphStyle:b={},bullet:U}=C;c.push({t:he.RETAIN,len:I-u.cursor}),c.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:b,startIndex:0}:{startIndex:0,paragraphStyle:{...b},bullet:{nestingLevel:(g=U==null?void 0:U.nestingLevel)!=null?g:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:ke.REPLACE}),u.moveCursorTo(I+1)}return c},Y_=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(f=>f.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Mt.CHECK_LIST)===-1)return!1;const o=new vn;o.reset();const a=new ze,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Mt.CHECK_LIST?Mt.CHECK_LIST_CHECKED:Mt.CHECK_LIST;return a.push({t:he.RETAIN,len:l-o.cursor}),a.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:ke.REPLACE}),o.moveCursorTo(l+1),a},z_=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new vn;l.reset();const u=new ze;for(const f of t){const{startIndex:g,paragraphStyle:C={},bullet:I}=f;u.push({t:he.RETAIN,len:g-l.cursor}),u.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:C,bullet:{nestingLevel:(h=I==null?void 0:I.nestingLevel)!=null?h:0,textStyle:(I==null?void 0:I.listType)===n?I.textStyle:{fs:20},listType:n,listId:a}}]},coverType:ke.REPLACE}),l.moveCursorTo(g+1)}return u};function V_(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const G_=e=>{var c,h,f;const{paragraphs:t,segmentId:n,document:r,type:s}=e,i=new vn;i.reset();const o=new ze,a=(c=r.getSnapshot().lists)!=null?c:{},l=(f=(h=r.getBody())==null?void 0:h.tables)!=null?f:[],u={...Zn,...a};for(const g of t){const{startIndex:C,paragraphStyle:I={},bullet:b}=g,U=V_(g,l);if(o.push({t:he.RETAIN,len:C-i.cursor}),b){const Z=b.listType;let V=u[Z].nestingLevel.length-1;U&&(V=Math.min(V,2)),o.push({t:he.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...I},bullet:{...b,nestingLevel:Math.max(Math.min(b.nestingLevel+s,V),0)}}]},coverType:ke.REPLACE})}else o.push({t:he.RETAIN,len:1});i.moveCursorTo(C+1)}return o};function K_(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function X_(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function q_(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}class ot{}R(ot,"customRange",{add:k_,delete:U_,copyCustomRange:M_,getCustomRangesInterestsWithSelection:N_,isIntersecting:jl}),R(ot,"customDecoration",{add:A_,delete:T_}),R(ot,"selection",{replace:F_,makeSelection:K_,normalizeSelection:X_,delete:zl,replaceTextRuns:$_,retain:P_}),R(ot,"range",{isIntersects:q_}),R(ot,"transform",{getPlainText:$r,fromPlainText:Bd,isEmptyDocument:$d}),R(ot,"paragraph",{bullet:{set:z_,switch:j_,toggleChecklist:Y_,changeNestLevel:G_}}),R(ot,"drawing",{add:W_});function J_(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function Vl(e){var t;return e.body=J_((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Qn{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new Qn(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ve.TRUE}get bold(){return this._style.bl===ve.TRUE}get underline(){return this._style.ul&&Xt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Xt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Xt.create(this._style.st)}get overline(){return this._style.ol&&Xt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return Kt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Kt extends Qn{static create(t={}){return new Kt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Kt.create(re.deepClone(this._style))}build(){return this.getValue()}}class Xt{constructor(t={s:1}){R(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Xt(t)}get show(){return this._decoration.s===ve.TRUE}get followFontColor(){return this._decoration.c===ve.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return Xt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class er{constructor(t={}){R(this,"_style");this._style=t}static create(t={}){return new er(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ve.TRUE}get keepNext(){return this._style.keepNext===ve.TRUE}get wordWrap(){return this._style.wordWrap===ve.TRUE}get widowControl(){return this._style.widowControl===ve.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ve.TRUE}copy(){return tr.create(re.deepClone(this._style))}getValue(){return this._style}}class tr extends er{static create(t={}){return new tr(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return tr.create(re.deepClone(this._style))}build(){return this.getValue()}}class qt{constructor(t){R(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Vl(t)}static create(t){return new qt(t)}static createByBody(t){return new qt({body:t,id:"d",documentStyle:{}})}copy(){return un.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return un.create({...re.deepClone(s),body:bt(r,t,n)})}toPlainText(){var t,n;return ot.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
9
+ `)}getParagraphStyle(){var t,n;return er.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Qn.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===zt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class un extends qt{constructor(n){super(n);R(this,"_doc");this._doc=new yt(n)}static newEmptyData(){return Vl({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
10
+ `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new un(n!=null?n:un.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Kt?r.build():r:a=s instanceof Kt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=ot.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof qt?n.getData():n:(s=Math.min(n,s),i=r instanceof qt?r.getData():r);const o=ot.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=ot.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);ze.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Kt?s.build():s,st:0,ed:r-n}]},o=ot.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return ze.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=ot.customRange.add({rangeType:zt.HYPERLINK,rangeId:kt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return ze.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=ot.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");ze.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=ot.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");ze.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,qt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=un.createByBody({dataStream:i,customRanges:[{rangeType:zt.HYPERLINK,rangeId:kt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function Z_(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var On=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(On||{});function Q_(e){return`sheet_interceptor_${e}`}const Gl=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class ep{constructor(t){R(this,"_interceptorsByName",new Map);R(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),Gl(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Ln(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function tp(e){return`sheet_async_interceptor_${e}`}const np=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class rp{constructor(t){R(this,"_asyncInterceptorsByName",new Map);R(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),np(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Ln(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function sp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function Kl(e){return/^-?\d+(\.\d+)?$/.test(e)}function ip(e){return Kl(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class ti{constructor(){R(this,"_data",[])}static create(){return new ti}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class ni{constructor(){R(this,"_data",new Map)}static create(){return new ni}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function op(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.close(),t.port2.close()}}function ap(e,t){return t.forEach(n=>e.add(n)),e}function lp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new yt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new ze,h=xt.getInstance();if(a>0&&c.retain(a),n.length>0){const f=i.sliceBody(a,a+o),g={dataStream:n};if(Array.isArray(f==null?void 0:f.textRuns)&&f.textRuns.length&&(g.textRuns=[{...f.textRuns[0],st:0,ed:n.length}]),(u=f==null?void 0:f.customRanges)!=null&&u.length){const C=f.customRanges[0];g.customRanges=[{...C,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,g)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const up="__default_document_sub_component_id20231101__";class Xl{constructor(){R(this,"skipNextObservers",!1);R(this,"lastReturnValue");R(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class cp extends Ie.Subject{constructor(){super(...arguments);R(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new Xl;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function hp(e){return new Ie.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const Zr=We.createIdentifier("core.resource-manager.service"),ri={[Nt.Editor]:"Editor",[Nt.Owner]:"Owner",[Nt.Reader]:"Reader",[Nt.UNRECOGNIZED]:"UNRECOGNIZED"},Qr=e=>e?{userID:`${ri[e]}_${re.generateRandomId(8)}`,name:ri[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},dp=(e,t)=>e.startsWith(ri[t]);class nr{constructor(){R(this,"_model",new Map);R(this,"_userChange$",new Ie.Subject);R(this,"userChange$",this._userChange$.asObservable());R(this,"_currentUser$",new Ie.BehaviorSubject(Qr()));R(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var fp=Object.getOwnPropertyDescriptor,gp=(e,t,n,r)=>{for(var s=r>1?void 0:r?fp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ql=(e,t)=>(n,r)=>t(n,r,e);d.AuthzIoLocalService=class{constructor(t,n){R(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Qr(Nt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?dp(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[Be.UNIVER_SHEET,Be.UNIVER_DOC,Be.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return kt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Nt.Owner,shareScope:-1,scope:{read:js.AllCollaborator,edit:js.AllCollaborator},creator:Qr(Nt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Nt.Owner)||this._getRole(Nt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}},d.AuthzIoLocalService=gp([ql(0,Zr),ql(1,We.Inject(nr))],d.AuthzIoLocalService);const Jl=We.createIdentifier("IAuthzIoIoService");var mp=Object.getOwnPropertyDescriptor,_p=(e,t,n,r)=>{for(var s=r>1?void 0:r?mp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},pp=(e,t)=>(n,r)=>t(n,r,e);d.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:_r.PERSON,mentions:[{objectType:_r.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}},d.MentionIOLocalService=_p([pp(0,We.Inject(nr))],d.MentionIOLocalService);const Zl=We.createIdentifier("univer.service.mention-io"),si=We.createIdentifier("univer.config-service");class Ql{constructor(){R(this,"_configChanged$",new Ie.Subject);R(this,"configChanged$",this._configChanged$.asObservable());R(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=Bs(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new Ie.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(Ie.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const rr="FOCUSING_UNIT",wn="FOCUSING_SHEET",sr="FOCUSING_DOC",ir="FOCUSING_SLIDE",Ep="FOCUSING_EDITOR_BUT_HIDDEN",eu="EDITOR_ACTIVATED",Cp="FOCUSING_EDITOR_INPUT_FORMULA",tu="FOCUSING_FX_BAR_EDITOR",Rp="FOCUSING_UNIVER_EDITOR",Ip="FOCUSING_EDITOR_INPUT_FORMULA",Sp="FOCUSING_PANEL_EDITOR",vp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Op="FOCUSING_COMMON_DRAWINGS",wp="FORMULA_EDITOR_ACTIVATED";class nu extends st{constructor(){super(...arguments);R(this,"_error$",new Ie.Subject);R(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const bp={version:"0.6.2"};function yp(e="",t=$n.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:bp.version,locale:t,styles:{},sheets:{},resources:[]}}class ru{constructor(t={}){R(this,"_styles");R(this,"_cacheMap",new Hn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const Ap=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Yt.equals(r,n))),Tp=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Yt.equals(n.range,s.range)}),ii={t:0,b:2,l:2,r:2},Np=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),su=90;function or(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=St.UNSPECIFIED,verticalAlign:a=en.UNSPECIFIED,wrapStrategy:l=tn.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:f,l:g}=i||ii,{vertexAngle:C,centerAngle:I}=uu(s),b={id:"d",body:{dataStream:`${e}${Do}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:f,marginRight:h,marginLeft:g,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:I,vertexAngle:C,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new yt(b)}function Mp(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function iu(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function ou(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===zt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:zt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&ze.apply(r,s.serialize())}function au(e){return e!=null}const Dp='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function lu(e){const t=lt.ff,n=lt.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=mn.ITALIC;(e.it===0||e.it===void 0)&&(r=mn.NORMAL);let s=mn.BOLD;(e.bl===0||e.bl===void 0)&&(s=mn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Ut.SUBSCRIPT||a===Ut.SUPERSCRIPT){const h=Lp(o,l),{sbr:f,spr:g}=h;l*=a===Ut.SUBSCRIPT?f:g}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${Dp} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function Lp(e,t){return Np(t)}function uu(e){const{a:t=0,v:n=ve.FALSE}=e||{a:0,v:ve.FALSE};let r=0,s=t;return n===ve.TRUE&&(r=su,s=su),{centerAngle:r,vertexAngle:s}}class Up{constructor(t,n){R(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ve.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return jt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:ve.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class kp{constructor(t,n,r){R(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ve.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===ve.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ve.TRUE:!0}getSize(){return jt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const Pp="DEFAULT_WORKSHEET_ROW_COUNT",cu=1e3,Fp="DEFAULT_WORKSHEET_COLUMN_COUNT",hu=20,xp="DEFAULT_WORKSHEET_ROW_HEIGHT",du=24,$p="DEFAULT_WORKSHEET_COLUMN_WIDTH",fu=88,Bp="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",gu=46,Hp="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",mu=20;function _u(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ve.FALSE,rowCount:cu,columnCount:hu,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:fu,defaultRowHeight:du,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ve.TRUE,rowHeader:{width:gu,hidden:ve.FALSE},columnHeader:{height:mu,hidden:ve.FALSE},rightToLeft:ve.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class Wp extends st{constructor(n){super();R(this,"_cellCache",new Map);R(this,"_rowCache",new Map);R(this,"_columnCache",new Map);R(this,"_hasRow",!1);R(this,"_hasColumn",!1);R(this,"_hasAll",!1);R(this,"_allIndex",-1);R(this,"_mergeData");R(this,"_rangeMap",new Hn(5e4));R(this,"_skeletonCache",new Hn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Yt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:f,startColumn:g,endColumn:C}=a[c];for(let I=n;I<=s;I++){let b=!1;for(let U=r;U<=i;U++)if(I>=h&&I<=f&&U>=g&&U<=C){o.push({startRow:h,endRow:f,startColumn:g,endColumn:C}),u.push(c),b=!0;break}if(b)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class pu extends st{constructor(n){super();R(this,"_cellContentInterceptor",null);R(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,On.Value|On.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,On.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,On.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,tt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,tt(()=>this._rowFilteredInterceptor=null)}}const Eu={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class ar{constructor(t,n,r){R(this,"_sheetId");R(this,"_snapshot");R(this,"_cellData");R(this,"_rowManager");R(this,"_columnManager");R(this,"_viewModel");R(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=_u(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new Ot(o),this._viewModel=new pu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new kp(this._snapshot,this._viewModel,i),this._columnManager=new Up(this._snapshot,s),this._spanModel=new Wp(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}mixinDefaultStyleToCellRaw(t,n,r,s){const i=this.getColumnStyle(n),o=this.getRowStyle(t),a=this.getDefaultCellStyleInternal();if(a||i||o){let l=r==null?void 0:r.s;typeof l=="string"&&(l=this._styles.get(l));const u=s?cs(a,i,o,l):cs(a,o,i,l);r||(r={}),r.s=u}}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const f=+h,g=t.getValue(u,f),C=g!=null&&g.s?this._styles.get(g.s):null,I=(C==null?void 0:C.bd)&&(C.bd.b||C.bd.l||C.bd.r||C.bd.t||C.bd.bc_tr||C.bd.bl_tr||C.bd.ml_tr||C.bd.tl_bc||C.bd.tl_br||C.bd.tl_mr);(g&&(g.v||g.p)||C!=null&&C.bg||I)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,f):(l=!0,i=f),o=Math.max(o,f))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new ar(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:f,endColumn:g}=r;t===c&&n===f?(o=h,a=g,l=c,u=f,i=!0):t>=c&&t<=h&&n>=f&&n<=g&&(o=h,a=g,l=c,u=f,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=fn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new Ot;return Os(t,r,n,s).forEach((u,c)=>{var f;let h;if(i===fn.Raw)h=this.getCellRaw(u,c);else if(i===fn.Intercepted)h=this.getCell(u,c);else if(i===fn.Both){const g=this.getCellRaw(u,c);if(g){h={...g};const C=(f=this.getCell(u,c))==null?void 0:f.v;au(C)&&h&&(h.displayV=String(C))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:f,endRow:g}=u;Os(h,g,c,f).forEach((C,I)=>{C===h&&I===c&&l.setValue(C,I,{...o.getValue(C,I),rowSpan:g-h+1,colSpan:f-c+1}),(C!==h||I!==c)&&l.realDeleteValue(C,I)})}),l}getRange(t,n,r,s){return typeof t=="object"?new gn(this,t,{getStyles:()=>this._styles}):new gn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,f=a.getMergedCell(l,u);if(f){if(l!==f.startRow||u!==f.startColumn){u=f.endColumn+1;continue}if(h&&n){u=f.endColumn+1;continue}const C={row:l,col:u,value:c};return C.colSpan=f.endColumn-f.startColumn+1,C.rowSpan=f.endRow-f.startRow+1,u=f.endColumn+1,{done:!1,value:C}}if(h&&n)u+=1;else{const g={row:l,col:u,value:c};return u+=1,{done:!1,value:g}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const C=u!==h.startRow,I=C||c!==h.startColumn;if(r&&I||!r&&C){u=h.endRow+1;continue}const b=l.getCell(h.startRow,h.startColumn);if(!b&&n){u=h.endRow+1;continue}const Z={row:u,col:h.startColumn,value:b};return Z.colSpan=h.endColumn-h.startColumn+1,Z.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:Z}}const f=l.getCell(u,c);if(!f&&n)u+=1;else{const C={row:u,col:c,value:f};return u+=1,{done:!1,value:C}}}}}}}}_getCellDocumentModel(t,n=Eu){var I;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Eu,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=Mp(o),c=i?lt.tr:u.textRotation||lt.tr;let h=u.horizontalAlign||lt.ht;const f=u.verticalAlign||lt.vt,g=u.wrapStrategy||lt.tb,C=u.paddingData||ii;if(t.f&&s)a=or(t.f.toString(),{},{verticalAlign:f}),h=lt.ht;else if(t.p){const{centerAngle:b,vertexAngle:U}=uu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,C,{horizontalAlign:h,verticalAlign:f,centerAngle:b,vertexAngle:U,wrapStrategy:g,zeroWidthParagraphBreak:1})}else if(t.v!=null){const b=iu(o);l=lu(b).fontCache;let U=Cu(t);t.t===Ht.FORCE_STRING&&s&&(U=`'${U}`),a=or(U,b,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&ou(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:g,verticalAlign:f,horizontalAlign:h,paddingData:C,fill:(I=o==null?void 0:o.bg)==null?void 0:I.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new yt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=iu(r);if(n!=null)return n.documentModel==null&&(n.documentModel=or("",s)),n;const i="";let o="document";const a=lt.tr,l=lt.ht,u=lt.vt,c=lt.tb,h=ii;return o=lu({}).fontCache,{documentModel:or(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Cu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return ot.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Ht.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Ht.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function jp(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return ot.transform.getPlainText(n)}return e==null?void 0:e.v}var Yp=Object.getOwnPropertyDescriptor,zp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Yp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Vp=(e,t)=>(n,r)=>t(n,r,e);function Gp(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}d.Workbook=class extends zr{constructor(n={},r){super();R(this,"type",Be.UNIVER_SHEET);R(this,"_sheetCreated$",new Ie.Subject);R(this,"sheetCreated$",this._sheetCreated$.asObservable());R(this,"_sheetDisposed$",new Ie.Subject);R(this,"sheetDisposed$",this._sheetDisposed$.asObservable());R(this,"_activeSheet$",new Ie.BehaviorSubject(null));R(this,"activeSheet$",this._activeSheet$.asObservable());R(this,"_worksheets");R(this,"_styles");R(this,"_snapshot");R(this,"_unitId");R(this,"_count");R(this,"_name$");R(this,"name$");this._logService=r;const s=yp();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new ru(i),this._count=1,this._worksheets=new Map,this._name$=new Ie.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new ar(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ve.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ve.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ve.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new ar(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}},d.Workbook=zp([Vp(1,It)],d.Workbook);class oi extends zr{constructor(n){var r;super();R(this,"type",Be.UNIVER_SLIDE);R(this,"_activePage$",new Ie.BehaviorSubject(null));R(this,"activePage$",this._activePage$.asObservable());R(this,"_name$");R(this,"name$");R(this,"_snapshot");R(this,"_unitId");this._snapshot={...Po,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new Ie.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:kt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=kt(6);return{id:n,pageType:bs.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var Kp=Object.getOwnPropertyDescriptor,Xp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Kp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ru=(e,t)=>(n,r)=>t(n,r,e);const bn=We.createIdentifier("univer.current");d.UniverInstanceService=class extends st{constructor(n,r){super();R(this,"_unitsByType",new Map);R(this,"_createHandler");R(this,"_ctorByType",new Map);R(this,"_currentUnits",new Map);R(this,"_currentUnits$",new Ie.BehaviorSubject(this._currentUnits));R(this,"currentUnits$",this._currentUnits$.asObservable());R(this,"_unitAdded$",new Ie.Subject);R(this,"unitAdded$",this._unitAdded$.asObservable());R(this,"_unitDisposed$",new Ie.Subject);R(this,"unitDisposed$",this._unitDisposed$.asObservable());R(this,"_focused$",new Ie.BehaviorSubject(null));R(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(Ie.map(r=>{var s;return(s=r.get(n))!=null?s:null}),Ie.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(Ie.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(Ie.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(Be.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,Be.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,Be.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(Be.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof d.Workbook?(this._contextService.setContextValue(rr,!0),this._contextService.setContextValue(sr,!1),this._contextService.setContextValue(wn,!0),this._contextService.setContextValue(ir,!1),this.setCurrentUnitForType(n)):this.focused instanceof yt?(this._contextService.setContextValue(rr,!0),this._contextService.setContextValue(sr,!0),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(ir,!1),this.setCurrentUnitForType(n)):this.focused instanceof oi?(this._contextService.setContextValue(rr,!0),this._contextService.setContextValue(sr,!1),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(ir,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(rr,!1),this._contextService.setContextValue(sr,!1),this._contextService.setContextValue(wn,!1),this._contextService.setContextValue(ir,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:Be.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}},d.UniverInstanceService=Xp([Ru(0,We.Inject(We.Injector)),Ru(1,dn)],d.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const qp={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var Jp=Object.getOwnPropertyDescriptor,Zp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Jp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Qp=(e,t)=>(n,r)=>t(n,r,e);d.LifecycleService=class extends st{constructor(n){super();R(this,"_lifecycle$",new Ie.BehaviorSubject(Je.Starting));R(this,"lifecycle$",this._lifecycle$.asObservable());R(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return Ie.firstValueFrom(this.lifecycle$.pipe(Ie.filter(r=>r>=n),ls(r=>r===n),Ie.map(()=>{})))}subscribeWithPrevious(){return Ie.merge(Iu(this.stage),this._lifecycle$.pipe(Ie.skip(1))).pipe(ls(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${qp[n]}".`)}},d.LifecycleService=Zp([Qp(0,It)],d.LifecycleService);function Iu(e){switch(e){case Je.Starting:return Ie.of(Je.Starting);case Je.Ready:return Ie.of(Je.Starting,Je.Ready);case Je.Rendered:return Ie.of(Je.Starting,Je.Ready,Je.Rendered);default:return Ie.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const eE=We.createIdentifier("ILocalStorageService");class cn extends st{constructor(){super();R(this,"_currentLocale$",new Ie.BehaviorSubject($n.ZH_CN));R(this,"currentLocale$",this._currentLocale$.asObservable());R(this,"_locales",null);R(this,"localeChanged$",new Ie.Subject);R(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(tt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Bs((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var ai=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(ai||{});const Su=We.createIdentifier("univer.permission-service");class vu extends st{constructor(){super(...arguments);R(this,"_permissionPointMap",new Map);R(this,"_permissionPointUpdate$",new Ie.Subject);R(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());R(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof Ie.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new Ie.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=ai.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return Ie.combineLatest(r).pipe(Lt.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var tE=Object.getOwnPropertyDescriptor,nE=(e,t,n,r)=>{for(var s=r>1?void 0:r?tE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},li=(e,t)=>(n,r)=>t(n,r,e);const rE=4,Ou=Symbol("DependentOn");class ui extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}R(ui,"pluginName"),R(ui,"type",Be.UNIVER_UNKNOWN);class sE{constructor(){R(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function iE(...e){return function(t){t[Ou]=e}}d.PluginService=class{constructor(t,n,r){R(this,"_pluginRegistry",new Map);R(this,"_pluginStore",new sE);R(this,"_seenPlugins",new Set);R(this,"_loadedPlugins",new Set);R(this,"_loadedPluginTypes",new Set([Be.UNIVER_UNKNOWN]));R(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===Be.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===Be.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},rE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Ou];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===Be.UNIVER_UNKNOWN&&c.type!==Be.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==Be.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Iu(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(Ie.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}},d.PluginService=nE([li(0,We.Inject(We.Injector)),li(1,We.Inject(d.LifecycleService)),li(2,It)],d.PluginService);function wu(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const ci=We.createIdentifier("resource-loader-service");class bu extends st{constructor(){super(...arguments);R(this,"_resourceMap",new Map);R(this,"_register$",new Ie.Subject);R(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),tt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class hi extends st{constructor(){super();R(this,"_currentTheme");R(this,"_currentTheme$",new Ie.BehaviorSubject({}));R(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(tt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}var oE=Object.getOwnPropertyDescriptor,aE=(e,t,n,r)=>{for(var s=r>1?void 0:r?oE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},di=(e,t)=>(n,r)=>t(n,r,e);const es=We.createIdentifier("univer.undo-redo.service"),lE=20;class yu{dispose(){}async dispatchToHandlers(){return!1}}const Au="univer.command.redo",Tu="univer.command.undo",Nu=new class extends yu{constructor(){super(...arguments);R(this,"type",kn.COMMAND);R(this,"id",Tu)}handler(t){const n=t.get(es),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Pn);return as(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Mu=new class extends yu{constructor(){super(...arguments);R(this,"type",kn.COMMAND);R(this,"id",Au)}handler(t){const n=t.get(es),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Pn);return as(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};d.LocalUndoRedoService=class extends st{constructor(n,r,s){super();R(this,"undoRedoStatus$");R(this,"_undoRedoStatus$",new Ie.BehaviorSubject({undos:0,redos:0}));R(this,"_undoStacks",new Map);R(this,"_redoStacks",new Map);R(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Nu)),this.disposeWithMe(this._commandService.registerCommand(Mu)),this.disposeWithMe(tt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(tt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>lE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),tt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(wn),s=this._contextService.getContextValue(tu),i=this._contextService.getContextValue(eu);return r?s?n=Ss:i?n=Is:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}},d.LocalUndoRedoService=aE([di(0,bn),di(1,Pn),di(2,dn)],d.LocalUndoRedoService);function uE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function cE(e){return new Promise(t=>setTimeout(t,e))}function hE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var fi=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(fi||{}),Du=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Du||{});const gi=We.createIdentifier("core.image-io.service");class Lu{constructor(t,n=100){R(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Hn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(gi)?this._injector.get(gi):null;if(t===fi.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const dE=["script","style","meta","comment","link"];var Uu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Uu||{}),ku=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(ku||{}),Pu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Pu||{}),Fu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Fu||{}),xu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(xu||{}),$u=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))($u||{}),fE=Object.getOwnPropertyDescriptor,gE=(e,t,n,r)=>{for(var s=r>1?void 0:r?fE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},mE=(e,t)=>(n,r)=>t(n,r,e);d.Skeleton=class extends st{constructor(n){super();R(this,"_fontLocale");R(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}},d.Skeleton=gE([mE(0,We.Inject(cn))],d.Skeleton);var _E=Object.getOwnPropertyDescriptor,pE=(e,t,n,r)=>{for(var s=r>1?void 0:r?_E(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ts=(e,t)=>(n,r)=>t(n,r,e);d.SheetSkeleton=class extends d.Skeleton{constructor(n,r,s,i,o,a){super(s);R(this,"_worksheetData");R(this,"_renderRawFormula",!1);R(this,"_cellData");R(this,"_imageCacheMap");R(this,"_isRowStylePrecedeColumnStyle",!1);R(this,"_skipAutoHeightForMergedCells",!0);R(this,"_rowTotalHeight",0);R(this,"_columnTotalWidth",0);R(this,"_rowHeaderWidth",0);R(this,"_columnHeaderHeight",0);R(this,"_rowHeightAccumulation",[]);R(this,"_columnWidthAccumulation",[]);R(this,"_marginTop",0);R(this,"_marginLeft",0);R(this,"_scaleX");R(this,"_scaleY");R(this,"_scrollX");R(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Lu(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Uo))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(Lo))!=null?r:!1}_resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:f,ia:g}=c;(g==null||g===ve.TRUE)&&typeof f=="number"?u=f:u=h,c.hd===ve.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===ve.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=St.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!ms(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:f,endX:g}=yn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&c===r?a+=(g-f)/2:a+=g-f,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!ms(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:f}=yn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===St.CENTER&&u===r?a+=(f-h)/2:a+=f-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:f,columnWidthAccumulation:g}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ve.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==ve.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=f,this._columnWidthAccumulation=g,this.makeDirty(!1)}calculate(){return this._resetCache(),this._updateLayout(),this}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new Ot;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:f,endRow:g,endColumn:C}=a[c];if(u.getValue(h,f))continue;$o({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:f,startRow:h,endColumn:C,endRow:g})&&(r=Math.min(r,h),s=Math.min(s,f),i=Math.max(i,g),o=Math.max(o,C),u.setValue(h,f,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:f}=yn(n,r,i,o);return s&&(u+=l,c+=l,h+=a,f+=a),{startY:u,endY:c,startX:h,endX:f}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=yn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Hu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=Fn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Bu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=Fn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=yn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:f,endY:g,startX:C,endX:I,mergeInfo:b}=u,U=a,Z=l;return s===!1&&(U=0,Z=0),f+=Z,g+=Z,C+=U,I+=U,b.startY+=Z,b.endY+=Z,b.startX+=U,b.endX+=U,{actualRow:n,actualColumn:r,startX:C,startY:f,endX:I,endY:g,isMerged:c,isMergedMainCell:h,mergeInfo:b}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=Fn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=Fn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const f of o)f.paragraphStyle||(f.paragraphStyle={}),f.paragraphStyle.horizontalAlign=r;return new yt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}},d.SheetSkeleton=pE([ts(2,We.Inject(cn)),ts(3,dn),ts(4,si),ts(5,We.Inject(We.Injector))],d.SheetSkeleton);function mi(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function EE(e,t,n,r){return mi(e,t,n,r)}function yn(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=mi(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:f,endRow:g,endColumn:C}=s;let I={startRow:h,startColumn:f,endRow:g,endColumn:C,startY:i,endY:o,startX:a,endX:l};const b=n.length-1,U=r.length-1;if(u&&h!==-1&&f!==-1){const Z=n[h-1]||0,V=n[g]||n[b],fe=r[f-1]||0,M=r[C]||r[U];I={...I,startY:Z,endY:V,startX:fe,endX:M}}else if(!u&&g!==-1&&C!==-1){const Z=n[g]||n[b],V=r[C]||r[U];I={...I,startY:i,endY:Z,startX:a,endX:V}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:I}}function Bu(e,t,n,r){const{x:s}=n;return e/t+s-r}function Hu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const Wu=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],_i=1,lr=8;class pi{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==_i)throw new Error(`Got v${s} data when expected v${_i}.`);const i=Wu[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new pi(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Wu.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,lr,t),this.coords=new this.ArrayType(this.data,lr+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(lr+o+a+l),this.ids=new this.IndexArrayType(this.data,lr,t),this.coords=new this.ArrayType(this.data,lr+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(_i<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Ei(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,f=l.pop()||0;if(h-f<=a){for(let b=f;b<=h;b++){const U=o[2*b],Z=o[2*b+1];U>=t&&U<=r&&Z>=n&&Z<=s&&u.push(i[b])}continue}const g=f+h>>1,C=o[2*g],I=o[2*g+1];C>=t&&C<=r&&I>=n&&I<=s&&u.push(i[g]),(c===0?t<=C:n<=I)&&(l.push(f),l.push(g-1),l.push(1-c)),(c===0?r>=C:s>=I)&&(l.push(g+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,f=a.pop()||0;if(h-f<=o){for(let b=f;b<=h;b++)Yu(i[2*b],i[2*b+1],t,n)<=u&&l.push(s[b]);continue}const g=f+h>>1,C=i[2*g],I=i[2*g+1];Yu(C,I,t,n)<=u&&l.push(s[g]),(c===0?t-r<=C:n-r<=I)&&(a.push(f),a.push(g-1),a.push(1-c)),(c===0?t+r>=C:n+r>=I)&&(a.push(g+1),a.push(h),a.push(1-c))}return l}}function Ei(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;ju(e,t,o,r,s,i),Ei(e,t,n,r,o-1,1-i),Ei(e,t,n,o+1,s,1-i)}function ju(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),f=.5*Math.exp(2*h/3),g=.5*Math.sqrt(h*f*(u-f)/u)*(c-u/2<0?-1:1),C=Math.max(r,Math.floor(n-c*f/u+g)),I=Math.min(s,Math.floor(n+(u-c)*f/u+g));ju(e,t,n,C,I,i)}const o=t[2*n+i];let a=r,l=s;for(ur(e,t,r,n),t[2*s+i]>o&&ur(e,t,r,s);a<l;){for(ur(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?ur(e,t,r,l):(l++,ur(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function ur(e,t,n,r){Ci(e,n,r),Ci(t,2*n,2*r),Ci(t,2*n+1,2*r+1)}function Ci(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Yu(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}function zu(e,t,n=0,r=e.length-1,s=CE){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),g=Math.max(n,Math.floor(t-u*h/l+f)),C=Math.min(r,Math.floor(t+(l-u)*h/l+f));zu(e,t,g,C,s)}const i=e[t];let o=n,a=r;for(cr(e,n,t),s(e[r],i)>0&&cr(e,n,r);o<a;){for(cr(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?cr(e,n,a):(a++,cr(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function cr(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function CE(e,t){return e<t?-1:e>t?1:0}class Ri{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!rs(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;rs(t,l)&&(n.leaf?r.push(a):Si(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!rs(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(rs(t,o)){if(n.leaf||Si(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=Tn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=RE(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&Si(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=Tn(t.slice(n,r+1)),An(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=Tn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));Vu(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);Vu(t,c,h,l,this.compareMinY);for(let f=c;f<=h;f+=l){const g=Math.min(f+l-1,h);a.children.push(this._build(t,f,g,s-1))}}return An(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=Ii(u),h=vE(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),dr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=Tn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,An(r,this.toBBox),An(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=Tn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,An(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=hr(t,0,a,this.toBBox),u=hr(t,a,r,this.toBBox),c=OE(l,u),h=Ii(l)+Ii(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:IE,i=t.leaf?this.compareMinY:SE,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=hr(t,0,n,i),a=hr(t,r-n,r,i);let l=ns(o)+ns(a);for(let u=n;u<r-n;u++){const c=t.children[u];dr(o,t.leaf?i(c):c),l+=ns(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];dr(a,t.leaf?i(c):c),l+=ns(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)dr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():An(t[n],this.toBBox)}}function RE(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function An(e,t){hr(e,0,e.children.length,t,e)}function hr(e,t,n,r,s){s||(s=Tn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];dr(s,e.leaf?r(o):o)}return s}function dr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function IE(e,t){return e.minX-t.minX}function SE(e,t){return e.minY-t.minY}function Ii(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ns(e){return e.maxX-e.minX+(e.maxY-e.minY)}function vE(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function OE(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function Si(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function rs(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Tn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Vu(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;zu(e,o,t,n,s),i.push(t,o,o,n)}}class wE{constructor(t=!1){R(this,"_tree",new Map);R(this,"_oneCellCache",new Map);R(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Ri),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let f=l;f<=c;f++){const g=a.get(f);if(g)for(let C=u;C<=h;C++){const I=g.get(C);I&&I.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var C;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(C=this._kdTree.get(n))==null?void 0:C.get(r);if(!u)return[];const{tree:c,items:h}=u,f=c.range(o,i,l,a),g=[];for(const I of f){const b=h[I];g.push(...Array.from(b.ids))}return g}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new pi(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Ri;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var bE=Object.getOwnPropertyDescriptor,yE=(e,t,n,r)=>{for(var s=r>1?void 0:r?bE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Gu=(e,t)=>(n,r)=>t(n,r,e);let vi=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case Be.UNRECOGNIZED:case Be.UNIVER_UNKNOWN:case Be.UNIVER_SLIDE:case Be.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(Be.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case Be.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(Be.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(Be.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(Be.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();ko(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(Be.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(Be.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};vi=yE([Gu(0,We.Inject(Zr)),Gu(1,We.Inject(bn))],vi);class AE{constructor(t={},n){R(this,"_startedTypes",new Set);R(this,"_injector");R(this,"_disposingCallbacks",new mr);const r=this._injector=TE(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(hi).setTheme(s),o&&this._injector.get(cn).load(o),i&&this._injector.get(cn).setLocale(i),a&&this._injector.get(It).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(bn)}get _pluginService(){return this._injector.get(d.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(tt(t));return tt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(cn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(It).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(Be.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(Be.UNIVER_SHEET,d.Workbook),this._univerInstanceService.registerCtorForType(Be.UNIVER_DOC,yt),this._univerInstanceService.registerCtorForType(Be.UNIVER_SLIDE,oi);const n=t.get(bn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(d.LifecycleService).stage<Je.Ready&&(this._injector.get(d.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function TE(e,t){const n=wu([[nu],[cn],[hi],[d.LifecycleService],[d.PluginService],[nr],[bn,{useClass:d.UniverInstanceService}],[Su,{useClass:vu}],[It,{useClass:Ui,lazy:!0}],[Pn,{useClass:d.CommandService}],[es,{useClass:d.LocalUndoRedoService,lazy:!0}],[si,{useClass:Ql}],[dn,{useClass:Di}],[Zr,{useClass:bu,lazy:!0}],[ci,{useClass:vi,lazy:!0}],[Jl,{useClass:d.AuthzIoLocalService}],[Zl,{useClass:d.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new We.Injector(n);return Oi(r,[[nr],[ci]]),r}Qu(),d.ABCToNumber=Md,d.AUTO_HEIGHT_FOR_MERGED_CELLS=Uo,d.AbsoluteRefType=nt,d.ActionIterator=Sn,d.AlignTypeH=fa,d.AlignTypeV=ga,d.ArrangeTypeEnum=pa,d.ArrowsAndMarkersShapes=Zi,d.AsyncInterceptorManager=rp,d.AutoFillSeries=Hi,d.BaselineOffset=Ut,d.BasicShapes=Ji,d.BlockType=Vo,d.BooleanNumber=ve,d.BorderStyleTypes=qe,d.BorderType=Wi,d.BuildTextUtils=ot,d.BulletAlignment=zn,d.COLORS=ds,d.CanceledError=oc,d.CellModeEnum=fn,d.CellValueType=Ht,d.Color=nn,d.ColorBuilder=Ir,d.ColorKit=vt,d.ColorType=_t,d.ColumnSeparatorType=Xo,d.CommandType=kn,d.CommonHideTypes=ji,d.ConfigService=Ql,d.ContextService=Di,d.CopyPasteType=Yi,d.CustomCommandExecutionError=is,d.CustomDecorationType=rn,d.CustomRangeType=zt,d.DEFAULT_CELL=Ed,d.DEFAULT_DOC=ei,d.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=up,d.DEFAULT_EMPTY_DOCUMENT_VALUE=Do,d.DEFAULT_RANGE=_d,d.DEFAULT_RANGE_ARRAY=md,d.DEFAULT_SELECTION=pd,d.DEFAULT_SLIDE=Po,d.DEFAULT_STYLES=lt,d.DEFAULT_WORKSHEET_COLUMN_COUNT=hu,d.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Fp,d.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=mu,d.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=Hp,d.DEFAULT_WORKSHEET_COLUMN_WIDTH=fu,d.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=$p,d.DEFAULT_WORKSHEET_ROW_COUNT=cu,d.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Pp,d.DEFAULT_WORKSHEET_ROW_HEIGHT=du,d.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=xp,d.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=gu,d.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Bp,d.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Ss,d.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Is,d.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Mo,d.DOC_RANGE_TYPE=ho,d.DashStyleType=na,d.DataStreamTreeNodeType=Ia,d.DataStreamTreeTokenType=Vt,d.DataValidationErrorStyle=Uu,d.DataValidationImeMode=ku,d.DataValidationOperator=Pu,d.DataValidationRenderMode=Fu,d.DataValidationStatus=xu,d.DataValidationType=$u,d.DeleteDirection=zi,d.DependentOn=iE,d.DesktopLogService=Ui,d.DeveloperMetadataVisibility=Vi,d.Dimension=Gi,d.Direction=Ki,d.Disposable=st,d.DisposableCollection=mr,d.DocStyleType=Yo,d.DocumentDataModel=yt,d.DocumentFlavor=ws,d.DrawingTypeEnum=Ea,d.EDITOR_ACTIVATED=eu,d.EXTENSION_NAMES=Fo,d.ErrorService=nu,d.EventState=Xl,d.EventSubject=cp,d.FOCUSING_COMMON_DRAWINGS=Op,d.FOCUSING_DOC=sr,d.FOCUSING_EDITOR_BUT_HIDDEN=Ep,d.FOCUSING_EDITOR_INPUT_FORMULA=Cp,d.FOCUSING_EDITOR_STANDALONE=Ip,d.FOCUSING_FX_BAR_EDITOR=tu,d.FOCUSING_PANEL_EDITOR=Sp,d.FOCUSING_SHEET=wn,d.FOCUSING_SLIDE=ir,d.FOCUSING_UNIT=rr,d.FOCUSING_UNIVER_EDITOR=Rp,d.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=vp,d.FORMULA_EDITOR_ACTIVATED=wp,d.FollowNumberWithType=zo,d.FontItalic=pr,d.FontStyleType=mn,d.FontWeight=Er,d.GridType=Go,d.HLSColor=lo,d.HorizontalAlign=St,d.IAuthzIoService=Jl,d.ICommandService=Pn,d.IConfigService=si,d.IContextService=dn,d.IImageIoService=gi,d.ILocalStorageService=eE,d.ILogService=It,d.IMentionIOService=Zl,d.IPermissionService=Su,d.IResourceLoaderService=ci,d.IResourceManagerService=Zr,d.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Lo,d.IUndoRedoService=es,d.IUniverInstanceService=bn,d.ImageCacheMap=Lu,d.ImageSourceType=fi,d.ImageUploadStatusType=Du,d.InterceptorEffectEnum=On,d.InterceptorManager=ep,d.InterpolationPointType=Xi,d.JSON1=Zm,d.JSONX=xt,d.LRUHelper=Wn,d.LRUMap=Hn,d.LifecycleStages=Je,d.ListGlyphType=Ne,d.LocaleService=cn,d.LocaleType=$n,d.LogLevel=Li,d.MOVE_BUFFER_VALUE=xn,d.MemoryCursor=vn,d.MentionType=_r,d.NamedStyleType=ea,d.NilCommand=Pi,d.NumberUnitType=da,d.ObjectMatrix=Ot,d.ObjectRelativeFromH=ca,d.ObjectRelativeFromV=ha,d.OtherShapes=Qi,d.PRESET_LIST_TYPE=Zn,d.PageElementType=Ca,d.PageOrientType=_a,d.PageType=bs,d.ParagraphElementType=Jo,d.ParagraphStyleBuilder=tr,d.ParagraphStyleValue=er,d.PermissionService=vu,d.PermissionStatus=ai,d.Plugin=ui,d.PositionedObjectLayoutType=Qo,d.PresetListType=Mt,d.ProtectionType=qi,d.QuickListType=Ml,d.QuickListTypeMap=s_,d.RANGE_DIRECTION=co,d.RANGE_TYPE=Le,d.RBush=Ri,d.RCDisposable=dc,d.RGBA_PAREN=Hc,d.RGB_PAREN=Bc,d.ROTATE_BUFFER_VALUE=Bi,d.RTree=wE,d.Range=gn,d.Rectangle=Yt,d.RedoCommand=Mu,d.RedoCommandId=Au,d.RefAlias=Nd,d.Registry=ti,d.RegistryAsMap=ni,d.RelativeDate=to,d.RelativeSlideLink=Ra,d.ResourceManagerService=bu,d.RgbColor=Sr,d.RichTextBuilder=un,d.RichTextValue=qt,d.RxDisposable=hc,d.SHEET_EDITOR_UNITS=Cd,d.SectionType=Ko,d.SheetTypes=no,d.SheetViewModel=pu,d.SliceBodyType=Zs,d.SlideDataModel=oi,d.SpacingRule=ta,d.SpecialShapes=eo,d.Styles=ru,d.THEME_COLORS=ao,d.TabStopAlignment=ra,d.TableAlignmentType=ia,d.TableLayoutType=oa,d.TableRowHeightRule=la,d.TableSizeType=sa,d.TableTextWrapType=aa,d.TextDecoration=ro,d.TextDecorationBuilder=Xt,d.TextDirection=Bn,d.TextDirectionType=qo,d.TextStyleBuilder=Kt,d.TextStyleValue=Qn,d.TextX=ze,d.TextXActionType=he,d.ThemeColor=vr,d.ThemeColorType=ct,d.ThemeColors=Cr,d.ThemeService=hi,d.Tools=re,d.UndoCommand=Nu,d.UndoCommandId=Tu,d.UnitModel=zr,d.Univer=AE,d.UniverInstanceType=Be,d.UpdateDocsAttributeType=ke,d.UserManagerService=nr,d.VerticalAlign=en,d.VerticalAlignmentType=ua,d.Worksheet=ar,d.WrapStrategy=tn,d.WrapTextType=Zo,d.addLinkToDocumentModel=ou,d.afterInitApply=Ic,d.afterTime=Rc,d.awaitTime=cE,d.binSearchFirstGreaterThanTarget=$i,d.binarySearchArray=Sc,d.bufferDebounceTime=Cc,d.cellToRange=mh,d.characterSpacingControlType=ma,d.checkForSubstrings=_h,d.checkIfMove=Oc,d.checkParagraphHasBullet=Zh,d.checkParagraphHasIndent=Qh,d.checkParagraphHasIndentByStyle=wo,d.codeToBlob=vc,d.composeBody=Qs,d.composeInterceptors=Gl,d.composeStyles=cs,d.concatMatrixArray=cd,d.convertBodyToHtml=$c,d.convertCellToRange=fo,d.covertTextRunToHtml=hs,d.createAsyncInterceptorKey=tp,d.createDefaultUser=Qr,d.createDocumentModelWithStyle=or,d.createInterceptorKey=Q_,d.createInternalEditorID=gd,d.createRowColIter=Os,d.dayjs=Pt,d.debounce=Um,d.dedupe=ec,d.deepCompare=_s,d.delayAnimationFrame=hE,d.deleteContent=yo,d.extractPureTextFromCell=Cu,d.fromCallback=Fi,d.fromEventSubject=hp,d.fromObservable=cc,d.generateRandomId=kt,d.get=hm,d.getArrayLength=jt,d.getBodySlice=bt,d.getBodySliceHtml=Rr,d.getBorderStyleType=dh,d.getCellCoordByIndexSimple=mi,d.getCellInfoInMergeData=oh,d.getCellPositionByIndexSimple=EE,d.getCellValueType=nh,d.getCellWithCoordByIndexCore=yn,d.getColorStyle=Tt,d.getCustomBlockSlice=Pl,d.getCustomDecorationSlice=xl,d.getCustomRangeSlice=Fl,d.getDocsUpdateBody=fh,d.getIntersectRange=$o,d.getOriginCellValue=jp,d.getParagraphsSlice=kl,d.getPlainText=$r,d.getReverseDirection=wc,d.getSectionBreakSlice=f_,d.getTableSlice=Ul,d.getTextRunSlice=Jr,d.getTransformOffsetX=Bu,d.getTransformOffsetY=Hu,d.getWorksheetUID=Gp,d.groupBy=rc,d.handleStyleToString=hh,d.hashAlgorithm=td,d.horizontalLineSegmentsSubtraction=kr,d.insertMatrixArray=Es,d.insertTextToContent=bo,d.isBlackColor=Qc,d.isBooleanString=Ym,d.isCellCoverable=ms,d.isCellV=sh,d.isEmptyCell=go,d.isFormulaId=ch,d.isFormulaString=uh,d.isICellData=th,d.isInternalEditorID=ko,d.isNodeEnv=xc,d.isNotNullOrUndefined=au,d.isNullCell=rh,d.isNumeric=Kl,d.isRangesEqual=Ap,d.isRealNum=ed,d.isSafeNumeric=ip,d.isSameStyleTextRun=mo,d.isUnitRangesEqual=Tp,d.isValidRange=gh,d.isWhiteColor=eh,d.makeArray=sc,d.makeCellRangeToRangeData=lh,d.makeCellToSelection=ah,d.makeCustomRangeStream=Fd,d.merge=Bs,d.mergeOverrideWithDependencies=wu,d.mergeSets=ap,d.mergeWith=xm,d.mergeWorksheetSnapshotWithDefault=_u,d.mixinClass=sp,d.moveMatrixArray=Rs,d.moveRangeByOffset=Rd,d.nameCharacterCheck=uE,d.normalizeBody=g_,d.normalizeTextRuns=Jn,d.numberToABC=Ld,d.numberToListABC=Ud,d.numfmt=ud,d.queryObjectMatrix=Td,d.registerDependencies=ic,d.remove=Ln,d.repeatStringNumTimes=jo,d.replaceInDocumentBody=lp,d.requestImmediateMacroTask=op,d.rotate=nc,d.searchArray=Fn,d.searchInOrderedArray=xi,d.selectionToArray=ih,d.sequence=bi,d.sequenceAsync=wi,d.sequenceExecute=as,d.sequenceExecuteAsync=Ec,d.set=Bm,d.shallowEqual=il,d.skipParseTagNames=dE,d.sliceMatrixArray=hd,d.sortRules=kd,d.sortRulesByDesc=Pd,d.sortRulesFactory=Yn,d.spliceArray=Cs,d.splitIntoGrid=vs,d.takeAfter=ls,d.textDiff=Ws,d.throttle=Z_,d.toDisposable=tt,d.touchDependencies=Oi,d.updateAttributeByDelete=$l,d.updateAttributeByInsert=Bl,Object.keys(We).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:()=>We[e]})}),Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});