@univerjs/core 1.0.0-alpha.6 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +82 -23
- package/lib/es/index.js +77 -25
- package/lib/index.js +77 -25
- package/lib/types/bases/typedef.d.ts +8 -0
- package/lib/types/docs/data-model/text-x/build-utils/data-stream-change.d.ts +3 -3
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/context/context.d.ts +1 -0
- package/lib/types/services/region/region.service.d.ts +28 -0
- package/lib/types/types/interfaces/i-document-data-interceptor.d.ts +2 -0
- package/lib/types/univer.d.ts +5 -0
- package/lib/umd/index.js +14 -14
- package/package.json +4 -4
package/lib/umd/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("rxjs"),require("@univerjs/protocol"),require("rxjs/operators"),require("@wendellhu/redi"),require("@univerjs/themes")):typeof define==`function`&&define.amd?define([`exports`,`rxjs`,`@univerjs/protocol`,`rxjs/operators`,`@wendellhu/redi`,`@univerjs/themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore={},e.rxjs,e.UniverProtocol,e.rxjs.operators,e[`@wendellhu/redi`],e.UniverThemes))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),p=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:o(u(e)),m(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e));let g=typeof global<`u`?global:typeof self<`u`?self:window;function _(){let e=new Map,t=0;typeof g.requestIdleCallback!=`function`&&(g.requestIdleCallback=function(n){let r=Date.now(),i=++t,a=setTimeout(function(){e.delete(i);let t=Math.max(0,50-(Date.now()-r));n({didTimeout:t===0,timeRemaining(){return t}})},1);return e.set(i,a),i}),typeof g.cancelIdleCallback!=`function`&&(g.cancelIdleCallback=function(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))})}function v(){typeof g.queueMicrotask!=`function`&&(g.queueMicrotask=function(e){Promise.resolve().then(e).catch(e=>{setTimeout(()=>{throw e},0)})})}function y(){typeof g.Array.prototype.findLastIndex!=`function`&&(g.Array.prototype.findLastIndex=function(e,t){if(this==null)throw TypeError(`Array.prototype.findLastIndex called on null or undefined`);if(typeof e!=`function`)throw TypeError(`callback must be a function`);let n=this.length>>>0;for(let r=n-1;r>=0;r--)if(r in this&&e.call(t,this[r],r,this))return r;return-1}),typeof g.Array.prototype.findLast!=`function`&&(g.Array.prototype.findLast=function(e,t){let n=this.findLastIndex(e,t);return n===-1?void 0:this[n]})}function b(){typeof g.String.prototype.at!=`function`&&(g.String.prototype.at=function(e){if(this==null)throw TypeError(`String.prototype.at called on null or undefined`);let t=this.length;if(e<0&&(e=t+e),!(e<0||e>=t))return this.charAt(e)})}function x(){_(),v(),y(),b()}function S(e){"@babel/helpers - typeof";return S=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S(e)}function C(e,t){if(S(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(S(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){var t=C(e,`string`);return S(t)==`symbol`?t:t+``}function T(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){return e instanceof t.Subscription||e instanceof t.Subject||e&&`closed`in e&&e.unsubscribe!==void 0}function D(e){let t=!1;return e?E(e)?{dispose:()=>e.unsubscribe()}:typeof e==`function`?{dispose:()=>{t||(t=!0,e())}}:e:D(()=>{})}var O=class{constructor(){T(this,`_disposables`,new Set)}add(e){let t=D(e);return this._disposables.add(t),{dispose:(e=!1)=>{e||t.dispose(),this._disposables.delete(t)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}},k=class{constructor(){T(this,`_disposed`,!1),T(this,`_collection`,new O)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw Error(`[Disposable]: object is disposed!`)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}},A=class extends k{constructor(...e){super(...e),T(this,`dispose$`,new t.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}},j=class extends k{constructor(e){super(),this._rootDisposable=e,T(this,`_ref`,0)}inc(){if(this._disposed)throw Error(`[RCDisposable]: should not ref to a disposed.`);this._ref+=1}dec(){--this._ref,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}},M=class extends k{};let N=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`.split(`.`)),P=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 F(e){if(!Number.isNaN(+e))return!1;if(e.startsWith(`http://localhost:3002`)||e.startsWith(`localhost:3002`))return!0;if(P.test(e)){if(I(e))return!0;try{let t=new URL(L(e)).hostname.split(`.`).pop();if(t&&N.has(t))return!0}catch{return!1}}return!1}function I(e){return/^[a-zA-Z]+:\/\//.test(e)}function ee(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function L(e){return I(e)?e:ee(e)?`mailto://${e}`:`https://${e}`}function R(e){if(!e||typeof e!=`string`)return!1;try{let t=typeof window<`u`&&window.location?window.location.origin:`http://localhost`,n=new URL(e,t);return[`http:`,`https:`,`mailto:`].includes(n.protocol)}catch{return!1}}function te(e,t){try{let n=new URL(t),r=n.pathname.endsWith(`/`)?n.pathname:`${n.pathname}/`,i=e.startsWith(`/`)?e.substring(1):e;return new URL(i,n.origin+r).toString()}catch(t){return console.error(`Error resolving URL with base URL:`,t),e}}function ne(e,t){return z.getValueType(e)===z.getValueType(t)?z.isArray(e)?re(e,t):z.isObject(e)?ie(e,t):z.isDate(e)?e.getTime()===t.getTime():z.isRegExp(e)?e.toString()===t.toString():e===t:!1}function re(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){let r=e[n],i=t[n];if(!ne(r,i))return!1}return!0}function ie(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.prototype.propertyIsEnumerable.call(t,r))return!1;let n=e[r],i=t[r];if(!ne(n,i))return!1}return!0}var z=class e{static deleteNull(e){for(let t in e)(e[t]===null||e[t]===void 0)&&delete e[t];return e}static getSystemType(){let e=navigator.userAgent,t=navigator.platform===`Win32`||navigator.platform===`Windows`,n=navigator.platform===`Mac68K`||navigator.platform===`MacPPC`||navigator.platform===`Macintosh`||navigator.platform===`MacIntel`;if(n)return`Mac`;if(navigator.platform===`X11`&&!t&&!n)return`Unix`;if(String(navigator.platform).indexOf(`Linux`)>-1)return`Linux`;if(t){if(e.indexOf(`Windows NT 5.0`)>-1||e.indexOf(`Windows 2000`)>-1)return`Windows 2000`;if(e.indexOf(`Windows NT 5.1`)>-1||e.indexOf(`Windows XP`)>-1)return`Windows XP`;if(e.indexOf(`Windows NT 5.2`)>-1||e.indexOf(`Windows 2003`)>-1)return`Windows 2003`;if(e.indexOf(`Windows NT 6.0`)>-1||e.indexOf(`Windows Vista`)>-1)return`Windows Vista`;if(e.indexOf(`Windows NT 6.1`)>-1||e.indexOf(`Windows 7`)>-1)return`Windows 7`;if(e.indexOf(`Windows NT 10`)>-1||e.indexOf(`Windows 10`)>-1)return`Windows 10`;if(e.indexOf(`Windows NT 11`)>-1||e.indexOf(`Windows 11`)>-1)return`Windows 11`}return`Unknown system`}static getBrowserType(){let e=navigator.userAgent,t=e.indexOf(`Opera`)>-1,n=e.indexOf(`compatible`)>-1&&e.indexOf(`MSIE`)>-1&&!t,r=e.indexOf(`Trident`)>-1&&e.indexOf(`rv:11.0`)>-1,i=e.indexOf(`Edge`)>-1,a=e.indexOf(`Firefox`)>-1,o=e.indexOf(`Safari`)>-1&&e.indexOf(`Chrome`)===-1,s=e.indexOf(`Chrome`)>-1&&e.indexOf(`Safari`)>-1;if(n){RegExp(`MSIE (\\d+\\.\\d+);`).test(e);let t=Number.parseFloat(RegExp.$1);return t===7?`IE7`:t===8?`IE8`:t===9?`IE9`:t===10?`IE10`:`0`}return a?`FF`:t?`Opera`:o?`Safari`:s?`Chrome`:i?`Edge`:r?`IE11`:`Unknown browser`}static deepMerge(t,...n){n.forEach(e=>e&&o(e));function r(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function i(t,n){t.forEach((t,o)=>{if(!(typeof o==`string`&&r(o))){if(e.isArray(t)){var s;let e=(s=n[o])==null?[]:s;n[o]=e,i(t,e);return}if(e.isObject(t)){var c;let e=(c=n[o])==null?{}:c;n[o]=e,a(t,e);return}n[o]=t}})}function a(t,n){Object.keys(t).forEach(o=>{if(r(o))return;let s=t[o];if(e.isObject(s)){var c;let e=(c=n[o])==null?{}:c;n[o]=e,a(s,e);return}if(e.isArray(s)){var l;let e=(l=n[o])==null?[]:l;n[o]=e,i(s,e);return}n[o]=s})}function o(n){Object.keys(n).forEach(o=>{if(r(o))return;let s=n[o];if(e.isArray(s)){var c;let e=(c=t[o])==null?[]:c;t[o]=e,i(s,e);return}if(e.isObject(s)){var l;let e=(l=t[o])==null?{}:l;t[o]=e,a(s,e);return}t[o]=s})}return t}static diffValue(e,t){return ne(e,t)}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)){let n=[];return t.forEach((t,r)=>{n[r]=e.deepClone(t)}),n}if(this.isObject(t)){let n=t,r={};for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=e.deepClone(n[t]));return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}return t}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()===``:!1:!0}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isDate(e){return this.getValueType(e)===`[object Date]`}static isRegExp(e){return this.getValueType(e)===`[object RegExp]`}static isArray(e){return this.getValueType(e)===`[object Array]`}static isString(e){return this.getValueType(e)===`[object String]`}static isNumber(e){return this.getValueType(e)===`[object Number]`}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isEmptyObject(e){for(let t in e)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(e){return F(e)}static normalizeUrl(e){return L(e)}static topLevelDomainCombiningString(){return[...N].join(`|`)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{let r=t[n];r==null?delete t[n]:e.removeNull(r)}),t}static numToWord(e){let t=``;for(;e>0;){let n=e%26;n=n===0?n=26:n,t=String.fromCharCode(96+n)+t,e=(e-n)/26}return t.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=0,i=0;for(let e=0;e<n;e++)i=t[e].charCodeAt(0)-96,r+=i*26**(n-e-1);return r===0?NaN:r-1}static chatAtABC(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}static commonExtend(e,t){let n={};for(let t in e)n[t]=e[t];for(let e in t)t[e]!=null&&(n[e]=t[e]);return n}static hasIntersectionBetweenTwoRanges(e,t,n,r){return t>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-zА-Яа-яЁё_]/.test(e)}static isValidParameter(e){let t=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!t&&n}static clamp(e,t,n){return Math.max(t,Math.min(n,e))}static now(){return performance&&performance.now?performance.now():Date.now()}};function ae(...e){let t={},n=e.length;for(let r=n-1;r>=0;r--){let n=e[r];if(n){let e=Object.keys(n);for(let r of e)t[r]===void 0&&(t[r]=n[r])}}return t}let oe=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,se=function(e){return e[e.DEFAULT_SERIES=0]=`DEFAULT_SERIES`,e[e.ALTERNATE_SERIES=1]=`ALTERNATE_SERIES`,e}({}),ce=function(e){return e[e.NONE=0]=`NONE`,e[e.THIN=1]=`THIN`,e[e.HAIR=2]=`HAIR`,e[e.DOTTED=3]=`DOTTED`,e[e.DASHED=4]=`DASHED`,e[e.DASH_DOT=5]=`DASH_DOT`,e[e.DASH_DOT_DOT=6]=`DASH_DOT_DOT`,e[e.DOUBLE=7]=`DOUBLE`,e[e.MEDIUM=8]=`MEDIUM`,e[e.MEDIUM_DASHED=9]=`MEDIUM_DASHED`,e[e.MEDIUM_DASH_DOT=10]=`MEDIUM_DASH_DOT`,e[e.MEDIUM_DASH_DOT_DOT=11]=`MEDIUM_DASH_DOT_DOT`,e[e.SLANT_DASH_DOT=12]=`SLANT_DASH_DOT`,e[e.THICK=13]=`THICK`,e}({}),le=function(e){return 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}({}),ue=function(e){return e[e.UNSUPPORTED=0]=`UNSUPPORTED`,e[e.RGB=1]=`RGB`,e[e.HEX=2]=`HEX`,e[e.THEME=3]=`THEME`,e}({}),de=function(e){return e[e.ON=0]=`ON`,e[e.OFF=1]=`OFF`,e}({}),fe=function(e){return 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}({}),pe=function(e){return e[e.LEFT=0]=`LEFT`,e[e.RIGHT=1]=`RIGHT`,e}({}),me=function(e){return e[e.DOCUMENT=0]=`DOCUMENT`,e[e.PROJECT=1]=`PROJECT`,e}({}),he=function(e){return e[e.COLUMNS=0]=`COLUMNS`,e[e.ROWS=1]=`ROWS`,e}({}),ge=function(e){return e[e.UP=0]=`UP`,e[e.RIGHT=1]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.LEFT=3]=`LEFT`,e}({});function _e(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}let ve=function(e){return 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}({}),ye=function(e){return e.EN_US=`enUS`,e.FR_FR=`frFR`,e.ZH_CN=`zhCN`,e.RU_RU=`ruRU`,e.ZH_TW=`zhTW`,e.ZH_HK=`zhHK`,e.VI_VN=`viVN`,e.FA_IR=`faIR`,e.JA_JP=`jaJP`,e.KO_KR=`koKR`,e.ES_ES=`esES`,e.CA_ES=`caES`,e.SK_SK=`skSK`,e.PT_BR=`ptBR`,e.DE_DE=`deDE`,e.IT_IT=`itIT`,e.ID_ID=`idID`,e.PL_PL=`plPL`,e.AR_SA=`arSA`,e}({}),be={enUS:{name:`English`,tag:`en-US`,direction:`ltr`},frFR:{name:`Français`,tag:`fr-FR`,direction:`ltr`},zhCN:{name:`简体中文`,tag:`zh-CN`,direction:`ltr`},ruRU:{name:`Русский`,tag:`ru-RU`,direction:`ltr`},zhTW:{name:`繁體中文`,tag:`zh-TW`,direction:`ltr`},zhHK:{name:`繁體中文(香港)`,tag:`zh-HK`,direction:`ltr`},viVN:{name:`Tiếng Việt`,tag:`vi-VN`,direction:`ltr`},faIR:{name:`فارسی`,tag:`fa-IR`,direction:`rtl`,numberingSystem:`arabext`},jaJP:{name:`日本語`,tag:`ja-JP`,direction:`ltr`},koKR:{name:`한국어`,tag:`ko-KR`,direction:`ltr`},esES:{name:`Español`,tag:`es-ES`,direction:`ltr`},caES:{name:`Català`,tag:`ca-ES`,direction:`ltr`},skSK:{name:`Slovenčina`,tag:`sk-SK`,direction:`ltr`},ptBR:{name:`Português (Brasil)`,tag:`pt-BR`,direction:`ltr`},deDE:{name:`Deutsch`,tag:`de-DE`,direction:`ltr`},itIT:{name:`Italiano`,tag:`it-IT`,direction:`ltr`},idID:{name:`Bahasa Indonesia`,tag:`id-ID`,direction:`ltr`},plPL:{name:`Polski`,tag:`pl-PL`,direction:`ltr`},arSA:{name:`العربية`,tag:`ar-SA`,direction:`rtl`,numberingSystem:`arab`}},xe=function(e){return 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}({}),Se=function(e){return e[e.RANGE=0]=`RANGE`,e[e.SHEET=1]=`SHEET`,e}({}),Ce=function(e){return 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}({}),we=function(e){return e[e.GRID=0]=`GRID`,e[e.KANBAN=1]=`KANBAN`,e[e.GANTT=2]=`GANTT`,e}({}),Te=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.LEFT_TO_RIGHT=1]=`LEFT_TO_RIGHT`,e[e.RIGHT_TO_LEFT=2]=`RIGHT_TO_LEFT`,e}({}),Ee=function(e){return 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}({}),De=function(e){return 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}({}),Oe=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TOP=1]=`TOP`,e[e.MIDDLE=2]=`MIDDLE`,e[e.BOTTOM=3]=`BOTTOM`,e}({}),ke=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.OVERFLOW=1]=`OVERFLOW`,e[e.CLIP=2]=`CLIP`,e[e.WRAP=3]=`WRAP`,e}({}),Ae=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ITALIC=1]=`ITALIC`,e}({}),je=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.BOLD=1]=`BOLD`,e}({}),Me=function(e){return e[e.NORMAL=1]=`NORMAL`,e[e.SUBSCRIPT=2]=`SUBSCRIPT`,e[e.SUPERSCRIPT=3]=`SUPERSCRIPT`,e}({}),Ne=function(e){return e[e.FALSE=0]=`FALSE`,e[e.TRUE=1]=`TRUE`,e}({}),Pe=function(e){return e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`,e[e.BOOLEAN=3]=`BOOLEAN`,e[e.FORCE_STRING=4]=`FORCE_STRING`,e}({}),Fe=function(e){return 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}({}),Ie=function(e){return 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}({});var Le=`@univerjs/core`,Re=`1.0.0-alpha.6`;function ze(e,t){let n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Be(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ve(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function He(e,t){for(let n=e.length-1;n>-1;n--){let r=e[n];if(t(r,n))return r}return null}function Ue(e,t){if(e.length===0)return e;let n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function We(e,t){let n=new Map;return e.forEach(e=>{let r=t(e),i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(e)}),n}function Ge(e){return Array.isArray(e)?e:[e]}function Ke(e,t){t.forEach(t=>e.add(t))}function qe(e,t){t.forEach(([t])=>{e.has(t)&&e.get(t)})}var Je=class extends Error{constructor(e){super(e),this.name=`CustomCommandExecutionError`}},Ye=class extends Je{constructor(){super(`Canceled by facade`),this.name=`CanceledError`}};async function Xe(e){for(let[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function Ze(e){for(let[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function Qe(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var $e=typeof global==`object`&&global&&global.Object===Object&&global,et=typeof self==`object`&&self&&self.Object===Object&&self,tt=$e||et||Function(`return this`)(),nt=function(){return tt.Date.now()},rt=/\s/;function it(e){for(var t=e.length;t--&&rt.test(e.charAt(t)););return t}var at=/^\s+/;function ot(e){return e&&e.slice(0,it(e)+1).replace(at,``)}var st=tt.Symbol,ct=Object.prototype,lt=ct.hasOwnProperty,ut=ct.toString,dt=st?st.toStringTag:void 0;function ft(e){var t=lt.call(e,dt),n=e[dt];try{e[dt]=void 0;var r=!0}catch{}var i=ut.call(e);return r&&(t?e[dt]=n:delete e[dt]),i}var pt=Object.prototype.toString;function mt(e){return pt.call(e)}var ht=`[object Null]`,gt=`[object Undefined]`,_t=st?st.toStringTag:void 0;function vt(e){return e==null?e===void 0?gt:ht:_t&&_t in Object(e)?ft(e):mt(e)}function yt(e){return typeof e==`object`&&!!e}var bt=`[object Symbol]`;function xt(e){return typeof e==`symbol`||yt(e)&&vt(e)==bt}var St=NaN,Ct=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,Tt=/^0o[0-7]+$/i,Et=parseInt;function Dt(e){if(typeof e==`number`)return e;if(xt(e))return St;if(Qe(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Qe(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=ot(e);var n=wt.test(e);return n||Tt.test(e)?Et(e.slice(2),n?2:8):Ct.test(e)?St:+e}var Ot=`Expected a function`,kt=Math.max,At=Math.min;function jt(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(Ot);t=Dt(t)||0,Qe(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?kt(Dt(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?At(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=nt();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(nt())}function x(){var e=nt(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}var Mt=Array.isArray,Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/;function Ft(e,t){if(Mt(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||xt(e)?!0:Pt.test(e)||!Nt.test(e)||t!=null&&e in Object(t)}var It=`[object AsyncFunction]`,Lt=`[object Function]`,Rt=`[object GeneratorFunction]`,zt=`[object Proxy]`;function Bt(e){if(!Qe(e))return!1;var t=vt(e);return t==Lt||t==Rt||t==It||t==zt}var Vt=tt[`__core-js_shared__`],Ht=function(){var e=/[^.]+$/.exec(Vt&&Vt.keys&&Vt.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function Ut(e){return!!Ht&&Ht in e}var Wt=Function.prototype.toString;function Gt(e){if(e!=null){try{return Wt.call(e)}catch{}try{return e+``}catch{}}return``}var Kt=/[\\^$.*+?()[\]{}|]/g,qt=/^\[object .+?Constructor\]$/,Jt=Function.prototype,Yt=Object.prototype,Xt=Jt.toString,Zt=Yt.hasOwnProperty,Qt=RegExp(`^`+Xt.call(Zt).replace(Kt,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function $t(e){return!Qe(e)||Ut(e)?!1:(Bt(e)?Qt:qt).test(Gt(e))}function en(e,t){return e==null?void 0:e[t]}function tn(e,t){var n=en(e,t);return $t(n)?n:void 0}var nn=tn(Object,`create`);function rn(){this.__data__=nn?nn(null):{},this.size=0}function an(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var on=`__lodash_hash_undefined__`,sn=Object.prototype.hasOwnProperty;function cn(e){var t=this.__data__;if(nn){var n=t[e];return n===on?void 0:n}return sn.call(t,e)?t[e]:void 0}var ln=Object.prototype.hasOwnProperty;function un(e){var t=this.__data__;return nn?t[e]!==void 0:ln.call(t,e)}var dn=`__lodash_hash_undefined__`;function fn(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=nn&&t===void 0?dn:t,this}function pn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pn.prototype.clear=rn,pn.prototype.delete=an,pn.prototype.get=cn,pn.prototype.has=un,pn.prototype.set=fn;function mn(){this.__data__=[],this.size=0}function hn(e,t){return e===t||e!==e&&t!==t}function gn(e,t){for(var n=e.length;n--;)if(hn(e[n][0],t))return n;return-1}var _n=Array.prototype.splice;function vn(e){var t=this.__data__,n=gn(t,e);return n<0?!1:(n==t.length-1?t.pop():_n.call(t,n,1),--this.size,!0)}function yn(e){var t=this.__data__,n=gn(t,e);return n<0?void 0:t[n][1]}function bn(e){return gn(this.__data__,e)>-1}function xn(e,t){var n=this.__data__,r=gn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Sn(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])}}Sn.prototype.clear=mn,Sn.prototype.delete=vn,Sn.prototype.get=yn,Sn.prototype.has=bn,Sn.prototype.set=xn;var Cn=tn(tt,`Map`);function wn(){this.size=0,this.__data__={hash:new pn,map:new(Cn||Sn),string:new pn}}function Tn(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function En(e,t){var n=e.__data__;return Tn(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Dn(e){var t=En(this,e).delete(e);return this.size-=+!!t,t}function On(e){return En(this,e).get(e)}function kn(e){return En(this,e).has(e)}function An(e,t){var n=En(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function jn(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])}}jn.prototype.clear=wn,jn.prototype.delete=Dn,jn.prototype.get=On,jn.prototype.has=kn,jn.prototype.set=An;var Mn=`Expected a function`;function Nn(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Mn);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Nn.Cache||jn),n}Nn.Cache=jn;var Pn=500;function Fn(e){var t=Nn(e,function(e){return n.size===Pn&&n.clear(),e}),n=t.cache;return t}var In=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ln=/\\(\\)?/g,Rn=Fn(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(In,function(e,n,r,i){t.push(r?i.replace(Ln,`$1`):n||e)}),t});function zn(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Bn=1/0,Vn=st?st.prototype:void 0,Hn=Vn?Vn.toString:void 0;function Un(e){if(typeof e==`string`)return e;if(Mt(e))return zn(e,Un)+``;if(xt(e))return Hn?Hn.call(e):``;var t=e+``;return t==`0`&&1/e==-Bn?`-0`:t}function Wn(e){return e==null?``:Un(e)}function Gn(e,t){return Mt(e)?e:Ft(e,t)?[e]:Rn(Wn(e))}var Kn=1/0;function qn(e){if(typeof e==`string`||xt(e))return e;var t=e+``;return t==`0`&&1/e==-Kn?`-0`:t}function Jn(e,t){t=Gn(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[qn(t[n++])];return n&&n==r?e:void 0}function Yn(e,t,n){var r=e==null?void 0:Jn(e,t);return r===void 0?n:r}function Xn(){this.__data__=new Sn,this.size=0}function Zn(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Qn(e){return this.__data__.get(e)}function $n(e){return this.__data__.has(e)}var er=200;function tr(e,t){var n=this.__data__;if(n instanceof Sn){var r=n.__data__;if(!Cn||r.length<er-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(e,t),this.size=n.size,this}function nr(e){var t=this.__data__=new Sn(e);this.size=t.size}nr.prototype.clear=Xn,nr.prototype.delete=Zn,nr.prototype.get=Qn,nr.prototype.has=$n,nr.prototype.set=tr;var rr=function(){try{var e=tn(Object,`defineProperty`);return e({},``,{}),e}catch{}}();function ir(e,t,n){t==`__proto__`&&rr?rr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ar(e,t,n){(n!==void 0&&!hn(e[t],n)||n===void 0&&!(t in e))&&ir(e,t,n)}function or(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var sr=or(),cr=typeof e==`object`&&e&&!e.nodeType&&e,lr=cr&&typeof module==`object`&&module&&!module.nodeType&&module,ur=lr&&lr.exports===cr?tt.Buffer:void 0,dr=ur?ur.allocUnsafe:void 0;function fr(e,t){if(t)return e.slice();var n=e.length,r=dr?dr(n):new e.constructor(n);return e.copy(r),r}var pr=tt.Uint8Array;function mr(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}function hr(e,t){var n=t?mr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function gr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var _r=Object.create,vr=function(){function e(){}return function(t){if(!Qe(t))return{};if(_r)return _r(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function yr(e,t){return function(n){return e(t(n))}}var br=yr(Object.getPrototypeOf,Object),xr=Object.prototype;function Sr(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||xr)}function Cr(e){return typeof e.constructor==`function`&&!Sr(e)?vr(br(e)):{}}var wr=`[object Arguments]`;function Tr(e){return yt(e)&&vt(e)==wr}var Er=Object.prototype,Dr=Er.hasOwnProperty,Or=Er.propertyIsEnumerable,kr=Tr(function(){return arguments}())?Tr:function(e){return yt(e)&&Dr.call(e,`callee`)&&!Or.call(e,`callee`)},Ar=9007199254740991;function jr(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Ar}function Mr(e){return e!=null&&jr(e.length)&&!Bt(e)}function Nr(e){return yt(e)&&Mr(e)}function Pr(){return!1}var Fr=typeof e==`object`&&e&&!e.nodeType&&e,Ir=Fr&&typeof module==`object`&&module&&!module.nodeType&&module,Lr=Ir&&Ir.exports===Fr?tt.Buffer:void 0,Rr=(Lr?Lr.isBuffer:void 0)||Pr,zr=`[object Object]`,Br=Function.prototype,Vr=Object.prototype,Hr=Br.toString,Ur=Vr.hasOwnProperty,Wr=Hr.call(Object);function Gr(e){if(!yt(e)||vt(e)!=zr)return!1;var t=br(e);if(t===null)return!0;var n=Ur.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Hr.call(n)==Wr}var Kr=`[object Arguments]`,qr=`[object Array]`,Jr=`[object Boolean]`,Yr=`[object Date]`,Xr=`[object Error]`,Zr=`[object Function]`,Qr=`[object Map]`,$r=`[object Number]`,ei=`[object Object]`,ti=`[object RegExp]`,ni=`[object Set]`,ri=`[object String]`,ii=`[object WeakMap]`,ai=`[object ArrayBuffer]`,oi=`[object DataView]`,si=`[object Float32Array]`,ci=`[object Float64Array]`,li=`[object Int8Array]`,ui=`[object Int16Array]`,di=`[object Int32Array]`,fi=`[object Uint8Array]`,pi=`[object Uint8ClampedArray]`,mi=`[object Uint16Array]`,hi=`[object Uint32Array]`,B={};B[si]=B[ci]=B[li]=B[ui]=B[di]=B[fi]=B[pi]=B[mi]=B[hi]=!0,B[Kr]=B[qr]=B[ai]=B[Jr]=B[oi]=B[Yr]=B[Xr]=B[Zr]=B[Qr]=B[$r]=B[ei]=B[ti]=B[ni]=B[ri]=B[ii]=!1;function gi(e){return yt(e)&&jr(e.length)&&!!B[vt(e)]}function _i(e){return function(t){return e(t)}}var vi=typeof e==`object`&&e&&!e.nodeType&&e,yi=vi&&typeof module==`object`&&module&&!module.nodeType&&module,bi=yi&&yi.exports===vi&&$e.process,xi=function(){try{return yi&&yi.require&&yi.require(`util`).types||bi&&bi.binding&&bi.binding(`util`)}catch{}}(),Si=xi&&xi.isTypedArray,Ci=Si?_i(Si):gi;function wi(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Ti=Object.prototype.hasOwnProperty;function Ei(e,t,n){var r=e[t];(!(Ti.call(e,t)&&hn(r,n))||n===void 0&&!(t in e))&&ir(e,t,n)}function Di(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?ir(n,s,c):Ei(n,s,c)}return n}function Oi(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var ki=9007199254740991,Ai=/^(?:0|[1-9]\d*)$/;function ji(e,t){var n=typeof e;return t=t==null?ki:t,!!t&&(n==`number`||n!=`symbol`&&Ai.test(e))&&e>-1&&e%1==0&&e<t}var Mi=Object.prototype.hasOwnProperty;function Ni(e,t){var n=Mt(e),r=!n&&kr(e),i=!n&&!r&&Rr(e),a=!n&&!r&&!i&&Ci(e),o=n||r||i||a,s=o?Oi(e.length,String):[],c=s.length;for(var l in e)(t||Mi.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||ji(l,c)))&&s.push(l);return s}function Pi(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Fi=Object.prototype.hasOwnProperty;function Ii(e){if(!Qe(e))return Pi(e);var t=Sr(e),n=[];for(var r in e)r==`constructor`&&(t||!Fi.call(e,r))||n.push(r);return n}function Li(e){return Mr(e)?Ni(e,!0):Ii(e)}function Ri(e){return Di(e,Li(e))}function zi(e,t,n,r,i,a,o){var s=wi(e,n),c=wi(t,n),l=o.get(c);if(l){ar(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Mt(c),p=!f&&Rr(c),m=!f&&!p&&Ci(c);u=c,f||p||m?Mt(s)?u=s:Nr(s)?u=gr(s):p?(d=!1,u=fr(c,!0)):m?(d=!1,u=hr(c,!0)):u=[]:Gr(c)||kr(c)?(u=s,kr(s)?u=Ri(s):(!Qe(s)||Bt(s))&&(u=Cr(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),ar(e,n,u)}function Bi(e,t,n,r,i){e!==t&&sr(t,function(a,o){if(i||(i=new nr),Qe(a))zi(e,t,o,n,Bi,r,i);else{var s=r?r(wi(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),ar(e,o,s)}},Li)}function Vi(e){return e}function Hi(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)}var Ui=Math.max;function Wi(e,t,n){return t=Ui(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Ui(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Hi(e,this,s)}}function Gi(e){return function(){return e}}var Ki=rr?function(e,t){return rr(e,`toString`,{configurable:!0,enumerable:!1,value:Gi(t),writable:!0})}:Vi,qi=800,Ji=16,Yi=Date.now;function Xi(e){var t=0,n=0;return function(){var r=Yi(),i=Ji-(r-n);if(n=r,i>0){if(++t>=qi)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zi=Xi(Ki);function Qi(e,t){return Zi(Wi(e,t,Vi),e+``)}function $i(e,t,n){if(!Qe(n))return!1;var r=typeof t;return(r==`number`?Mr(n)&&ji(t,n.length):r==`string`&&t in n)?hn(n[t],e):!1}function ea(e){return Qi(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&$i(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var ta=ea(function(e,t,n){Bi(e,t,n)}),na=ea(function(e,t,n,r){Bi(e,t,n,r)});function ra(e,t,n,r){if(!Qe(e))return e;t=Gn(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=qn(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=Qe(u)?u:ji(t[i+1])?[]:{})}Ei(s,c,l),s=s[c]}return e}function ia(e,t,n){return e==null?e:ra(e,t,n)}let aa=(0,i.createIdentifier)(`univer.config-service`);var oa=class{constructor(){T(this,`_configChanged$`,new t.Subject),T(this,`configChanged$`,this._configChanged$.asObservable()),T(this,`_config`,new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(e){return this._config.get(e)}setConfig(e,t,n){var r;let{merge:i=!1}=n||{},a=(r=this._config.get(e))==null?{}:r;a=i?ta(a,t):t,this._config.set(e,a),this._configChanged$.next({[e]:a})}deleteConfig(e){return this._config.delete(e)}subscribeConfigValue$(e){return new t.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,e)&&n.next(this._config.get(e));let r=this.configChanged$.pipe((0,t.filter)(t=>Object.prototype.hasOwnProperty.call(t,e))).subscribe(t=>n.next(t[e]));return()=>r.unsubscribe()})}};let sa=(0,i.createIdentifier)(`univer.context-service`);var ca=class extends k{constructor(...e){super(...e),T(this,`_contextChanged$`,new t.Subject),T(this,`contextChanged$`,this._contextChanged$.asObservable()),T(this,`_contextMap`,new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(e){var t;return(t=this._contextMap.get(e))==null?!1:t}setContextValue(e,t){this._contextMap.set(e,t),this._contextChanged$.next({[e]:t})}subscribeContextValue$(e){return new t.Observable(n=>{let r=this._contextChanged$.pipe((0,t.filter)(t=>t[e]!==void 0)).subscribe(t=>n.next(t[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}};let la=function(e){return 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}({}),ua=(0,i.createIdentifier)(`univer.log`);var da=class extends k{constructor(...e){super(...e),T(this,`_logLevel`,3),T(this,`_deduction`,new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}deprecate(...e){this._logLevel>=2&&this._logWithDeduplication(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...t){let n=t[0];/^\[(.*?)\]/g.test(n)?e(`\x1B[97;104m${n}\x1B[0m`,...t.slice(1)):e(...t)}_logWithDeduplication(e,...t){let n=fa(...t);this._deduction.has(n)||(this._deduction.add(n),this._log(e,...t))}};function fa(...e){return e.map(e=>JSON.stringify(e)).join(``)}function V(e,t){return function(n,r){t(n,r,e)}}function pa(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let ma=`command.logExecution`,ha=function(e){return e[e.COMMAND=0]=`COMMAND`,e[e.OPERATION=1]=`OPERATION`,e[e.MUTATION=2]=`MUTATION`,e}({}),ga=(0,i.createIdentifier)(`univer.core.command-service`);var _a=class{constructor(){T(this,`_commands`,new Map),T(this,`_commandTypes`,new Map)}registerCommand(e){if(this._commands.has(e.id))throw Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),D(()=>{this.unregisterCommand(e.id)})}unregisterCommand(e){this._commands.delete(e),this._commandTypes.delete(e)}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}};let va={id:`nil`,type:0,handler:()=>!0},ya=class extends k{constructor(e,t,n){super(),this._injector=e,this._logService=t,this._configService=n,T(this,`_commandRegistry`,void 0),T(this,`_beforeCommandExecutionListeners`,[]),T(this,`_commandExecutedListeners`,[]),T(this,`_collabMutationListeners`,[]),T(this,`_multiCommandDisposables`,new Map),T(this,`_commandExecutingLevel`,0),T(this,`_commandExecutionStack`,[]),this._commandRegistry=new _a,this.registerCommand(va)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}disposed(){return this._disposed}_warnCommandSkippedAfterDisposed(e){this._logService.warn(`[CommandService]`,`command "${e}" skipped because CommandService is disposed.`)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._commandRegistry.registerCommand(e)}unregisterCommand(e){var t;this._commandRegistry.unregisterCommand(e),(t=this._multiCommandDisposables.get(e))==null||t.dispose()}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),D(()=>{let t=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),D(()=>{let t=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onMutationExecutedForCollab(e){if(this._collabMutationListeners.indexOf(e)===-1)return this._collabMutationListeners.push(e),D(()=>{let t=this._collabMutationListeners.indexOf(e);this._collabMutationListeners.splice(t,1)});throw Error(`[CommandService]: could not add a collab mutation listener twice.`)}async executeCommand(e,t,n){if(this._disposed)return this._warnCommandSkippedAfterDisposed(e),!1;try{let r=this._commandRegistry.getCommand(e);if(r){let[i]=r,a={id:i.id,type:i.type,params:t},o=this._pushCommandExecutionStack(a),s=n==null?{}:n;if(this._beforeCommandExecutionListeners.forEach(e=>e(a,s)),this._disposed)return o.dispose(),this._warnCommandSkippedAfterDisposed(e),!1;let c=await this._execute(i,t,s);return s.syncOnly||this._commandExecutedListeners.forEach(e=>e(a,s)),i.type===2&&this._collabMutationListeners.forEach(e=>e(a,s)),o.dispose(),c}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Je)return!1;throw e}}syncExecuteCommand(e,t,n){if(this._disposed)return this._warnCommandSkippedAfterDisposed(e),!1;try{let i=this._commandRegistry.getCommand(e);if(i){let[a]=i,o={id:a.id,type:a.type,params:t};if(a.type===2){let e=He(this._commandExecutionStack,e=>e.type===0);if(e){var r;o.params=(r=o.params)==null?{}:r,o.params.trigger=e.id}}let s=this._pushCommandExecutionStack(o),c=n==null?{}:n;if(this._beforeCommandExecutionListeners.forEach(e=>e(o,c)),this._disposed)return s.dispose(),this._warnCommandSkippedAfterDisposed(e),!1;let l=this._syncExecute(a,t,c);return c.syncOnly||this._commandExecutedListeners.forEach(e=>e(o,c)),a.type===2&&this._collabMutationListeners.forEach(e=>e(o,c)),s.dispose(),l}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Je)return!1;throw e}}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),D(()=>ze(this._commandExecutionStack,e))}_registerMultiCommand(e){let t=this._commandRegistry.getCommand(e.id),n;if(!t){n=new ba(e.id);let t=new O;t.add(this._commandRegistry.registerCommand(n)),t.add(D(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,t)}else if(t[0].multi!==!0)throw Error(`Command has registered as a single command.`);else n=t[0];let r=n.registerImplementation(e);return D(()=>{if(r.dispose(),!n.hasImplementations()){var t;(t=this._multiCommandDisposables.get(e.id))==null||t.dispose()}})}async _execute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,t,n),this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}_syncExecute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,t,n),r instanceof Promise)throw TypeError(`[CommandService]: Command handler should not return a promise.`);this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}};ya=pa([V(0,(0,i.Inject)(i.Injector)),V(1,ua),V(2,aa)],ya);var ba=class{constructor(e){this.id=e,T(this,`name`,void 0),T(this,`multi`,!0),T(this,`type`,0),T(this,`priority`,0),T(this,`_implementations`,[]),T(this,`handler`,async(e,t)=>{if(!this._implementations.length)return!1;let n=e.get(ua),r=e.get(sa),a=e.get(i.Injector);for(let e of this._implementations){let i=e.command.preconditions;if((!i||i&&i(r))&&(n.debug(`[MultiCommand]`,`executing implementation "${e.command.name}".`),await a.invoke(e.command.handler,t)))return!0}return!1}),this.name=e}registerImplementation(e){let t={command:e};return this._implementations.push(t),this._implementations.sort((e,t)=>t.command.priority-e.command.priority),D(()=>{let e=this._implementations.indexOf(t);this._implementations.splice(e,1)})}hasImplementations(){return this._implementations.length>0}};function xa(e,t,n){return Ze(e.map(e=>()=>t.syncExecuteCommand(e.id,e.params,n)))}function Sa(e,t,n){return Xe(e.map(e=>()=>t.executeCommand(e.id,e.params,n)))}function Ca(e){return new t.Observable(t=>{let n=e((...e)=>t.next(e));return()=>n==null?void 0:n.dispose()})}function wa(e){return function(n){return new t.Observable(t=>(n.subscribe({next:n=>{t.next(n),e(n)&&t.complete()},complete:()=>t.complete(),error:e=>t.error(e)}),()=>t.unsubscribe()))}}function Ta(e=0){return n=>{let r=[];return n.pipe((0,t.tap)(e=>r.push(e)),(0,t.debounceTime)(e),(0,t.map)(()=>r),(0,t.tap)(()=>r=[]))}}function Ea(e){let n=new t.ReplaySubject(1);return setTimeout(()=>n.next(),e),n.pipe((0,t.take)(1))}function Da(e,n){let r=new t.BehaviorSubject(n),i=e.subscribe(r),a=r.complete.bind(r);return r.complete=()=>{i.unsubscribe(),a()},r}let Oa=e=>new Promise(n=>{(0,t.merge)(Ca(e.onCommandExecuted.bind(e)).pipe((0,r.filter)(([e])=>e.type===2)),(0,t.timer)(300)).pipe((0,r.debounceTime)(16),(0,r.first)()).subscribe(()=>{n()})});function ka(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 Aa(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((r+n)/2);if(t<e[i]&&(i===0||t>=e[i-1]))return i;if(t>=e[i])n=i+1;else if(t<e[i])r=i-1;else return-1}return-1}function ja(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i]<=t?n=i+1:r=i}return n<e.length?n:e.length-1}function Ma(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(r=e.length<40||t<=e[20]||t>=e[r-20]?ka(e,t):ja(e,t),n){let t=e[r];return e.indexOf(t)}return r}function Na(e){let t=new Blob([e],{type:`text/javascript`});return window.URL.createObjectURL(t)}function Pa(e,t){if(t==null||e==null)return!0;let{left:n=0,top:r=0,height:i=0,width:a=0,angle:o=0}=t,{left:s=0,top:c=0,height:l=0,width:u=0,angle:d=0}=e,f=u,p=l,m=a,h=i;return Math.abs(s-n)>2||Math.abs(c-r)>2||Math.abs(f-m)>2||Math.abs(p-h)>2||Math.abs(d-o)>1}let Fa={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],darkyellow:[139,128,0],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]};var Ia=class e{static mix(t,n,r){var i,a;r=Math.min(1,Math.max(0,r));let o=new e(t).toRgb(),s=new e(n).toRgb(),c=(i=o.a)==null?1:i,l=(a=s.a)==null?1:a;return new e({r:(s.r-o.r)*r+o.r,g:(s.g-o.g)*r+o.g,b:(s.b-o.b)*r+o.b,a:(l-c)*r+c})}static getContrastRatio(t,n){let r=new e(t).getLuminance(),i=new e(n).getLuminance();return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}constructor(t){if(T(this,`_color`,void 0),T(this,`_rgbColor`,void 0),T(this,`_isValid`,!1),t==null){this._setNullColor();return}if(t instanceof e){this._color={...t._color},this._rgbColor={...t._rgbColor};return}let n=za(t);if(n==null){this._setNullColor();return}this._color=n;let r=Wa(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){let{r:e,g:t,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?`a`:``}(${e},${t},${n}${i?`,${r}`:``})`}toString(){return this.toRgbString()}toHexString(e){let{r:t,g:n,b:r,a:i=1}=this.toRgb(),a=i<1,o=[La(Math.round(t).toString(16)),La(Math.round(n).toString(16)),La(Math.round(r).toString(16)),La(Math.round(i*255).toString(16))];return e&&o[0][0]===o[0][1]&&o[1][0]===o[1][1]&&o[2][0]===o[2][1]&&o[3][0]===o[3][1]?a?`#${o[0][0]}${o[1][0]}${o[2][0]}${o[3][0]}`:`#${o[0][0]}${o[1][0]}${o[2][0]}`:a?`#${o[0]}${o[1]}${o[2]}${o[3]}`:`#${o[0]}${o[1]}${o[2]}`}toHsv(){return Ya(this.toRgb())}toHsl(){return Ja(this.toRgb())}lighten(t=10){let n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}darken(t=10){let n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}setAlpha(t){return new e({...this._rgbColor,a:t})}getLuminance(){let{r:e,g:t,b:n}=this.toRgb();return e=Ra(e),t=Ra(t),n=Ra(n),Number((.2126*e+.7152*t+.0722*n).toFixed(3))}getBrightness(){let{r:e,g:t,b:n}=this.toRgb();return(e*299+t*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)==null?1:e}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}}};let La=e=>e.length===1?`0${e}`:e,Ra=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),za=e=>{if(Za(e)){if(`r`in e){let t={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(t.a=e.a),t}if(`l`in e){let t={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(t.a=e.a),t}let t={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(t.a=e.a),t}let t=e.trim().toLowerCase();if(Fa[t]){let e=Fa[t],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(t.startsWith(`#`))return Ba(t);if(t.startsWith(`rgb`))return Va(t);if(t.startsWith(`hsl`))return Ha(t);if(t.startsWith(`hsv`))return Ua(t)},Ba=e=>{let t=e.substring(1),n=RegExp(`.{1,${t.length>=6?2:1}}`,`g`),r=t.match(n);if(!r||r.length<3)throw Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(e=>e+e));let i={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(i.a=Number.parseInt(r[3],16)/255),i},Va=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal rgb color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal rgb color`);let 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},Ha=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsl color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsl color`);let 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},Ua=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsv color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsv color`);let 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},Wa=e=>{let t=za(e);if(t!=null)return`r`in t?t:`l`in t?Ka(t):qa(t)},Ga=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Ka=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let i=0,a=0,o=0;if(n===0)i=a=o=r;else{let e=r<.5?r*(1+n):r+n-r*n,s=2*r-e;i=Ga(s,e,t+1/3),a=Ga(s,e,t),o=Ga(s,e,t-1/3)}let s={r:Math.round(i*255),g:Math.round(a*255),b:Math.round(o*255)};return e.a!==void 0&&(s.a=e.a),s},qa=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;let i=Math.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),c=r*(1-(1-a)*n),l=i%6,u=[r,s,o,o,c,r][l],d=[c,r,r,s,o,o][l],f=[o,o,c,r,r,s][l],p={r:u*255,g:d*255,b:f*255};return e.a!==void 0&&(p.a=e.a),p},Ja=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c;if(i===a)s=c=0;else{let e=i-a;switch(c=o>.5?e/(2-i-a):e/(i+a),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;default:s=(t-n)/e+4;break}s/=6}let l={h:Math.round(s*360),s:Math.round(c*100),l:Math.round(o*100)};return e.a!==void 0&&(l.a=e.a),l},Ya=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o,s=i,c=i-a,l=i===0?0:c/i;if(i===a)o=0;else{switch(i){case t:o=(n-r)/c+(n<r?6:0);break;case n:o=(r-t)/c+2;break;default:o=(t-n)/c+4;break}o/=6}let u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(s*100)};return e.a!==void 0&&(u.a=e.a),u},Xa=e=>e==null,Za=e=>!Xa(e)&&typeof e==`object`;function Qa(e){return!!(/^#(?:[0]{3}|[0]{6})\b/.test(e)||/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/.test(e)||/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function $a(e){return!!(/^#(?:[Ff]{3}|[Ff]{6})\b/.test(e)||/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/.test(e)||/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}let eo=function(e){return e[e.COVER=0]=`COVER`,e[e.REPLACE=1]=`REPLACE`,e}({});function to(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 no(e){if(e.t!==void 0)return e.t;if(typeof e.v==`string`)return 1;if(typeof e.v==`number`)return 2;if(typeof e.v==`boolean`)return 3}function ro(e){if(e==null)return!0;let{v:t,f:n,si:r,p:i}=e;return!(!(t==null||typeof t==`string`&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||i!=null)}function io(e){return e!=null&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)}let ao=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({}),oo=function(e){return e[e.NONE=0]=`NONE`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({});function so(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}let co=function(e){return e.NONE=`none`,e.BACKWARD=`backward`,e.FORWARD=`forward`,e}({}),lo=function(e){return e.RECT=`RECT`,e.TEXT=`TEXT`,e}({});function uo(e,t,n){let r=!1,i=!1,a=e,o=t,s=e,c=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c};for(let l=0;l<n.length;l++){let{startRow:u,endRow:d,startColumn:f,endColumn:p}=n[l];if(e===u&&t===f){a=d,o=p,s=u,c=f,i=!0;break}if(e>=u&&e<=d&&t>=f&&t<=p){a=d,o=p,s=u,c=f,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}let fo=function(e){return e.Raw=`raw`,e.Intercepted=`intercepted`,e.Both=`both`,e}({}),po={Office:{4:`#4472C4`,5:`#ED7D31`,6:`#A5A5A5`,7:`#70AD47`,8:`#5B9BD5`,9:`#70AD47`,0:`#000000`,2:`#44546A`,1:`#FFFFFF`,3:`#E7E6E6`,10:`#0563C1`,11:`#954F72`}},mo=`general`,ho=`hash`,go=`zero`,_o=`qmark`,vo=`slash`,yo=`group`,bo=`scale`,xo=`comma`,So=`break`,Co=`text`,wo=`plus`,To=`minus`,Eo=`point`,Do=`space`,Oo=`percent`,ko=`digit`,Ao=`calendar`,jo=`error`,Mo=`datetime`,No=`duration`,Po=`condition`,Fo=`dbnum`,Io=`natnum`,Lo=`locale`,Ro=`color`,zo=`modifier`,Bo=`ampm`,Vo=`escaped`,Ho=`string`,Uo=`skip`,Wo=`fill`,Go=`paren`,Ko=`char`,qo=`#000000.#FFFFFF.#FF0000.#00FF00.#0000FF.#FFFF00.#FF00FF.#00FFFF.#800000.#008000.#000080.#808000.#800080.#008080.#C0C0C0.#808080.#9999FF.#993366.#FFFFCC.#CCFFFF.#660066.#FF8080.#0066CC.#CCCCFF.#000080.#FF00FF.#FFFF00.#00FFFF.#800080.#800000.#008080.#0000FF.#00CCFF.#CCFFFF.#CCFFCC.#FFFF99.#99CCFF.#FF99CC.#CC99FF.#FFCC99.#3366FF.#33CCCC.#99CC00.#FFCC00.#FF9900.#FF6600.#666699.#969696.#003366.#339966.#003300.#333300.#993300.#993366.#333399.#333333`.split(`.`),Jo=`¤.$.£.¥.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿`.split(`.`),Yo=RegExp(`[${Jo.join(``)}]`);function Xo(e){return!!e&&`scale`in e}function Zo(e){return!!e&&`generated`in e&&!!e.generated}function Qo(e){return!!(Xo(e[0])&&e[0].percent||Xo(e[1])&&e[1].percent||Xo(e[2])&&e[2].percent||Xo(e[3])&&e[3].percent)}function $o(e){return!!(Xo(e[0])&&e[0].date||Xo(e[1])&&e[1].date||Xo(e[2])&&e[2].date||Xo(e[3])&&e[3].date)}function es(e){let[t,n,r,i]=e;return!!((!t||Zo(t))&&(!n||Zo(n))&&(!r||Zo(r))&&Xo(i)&&i.text&&!Zo(i))}let ts={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},ns=[[`DMY`,1],[`DM`,2],[`MY`,3],[`MDY`,4],[`MD`,5],[`hmsa`,6],[`hma`,7],[`hms`,8],[`hm`,9]];function rs(e,t=null){var n;let[r,i]=e;if(!r)throw TypeError(`Cannot read properties of undefined (reading 'frac_max')`);let a=Xo(r)?r:void 0,o=Xo(i)?i:void 0,s=`error`in r,c=a==null?void 0:a.frac_max,l={type:`general`,isDate:$o(e),isText:es(e),isPercent:Qo(e),maxDecimals:a!=null&&a.general?9:c==null?0:c,scale:(n=a==null?void 0:a.scale)==null?1:n,color:0,parentheses:0,grouped:a!=null&&a.grouping?1:0,code:``,level:0},u=!l.isDate&&!l.isText&&!s&&r.tokens.some(e=>e.type===`string`&&typeof e.value==`string`&&(t?e.value===t:Yo.test(e.value))),d=`G`,f=c!==void 0&&c>=0?Math.min(15,c):``,p=``,m=``;if(o!=null&&o.color&&(m=`-`,l.color=1),a!=null&&a.parens&&(p=`()`,l.parentheses=1),u)d=`C`,l.type=`currency`;else if(s)l.type=`error`,l.maxDecimals=0;else if(l.isDate){let e=0,t=0,n=``;r.tokens.forEach(r=>{let i=r.type;/^(b-)?year/.test(i)?(n+=`Y`,t++):i.startsWith(`month`)?(n+=`M`,t++):/^(week)?day/.test(i)?(n+=`D`,t++):(i===`hour`||i===`min`||i===`sec`||i===`ampm`)&&(n+=i[0],e++)}),l.type=`date`,t&&e?l.type=`datetime`:!t&&e&&(l.type=`time`);let i=ns.find(([e])=>n.startsWith(e));d=i?`D`:`G`,f=i?i[1]:``}else l.isText?(d=`G`,l.type=`text`,f=``,l.maxDecimals=0):a!=null&&a.general?(d=`G`,l.type=`general`,f=``):a!=null&&a.fractions?(d=`G`,l.type=`fraction`,f=``):a!=null&&a.exponential?(d=`S`,l.type=`scientific`):l.isPercent?(d=`P`,l.type=`percent`):a!=null&&a.grouping?(d=`,`,l.type=`grouped`):a&&(a.int_max||c)&&(d=`F`,l.type=`number`);return l.code=d+f+m+p,l.level=ts[l.type],Object.freeze(l)}function is(e){var t;let[n]=e;if(!n)throw TypeError(`Cannot read properties of undefined (reading 'date')`);let r=Xo(n)?n:void 0,i=(t=r==null?void 0:r.date)==null?0:t;return{year:!!(i&2),month:!!(i&4),day:!!(i&8),hours:!!(i&16),minutes:!!(i&32),seconds:!!(i&64),clockType:(r==null?void 0:r.clock)===12?12:24}}function as(e){if(!Number.isFinite(e))throw RangeError(`decimalFromNumber requires a finite number`);let t=e<0||Object.is(e,-0);if(e===0)return{negative:t,digits:`0`,exponent:0};let[n,r]=Math.abs(e).toExponential(14).split(`e`);return{negative:t,digits:n.replace(`.`,``).replace(/0+$/,``)||`0`,exponent:Number(r)}}function os(e,t){return{...e,exponent:e.digits===`0`?0:e.exponent+Math.trunc(t)}}function ss(e){let t=[...e];for(let e=t.length-1;e>=0;e--){if(t[e]!==`9`)return t[e]=String(Number(t[e])+1),t.join(``);t[e]=`0`}return`1${t.join(``)}`}function cs(e,t=0){let n=Math.trunc(t),r=e.exponent+1+n,i;if(r<0?i=`0`:r===0?i=e.digits[0]>=`5`?`1`:`0`:(i=e.digits.slice(0,r).padEnd(r,`0`)||`0`,r<e.digits.length&&e.digits[r]>=`5`&&(i=ss(i))),/^0+$/.test(i))return{negative:e.negative,integer:`0`,fraction:``,zero:!0};if(n<=0)return{negative:e.negative,integer:i+`0`.repeat(-n),fraction:``,zero:!1};let a=i.padStart(n+1,`0`);return{negative:e.negative,integer:a.slice(0,-n),fraction:a.slice(-n).replace(/0+$/,``),zero:!1}}function ls(e){let t=Number(e.fraction?`${e.integer}.${e.fraction}`:e.integer);return e.negative&&!e.zero?-t:t}function us(e){return`${e.negative&&!e.zero?`-`:``}${e.integer}${e.fraction?`.${e.fraction}`:``}`}function ds(e,t,n,r){if(e.digits===`0`)return{exponent:0,rounded:cs(e,r)};let i=t>1?Math.floor(e.exponent/t)*t:e.exponent;n||i++;let a=cs(os(e,-i),r);return t===1&&a.integer.length>1&&(i++,a=cs(os(e,-i),r)),{exponent:i,rounded:a}}let fs=Object.freeze({1078:`af`,1052:`sq`,1118:`am`,5121:`ar_DZ`,15361:`ar_BH`,3073:`ar_EG`,2049:`ar_IQ`,11265:`ar_JO`,13313:`ar_KW`,12289:`ar_LB`,4097:`ar_LY`,6145:`ar_MA`,8193:`ar_OM`,16385:`ar_QA`,1025:`ar_SA`,10241:`ar_SY`,7169:`ar_TN`,14337:`ar_AE`,9217:`ar_YE`,1067:`hy`,1101:`as`,2092:`az_AZ`,1068:`az_AZ`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn_IN`,5146:`bs`,1026:`bg`,1109:`my`,1027:`ca`,2052:`zh_CN`,3076:`zh_HK`,5124:`zh_MO`,4100:`zh_SG`,1028:`zh_TW`,1050:`hr`,1029:`cs`,1030:`da`,1125:`dv`,2067:`nl_BE`,1043:`nl_NL`,1126:`bin`,3081:`en_AU`,10249:`en_BZ`,4105:`en_CA`,9225:`en_CB`,2057:`en_GB`,16393:`en_IN`,6153:`en_IE`,8201:`en_JM`,5129:`en_NZ`,13321:`en_PH`,7177:`en_ZA`,11273:`en_TT`,1033:`en_US`,12297:`en_ZW`,1061:`et`,1071:`mk`,1080:`fo`,1065:`fa`,1124:`fil`,1035:`fi`,2060:`fr_BE`,11276:`fr_CM`,3084:`fr_CA`,9228:`fr_CG`,12300:`fr_CI`,1036:`fr_FR`,5132:`fr_LU`,13324:`fr_ML`,6156:`fr_MC`,14348:`fr_MA`,10252:`fr_SN`,4108:`fr_CH`,7180:`fr`,1122:`fy_NL`,2108:`gd_IE`,1084:`gd`,1110:`gl`,1079:`ka`,3079:`de_AT`,1031:`de_DE`,5127:`de_LI`,4103:`de_LU`,2055:`de_CH`,1032:`el`,1140:`gn`,1095:`gu`,1279:`en`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig_NG`,1057:`id`,1040:`it_IT`,2064:`it_CH`,1041:`ja`,1099:`kn`,1120:`ks`,1087:`kk`,1107:`km`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1142:`la`,1062:`lv`,1063:`lt`,2110:`ms_BN`,1086:`ms_MY`,1100:`ml`,1082:`mt`,1112:`mni`,1153:`mi`,1102:`mr`,1104:`mn`,2128:`mn`,1121:`ne`,1044:`no_NO`,2068:`no_NO`,1096:`or`,1045:`pl`,1046:`pt_BR`,2070:`pt_PT`,1094:`pa`,1047:`rm`,2072:`ro_MO`,1048:`ro_RO`,1049:`ru`,2073:`ru_MO`,1083:`se`,1103:`sa`,3098:`sr_SP`,2074:`sr_SP`,1072:`st`,1074:`tn`,1113:`sd`,1115:`si`,1051:`sk`,1060:`sl`,1143:`so`,1070:`sb`,11274:`es_AR`,16394:`es_BO`,13322:`es_CL`,9226:`es_CO`,5130:`es_CR`,7178:`es_DO`,12298:`es_EC`,17418:`es_SV`,4106:`es_GT`,18442:`es_HN`,2058:`es_MX`,19466:`es_NI`,6154:`es_PA`,15370:`es_PY`,10250:`es_PE`,20490:`es_PR`,1034:`es_ES`,14346:`es_UY`,8202:`es_VE`,1089:`sw`,2077:`sv_FI`,1053:`sv_SE`,1114:`syc`,1064:`tg`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1073:`ts`,1055:`tr`,1090:`tk`,1058:`uk`,1056:`ur`,2115:`uz_UZ`,1091:`uz_UZ`,1075:`ve`,1066:`vi`,1106:`cy`,1076:`xh`,1085:`yi`,1077:`zu`}),ps=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,ms={},H=(e,t=``)=>e.replace(/~/g,t).split(`;`),U=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(e=>{let n=e.slice(0,t%10);return n+(t<10||e===n?``:`.`)})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(e=>{let t=e.slice(0,n%10);return t+(n<10||e===t?``:`.`)})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),hs={group:`\xA0`,decimal:`.`,positive:`+`,negative:`-`,percent:`%`,exponent:`E`,nan:`NaN`,infinity:`∞`,ampm:H(`AM;PM`),mmmm6:H(`Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah`),mmm6:H(`Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H.`),mmmm:H(`January;February;March;April;May;June;July;August;September;October;November;December`),mmm:H(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec`),dddd:H(`Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday`),ddd:H(`Sun;Mon;Tue;Wed;Thu;Fri;Sat`),bool:H(`TRUE;FALSE`),preferMDY:!1};function gs(e){let t=ps.exec(e);if(!t)throw SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?`_${t[2]}`:``),language:t[1],territory:t[2]||``}}function _s(e){if(typeof e==`number`)return fs[e&65535]||null;let t=Number.parseInt(e,16);return Number.isFinite(t)&&fs[t&65535]?fs[t&65535]||null:ps.test(e)?e:null}function vs(e){let t=_s(e),n=null;if(t){let e=gs(t);n=ms[e.lang]||ms[e.language]||null}return n}function ys(e){return Object.assign({},hs,e)}function W(e,t){let n=typeof t==`object`?t:gs(t);return ms[n.lang]=ys(e),n.language!==n.lang&&!ms[n.language]&&(ms[n.language]=ys(e)),ms[n.lang]}let bs=ys({group:`,`,preferMDY:!0});bs.isDefault=!0,W({group:`,`,ampm:H(`上午;下午`),mmmm:H(`一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月`),mmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:H(`周日;周一;周二;周三;周四;周五;周六`)},`zh_CN`);let xs={group:`,`,ampm:H(`上午;下午`),mmmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),mmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:H(`周日;周一;周二;周三;周四;周五;周六`)};W({...xs,nan:`非數值`,dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_TW`),W({...xs,dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_HK`),W({...xs,ampm:H(`午前;午後`),dddd:H(`日~;月~;火~;水~;木~;金~;土~`,`曜日`),ddd:H(`日;月;火;水;木;金;土`)},`ja`),W({group:`,`,ampm:H(`오전;오후`),mmmm:H(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),mmm:H(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),dddd:H(`일요일;월요일;화요일;수요일;목요일;금요일;토요일`),ddd:H(`일;월;화;수;목;금;토`)},`ko`),W({group:`,`,ampm:H(`ก่อนเที่ยง;หลังเที่ยง`),mmmm:H(`มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~`,`าคม`),mmm:H(`ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค.`),dddd:H(`วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์`),ddd:H(`อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.`)},`th`),W(U({decimal:`,`,ampm:H(`dop.;odp.`),mmmm:H(`ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince`),mmm:H(`I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII`),dddd:H(`neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota`),bool:H(`PRAVDA;NEPRAVDA`)},-1,2),`cs`),W(U({group:`.`,decimal:`,`,mmmm:H(`januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december`),dddd:H(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:H(`SAND;FALSK`)},13,13),`da`),W(U({group:`.`,decimal:`,`,ampm:H(`a.m.;p.m.`),mmmm:H(`januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december`),mmm:H(`jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec.`),dddd:H(`zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag`),bool:H(`WAAR;ONWAAR`)},-1,2),`nl`),W({group:`,`,preferMDY:!0},`en`),W({group:`,`,preferMDY:!0},`en_US`),W({group:`,`},`en_AU`),W({group:`,`},`en_CA`),W({group:`,`},`en_GB`),W({group:`,`,mmm:H(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec`)},`en_IE`),W(U({decimal:`,`,nan:`epäluku`,ampm:H(`ap.;ip.`),mmmm:H(`tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~`,`kuuta`),mmm:H(`tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk.`),dddd:H(`sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~`,`taina`),bool:H(`TOSI;EPÄTOSI`)},-1,2),`fi`);let Ss=U({group:` `,decimal:`,`,mmmm:H(`janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre`),mmm:H(`janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc.`),dddd:H(`~manche;lun~;mar~;mercre~;jeu~;vendre~;same~`,`di`),bool:H(`VRAI;FAUX`)},-1,13);W({...Ss},`fr`),W({...Ss,mmm:H(`janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.`)},`fr_CA`),W({group:`'`,decimal:`.`,...Ss},`fr_CH`);let Cs=U({mmmm:H(`Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember`),mmm:H(`Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez.`),dddd:H(`Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~`,`tag`),bool:H(`WAHR;FALSCH`)},-1,12);W({group:`.`,decimal:`,`,...Cs},`de`),W({group:`'`,decimal:`.`,...Cs},`de_CH`),W(U({group:`.`,decimal:`,`,ampm:H(`π.μ.;μ.μ.`),mmmm:H(`Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~`,`ίου`),mmm:H(`Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ`),dddd:H(`Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο`)},-1,3),`el`),W({decimal:`,`,ampm:H(`de.;du.`),mmmm:H(`január;február;március;április;május;június;július;augusztus;szeptember;október;november;december`),mmm:H(`jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec.`),dddd:H(`vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat`),ddd:H(`V;H;K;Sze;Cs;P;Szo`),bool:H(`IGAZ;HAMIS`)},`hu`),W(U({group:`.`,decimal:`,`,ampm:H(`f.h.;e.h.`),mmmm:H(`janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember`),dddd:H(`sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~`,`dagur`)},13,13),`is`),W(U({group:`.`,decimal:`,`,mmmm:H(`Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember`),dddd:H(`Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu`)},3,3),`id`);let ws=U({mmmm:H(`gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre`),dddd:H(`domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato`),bool:H(`VERO;FALSO`)},3,3);W({group:`.`,decimal:`,`,...ws},`it`),W({group:`'`,decimal:`.`,...ws},`it_CH`);let Ts={decimal:`,`,ampm:H(`a.m.;p.m.`),mmmm:H(`januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember`),mmm:H(`jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des.`),dddd:H(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:H(`SANN;USANN`)};W(U({...Ts},-1,13),`nb`),W(U({...Ts},-1,13),`no`),W(U({decimal:`,`,mmmm:H(`stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia`),dddd:H(`niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota`),ddd:H(`niedz.;pon.;wt.;śr.;czw.;pt.;sob.`),bool:H(`PRAWDA;FAŁSZ`)},3,-1),`pl`);let Es={group:`.`,decimal:`,`,mmmm:H(`janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro`),dddd:H(`domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado`),bool:H(`VERDADEIRO;FALSO`)};W(U(Es,13,13),`pt`),W(U(Es,13,13),`pt_BR`),W({decimal:`,`,nan:`не\xA0число`,mmmm:H(`января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря`),mmm:H(`янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек.`),dddd:H(`воскресенье;понедельник;вторник;среда;четверг;пятница;суббота`),ddd:H(`вс;пн;вт;ср;чт;пт;сб`),mmmm6:H(`рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан`),mmm6:H(`рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам.`),bool:H(`ИСТИНА;ЛОЖЬ`)},`ru`),W(U({decimal:`,`,mmmm:H(`januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra`),dddd:H(`nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota`)},3,2),`sk`);let Ds={group:`.`,decimal:`,`,ampm:H(`a.\xA0m.;p.\xA0m.`),mmmm:H(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~`,`bre`),mmm:H(`ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic`),dddd:H(`domingo;lunes;martes;miércoles;jueves;viernes;sábado`),ddd:H(`dom;lun;mar;mié;jue;vie;sáb`),bool:H(`VERDADERO;FALSO`)},Os=H(`ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic`),ks=H(`ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.`);W({...Ds},`es`),W({...Ds},`es_AR`),W({...Ds},`es_BO`),W({...Ds},`es_CL`),W({...Ds},`es_CO`),W({...Ds},`es_EC`),W({...Ds,mmm:Os,ampm:H(`a.m.;p.m.`)},`es_MX`),W({...Ds,mmm:ks},`es_PY`),W({...Ds,mmm:ks},`es_UY`),W({...Ds,mmm:ks,mmmm:H(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre`)},`es_VE`),W({decimal:`,`,ampm:H(`fm;em`),mmmm:H(`januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december`),mmm:H(`jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec.`),dddd:H(`sön~;mån~;tis~;ons~;tors~;fre~;lör~`,`dag`),ddd:H(`sön;mån;tis;ons;tors;fre;lör`)},`sv`),W(U({group:`.`,decimal:`,`,ampm:H(`ÖÖ;ÖS`),mmmm:H(`Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık`),mmm:H(`Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara`),dddd:H(`Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi`),ddd:H(`Paz;Pzt;Sal;Çar;Per;Cum;Cmt`),bool:H(`DOĞRU;YANLIŞ`)},3,-1),`tr`),W({group:`,`,ampm:H(`yb;yh`),mmmm:H(`Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr`),mmm:H(`Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag`),dddd:H(`Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn`),ddd:H(`Sul;Llun;Maw;Mer;Iau;Gwen;Sad`)},`cy`),W({group:`.`,decimal:`,`,mmmm:H(`yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr`),mmm:H(`yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek`),dddd:H(`bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə`),ddd:H(`B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.`)},`az`),W(U({decimal:`,`,mmmm:H(`студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня`),dddd:H(`нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота`),ddd:H(`нд;пн;аў;ср;чц;пт;сб`)},3,-1),`be`),W({decimal:`,`,ampm:H(`пр.об.;сл.об.`),mmmm:H(`януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември`),mmm:H(`яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек`),dddd:H(`неделя;понеделник;вторник;сряда;четвъртък;петък;събота`),ddd:H(`нд;пн;вт;ср;чт;пт;сб`),bool:H(`ИСТИНА;ЛОЖЬ`)},`bg`),W({group:`.`,decimal:`,`,mmmm:H(`de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre`),mmm:H(`de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des.`),dddd:H(`diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte`),ddd:H(`dg.;dl.;dt.;dc.;dj.;dv.;ds.`),ampm:H(`a.\xA0m.;p.\xA0m.`)},`ca`),W(U({group:`,`,decimal:`.`,mmmm:H(`Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre`),dddd:H(`Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado`)},3,3),`fil`),W({group:`,`,decimal:`.`,mmmm:H(`જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર`),mmm:H(`જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે`),dddd:H(`રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~`,`વાર`),ddd:H(`રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ`)},`gu`),W({group:`,`,decimal:`.`,ampm:H(`לפנה״צ;אחה״צ`),dddd:H(`~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת`,`יום `),ddd:H(`~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת`,`יום `),mmmm:H(`ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר`),mmm:H(`ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳`),mmmm6:H(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן`),mmm6:H(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן`)},`he`),W(U({group:`.`,decimal:`,`,mmmm:H(`siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca`),mmm:H(`sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro`),dddd:H(`nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota`)},-1,3),`hr`),W({decimal:`,`,mmmm:H(`հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի`),mmm:H(`հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ`),dddd:H(`կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ`),ddd:H(`կիր;երկ;երք;չրք;հնգ;ուր;շբթ`)},`hy`),W(U({decimal:`,`,mmmm:H(`იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი`),dddd:H(`კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი`)},3,3),`ka`),W(U({decimal:`,`,mmmm:H(`қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан`),dddd:H(`жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі`),ddd:H(`жс;дс;сс;ср;бс;жм;сб`)},13,-1),`kk`),W({group:`,`,mmmm:H(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್`),mmm:H(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ`),dddd:H(`ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~`,`ವಾರ`),ddd:H(`ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ`),ampm:H(`ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ`)},`kn`),W({decimal:`,`,mmmm:H(`sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio`),mmm:H(`saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod.`),dddd:H(`sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis`),ddd:H(`sk;pr;an;tr;kt;pn;št`),ampm:H(`priešpiet;popiet`)},`lt`),W({decimal:`,`,mmmm:H(`janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris`),mmm:H(`janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec.`),dddd:H(`svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena`),ddd:H(`svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd.`),ampm:H(`priekšpusdienā;pēcpusdienā`)},`lv`),W({group:`,`,decimal:`.`,mmmm:H(`ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ`),mmm:H(`ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം`),dddd:H(`ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച`),ddd:H(`ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി`)},`ml`),W({group:`,`,decimal:`.`,mmmm:H(`нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~`,`р сар`),mmm:H(`1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~`,`-р сар`),dddd:H(`ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба`),ddd:H(`Ня;Да;Мя;Лх;Пү;Ба;Бя`),ampm:H(`ү.ө.;ү.х.`)},`mn`),W({group:`,`,decimal:`.`,mmmm:H(`जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर`),mmm:H(`जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें`),dddd:H(`रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:H(`रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि`)},`mr`),W(U({group:`,`,decimal:`.`,mmmm:H(`ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ`),mmm:H(`ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ`),dddd:H(`တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ`),ampm:H(`နံနက်;ညနေ`)},-1,0),`my`),W({group:`,`,decimal:`.`,mmmm:H(`ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ`),mmm:H(`ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ`),dddd:H(`ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ`),ddd:H(`ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ`),ampm:H(`ਪੂ.ਦੁ.;ਬਾ.ਦੁ.`)},`pa`),W({group:`.`,decimal:`,`,mmmm:H(`ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~`,`brie`),mmm:H(`ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec.`),dddd:H(`duminică;luni;marți;miercuri;joi;vineri;sâmbătă`),ddd:H(`dum.;lun.;mar.;mie.;joi;vin.;sâm.`),ampm:H(`a.m.;p.m.`)},`ro`),W(U({group:`.`,decimal:`,`,mmmm:H(`januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december`),mmm:H(`jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec.`),dddd:H(`nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota`),ampm:H(`dop.;pop.`)},-1,13),`sl`),W(U({group:`.`,decimal:`,`,mmmm:H(`јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар`),dddd:H(`недеља;понедељак;уторак;среда;четвртак;петак;субота`)},3,3),`sr`),W({group:`,`,decimal:`.`,mmmm:H(`ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்`),mmm:H(`ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச.`),dddd:H(`ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி`),ddd:H(`ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி`)},`ta`),W({group:`,`,decimal:`.`,mmmm:H(`జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్`),mmm:H(`జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం`),dddd:H(`ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం`),ddd:H(`ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని`)},`te`),W({decimal:`,`,mmmm:H(`січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня`),mmm:H(`січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд.`),dddd:H(`неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу`),ddd:H(`нд;пн;вт;ср;чт;пт;сб`),ampm:H(`дп;пп`)},`uk`),W({group:`.`,decimal:`,`,mmmm:H(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`tháng `),mmm:H(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`thg `),dddd:H(`Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy`),ddd:H(`CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7`),ampm:H(`SA;CH`)},`vi`),W(U({group:`٬`,decimal:`٫`,ampm:H(`ص;م`),mmmm:H(`يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر`),dddd:H(`الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت`),mmmm6:H(`رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان`)},0,0),`ar`),W({group:`,`,decimal:`.`,mmmm:H(`জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর`),mmm:H(`জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ`),dddd:H(`রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার`),ddd:H(`রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি`)},`bn`),W({group:`,`,decimal:`.`,mmmm:H(`जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर`),mmm:H(`जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰`),dddd:H(`रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:H(`रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि`),ampm:H(`am;pm`)},`hi`);function As(e,t){switch(t){case`int`:return e.int_pattern;case`frac`:return e.frac_pattern;case`man`:return e.man_pattern;case`den`:return e.den_pattern;case`num`:return e.num_pattern}}function js(e,t,n){let r=e.length,i=e.replace(/#/g,``).length;switch(n){case`int`:t.int_max=r,t.int_min=i;break;case`frac`:t.frac_max=r,t.frac_min=i;break;case`man`:t.man_max=r,t.man_min=i;break;case`den`:t.den_max=r,t.den_min=i;break;case`num`:t.num_max=r,t.num_min=i;break}return t}function G(e,t){typeof e==`string`?t.push({type:`string`,value:e}):t.push(e)}function Ms(e,t){let n=e==null?void 0:e.type;return n===`hash`||n===`zero`||n===`qmark`||n===`digit`&&t===`den`}function Ns(e){if(e===null)throw TypeError(`Cannot read properties of null (reading 'num')`)}function Ps(e){let t=[],n={scale:1,scaleExponent:0,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:t,tokensUsed:0,pattern:``,int_max:0,int_min:0,frac_max:0,frac_min:0,man_max:0,man_min:0,num_max:0,num_min:0,den_max:0,den_min:0,int_p:``,man_p:``,num_p:``,den_p:``,integer:!1},r=`int`,i=null,a=[],o,s=!1,c=-1,l=!1,u=``,d=!1;for(;++c<e.length&&!l;){var f;let h=e[c],g=h.type||`error`;if(u+=h.raw,g===`general`)n.general=!0,G(h,t);else if(Ms(h,r)){let e=As(n,r);Ms(o,r)||(o==null?void 0:o.type)===`group`?(e.push((e.pop()||``)+h.value),Ns(i),i.num+=h.value):(e.push(h.value),i={type:r,num:h.value},G(i,t))}else if(g===`paren`)h.value===`(`&&(n.parens=!0),G(h.value,t);else if(g===`digit`)G(h.value,t);else if(g===`slash`){d=!0;let e=As(n,r);if(e.length){if(!i)throw SyntaxError(`Format pattern is missing a numerator`);n.fractions=!0;let a=e.pop();if(a===void 0)throw SyntaxError(`Format pattern is missing a numerator`);n.num_pattern.push(a),i.type=`num`,r=`den`,G({type:`div`},t)}else G(h.value,t)}else if(g===`comma`)G(`,`,t);else if(g===`scale`)n.scale=.001**h.raw.length,n.scaleExponent=-3*h.raw.length;else if(g===`group`){if(r===`int`&&(n.grouping=!0),r===`den`)throw SyntaxError(`Cannot group denominator digits`)}else if(g===`space`)G(h,t);else if(g===`break`){l=!0;break}else if(g===`text`)n.text=!0,G(h,t);else if(g===`plus`||g===`minus`)G(h,t);else if(g===`duration`){let e=h.value.toLowerCase(),r=e[0],i={type:``,size:0,date:1,pad:e.length};r===`h`?(i.size=16,i.type=`hour-elap`):r===`m`?(i.size=32,i.type=`min-elap`):(i.size=64,i.type=`sec-elap`),n.date|=i.size,a.push(i),G(i,t)}else if(n.date&&g===`point`&&((f=e[c+1])==null?void 0:f.type)===`zero`){var p,m;let r=1;c++;let i=`0`;((p=e[c+1])==null?void 0:p.type)===`zero`&&(i+=`0`,r=2,c++),((m=e[c+1])==null?void 0:m.type)===`zero`&&(i+=`0`,r=3,c++),u+=i;let a=[64,128,256,512][r];n.date|=a,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,r),G({type:`subsec`,size:a,decimals:r,date:1},t)}else if(g===`calendar`)s||(h.value===`B2`||h.value===`b2`?n.date_system=6:n.date_system=1);else if(g===`datetime`){let e={type:``,size:0,date:1},r=h.value.toLowerCase(),i=r[0];if(r===`y`||r===`yy`)e.size=2,e.type=`year-short`;else if(i===`y`||i===`e`)e.size=2,e.type=`year`;else if(r===`b`||r===`bb`)e.size=2,e.type=`b-year-short`;else if(i===`b`)e.size=2,e.type=`b-year`;else if(r===`d`||r===`dd`)e.size=8,e.type=`day`,e.pad=/dd/.test(r);else if(r===`ddd`||r===`aaa`)e.size=8,e.type=`weekday-short`;else if(i===`d`||i===`a`)e.size=8,e.type=`weekday`;else if(i===`h`)e.size=16,e.type=`hour`,e.pad=/hh/i.test(r);else if(i===`m`){r.length===3?(e.size=4,e.type=`monthname-short`):r.length===5?(e.size=4,e.type=`monthname-single`):r.length>=4&&(e.size=4,e.type=`monthname`);let t=a[a.length-1];!e.type&&t&&!t.used&&t.size&80&&(t.used=!0,e.size=32,e.type=`min`,e.pad=/mm/.test(r)),e.type||(e.size=4,e.type=`month`,e.pad=/mm/.test(r),e.indeterminate=!0)}else if(i===`s`){e.size=64,e.type=`sec`,e.pad=/ss/.test(r);let t=a[a.length-1];t&&t.size&32?e.used=!0:t!=null&&t.indeterminate&&(delete t.indeterminate,t.size=32,t.type=`min`,e.used=!0)}n.date|=e.size,n.date_eval=!0,a.push(e),G(e,t)}else if(g===`ampm`)n.clock=12,n.date|=16,n.date_eval=!0,h.short=h.value===`A/P`,G(h,t);else if(g===`string`||g===`escaped`||g===`char`)G(h.value,t);else if(g===`condition`)n.condition=[h.value[0],Number.parseFloat(h.value[1])];else if(g===`locale`){let e=h.value.split(`-`),r=e.length<2?``:e.slice(1).join(`-`),i=e[0];i&&G(i,t);let a=_s(r);a&&(n.locale=a);let o=Number.parseInt(r,16);Number.isFinite(o)&&o&16711680&&(o>>16&255)==6&&(n.date_system=6),s=!0}else if(g===`color`){let e=h.value.toLowerCase(),t=e,r=/^color\s*(\d+)$/i.exec(e);r&&(t=Number.parseInt(r[1],10)),n.color=t}else if(g===`percent`)n.scale=100,n.scaleExponent=2,n.percent=!0,G(`%`,t);else if(g===`point`)G(h,t),n.date||(n.dec_fractions=!0,r=`frac`);else if(g===`exp`)n.exponential=!0,n.exp_plus=h.value.includes(`+`),r=`man`,G({type:`exp`,plus:n.exp_plus},t);else if(g===`skip`||g===`fill`)G(h,t);else if(!(g===`dbnum`||g===`natnum`))throw SyntaxError(g===`error`?`Illegal character: ${u}`:`Unknown token ${g} in ${u}`);o=h}if(n.tokensUsed=c,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&G({type:`text`},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||d&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw SyntaxError(`Invalid pattern: ${u}`);let h=n.int_pattern.join(``),g=n.man_pattern.join(``),_=n.frac_pattern.join(``);js(h,n,`int`);let v=0;for(let e=0;e<h.length;e++){let t=h[h.length-1-e];/^[0-9?]/.test(t)&&(v=e+1)}n.int_min=v,js(_,n,`frac`),js(g,n,`man`);let y=n.num_pattern.join(``),b=n.den_pattern[0]||``;if(b.includes(`?`)||y.includes(`?`)?(b=b.replace(/\d/g,`?`),b=b.replace(/#$/g,`?`),js(y,n,`num`),js(b,n,`den`),y=y.replace(/#$/g,`?`)):(js(y,n,`num`),js(b,n,`den`)),n.int_p=h,n.man_p=g,n.num_p=y,n.den_p=b,n.den_pattern.length&&(n.denominator=Number.parseInt(n.den_pattern.join(``).replace(/\D/g,``),10)),n.integer=!!h.length,!n.integer&&!n.exponential&&_.length){let e=n.tokens.findIndex(e=>e.type===`point`);n.tokens.splice(e,0,{type:`int`,value:`#`}),n.integer=!0,n.int_pattern=[`#`],n.int_p=`#`}if(n.fractions)for(let e=0;e<t.length-1;e++){let n=t[e];if(n.type!==`string`&&n.type!==`space`)continue;let r=t[e+1].type;r===`num`?n.rule=`num+int`:r===`div`?n.rule=`num`:r===`den`&&(n.rule=`den`)}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Fs(e){if(e===0)return e;let t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Is(e,t=2,n=2){let r=e<0?-1:1,i=10**(t||2),a=10**(n||2),o=Math.abs(e),s=0,c=0,l=0,u=1,d,f;if(e=o,e%1==0)f=[e*r,1];else if(e<1e-19)f=[r,0x8ac7230489e80000];else if(e>0x8ac7230489e80000)f=[0x8ac7230489e80000*r,1];else{do if(o=1/(o-Math.floor(o)),d=u,u=u*Math.floor(o)+s,s=d,c=l,l=Math.floor(e*u+.5),l>=i||u>=a)return[r*c,s];while(Math.abs(e-l/u)>=1e-13&&o!==Math.floor(o));f=[r*l,u]}return f}let Ls={total:1,sign:0,period:0,int:1,frac:0};function Rs(e,t=!0){let n=as(e);if(n.digits===`0`)return Ls;let r=n.exponent+1,i=Math.max(r,1),a=Math.max(0,n.digits.length-r),o=t&&n.negative?1:0,s=+(a>0);return{total:o+i+s+a,digits:Math.max(r,0)+a,sign:o,period:s,int:i,frac:a}}function zs(e,t=0){let n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function Bs(e,t=1){return t<-300?Number.parseFloat(e.toExponential().split(`e`)[0]):e*10**-t}function Vs(e,t=0){if(e<0)return-Vs(-e,t);if(t){let n=10**t||1;return Vs(e*n,0)/n}return Math.round(e)}function Hs(e,t=0){if(typeof e!=`number`)return e;if(!Number.isFinite(e)||e===0)return e===0?0:e;if(!Number.isFinite(t))return Vs(e,t);let n=Math.trunc(t);if(Number.isInteger(e)&&n>=0||n>324)return e;let r=ls(cs(as(e),n));return Number.isFinite(r)?r:e}function Us(e,t){return e.replace(/\./,t.decimal)}function Ws(e){return e?e.negative?{...e,negative:!1}:e:null}function Gs(e){var t;return(t=e==null?void 0:e.exponent)==null?0:t}function Ks(e){return!e||e.exponent<-308}function qs(e,t){let n=ds(e,1,!0,5),r=n.exponent,i=Math.abs(r);return[Us(us(n.rounded),t),t.exponent,r<0?t.negative:t.positive,i<10?`0`:``,i]}function Js(e,t,n){let r=Math.abs(t),i=e===1?e:Math.round(e*1e5)/1e5;return[Us(String(i),n),n.exponent,t<0?n.negative:n.positive,r<10?`0`:``,r]}function Ys(e,t,n,r,i=null){let a=typeof n==`number`?n|0:0;if(typeof n==`string`)e.push(n);else if(n===a)e.push(Math.abs(a));else{let t=Math.abs(n),a=Ws(i),o=Gs(a),s=null;Ks(a)&&(o=zs(t),s=Bs(t,o),s===10&&(s=1,o++));let c=Rs(t);if(o>=-4&&o<=-1){let n=t.toPrecision(10+o).replace(/\.?0+$/,``);e.push(Us(n,r))}else if(o===10){let n=t.toFixed(10).slice(0,12).replace(/\.$/,``);e.push(Us(n,r))}else if(Math.abs(o)<=9)if(c.total<=11){let n=Hs(t,9).toFixed(c.frac);e.push(Us(n,r))}else o===9?e.push(Math.floor(t)):o>=0&&o<9?e.push(Us(String(Hs(t,9-o)),r)):e.push(...s===null?qs(a,r):Js(s,o,r));else c.total>=12?e.push(...s===null?qs(a,r):Js(s,o,r)):e.push(Us(Hs(t,9).toFixed(c.frac),r))}return e}function Xs(e,t=!1){return e===`0`?`0`:e===`?`?t?`\xA0`:` `:``}let Zs=Math.floor;function Qs(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019,r=Zs(4*n/146097);n-=Zs((146097*r+3)/4);let i=Zs(4e3*(n+1)/1461001);n=n-Zs(1461*i/4)+31;let a=Zs(80*n/2447),o=n-Zs(2447*a/80);n=Zs(a/11);let s=a+2-12*n;return[100*(r-49)+i+n|0,s|0,o|0]}function $s(e){return Qs(e+1462)}function ec(e){if(e===60)throw Error(`#VALUE!`);if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];let t=10631/30,n=8.01/60,r=e+466935,i=Zs(r/10631);r-=10631*i;let a=Zs((r-n)/t);r-=Zs(a*t+n);let o=Zs((r+28.5001)/29.5);return o===13?[30*i+a,12,30]:[30*i+a,o,r-Zs(29.5001*o-29)]}function tc(e,t=0,n=!0){let r=Zs(e);return t===6?ec(r):t===-1?$s(r):Qs(r,n)}let nc=86400;function rc(e,t,n){return n?e<-694324||t>=35830291:e<0||t>=2958466}function ic(e,t=0){if(e<0)return-ic(-e,t);if(t){let n=10**t||1;return ic(e*n,0)/n}return Math.round(e)}function ac(e,t,n,r,i=null){var a,o;let s=t,c=e,l=e,u=``,d=``,f=``,p=``,m=``,h=``,g=0,_=null,v=0;if(typeof c==`bigint`){if(c<=2**53-1&&c>=-(2**53-1))l=Number(c),c=l;else return n.bigintErrorNumber?String(c):n.overflow;v=l}else v=Math.trunc(l);let y=0,b=0,x=1,S=0,C=0,w=0,T=0,E=0,D=0,O=r||bs,k=i;if(!k&&typeof e==`number`&&Number.isFinite(e)&&(k=as(e)),k&&!s.text&&s.scaleExponent&&(k=os(k,s.scaleExponent)),!s.text&&Number.isFinite(s.scale)&&s.scale!==1&&(l=Fs(l*s.scale),c=l),s.exponential&&k&&k.exponent>=-308){let e=ds(k,s.int_max,!!s.integer,s.frac_max);g=e.exponent,_=e.rounded,u+=Math.abs(g)}else if(s.exponential){let e=Math.abs(l);e&&(g=zs(e,s.int_max)),l&&!s.integer&&g++,e=Bs(e,g),s.int_max===1&&ic(e,s.frac_max)===10&&(e=1,g++),l=l<0?-e:e,c=l,u+=Math.abs(g)}let A=!Number.isSafeInteger(l)||!!s.scaleExponent;if(_=_||(k&&A&&!s.date&&!s.fractions&&!s.exponential&&(s.integer||s.dec_fractions)?cs(k,s.frac_max):null),s.integer)if(_)h=_.integer===`0`?``:_.integer;else{let e=s.fractions?1:s.frac_max,t=Math.abs(Number.isSafeInteger(l)&&e===0?l:ic(l,e));h+=t<1?``:Math.floor(t)}let j=(a=n.grouping[0])==null?3:a,M=(o=n.grouping[1])==null?j:o;s.dec_fractions&&(m=_?_.fraction:String(ic(l,s.frac_max)).split(`.`)[1]||``);let N=!s.error&&(s.num_p.includes(`0`)||s.den_p.includes(`0`)),P=N;if(s.fractions){P=N||!!(l%1);let e=Math.abs(s.integer?l%1:l);if(e)if(P=!0,s.denominator&&Number.isFinite(s.denominator))p+=s.denominator,f+=ic(e*s.denominator),f===`0`&&(f=``,p=``,P=N);else{let t=Is(e,1/0,s.den_max);f+=t[0],p+=t[1],s.integer&&f===`0`&&(f=``,p=``,P=N)}else!l&&!s.integer&&(P=!0,f=`0`,p=`1`);s.integer&&!P&&!Math.trunc(l)&&(h=`0`)}if(s.date){v=Math.trunc(l);let e=nc*(l-v);if(y=Math.floor(e),D=e-y,Math.abs(D)<1e-6?D=0:D>.9999&&(D=0,y+=1,y===nc&&(y=0,v+=1)),D){let e=s.date&512||s.date&256||s.date&128;(e===512&&D>.9995||e===256&&D>.995||e===128&&D>.95||!e&&D>=.5)&&(y++,D=0)}if(v||s.date_system){let e=tc(l,s.date_system,n.leap1900);b=e[0],x=e[1],S=e[2]}if(y){let e=y<0?nc+y:y;E=Math.floor(e)%60,T=Math.floor(e/60)%60,w=Math.floor(e/60/60)%60}if(C=(6+v)%7,s.date_eval&&rc(l,v+y/nc,n.dateSpanLarge)){if(n.dateErrorThrows)throw Error(`Date out of bounds`);return n.dateErrorNumber?Ys(l<0?[O.negative]:[],{},l,O,k).join(``):n.overflow}}let F=Xs(`?`,n.nbsp);g<0?d=`-`:s.exp_plus&&(d=`+`);let I=[],ee=(e,t,r,i)=>{let a=i,o=!a&&e.length>t.length?r.length+e.length-t.length:r.length;e.length<t.length&&(a+=e.length-t.length);for(let t=0;t<o;t++)I.push(e[t+a]||Xs(r[t],n.nbsp));return o},L=!1,R={int:0,frac:0,man:0,num:0,den:0};for(let e=0,t=s.tokens.length;e<t;e++){let t=s.tokens[e],i=t.type,a=t.num?t.num.length:0;if(i===`string`){let e=t.value;t.rule?t.rule===`num`?P?I.push(e.replace(/ /g,F)):(s.num_min>0||s.den_min>0)&&I.push(e.replace(/./g,F)):t.rule===`num+int`?P&&h?I.push(e.replace(/ /g,F)):s.den_min>0&&(h||s.num_min)&&I.push(e.replace(/./g,F)):t.rule===`den`&&(P?I.push(e.replace(/ /g,F)):s.den_min>0&&I.push(e.replace(/./g,F))):I.push(e.replace(/ /g,F))}else if(i===`space`)t.rule===`num+int`?(P||s.num_min||s.den_min)&&(h||s.num_min)&&I.push(F):I.push(F);else if(i===`error`)I.push(n.invalid);else if(i===`point`)I.push(s.date?t.value:O.decimal);else if(i===`general`)Ys(I,s,c,O,k);else if(i===`exp`)I.push(O.exponent);else if(i===`minus`)t.volatile&&s.date||(t.volatile&&_?_.negative&&!_.zero&&I.push(O.negative):t.volatile&&(l>=0||typeof c!=`number`)||(t.volatile&&!s.fractions&&(s.integer||s.dec_fractions)?(l<0&&h&&h!==`0`||m)&&I.push(O.negative):I.push(O.negative)));else if(i===`plus`)I.push(O.positive);else if(i===`text`)I.push(c);else if(i===`fill`)n.fillChar&&I.push(n.fillChar,t.value);else if(i===`skip`)n.skipChar?I.push(n.skipChar,t.value):I.push(n.nbsp?`\xA0`:` `);else if(i===`div`)P?I.push(`/`):s.num_min>0||s.den_min>0?I.push(F):I.push(Xs(`#`,n.nbsp));else if(i===`int`)if(s.int_pattern.length===1){let e=s.int_p,t=Math.max(s.int_min,h.length),r=``;for(let i=t;i>0;i--){let t=h.charAt(h.length-i),a=t?``:e.charAt(e.length-i)||e[0],o=``;if(s.grouping){let e=i-1-j;e>=0&&!(e%M)&&(o=t||a===`0`?O.group:Xs(`?`,n.nbsp))}r+=(t||Xs(a,n.nbsp))+o}I.push(r)}else R.int+=ee(h,s.int_p,t.num,R.int);else if(i===`frac`){let e=R.frac;for(let r=0;r<a;r++)I.push(m[r+e]||Xs(t.num[r],n.nbsp));R.frac+=a}else if(i===`man`)!R[i]&&!R.man&&I.push(d),R.man+=ee(u,s.man_p,t.num,R.man);else if(i===`num`)R.num+=ee(f,s.num_p,t.num,R.num);else if(i===`den`){let e=R.den;for(let r=0;r<a;r++){let i=p[r+e];if(!i){let e=t.num[r];`123456789`.includes(e)||L&&e===`0`?(L=!0,i=n.nbsp?`\xA0`:` `):i=!L&&r===a-1&&e===`0`&&!p?`1`:Xs(e,n.nbsp)}I.push(i)}R.den+=a}else if(i===`year`)b<0&&I.push(O.negative),I.push(String(Math.abs(b)).padStart(4,`0`));else if(i===`year-short`){let e=b%100;I.push(e<10?`0`:``,e)}else if(i===`month`)I.push(t.pad&&x<10?`0`:``,x);else if(i===`monthname-single`)s.date_system===6?I.push(O.mmmm6[x-1].charAt(0)):I.push(O.mmmm[x-1].charAt(0));else if(i===`monthname-short`)s.date_system===6?I.push(O.mmm6[x-1]):I.push(O.mmm[x-1]);else if(i===`monthname`)s.date_system===6?I.push(O.mmmm6[x-1]):I.push(O.mmmm[x-1]);else if(t.type===`weekday-short`)I.push(O.ddd[C]);else if(i===`weekday`)I.push(O.dddd[C]);else if(i===`day`)I.push(t.pad&&S<10?`0`:``,S);else if(i===`hour`){let e=w%s.clock||(s.clock<24?s.clock:0);I.push(t.pad&&e<10?`0`:``,e)}else if(i===`min`)I.push(t.pad&&T<10?`0`:``,T);else if(i===`sec`)I.push(t.pad&&E<10?`0`:``,E);else if(i===`subsec`){I.push(O.decimal);let e=D.toFixed(s.sec_decimals);I.push(e.slice(2,2+t.decimals))}else if(i===`ampm`){let e=w<12?0:1;t.short&&!r?I.push(`AP`[e]):I.push(O.ampm[e])}else if(i===`hour-elap`){l<0&&I.push(O.negative);let e=v*24+Math.floor(Math.abs(y)/3600);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`min-elap`){l<0&&I.push(O.negative);let e=v*1440+Math.floor(Math.abs(y)/60);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`sec-elap`){l<0&&I.push(O.negative);let e=v*nc+Math.abs(y);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`b-year`)I.push(b+543);else if(i===`b-year-short`){let e=(b+543)%100;I.push(e<10?`0`:``,e)}}return I.join(``)}let oc=Ps([{type:Co,value:`@`,raw:`@`}]);function sc(e){return!!e&&`scale`in e}function cc(e,t){for(let n=0;n<3;n++){let r=t[n];if(sc(r)){let t;if(r.condition){let n=r.condition[0],i=r.condition[1];n===`=`?t=e===i:n===`>`?t=e>i:n===`<`?t=e<i:n===`>=`?t=e>=i:n===`<=`?t=e<=i:n===`<>`&&(t=e!==i)}else t=!0;if(t)return r}else if(r)return r}}function lc(e,t,n){let r=t.partitions,i=r[3],a=null;return(typeof e==`number`||typeof e==`bigint`)&&isFinite(e)&&(i=cc(e,r)),sc(i)&&i.color&&(a=i.color),a&&typeof a==`number`&&n.indexColors&&(a=qo[a-1]||`#000`),a}function uc(e,t,n){let r=t.partitions,i=vs(t.locale||n.locale),a=e,o=r[3]?r[3]:oc;if(typeof a==`boolean`&&(a=(i||bs).bool[+!a]),a==null)return``;let s=typeof a==`bigint`;if(typeof a!=`number`&&!s)return ac(a,o,n,i);if(!s&&!Number.isFinite(a)){let e=i||bs;return Number.isNaN(a)?e.nan:(a<0?e.negative:``)+e.infinity}let c=cc(e,r),l=c&&typeof e==`number`&&Number.isFinite(e)?as(e):null;return c?ac(e,c,n,i,l):n.overflow}let dc={overflow:`######`,dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:`######`,locale:``,ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:``,fillChar:``},fc=[[mo,/^General/i,0],[ho,/^#/,0],[go,/^0/,0],[_o,/^\?/,0],[vo,/^\//,0],[So,/^;/,0],[Co,/^@/,0],[wo,/^\+/,0],[To,/^-/,0],[Eo,/^\./,0],[Do,/^ /,0],[Oo,/^%/,0],[ko,/^[1-9]/,0],[Ao,/^(?:B[12])/i,0],[jo,/^B$/,0],[Mo,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[No,/^(?:\[(h+|m+|s+)\])/i,1],[Po,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[Fo,/^\[(DBNum[0-4]?\d)\]/i,1],[Io,/^\[(NatNum[0-4]?\d)\]/i,1],[Lo,/^\[\$([^\]]+)\]/,1],[Ro,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[zo,/^\[([^\]]+)\]/,1],[Bo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[Vo,/^\\(.)/,1],[Ho,/^"([^"]*?)"/,1],[Uo,/^_(\\.|.)/,1],[`exp`,/^[Ee]([+-])/,1],[Wo,/^\*(\\.|.)/,1],[Go,/^[()]/,0],[jo,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Ko,/^./,0]],pc=e=>{let t=(e||`\0`).charCodeAt(0);return t===63||t===35||t>=48&&t<=57};function mc(e){let t=0,n=[],r=[];for(;t<e.length;){let i=e.slice(t),a=0,o=/^(,+)(.)?/.exec(i);if(o){let i=o[1];a=i.length;let s=e[t-1]||``,c=!1,l=!1;pc(s)?(c=!0,l=!0):s===`.`&&(l=!0);let u=o[2]||``;if(c&&(!u||u===`;`)&&(c=!1),l&&pc(u)&&(l=!1),c&&!l)n.push({type:yo,value:`,`,raw:i});else if(!c&&l)n.push({type:bo,value:`,`,raw:i});else if(c&&l){let e={type:bo,value:`,`,raw:i};n.push(e),r.push(e)}else n.push({type:xo,value:`,`,raw:i})}else{let e;for(let[t,r,o]of fc){let s=r.exec(i);if(s){e={type:t,value:typeof o==`number`?s[o||0]:o.map(e=>s[e]),raw:s[0]},n.push(e),a=s[0].length;break}}r.length&&(e==null?void 0:e.raw)===`;`&&(r.length=0),r.length&&pc(e==null?void 0:e.raw)&&(r.forEach(e=>e.type=yo),r.length=0)}if(!a){let e=i[0];a=1,n.push({type:Ko,value:e,raw:e})}t+=a}return n}function hc(e){var t,n;let r=(t=e.condition)==null?void 0:t[0],i=(n=e.condition)==null?void 0:n[1];typeof i==`number`&&i<0&&(r===`<`||r===`<=`||r===`=`)||i===0&&r===`<`||e.tokens.unshift({type:`minus`,volatile:!0})}function gc(e,t=null){let n={...e,int_pattern:[...e.int_pattern],frac_pattern:[...e.frac_pattern],man_pattern:[...e.man_pattern],den_pattern:[...e.den_pattern],num_pattern:[...e.num_pattern],tokens:[...e.tokens]};return e.condition&&(n.condition=[...e.condition]),t&&n.tokens.unshift(t),n.generated=!0,n}function _c(e){let t=[],n=!1,r,i=null,a=0,o=0,s=0,c=mc(e);do{var l;let e=Ps(c);if((e.date||e.general)&&(e.int_pattern.length||e.frac_pattern.length||e.scale!==1||e.text))throw Error(`Illegal format`);if(e.condition&&(s++,n=!0),e.text){if(i)throw Error(`Unexpected partition`);i=e}e.locale&&(r=_s(e.locale)),t.push(e),a=+(((l=c[e.tokensUsed])==null?void 0:l.type)===`break`),c=c.slice(e.tokensUsed+a),o++}while(a&&o<4&&s<3);if(a)throw Error(`Unexpected partition`);if(s>2)throw Error(`Unexpected condition`);let u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw Error(`Unexpected partition`);if(n){t[0].condition||(t[0].condition=[`>`,0]);let e=t.length;if(e===1){let e=Ps(mc(`General`));e.generated=!0,t[1]=e}if(e<3){let e=t[0],n=t[1];if(hc(e),n.condition)hc(n);else{let t=e.condition;((t==null?void 0:t[0])===`=`||typeof(t==null?void 0:t[1])==`number`&&t[1]>=0&&(t[0]===`>`||t[0]===`>=`))&&n.tokens.unshift({type:`minus`,volatile:!0})}}else t.forEach(hc)}else{if(t.length<4&&i)for(let e=0,n=t.length;e<n;e++)t[e]===i&&t.splice(e,1);if(t.length<1&&i){let e=Ps(mc(`General`));e.generated=!0,t[0]=e}if(t.length<2&&t.push(gc(t[0],{type:`minus`,volatile:!0})),t.length<3&&t.push(gc(t[0])),t.length<4)if(i)t.push(i);else{let e=Ps(mc(`@`));e.generated=!0,t.push(e)}t[0].condition=[`>`,0],t[1].condition=[`<`,0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}let vc=Math.floor,yc=86400,bc=Date.UTC;function xc(e,t){let n=null;if(Array.isArray(e)){let[t,r,i,a,o,s]=e;n=bc(t,r==null?0:r-1,i==null?1:i,a||0,o||0,s||0)}else if(e instanceof Date&&(n=e.getTime(),!(t!=null&&t.ignoreTimezone))){let t=new Date;t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=t.getTime()}if(n!=null&&Number.isFinite(n)){let e=n/864e5;return e-(e<=-25509?-25568:-25569)}return null}function Sc(e,t){let n=e|0,r=yc*(e-n),i=vc(r);r-i>.9999&&(i+=1,i===yc&&(i=0,n+=1));let a=i<0?yc+i:i,[o,s,c]=tc(e,0,t==null?void 0:t.leap1900);return[o,s,c,vc(a/60/60)%60,vc(a/60)%60,vc(a)%60]}let Cc=`!d-m-y.!d-m-Y.!j-m-y.!j-m-Y.!d-n-y.!d-n-Y.!j-n-y.!j-n-Y.?m-d-y.?m-d-Y.?m-j-y.?m-j-Y.?n-d-y.?n-d-Y.?n-j-y.?n-j-Y.d-M-y.d-M-Y.j-M-y.j-M-Y.M-d-y.M-d-Y.M-j-y.M-j-Y.d-F-y.d-F-Y.F-d-y.F-d-Y.F-j-y.F-j-Y.j-F-y.j-F-Y.y-F-d.y-F-j.y-M-d.y-M-j.Y-F-d.Y-F-j.Y-M-d.Y-m-d.Y-M-j.Y-m-j.Y-n-d.Y-n-j.j-F.j-M.d-F.d-M.n-d.n-j.n-Y.m-d.m-j.m-Y.M-Y.M-y.F-y.F-Y.Y-M.Y-n.Y-m.Y-F.Y-M`.split(`.`),wc={j:`d`,d:`d`,D:`ddd`,l:`dddd`,n:`m`,m:`m`,M:`mmm`,F:`mmmm`,y:`yy`,Y:`yyyy`},Tc={j:`dd`,d:`dd`,D:`ddd`,l:`dddd`,n:`mm`,m:`mm`,M:`mmm`,F:`mmmm`,y:`yy`,Y:`yyyy`},Ec={},Dc={};function Oc(e,t,n=1){if(e){let r=e[0],i=e.slice(1);if(r===`!`)Oc(i,t,4);else if(r===`?`)Oc(i,t,2);else{let e=t[r];typeof e!=`object`&&(e={},t[r]=e),Oc(i,e,n)}}else t.$=n}function kc(e,t){Oc(e,t),Oc(`${e} x`,t),Oc(`${e} l`,t),Oc(`${e} l x`,t),Oc(`l ${e}`,t),Oc(`l ${e} x`,t),Oc(`${e} D`,t),Oc(`${e} D x`,t),Oc(`D ${e}`,t),Oc(`D ${e} x`,t)}Cc.forEach(e=>{e.startsWith(`?`)||kc(e,Ec),e.startsWith(`!`)||kc(e,Dc)});let Ac=new Date().getUTCFullYear(),jc={".":[`,`,`\xA0`,` `,`'`,`٬`],",":[`.`,`\xA0`,` `,`'`,`٬`],"٫":[`.`,`\xA0`,` `,`'`,`٬`]},Mc=e=>(e==null?void 0:e.length)===1&&e>=`0`&&e<=`9`;function Nc(e,t={}){let n=vs(t.locale||``)||bs,r=n.decimal,i=[...jc[r]||[`'`,`٬`]];!i.includes(n.group)&&n.group!==` `&&n.group!==r&&i.push(n.group);let a=``,o=``,s=1,c=``,l=!1,u=!1,d=!1,f=!1,p=!1,m=``,h=!1,g=0,_=[` `,`\xA0`,` `,`+`,`%`,`(`,`-`].concat(Jo);for(;_.includes(e.charAt(g));){let t=e.charAt(g);if(t===`-`){if(l||u)return null;l=!0,s=-1}else if(Yo.test(t)){if(p)return null;p=!0,m=t}else if(t===`(`){if(u||l)return null;u=!0,s=-1}else if(t===`%`){if(f)return null;f=!0}g++}let v=!1,y;if(e.charAt(g)===r||Mc(e.charAt(g)))for(;g<e.length;){let t=e.charAt(g);if(!y&&i.includes(t))y=t;else if(!(y&&y===t))if(t===r){if(v)break;a+=`.`,v=!0}else if(Mc(t))a+=t;else break;g++}if(e.charAt(g)===`e`||e.charAt(g)===`E`){o+=e.charAt(g),g++,(e.charAt(g)===`+`||e.charAt(g)===`-`)&&(o+=e.charAt(g),g++);let t=g;for(;Mc(e.charAt(g));)o+=e.charAt(g),g++;if(t===g)return null}let b=[` `,`\xA0`,` `,`%`,`$`,`)`].concat(Jo);for(;b.includes(e.charAt(g));){let t=e.charAt(g);if(Yo.test(t)){if(p)return null;p=!0,m=t,h=!0}else if(t===`)`){if(d||!u)return null;d=!0}else if(t===`%`){if(f)return null;f=!0}g++}if(g!==e.length)return null;let x=Number.parseFloat(a+o);if(!Number.isFinite(x))return null;if(o){if(f||p)return null;c=`0.00E+00`}else if(f){if(p)return null;c=a.includes(`.`)?`0.00%`:`0%`,x*=.01}else if(p){let e=a.includes(`.`)?`#,##0.00`:`#,##0`;c=h?e+m:m+e}else y&&(c=a.includes(`.`)?`#,##0.00`:`#,##0`);let S={v:x*s};return c&&(S.z=c),S}function Pc(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){if(n>(e%4==0&&e%100!=0||e%400==0||e===1900?29:28))return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}let Fc=(e,t,n=!1)=>{for(let r of t)if(e.startsWith(r[0])){let t=r[0].length;return n&&(r[2]===`D`||r[2]===`M`)&&e[t]===`.`&&t++,[e.slice(0,t),r]}return[``,null]},Ic=(e,t,n,r)=>{let i=n.path||``,a=Object.keys(t);for(let o of a){let a=t[o],s;if(a){if(o===`$`||o===`€`)e||(s=n);else{if(typeof a!=`object`)continue;if(o===`-`){let t=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(t){let o=t[1]===`-`||t[1]===`/`||t[1]===`.`?t[1]:` `;if(!n.sep||n.sep===o){let c=t[0].replace(/\s+/g,` `);s=Ic(e.slice(t[0].length),a,{...n,sep:o,path:i+c},r)}}}else if(o===` `){let t=/^[,.]?\s+/.exec(e);if(t){let o=t[0].replace(/\s+/g,` `);s=Ic(e.slice(t[0].length),a,{...n,path:i+o},r)}}else if(o===`j`||o===`d`){let t=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,day:t[0],path:i+o},r))}else if(o===`n`||o===`m`){let t=/^(0?[1-9]|1[012])\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,month:+t[0],_mon:t[0],path:i+o},r))}else if(o===`F`||o===`M`){let[t,c]=Fc(e,r.mon,r.mp);(c==null?void 0:c[2])===o&&(s=Ic(e.slice(t.length),a,{...n,month:c[1],_mon:t,path:i+o},r))}else if(o===`l`||o===`D`){let[t,c]=Fc(e,r.day,r.dp);(c==null?void 0:c[2])===o&&(s=Ic(e.slice(t.length),a,{...n,path:i+o},r))}else if(o===`y`){let t=/^\d\d\b/.exec(e);if(t){let c=+t[0]>=30?+t[0]+1900:+t[0]+2e3;s=Ic(e.slice(t[0].length),a,{...n,year:c,path:i+o},r)}}else if(o===`Y`){let t=/^\d\d\d\d\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,year:+t[0],path:i+o},r))}else if(o===`x`){let t=Vc(e,{locale:r.locale});t&&(s=Ic(``,a,{...n,time:t.v,tf:t.z,path:i+o},r))}else throw Error(`Unknown date token "${o}"`)}if(s&&Pc(n.year||1916,n.month||1,n.day?+n.day:1))return s}}},Lc=e=>e.replace(/\s+/g,` `).trim().replace(/’/,`'`).replace(/\.$/,``).toLowerCase(),Rc=(e,t)=>{let n=e.map((e,n)=>[Lc(e),n+1,t]);return n.sort((e,t)=>t[0].length-e[0].length),n};function zc(e,t={}){var n,r;let i=vs(t.locale||``)||bs,a={mon:Rc(i.mmmm,`F`).concat(Rc(i.mmm,`M`)),mp:i.mmm[0].at(-1)===`.`,day:Rc(i.dddd,`l`).concat(Rc(i.ddd,`D`)),dp:i.ddd[0].at(-1)===`.`,locale:t.locale},o=Ic(Lc(e),i.preferMDY?Dc:Ec,{path:``},a);if(!o||o.sep===`.`&&o.path.length===3||o.month==null||o._mon==null)return null;let s=+((n=o.year)==null?Ac:n),c=(r=o.day)==null?`1`:r,l=-1/0;if(s<1900)return null;s<=1900&&o.month<=2?l=25568:s<1e4&&(l=25569);let u=Date.UTC(s,o.month-1,+c)/864e5+l+(o.time||0);if(u<0||u>2958465)return null;let d=o._mon[0]===`0`||c[0]===`0`||o._mon.length===2&&c.length===2;return{v:u,z:o.path.replace(/[jdlDnmMFyYx]/g,e=>e===`x`?o.tf||``:(d?Tc[e]:wc[e])||e)}}let Bc=e=>e.replace(/\s+/g,``).trim().replace(/\./g,``).toLowerCase();function Vc(e,t={}){let n=vs(t.locale||``)||bs,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e),i=``;if(r){let t=Bc(e.slice(r[0].length));if(t===Bc(n.ampm[0])||t===`a`||t===`am`)i=`a`;else if(t===Bc(n.ampm[1])||t===`p`||t===`pm`)i=`p`;else if(t===`:`)r[3]||(r[3]=`0`),r[2]||(r[2]=`0`);else if(t)return null}if(!r)return null;let[,a,o,s,c]=r;if(c&&!s||!i&&!o&&!s)return null;let l=+(a||0);if(i){if(l>=13)return null;i===`a`?l===12&&(l=0):i===`p`&&l!==12&&(l+=12)}let u=+(o||0),d=+(s||0),f=+(c||0),p=a.length===2?`hh`:`h`,m=s?`:ss`:``,h=i?` AM/PM`:``;return{v:(l*60*60+u*60+d+f)/(3600*24),z:`${p}:mm${m}${h}`}}function Hc(e,t={}){let n=vs(t.locale||``)||bs,r=e.trim().toLowerCase(),i=n.bool[0].toLowerCase();if(r===`true`||r===i)return{v:!0};let a=n.bool[1].toLowerCase();return r===`false`||r===a?{v:!1}:null}function Uc(e,t){var n,r,i;return(n=(r=(i=Nc(e,t))==null?zc(e,t):i)==null?Vc(e,t):r)==null?Hc(e,t):n}var Wc=p({addLocale:()=>W,dateFromSerial:()=>Sc,dateToSerial:()=>xc,dec2frac:()=>Is,format:()=>qc,formatColor:()=>Jc,getFormatDateInfo:()=>el,getFormatInfo:()=>$c,getLocale:()=>vs,isDateFormat:()=>Yc,isPercentFormat:()=>Xc,isTextFormat:()=>Zc,isValidFormat:()=>Qc,parseBool:()=>Hc,parseDate:()=>zc,parseLocale:()=>gs,parseNumber:()=>Nc,parseTime:()=>Vc,parseValue:()=>Uc,round:()=>Hs,tokenTypes:()=>tl,tokenize:()=>mc});let Gc=Object.create({});function Kc(e,t=!1){let n=e||`General`,r=Gc[n];if(!r)try{r=_c(n),Gc[n]=r}catch(e){if(t)throw e;let i=e instanceof Error?e.message:String(e),a={tokens:[{type:`error`}],error:i};r={pattern:n,partitions:[a,a,a,a],error:i,locale:null}}return r}function qc(e,t,n={}){var r;let i=Object.assign({},dc,n),a=Kc(e,i.throws);return uc((r=xc(t,i))==null?t:r,a,i)}function Jc(e,t,n){var r;let i=Object.assign({},dc,n),a=Kc(e,i.throws);return lc((r=xc(t,i))==null?t:r,a,i)}function Yc(e){return $o(Kc(e,!1).partitions)}function Xc(e){return Qo(Kc(e,!1).partitions)}function Zc(e){return es(Kc(e,!1).partitions)}function Qc(e){try{return Kc(e,!0),!0}catch{return!1}}function $c(e,t={}){let n=Kc(e,!1);return n.info||(n.info=rs(n.partitions,t==null?void 0:t.currency)),n.info}function el(e){let t=Kc(e,!1);return t.dateInfo||(t.dateInfo=is(t.partitions)),t.dateInfo}let tl=Object.freeze({AMPM:Bo,BREAK:So,CALENDAR:Ao,CHAR:Ko,COLOR:Ro,COMMA:xo,CONDITION:Po,DATETIME:Mo,DBNUM:Fo,DIGIT:ko,DURATION:No,ERROR:jo,ESCAPED:Vo,EXP:`exp`,FILL:Wo,GENERAL:mo,GROUP:yo,HASH:ho,LOCALE:Lo,MINUS:To,MODIFIER:zo,NATNUM:Io,PAREN:Go,PERCENT:Oo,PLUS:wo,POINT:Eo,QMARK:_o,SCALE:bo,SKIP:Uo,SLASH:vo,SPACE:Do,STRING:Ho,TEXT:Co,ZERO:go}),nl=new Set([`d`,`g`,`i`,`m`,`s`,`u`,`v`,`y`]);function rl(e,t){let n=il(t);return new RegExp(e,n)}function il(e){if(e===void 0)return;let t=new Set;for(let n of e){if(!nl.has(n)||t.has(n))throw SyntaxError(`Invalid regular expression flags: ${e}`);t.add(n)}return e}var al=class e{constructor(...e){T(this,`data`,void 0),this.data=ll(e.flatMap(e=>sl(e)))}union(...t){return new e(this,...t)}subtract(...t){let n=ll(t.flatMap(e=>sl(e))),r=this.data.slice();for(let[e,t]of n){let n=[];for(let[i,a]of r){if(t<i||e>a){n.push([i,a]);continue}e>i&&n.push([i,e-1]),t<a&&n.push([t+1,a])}r=n}return new e(...r)}intersect(...t){let n=ll(t.flatMap(e=>sl(e))),r=[];for(let[e,t]of this.data)for(let[i,a]of n){let n=Math.max(e,i),o=Math.min(t,a);n<=o&&r.push([n,o])}return new e(...r)}isEmpty(){return this.data.length===0}toString(){return this.isEmpty()?`(?!)`:`[${this.data.map(ul).join(``)}]`}toRegExp(e){return rl(this.toString(),e)}};let ol=(...e)=>new al(...e);function sl(e){if(e instanceof al)return e.data;if(Array.isArray(e)){let t=cl(e[0]),n=cl(e[1]);return[[Math.min(t,n),Math.max(t,n)]]}let t=cl(e);return[[t,t]]}function cl(e){if(typeof e==`number`){if(!Number.isInteger(e)||e<0||e>1114111)throw RangeError(`Invalid code point: ${e}`);return e}let t=e.codePointAt(0);if(t==null||String.fromCodePoint(t)!==e)throw RangeError(`Charset string inputs must contain exactly one code point: ${e}`);return t}function ll(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]),n=[];for(let[e,r]of t){let t=n[n.length-1];!t||e>t[1]+1?n.push([e,r]):t[1]=Math.max(t[1],r)}return n}function ul([e,t]){return e===t?dl(e):`${dl(e)}-${dl(t)}`}function dl(e){let t=String.fromCodePoint(e);return t===`\\`||t===`]`||t===`-`||t===`^`?`\\${t}`:e<=31||e===127?`\\u${e.toString(16).padStart(4,`0`)}`:t}function fl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pl(e,t){return rl(fl(e),t)}function ml(e){return rl(`^${fl(e).replace(/\\\*/g,`.*`).replace(/\\\?/g,`.`)}$`,`i`)}var hl=class e{constructor(...t){T(this,`charset`,void 0),T(this,`strings`,void 0);let n=[],r=[];for(let i of t)i instanceof e?(n.push(i.charset),r.push(...i.strings)):i instanceof al||typeof i==`number`||Array.isArray(i)?n.push(i):r.push(i);this.charset=ol(...n),this.strings=Array.from(new Set(r))}union(...t){return new e(this,...t)}subtract(...t){let n=new e(...t),r=this.strings.filter(e=>!n.strings.includes(e));return new e(this.charset.subtract(n.charset),...r)}isEmpty(){return this.charset.isEmpty()&&this.strings.length===0}toString(){if(this.isEmpty())return`(?!)`;let e=[...this.charset.isEmpty()?[]:[this.charset.toString()],...this.strings.map(fl)];return e.length===1?e[0]:`(?:${e.join(`|`)})`}toRegExp(e){return rl(this.toString(),e)}};let gl={Charset:al,Or:hl,charset:ol,or:(...e)=>new hl(...e),createRegExpFromSafeFragment:rl,escapeRegExp:fl,createLiteralRegExp:pl,createFromWildcard:ml};function _l(e){return e===`@@@`||e===`@`}function vl(e){return e==null||e===`General`}let yl=(e,t)=>{if(e&&!t||!e&&t)return!1;let n=e=>{let t=mc(e),n=``,r=!1,i=!1;for(let e of t){if(e.type===tl.POINT){r=!0;continue}if(!(i&&e.type===tl.MINUS)&&e.type!==tl.SKIP){if(e.type===tl.COLOR){i=!0;continue}else i=!1;r&&e.type===tl.ZERO||(r=!1,r||(n+=e.value||``))}}return n};return n(e)===n(t)},bl=new Set([`m d`]),xl=new Set([`h:mm AM/PM`,`hh:mm AM/PM`]),Sl=`Rp.zł.NT$.R$.HK$.$.£.¥.¤.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿.﷼`.split(`.`),Cl=RegExp(`^${gl.charset(...Array.from(new Set(Sl.join(``))))}+`),wl=e=>{var t,n;let r=(t=(n=zc(e))==null?Vc(e):n)==null?Nc(e):t;if(!r)return null;let{z:i}=r;if(i){if(bl.has(i)||xl.has(i)&&!/\s(A|AM|P|PM)$/i.test(e))return null;if(i.includes(`#,##0`)){if(/[.,]$/.test(e))return null;let t=e.replace(Cl,``).trim();if(t.includes(`,`)&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(t))return null}}return r};function Tl(e,t){let n={};for(let r in e){let i=Number(r),a=e[i];for(let e in a){let r=Number(e),o=a[r],s=t(i,r,o);s!==void 0&&(n[i]?n[i][r]=s:n[i]={[r]:s})}}return n}function El(e){let t=0,n=Object.keys(e);for(let e of n){let n=Number(e);t=Math.max(t,n)}return t+1}let Dl=e=>e==null||typeof e==`object`&&Object.keys(e).length===0;function Ol(e,t,n){let r=El(n),i=n;for(let t=r-1;t>=e;t--)Dl(i[t])?delete i[t+1]:i[t+1]=i[t];Dl(t)||(i[e]=t)}function kl(e,t,n){let r=Object.keys(n).reduce((e,t)=>Math.max(e,Number.parseInt(t)),0)+1;for(let i=e;i<r;i++)i<e+t?delete n[i]:n[i]!==void 0&&(n[i-t]=n[i],delete n[i])}function Al(e,t){let n=e,r=Object.keys(n),i=r.length,a=t,o=Object.keys(a),s=o.length,c={},l=0;for(let e=0;e<i;e++,l++)c[l]=n[r[e]];for(let e=0;e<s;e++,l++)c[l]=a[o[e]];return c}function jl(e,t,n){let r=n;if(El(n)>0){let n={},i=0;for(let a=e;a<=t;a++)r[a]&&(n[i]=r[a],i++);return n}return{}}function Ml(e,t,n,r){let i=e>n;if(!i&&e+t>n)throw Error(`Invalid move operation`);i?Nl(e,t,n,r):Pl(e,t,n,r)}function Nl(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e-1;r>=n;r--){let e=i[r];i[r+t]=e,e===void 0&&delete i[r+t]}a.forEach((e,t)=>{i[n+t]=e,e===void 0&&delete i[n+t]})}function Pl(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e+t;r<n;r++){let e=i[r];i[r-t]=e,e===void 0&&delete i[r-t]}a.forEach((e,r)=>{i[n+r-t]=e,e===void 0&&delete i[n+r-t]})}var Fl=class e{constructor(e={}){T(this,`_matrix`,void 0),this._setOriginValue(e)}static MakeObjectMatrixSize(t){return new e({[t-1]:{}})}getMatrix(){return this._matrix}forEach(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,i)===!1)return this}return this}forRow(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,Object.keys(i).map(e=>Number(e)))===!1)return this}return this}forValue(e){let t=this._matrix;for(let n in t){let r=Number(n),i=t[r];if(i)for(let t in i){let n=Number(t),a=i[n];if(e(r,n,a)===!1)return this}}return this}swapRow(e,t){let n=this._matrix[e],r=this._matrix[t];this._matrix[e]=r,this._matrix[t]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let t=this.getRow(e);return t==null&&(t={},this._matrix[e]=t),t}reset(){this._setOriginValue({})}hasValue(){let e=this._matrix,t=Object.keys(e);if(t.length===0)return!1;for(let n of t){let t=e[Number(n)];if(Object.keys(t).length>0)return!0}return!1}getValue(e,t){var n;return(n=this._matrix)==null||(n=n[e])==null?void 0:n[t]}setValue(e,t,n){let r=this.getRowOrCreate(e);r[t]=n}deleteValue(e,t){var n;(n=this._matrix)==null||(n=n[e])==null||delete n[t]}realDeleteValue(e,t){var n;if((n=this._matrix)==null||(n=n[e])==null||delete n[t],this.getRow(e)){let t=this.getRow(e);if(t==null)return;if(Object.keys(t).length===0){var r;(r=this._matrix)==null||delete r[e]}}}setRow(e,t){this._matrix[e]=t}moveRows(e,t,n){Ml(e,t,n,this._matrix)}moveColumns(e,t,n){this.forEach((r,i)=>{Ml(e,t,n,i)})}insertRows(e,t){let n=Object.keys(this._matrix);for(let r=n.length-1;r>=0;r--){let i=Number(n[r]);if(i>=e){let e=this._matrix[i];delete this._matrix[i],this._matrix[i+t]=e}}}insertColumns(e,t){let n=Object.keys(this._matrix);for(let r=0;r<n.length;r++){let i=Number(n[r]),a=this._matrix[i],o=Object.keys(a);for(let n=o.length-1;n>=0;n--){let r=Number(o[n]);if(r>=e){let e=a[r];delete a[r],a[r+t]=e}}}}removeRows(e,t){kl(e,t,this._matrix)}removeColumns(e,t){this.forEach((n,r)=>{r&&kl(e,t,r)})}getFragment(t,n,r,i){let a=new e,o=0;for(let e=t;e<=n;e++){let t={},n=0;for(let a=r;a<=i;a++)t[n]=this.getValue(e,a),n++;a.setRow(o,t),o++}return a}getSlice(t,n,r,i){let a=new e;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this.getValue(e,t);n&&a.setValue(e,t,z.deepClone(n))}return a}getSliceDataAndCellCountByRows(t,n){let r=new e,i=0;for(let e=t;e<=n;e++){let t=this.getRow(e);t&&(r.setRow(e,t),i+=Object.keys(t).length)}return{sliceData:r,cellCount:i}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return El(this._matrix)}getRange(){let e=this.getLength()-1,t=0,n=this.getLength();for(let e=0;e<n;e++){let n=this.getRow(e);if(n){let e=El(n)-1;t=e>t?e:t}}return{startRow:0,startColumn:0,endRow:e,endColumn:t}}getRealRange(){let e=Object.keys(this._matrix),t=e.length,n=t>0?Number(e[0]):0,r=t>0?Number(e[t-1]):0,i=-1/0,a=0;for(let t of e){let e=this.getRow(Number(t));if(e){let t=Object.keys(e);if(t.length>0){let e=Number(t[0]),n=Number(t[t.length-1]);(i===-1/0||e<i)&&(i=e),n>a&&(a=n)}}}return i===-1/0&&(i=0),{startRow:n,endRow:r,startColumn:i,endColumn:a}}getRealRowRange(){let e=Object.keys(this._matrix),t=e.length;return{startRow:t>0?Number(e[0]):0,endRow:t>0?Number(e[t-1]):0}}toNativeArray(){let e=[];return this.forValue((t,n,r)=>{e.push(r)}),e}toArray(){let e=[];return this.forRow((t,n)=>{e[t]==null&&(e[t]=[]),n.forEach(n=>{e[t][n]=this.getValue(t,n)})}),e}toFullArray(){let{endColumn:e,endRow:t}=this.getRange(),n=[];for(let r=0;r<=t;r++){let t=Array(e+1).fill(void 0);n.push(t)}return this.forValue((e,t,r)=>{n[e][t]=r}),n}toJSON(){return this._matrix}clone(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let t=0,n=0,r=!1,i=!1,a=new e;return this.forEach((e,o)=>{r||(r=!0,t=e),Object.keys(o).forEach(r=>{let o=Number(r);i?o<n&&(n=o):(i=!0,n=o);let s=this.getValue(e,o);a.setValue(e-t,o-n,s)})}),a.getData()}getStartEndScope(){let e=-1,t=-1,n=-1,r=-1,i=Object.keys(this._matrix);i.length>0&&(e=+i[0],t=+i[i.length-1]);for(let e of i){let t=Object.keys(this._matrix[e]);t.length>0&&(n=n===-1?+t[0]:Math.min(n,+t[0]),r=Math.max(r,+t[t.length-1]))}return{startRow:e,endRow:t,startColumn:n,endColumn:r}}getDataRange(){let e=0,t=0,n=0,r=-1,i=!1,a=!1;return this.forEach((o,s)=>{if(i||(i=!0,e=o),s==null)return;let c=El(s)-1;c>n&&(n=c),Object.keys(s).forEach(e=>{let n=Number(e);a?n<t&&(t=n):(a=!0,t=n)}),o>r&&(r=o)}),{startRow:e,startColumn:t,endRow:r,endColumn:n}}getDiscreteRanges(){let e=[];return this.forEach((t,n)=>{Object.keys(n).forEach(n=>{let r=Number(n),i=!1;for(let n of e)if(t>=n.startRow&&t<=n.endRow+1&&r>=n.startColumn&&r<=n.endColumn+1){n.endRow=Math.max(t,n.endRow),n.endColumn=Math.max(r,n.endColumn),i=!0;break}i||e.push({startRow:t,endRow:t,startColumn:r,endColumn:r})})}),e}merge(e){this.forValue((t,n)=>{let r=e.getValue(t,n);r!=null&&this.setValue(t,n,r)})}concatRows(e){let t=e.getMatrix();for(let e in t){let n=Number(e);this.setRow(n,t[n])}}_setOriginValue(e={}){this._matrix=e}};function Il(e){let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,mergeInfo:a}=e,{startY:o,endY:s,startX:c,endX:l}=e,u=t,d=n,f=t,p=n;if(r&&a){let{startRow:e,startColumn:t,endRow:n,endColumn:r,startY:i,endY:m,startX:h,endX:g}=a;u=e,d=t,f=n,p=r,o=i,s=m,c=h,l=g}return i&&(o=a.startY,s=a.endY,c=a.startX,l=a.endX,f=a.endRow,p=a.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:p,startY:o,endY:s,startX:c,endX:l}}let Ll=Il;function Rl(e){if(!e)return;let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,startRow:a,startColumn:o,endRow:s,endColumn:c}=e,l=t,u=n,d=t,f=n;return(r||i)&&(l=a,u=o,d=s,f=c),{startRow:l,startColumn:u,endRow:d,endColumn:f}}function zl(e){var t;return!e||((e==null||(t=e.v)==null?void 0:t.toString())||``).length===0&&!e.p}function Bl(e){return zl(e)&&(e==null?void 0:e.coverable)!==!1}function Vl(e){if(e){if(e.rgb)return new Ia(e.rgb).toHexString();if(e.th!=null){var t;let n=(t=po.Office)==null?void 0:t[e.th];if(n)return new Ia(n).toRgbString()}}return null}function Hl(e){return z.isString(e)&&e.substring(0,1)===`=`&&e.length>1}function Ul(e){return z.isString(e)&&e.length>0}function Wl(e,t=!1){let n=``,r=new Map([[`ff`,()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],[`fs`,()=>{if(e.fs){let t=e.fs;e.va&&(t/=2),n+=`font-size: ${t}pt; `}}],[`it`,()=>{e.it&&(n+=`font-style: italic; `)}],[`bl`,()=>{e.bl&&(n+=`font-weight: bold; `)}],[`ul`,()=>{var t;(t=e.ul)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} underline`):n+=`text-decoration: underline; `,e.ul.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.ul.cl)}; `),e.ul.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],[`st`,()=>{var t;(t=e.st)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} line-through`):n+=`text-decoration-line: line-through; `,e.st.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.st.cl)}; `),e.st.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],[`ol`,()=>{var t;(t=e.ol)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} overline`):n+=`text-decoration-line: overline; `,e.ol.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.ol.cl)}; `),e.ol.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],[`bg`,()=>{e.bg&&(n+=`background: ${Vl(e.bg)}; `)}],[`bd`,()=>{var t,r,i,a;if((t=e.bd)!=null&&t.b){var o,s;n+=`border-bottom: ${Gl((o=e.bd)==null?void 0:o.b.s)} ${(s=Vl(e.bd.b.cl))==null?``:s}; `}if((r=e.bd)!=null&&r.t){var c,l;n+=`border-top: ${Gl((c=e.bd)==null?void 0:c.t.s)} ${(l=Vl(e.bd.t.cl))==null?``:l}; `}if((i=e.bd)!=null&&i.r){var u,d;n+=`border-right: ${Gl((u=e.bd)==null?void 0:u.r.s)} ${(d=Vl(e.bd.r.cl))==null?``:d}; `}if((a=e.bd)!=null&&a.l){var f,p;n+=`border-left: ${Gl((f=e.bd)==null?void 0:f.l.s)} ${(p=Vl(e.bd.l.cl))==null?``:p}; `}}],[`cl`,()=>{e.cl&&(n+=`color: ${Vl(e.cl)}; `)}],[`va`,()=>{e.va===2?n+=`vertical-align: sub; `:e.va===3&&(n+=`vertical-align: super; `)}],[`td`,()=>{e.td===1?n+=`direction: ltr; `:e.td===2&&(n+=`direction: rtl; `)}],[`tr`,()=>{if(e.tr){var t,r,i;n+=`--data-rotate: (${(t=e.tr)==null?void 0:t.a}deg${(r=e.tr)!=null&&r.v?` ,${(i=e.tr)==null?void 0:i.v}`:``});`}}],[`ht`,()=>{e.ht===1?n+=`text-align: left; `:e.ht===3?n+=`text-align: right; `:e.ht===2?n+=`text-align: center; `:e.ht===4&&(n+=`text-align: justify; `)}],[`vt`,()=>{e.vt===3?n+=`vertical-align: bottom; `:e.vt===1?n+=`vertical-align: top; `:e.vt===2&&(n+=`vertical-align: middle; `)}],[`tb`,()=>{e.tb===2?n+=`white-space: nowrap; overflow-x: hidden; `:e.tb===3&&(n+=`white-space: normal;`)}],[`pd`,()=>{var t,r,i,a,o,s,c,l;let u=`${(t=e.pd)==null?void 0:t.b}pt`,d=`${(r=e.pd)==null?void 0:r.t}pt`,f=`${(i=e.pd)==null?void 0:i.l}pt`,p=`${(a=e.pd)==null?void 0:a.r}pt`;(o=e.pd)!=null&&o.b&&(n+=`padding-bottom: ${u}; `),(s=e.pd)!=null&&s.t&&(n+=`padding-top: ${d}; `),(c=e.pd)!=null&&c.l&&(n+=`padding-left: ${f}; `),(l=e.pd)!=null&&l.r&&(n+=`padding-right: ${p}; `)}]]),i=[`bd`,`tr`,`tb`];for(let n in e){var a;t&&i.includes(n)||(a=r.get(n))==null||a()}return n}function Gl(e){let t=``;return e===0?t=`none`:e===1?t=`0.5pt solid`:e===2?t=`0.5pt double`:e===3?t=`0.5pt dotted`:e===4||e===5?t=`0.5pt dashed`:e===6?t=`0.5pt dotted`:e===7?t=`0.5pt double`:e===8?t=`1pt solid`:e===9||e===10?t=`1pt dashed`:e===11?t=`1pt dotted`:e===12?t=`0.5pt dashed`:e===13&&(t=`1.5pt solid`),t}function Kl(e){let t=0;if(e=e.trim(),e===`none`)t=0;else if(e===`0.5pt solid`)t=1;else if(e===`0.5pt double`)t=2;else if(e===`0.5pt dotted`)t=3;else if(e===`0.5pt dashed`)t=4;else if(e===`1pt solid`)t=8;else if(e===`1pt dashed`)t=9;else if(e===`1pt dotted`)t=11;else if(e===`1.5pt solid`)t=13;else if(!e.includes(`none`))t=1;else return 0;return t}function ql(e,t){let n=e.body;if(t){let{headers:r,footers:i}=e;r!=null&&r[t]?n=r[t].body:i!=null&&i[t]&&(n=i[t].body)}return n}function Jl(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a,rangeType:o}=e;if(n<0||i<0||r<0||a<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===2||!(Number.isNaN(i)&&Number.isNaN(a))&&o===1||o!==1&&o!==2&&(Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(a)||Number.isNaN(r)))return!1;if(t){let e=t.getRowCount(),n=t.getColumnCount();if(r>=e||a>=n)return!1}return!0}function Yl(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Xl(e){if(Hl(e))return{f:e,v:null,p:null};if(io(e)){if(typeof e==`string`){let t=wl(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||`General`}}}}return{v:e,p:null,f:null}}return to(e),e}function Zl(e,t){let n=new Fl,{startRow:r,startColumn:i,endRow:a,endColumn:o}=t;if(z.isArray(e))for(let t=0;t<=a-r;t++)for(let a=0;a<=o-i;a++)n.setValue(t+r,a+i,Xl(e[t][a]));else new Fl(e).forValue((e,t,r)=>{n.setValue(e,t,Xl(r))});return n.getMatrix()}function Ql(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?Object.keys(e).every(n=>Ql(e[n],t[n])):!1:e===t:!1}function $l(e,t){let n=e.ts||{},r=t.ts||{};return e.sId===t.sId?Ql(n,r):!1}function eu(e,t){return t.some(t=>e.indexOf(t)>-1)}let tu=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],nu=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],ru=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],iu=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],au=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],ou={L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`,l:`M/D/YYYY`,ll:`MMM D, YYYY`,lll:`MMM D, YYYY h:mm A`,llll:`ddd, MMM D, YYYY h:mm A`},su={millisecond:`millisecond`,milliseconds:`millisecond`,ms:`millisecond`,second:`second`,seconds:`second`,s:`second`,minute:`minute`,minutes:`minute`,m:`minute`,hour:`hour`,hours:`hour`,h:`hour`,day:`day`,days:`day`,d:`day`,week:`week`,weeks:`week`,w:`week`,month:`month`,months:`month`,M:`month`,year:`year`,years:`year`,y:`year`};var cu=class e{constructor(e,t){this._date=e,this._isUTC=t}isValid(){return!Number.isNaN(this._date.getTime())}format(e=`YYYY-MM-DDTHH:mm:ssZ`){return this.isValid()?Cu(this._date,e,this._isUTC):`Invalid Date`}formatIntl(e,t={}){if(!this.isValid())return`Invalid Date`;if(typeof Intl>`u`||typeof Intl.DateTimeFormat!=`function`)return this.format();let n=this._isUTC&&!t.timeZone?{...t,timeZone:`UTC`}:t;return new Intl.DateTimeFormat(e,n).format(this._date)}valueOf(){return this._date.getTime()}toDate(){return new Date(this.valueOf())}_clone(){return new e(this.toDate(),this._isUTC)}add(t,n=`millisecond`){let r=mu(n);return!this.isValid()||!r||!Number.isFinite(t)?this._clone():new e(_u(this._date,t,r,this._isUTC),this._isUTC)}subtract(e,t=`millisecond`){return this.add(-e,t)}startOf(t){let n=mu(t);return!n||!this.isValid()?this._clone():new e(vu(this._date,n,this._isUTC),this._isUTC)}endOf(e){let t=mu(e);return!t||!this.isValid()||t===`millisecond`?this._clone():this.startOf(t).add(1,t).subtract(1,`millisecond`)}utc(){return new e(this.toDate(),!0)}local(){return new e(this.toDate(),!1)}weekday(e){let t=(uu(this._date,this._isUTC).dayOfWeek-0+7)%7;return e===void 0?t:this.add(e-t,`day`)}week(e){let t=yu(this._date,this._isUTC);return e===void 0?t:this.add((e-t)*7,`day`)}};function lu(e,t=2){return String(Math.abs(e)).padStart(t,`0`)}function uu(e,t){return t?{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),millisecond:e.getUTCMilliseconds(),dayOfWeek:e.getUTCDay()}:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),dayOfWeek:e.getDay()}}function du(e,t){return e instanceof cu?e.toDate():e===void 0?new Date:e===null?new Date(NaN):e instanceof Date?new Date(e.getTime()):typeof e==`number`?new Date(e):typeof e==`string`?pu(e,t):new Date(NaN)}function fu(e,t,n,r,i,a,o,s){let c=s?new Date(Date.UTC(e,t-1,n,r,i,a,o)):new Date(e,t-1,n,r,i,a,o),l=uu(c,s);return l.year!==e||l.month!==t||l.day!==n||l.hour!==r||l.minute!==i||l.second!==a?new Date(NaN):c}function pu(e,t){let n=e.trim();if(!n)return new Date(NaN);let r=n.match(/^(\d{4})年(\d{1,2})月(\d{1,2})日(?:\s+(\d{1,2})(?::(\d{1,2})(?::(\d{1,2}))?)?)?$/);if(r){let[,e,n,i,a=`0`,o=`0`,s=`0`]=r;return fu(Number(e),Number(n),Number(i),Number(a),Number(o),Number(s),0,t)}let i=n.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[ T](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?)?$/);if(i){let[,e,n,r,a=`0`,o=`0`,s=`0`,c=`0`]=i;return fu(Number(e),Number(n),Number(r),Number(a),Number(o),Number(s),Number(c),t)}return/^-?\d+(\.\d+)?$/.test(n)?new Date(Number(n)):new Date(n)}function mu(e){var t;return(t=su[e])==null?su[String(e).toLowerCase()]:t}function hu(e,t,n){return n?new Date(Date.UTC(e,t,0)).getUTCDate():new Date(e,t,0).getDate()}function gu(e,t,n,r){let i=new Date(e.getTime());if(t){switch(n){case`year`:i.setUTCFullYear(r);break;case`month`:i.setUTCMonth(r);break;case`day`:i.setUTCDate(r);break;case`hour`:i.setUTCHours(r);break;case`minute`:i.setUTCMinutes(r);break;case`second`:i.setUTCSeconds(r);break;case`millisecond`:i.setUTCMilliseconds(r);break}return i}switch(n){case`year`:i.setFullYear(r);break;case`month`:i.setMonth(r);break;case`day`:i.setDate(r);break;case`hour`:i.setHours(r);break;case`minute`:i.setMinutes(r);break;case`second`:i.setSeconds(r);break;case`millisecond`:i.setMilliseconds(r);break}return i}function _u(e,t,n,r){switch(n){case`millisecond`:return new Date(e.getTime()+t);case`second`:return new Date(e.getTime()+t*1e3);case`minute`:return new Date(e.getTime()+t*6e4);case`hour`:return new Date(e.getTime()+t*36e5);case`day`:return gu(e,r,`day`,(r?e.getUTCDate():e.getDate())+t);case`week`:return gu(e,r,`day`,(r?e.getUTCDate():e.getDate())+t*7);case`month`:{let n=uu(e,r),i=fu(n.year,n.month,1,n.hour,n.minute,n.second,n.millisecond,r),a=gu(i,r,`month`,(r?i.getUTCMonth():i.getMonth())+t),o=uu(a,r),s=hu(o.year,o.month,r);return gu(a,r,`day`,Math.min(n.day,s))}case`year`:return _u(e,t*12,`month`,r)}}function vu(e,t,n){let r=uu(e,n);switch(t){case`year`:return fu(r.year,1,1,0,0,0,0,n);case`month`:return fu(r.year,r.month,1,0,0,0,0,n);case`week`:{let e=(r.dayOfWeek-0+7)%7,t=fu(r.year,r.month,r.day,0,0,0,0,n);return gu(t,n,`day`,(n?t.getUTCDate():t.getDate())-e)}case`day`:return fu(r.year,r.month,r.day,0,0,0,0,n);case`hour`:return fu(r.year,r.month,r.day,r.hour,0,0,0,n);case`minute`:return fu(r.year,r.month,r.day,r.hour,r.minute,0,0,n);case`second`:return fu(r.year,r.month,r.day,r.hour,r.minute,r.second,0,n);default:return new Date(e.getTime())}}function yu(e,t){let n=vu(e,`week`,t),r=vu(vu(e,`year`,t),`week`,t);return Math.floor((n.getTime()-r.getTime())/864e5/7)+1}function bu(e,t,n=!1){if(t)return n?`+0000`:`+00:00`;let r=-e.getTimezoneOffset(),i=r>=0?`+`:`-`,a=Math.abs(r),o=lu(Math.floor(a/60),2),s=lu(a%60,2);return n?`${i}${o}${s}`:`${i}${o}:${s}`}function xu(e){let t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function Su(e){return e.replace(/LLLL|LLL|LL|L|llll|lll|ll|l/g,e=>{var t;return(t=ou[e])==null?e:t})}function Cu(e,t,n){let r=uu(e,n),i=r.hour%12,a=i===0?12:i,o=Math.ceil(r.month/3),s={YYYY:String(r.year),YY:lu(r.year%100,2),MMMM:tu[r.month-1],MMM:nu[r.month-1],MM:lu(r.month,2),M:String(r.month),DD:lu(r.day,2),D:String(r.day),Do:xu(r.day),dddd:ru[r.dayOfWeek],ddd:iu[r.dayOfWeek],dd:au[r.dayOfWeek],d:String(r.dayOfWeek),HH:lu(r.hour,2),H:String(r.hour),hh:lu(a,2),h:String(a),mm:lu(r.minute,2),m:String(r.minute),ss:lu(r.second,2),s:String(r.second),SSS:lu(r.millisecond,3),A:r.hour>=12?`PM`:`AM`,a:r.hour>=12?`pm`:`am`,Q:String(o),Qo:xu(o),X:String(Math.floor(e.getTime()/1e3)),x:String(e.getTime()),Z:bu(e,n,!1),ZZ:bu(e,n,!0)},c=[];return Su(t.replace(/\[([^\]]+)]/g,(e,t)=>`\u0000${c.push(t)-1}\u0000`)).replace(/YYYY|YY|MMMM|MMM|MM|M|DD|Do|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|A|a|Qo|Q|X|x|ZZ|Z/g,e=>{var t;return(t=s[e])==null?e:t}).replace(/\u0000(\d+)\u0000/g,(e,t)=>{var n;return(n=c[Number(t)])==null?``:n})}function wu(e){return new cu(du(e,!1),!1)}let Tu=Object.assign(wu,{utc:e=>new cu(du(e,!0),!0),isDateKit:e=>e instanceof cu,unix:e=>wu(e*1e3)});function Eu(e,t,n,r){if(e>t)throw Error(`a1 should be less than a2`);if(n>r)throw Error(`b1 should be less than b2`);if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];let i=r-n+1;return e<n&&t>r?[e,t-i]:n<=e&&r<t?[r+1-i,t-i]:n>e&&r>=t?[e,n-1]:[e,t]}function Du(e){if(e==null)return!1;let t=e.bullet;return(t==null?void 0:t.listId)!=null}function Ou(e){if(e==null)return!1;let t=e.paragraphStyle;return ku(t)}function ku(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 Au(e,t,n){return e.slice(0,t)+n+e.slice(t)}function ju(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Mu(e){if(e==null||typeof e==`boolean`)return!1;if(typeof e==`number`)return!isNaN(e);if(typeof e==`string`){let t=e.trim();return t===``?!1:!isNaN(Number(t))}return!1}function Nu(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function Pu(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>(Array.isArray(e)?e[0]:e)-(Array.isArray(t)?t[0]:t)),n=[],r=Array.isArray(t[0])?t[0][0]:t[0],i=r;for(let e=1;e<t.length;e++){let a=t[e],o,s;Array.isArray(a)?(o=a[0],s=a[1]):(o=a,s=a),o<=i+1?i=Math.max(i,s):(n.push([r,i]),r=o,i=s)}return n.push([r,i]),n}function Fu(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]),n=[],[r,i]=t[0];for(let e=1;e<t.length;e++){let[a,o]=t[e];a<=i+1?i=Math.max(i,o):(n.push([r,i]),r=a,i=o)}return n.push([r,i]),n}function Iu(...e){let t;return t=e.length===1&&Array.isArray(e[0])?e[0]:e,Object.assign({},...t)}let Lu,Ru,zu,Bu,K=Symbol(`newer`),q=Symbol(`older`);Lu=Symbol.iterator;var Vu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[Lu](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:e.key}):{done:!0,value:void 0}}};Ru=Symbol.iterator;var Hu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[Ru](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:e.value}):{done:!0,value:void 0}}};zu=Symbol.iterator;var Uu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[zu](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}},Wu=class{constructor(e,t){T(this,`key`,void 0),T(this,`value`,void 0),T(this,K,void 0),T(this,q,void 0),this.key=e,this.value=t,this[K]=void 0,this[q]=void 0}toJSON(){return{key:this.key,value:this.value}}};Bu=Symbol.iterator;var Gu=class{onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),D(()=>ze(this._onShiftListeners,e));throw Error(`[LRUMap]: the listener has been registered!`)}constructor(...e){if(T(this,`_keymap`,void 0),T(this,`size`,0),T(this,`limit`,void 0),T(this,`oldest`,void 0),T(this,`newest`,void 0),T(this,`_onShiftListeners`,[]),Ku.hasLength(e,1)){if(Ku.isNumber(e[0])){let t=e[0];this._initialize(t,void 0);return}if(Ku.isIterable(e[0])){let t=e[0];this._initialize(0,t);return}return}if(Ku.hasLength(e,2)){let t=e[0],n=e[1];this._initialize(t,n)}}_initialize(e,t){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[K]&&(e===this.oldest&&(this.oldest=e[K]),e[K][q]=e[q]),e[q]&&(e[q][K]=e[K]),e[K]=void 0,e[q]=this.newest,this.newest&&(this.newest[K]=e),this.newest=e)}assign(e){let t,n=this.limit||Number.MAX_VALUE;this._keymap.clear();let r=e[Symbol.iterator]();for(let e=r.next();!e.done;e=r.next()){let r=new Wu(e.value[0],e.value[1]);if(this._keymap.set(r.key,r),t?(t[K]=r,r[q]=t):this.oldest=r,t=r,n--===0)throw Error(`overflow`)}this.newest=t,this.size=this._keymap.size}set(e,t){let n=this._keymap.get(e);return n?(n.value=t,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new Wu(e,t)),this.newest?(this.newest[K]=n,n[q]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let e=this.oldest;if(e)return this.oldest&&this.oldest[K]?(this.oldest=this.oldest[K],this.oldest[q]=void 0):(this.oldest=void 0,this.newest=void 0),e[K]=e[q]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(t=>t(e)),[e.key,e.value]}get(e){let t=this._keymap.get(e);if(t)return this._markEntryAsUsed(t),t.value}has(e){return this._keymap.has(e)}find(e){let t=this._keymap.get(e);return t?t.value:void 0}delete(e){let t=this._keymap.get(e);if(t)return this._keymap.delete(t.key),t[K]&&t[q]?(t[q][K]=t[K],t[K][q]=t[q]):t[K]?(t[K][q]=void 0,this.oldest=t[K]):t[q]?(t[q][K]=void 0,this.newest=t[q]):this.oldest=this.newest=void 0,this.size--,t.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Vu(this.oldest)}values(){return new Hu(this.oldest)}entries(){return this[Symbol.iterator]()}[Bu](){return new Uu(this.oldest)}forEach(e,t){typeof t!=`object`&&(t=this);let n=this.oldest;for(;n;)e.call(t,n.value,n.key,this),n=n[K]}toJSON(){let e=Array(this.size),t=0,n=this.oldest;for(;n;)e[t++]={key:n.key,value:n.value},n=n[K];return e}toString(){let e=``,t=this.oldest;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t[K],t&&(e+=` < `);return e}},Ku=class{static hasLength(e,t){return e.length===t}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)===`[object Number]`}};function qu(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65||r>90)return-1;t=t*26+(r-64)}return t}let Ju=1048576,Yu=16384,Xu=`__INTERNAL_EDITOR__`,Zu=`${Xu}DOCS_NORMAL`,Qu=`${Xu}DOCS_FORMULA_BAR`,$u=`${Xu}COMMENT_EDITOR`,ed=Symbol(`AUTO_HEIGHT_FOR_MERGED_CELLS`);function td(e){return`${Xu}${e}`}function nd(e){return e.startsWith(Xu)}function rd(e){return e.startsWith($u)}let id=function(e){return e.PARAGRAPH=`paragraph`,e.BLOCK_RANGE=`blockRange`,e.TABLE=`table`,e.CUSTOM_BLOCK=`customBlock`,e.COLUMN_GROUP=`columnGroup`,e}({}),ad=function(e){return e[e.character=0]=`character`,e[e.paragraph=1]=`paragraph`,e[e.table=2]=`table`,e[e.numbering=3]=`numbering`,e}({}),od=function(e){return e[e.TAB=0]=`TAB`,e[e.SPACE=1]=`SPACE`,e[e.NOTHING=2]=`NOTHING`,e}({}),sd=function(e){return 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}({}),cd=function(e){return 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}({}),ld=function(e){return e.CALLOUT=`callout`,e.QUOTE=`quote`,e.CODE=`code`,e}({}),ud=function(e){return 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}({}),dd=function(e){return e[e.COMMENT=0]=`COMMENT`,e[e.DELETED=9999]=`DELETED`,e}({}),fd=function(e){return e[e.DRAWING=0]=`DRAWING`,e[e.CUSTOM=1]=`CUSTOM`,e}({}),pd=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRADITIONAL=1]=`TRADITIONAL`,e[e.MODERN=2]=`MODERN`,e}({}),md=function(e){return 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}({}),hd=function(e){return 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}({}),gd=function(e){return 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}({}),_d=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.TBRL=1]=`TBRL`,e[e.LRTBV=2]=`LRTBV`,e}({}),vd=function(e){return 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}({}),yd=function(e){return e[e.BOTH_SIDES=0]=`BOTH_SIDES`,e[e.LEFT=1]=`LEFT`,e[e.RIGHT=2]=`RIGHT`,e[e.LARGEST=3]=`LARGEST`,e}({}),bd=function(e){return 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}({}),xd=function(e){return 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}({}),Sd=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Cd=function(e){return 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}({}),wd=function(e){return 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}({}),Td=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SPECIFIED=1]=`SPECIFIED`,e}({}),Ed=function(e){return e[e.START=0]=`START`,e[e.CENTER=1]=`CENTER`,e[e.END=2]=`END`,e}({}),Dd=function(e){return e[e.AUTO_FIT=0]=`AUTO_FIT`,e[e.FIXED=1]=`FIXED`,e}({}),Od=function(e){return e[e.NONE=0]=`NONE`,e[e.WRAP=1]=`WRAP`,e}({}),kd=function(e){return e.FIXED=`fixed`,e.AUTO=`auto`,e}({}),Ad=function(e){return e.STACK=`stack`,e.SHRINK=`shrink`,e}({}),jd=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Md=function(e){return 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}({}),Nd=function(e){return e.NORMAL=`normal`,e.BOLD=`bold`,e.ITALIC=`italic`,e}({}),Pd=function(e){return 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}({}),Fd=function(e){return 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}({}),Id=function(e){return 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}({}),Ld=function(e){return 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}({}),Rd=function(e){return 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}({}),zd=function(e){return e[e.compressPunctuation=0]=`compressPunctuation`,e[e.compressPunctuationAndJapaneseKana=1]=`compressPunctuationAndJapaneseKana`,e[e.doNotCompress=2]=`doNotCompress`,e}({}),Bd=function(e){return e[e.PORTRAIT=0]=`PORTRAIT`,e[e.LANDSCAPE=1]=`LANDSCAPE`,e}({}),Vd=function(e){return e.Letter=`Letter`,e.Tabloid=`Tabloid`,e.Legal=`Legal`,e.Statement=`Statement`,e.Executive=`Executive`,e.Folio=`Folio`,e.A3=`A3`,e.A4=`A4`,e.A5=`A5`,e.B4=`B4`,e.B5=`B5`,e}({}),Hd=[`A3`,`A4`,`A5`,`B4`,`B5`,`Letter`,`Tabloid`,`Legal`,`Statement`,`Executive`,`Folio`],Ud=function(e){return e[e.forward=0]=`forward`,e[e.backward=1]=`backward`,e[e.front=2]=`front`,e[e.back=3]=`back`,e}({}),Wd=function(e){return 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[e.DRAWING_BLOCK=9]=`DRAWING_BLOCK`,e}({});function Gd(){return e=>e}let Kd=Gd()([`s`,`c`,`cl`,`t`]),qd=Gd()([`rgb`,`th`]),Jd=Gd()([`s`,`cl`]),Yd=Gd()([`t`,`r`,`b`,`l`,`tl_br`,`tl_bc`,`tl_mr`,`bl_tr`,`ml_tr`,`bc_tr`]),Xd=Gd()([`a`,`v`]),Zd=Gd()([`t`,`r`,`b`,`l`]),Qd=Gd()([`ff`,`fs`,`it`,`bl`,`ul`,`bbl`,`st`,`ol`,`bg`,`bd`,`cl`,`va`,`n`,`stf`,`tr`,`td`,`ht`,`vt`,`tb`,`pd`]),$d={sheetId:``,range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},ef={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},tf={startRow:0,startColumn:0,endRow:0,endColumn:0},nf={row:0,column:0},J={ff:`Arial`,fs:11,it:0,bl:0,ul:{s:0},st:{s:0},ol:{s:0},tr:{a:0,v:0},td:0,cl:{rgb:`#000000`},bg:{rgb:`#fff`},ht:0,vt:0,tb:0,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},rf=[Zu,Qu],af={4:{fs:20,bl:1},5:{fs:18,bl:1},6:{fs:16,bl:1},7:{fs:14,bl:1},8:{fs:12,bl:1},1:null,2:{fs:26,bl:1},3:{fs:15,cl:{rgb:`#999999`}},0:null},of=1.5,sf={4:{spaceAbove:{v:20},spaceBelow:{v:10}},5:{spaceAbove:{v:18},spaceBelow:{v:10}},6:{spaceAbove:{v:16},spaceBelow:{v:10}},7:{spaceAbove:{v:14},spaceBelow:{v:8}},8:{spaceAbove:{v:12},spaceBelow:{v:8}},1:{spaceAbove:{v:0},spaceBelow:{v:12}},2:{spaceAbove:{v:0},spaceBelow:{v:7}},3:{spaceAbove:{v:0},spaceBelow:{v:16}},0:null},cf=function(e){return e.ARRAY_CONVERTOR=`ARRAY_CONVERTOR`,e.MATRIX_CONVERTOR=`MATRIX_CONVERTOR`,e}({}),lf={A3:{width:1123,height:1587},A4:{width:794,height:1124},A5:{width:559,height:794},B4:{width:944,height:1344},B5:{width:665,height:944},Executive:{width:696,height:1008},Folio:{width:816,height:1248},Legal:{width:816,height:1344},Letter:{width:816,height:1056},Statement:{width:528,height:816},Tabloid:{width:1056,height:1632}},uf=function(e){return e.NARROW=`narrow`,e.MEDIUM=`medium`,e.WIDE=`wide`,e}({}),df={narrow:lf.A4.width,medium:960,wide:lf.A3.width};function ff(e,t){let{textRuns:n=[]}=t,r=0;for(let t of n){let{ts:n={},st:i,ed:a}=t;if(n[e]==null)return 0;switch(e){case`bl`:case`it`:if(n[e]===0)return 0;break;case`ul`:case`st`:if(n[e].s===0)return 0;break;default:throw Error(`unknown style key: ${e} in IStyleBase`)}r+=a-i}return+(t.dataStream.indexOf(`\r
|
|
2
|
-
`)===r)}var pf=class e{constructor(e,t,n){this._deps=n,T(this,`_range`,void 0),T(this,`_worksheet`,void 0),this._range=t,this._worksheet=e}static foreach(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t(e,n)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=[];for(let a=e;a<=t;a++){let e=[];for(let t=n;t<=r;t++)e.push(this.getMatrix().getValue(a,t)||null);i.push(e)}return i}getMatrix(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Fl;for(let o=e;o<=t;o++)for(let e=n;e<=r;e++)a.setValue(o,e,i.getValue(o,e)||null);return a}getMatrixObject(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Fl;for(let o=e;o<=t;o++)for(let t=n;t<=r;t++)a.setValue(o-e,t-n,i.getValue(o,t)||{});return a}getA1Notation(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i,a;return n<r?(i=z.numToWord(n+1)+(e+1),a=z.numToWord(r+1)+(t+1)):(i=z.numToWord(r+1)+(t+1),a=z.numToWord(n+1)+(e+1)),i===a?`${i}`:`${i}:${a}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.bg)==null?void 0:n.rgb)||J.bg.rgb}))}getCell(t,n){let{startRow:r,startColumn:i}=this._range,a={startRow:r+t,endRow:r+t,startColumn:i+n,endColumn:i+n};return new e(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){let{startRow:t,endRow:n,startColumn:r,endColumn:i}=this._range,a=this._worksheet.getCellMatrix().getFragment(t,n,r,i).getData();if(e.isIncludeStyle){let e=this._deps.getStyles();for(let s=0;s<=n-t;s++)for(let t=0;t<=i-r;t++){var o;if(a==null||(a==null||(o=a[s])==null?void 0:o[t])==null)continue;let n=a[s][t].s;n&&(a[s][t].s=e.get(n))}}return a}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.cl)==null?void 0:n.rgb)||J.cl.rgb}))}getFontFamilies(){return this._getStyles(`ff`)}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles(`ul`)}getUnderline(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?ff(`ul`,n.body)===1?{s:1}:{s:0}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles(`ol`)}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?ff(`st`,n.body)===1?{s:1}:{s:0}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles(`st`)}getFontSize(){var e,t;let n=((e=this.getValue())==null?void 0:e.p)||{};return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0&&n.body.textRuns.some(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)!=null})?Math.max(...n.body.textRuns.map(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)||0})):this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles(`fs`)}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles(`bd`)}getFontStyle(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?+(ff(`it`,n.body)===1):this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles(`it`)}getFontWeight(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?+(ff(`bl`,n.body)===1):this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles(`bl`)}getGridId(){return this._worksheet.getSheetId()}getHeight(){let{_range:e,_worksheet:t}=this,{startRow:n,endRow:r}=e,i=0;for(let e=0;e<=r-n;e++){let n=t.getRowHeight(e);i+=n}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles(`ht`)}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){let{startColumn:e,endColumn:t}=this._range;return t-e+1}getNumRows(){let{startRow:e,endRow:t}=this._range;return t-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(e=>(e==null?void 0:e.p)||``))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles(`td`)}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles(`tr`)}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>e.getStyleByCell(t)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles(`vt`)}getWidth(){let{_range:e,_worksheet:t}=this,{startColumn:n,endColumn:r}=e,i=0;for(let e=0;e<=r-n;e++)i+=t.getColumnWidth(e);return i}getWrap(){return+(this.getWrapStrategy()===3)}getWrapStrategies(){return this._getStyles(`tb`)}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){e.foreach(this._range,t)}_getStyles(e){let t=this._deps.getStyles();return this.getValues().map(n=>n.map(n=>{let r=t&&t.getStyleByCell(n);return r&&r[e]||J[e]}))}};T(pf,`transformRange`,(e,t)=>{let n=t.getMaxColumns()-1,r=t.getMaxRows()-1;return e.rangeType===3?{startColumn:0,startRow:0,endColumn:n,endRow:r}:e.rangeType===2?{startRow:0,endRow:r,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===1?{startColumn:0,endColumn:n,startRow:e.startRow,endRow:e.endRow}:{startColumn:e.startColumn,endColumn:Math.min(e.endColumn,n),startRow:e.startRow,endRow:Math.min(e.endRow,r)}});function mf(e,t,n=0,r=e.length-1,i=gf){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);mf(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(hf(e,n,t),i(e[r],a)>0&&hf(e,n,r);o<s;){for(hf(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?hf(e,n,s):(s++,hf(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function hf(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function gf(e,t){return e<t?-1:+(e>t)}var _f=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!kf(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;kf(e,s)&&(t.leaf?n.push(o):Of(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!kf(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(kf(e,a)){if(t.leaf||Of(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Af([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=vf(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&Of(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=Af(e.slice(t,n+1)),yf(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=Af([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));jf(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);jf(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return yf(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=wf(o),c=Ef(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),xf(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=Af(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,yf(n,this.toBBox),yf(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=Af([e,t]),this.data.height=e.height+1,this.data.leaf=!1,yf(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=bf(e,0,o,this.toBBox),s=bf(e,o,n,this.toBBox),c=Df(t,s),l=wf(t)+wf(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Sf,i=e.leaf?this.compareMinY:Cf;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=bf(e,0,t,i),o=bf(e,n-t,n,i),s=Tf(a)+Tf(o);for(let r=t;r<n-t;r++){let t=e.children[r];xf(a,e.leaf?i(t):t),s+=Tf(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];xf(o,e.leaf?i(t):t),s+=Tf(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)xf(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():yf(e[t],this.toBBox)}};function vf(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 yf(e,t){bf(e,0,e.children.length,t,e)}function bf(e,t,n,r,i){i||(i=Af(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];xf(i,e.leaf?r(t):t)}return i}function xf(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 Sf(e,t){return e.minX-t.minX}function Cf(e,t){return e.minY-t.minY}function wf(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Tf(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Ef(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 Df(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function Of(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function kf(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Af(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jf(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;mf(e,o,t,n,i),a.push(t,o,o,n)}}function Mf(e,t,n,r=!1){if(t===0&&n===0)return e;let i={...e},a=i.startAbsoluteRefType||0,o=i.endAbsoluteRefType||0,s=i.rangeType||0;if(!r&&a===3&&o===3)return i;let c=Nf(i.startRow,n,i.startColumn,t,s),l=Nf(i.endRow,n,i.endColumn,t,s);return r||a===0&&o===0?i={...i,startRow:c.row,startColumn:c.column,endRow:l.row,endColumn:l.column}:(a===0?i={...i,startRow:c.row,startColumn:c.column}:a===2?i={...i,startRow:c.row}:a===1&&(i={...i,startColumn:c.column}),o===0?i={...i,endRow:l.row,endColumn:l.column}:o===2?i={...i,endRow:l.row}:o===1&&(i={...i,endColumn:l.column}),i)}function Nf(e,t,n,r,i){return i===0?{row:e+t,column:n+r}:i===1?{row:e+t,column:n}:i===2?{row:e,column:n+r}:{row:e,column:n}}function Pf(e){let t=new Set,n=new Set;for(let r of e)t.add(r.startColumn),t.add(r.endColumn+1),n.add(r.startRow),n.add(r.endRow+1);let r=Array.from(t).sort((e,t)=>e-t),i=Array.from(n).sort((e,t)=>e-t);e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let a=[];for(let t=0;t<i.length-1;t++)for(let n=0;n<r.length-1;n++){let o=r[n],s=r[n+1]-1,c=i[t],l=i[t+1]-1;for(let t of e){if(t.startRow>l)break;if(t.startRow<=c&&t.endRow>=l&&t.startColumn<=o&&t.endColumn>=s){a.push({startColumn:o,endColumn:s,startRow:c,endRow:l});break}}}return a}function Ff(e){e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let t={};for(let n of e)t[n.startRow]||(t[n.startRow]=[]),t[n.startRow].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startColumn-t.startColumn);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startColumn<=i.endColumn+1&&t.startRow===i.startRow&&t.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,t.endColumn):(n.push(i),i=t)}n.push(i)}return n}function If(e){e.sort((e,t)=>e.startColumn-t.startColumn||e.startRow-t.startRow);let t={};for(let n of e)t[n.startColumn]||(t[n.startColumn]=[]),t[n.startColumn].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startRow-t.startRow);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startRow<=i.endRow+1&&t.startColumn===i.startColumn&&t.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,t.endRow):(n.push(i),i=t)}n.push(i)}return n}function Lf(e){return If(Ff(Pf(e)))}function Rf(e,t){let n=[];return e.forEach(e=>{n.push(...Uf.subtract(e,t))}),Uf.mergeRanges(n)}function zf(e,t){let n=Bf(e.startRow,e.endRow,t.startRow,t.endRow),r=Bf(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;let[i,a]=n,[o,s]=r;return{startRow:i,endRow:a,startColumn:o,endColumn:s,rangeType:Vf(e.rangeType,t.rangeType,i,a,o,s)}}function Bf(e,t,n,r){let i=isNaN(e)?-1/0:e,a=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,s=isNaN(r)?1/0:r,c=Math.max(i,o),l=Math.min(a,s);return c<=l?[c===-1/0?NaN:c,l===1/0?NaN:l]:null}function Vf(e,t,n,r,i,a){let o=e===void 0?Hf(n,r,i,a):e,s=t===void 0?Hf(n,r,i,a):t;return o===3||s===3?o===s?o:o===3?s:o:o===s?o:0}function Hf(e,t,n,r){let i=!isNaN(e)&&!isNaN(t),a=!isNaN(n)&&!isNaN(r);return i&&a?0:i?1:a?2:3}var Uf=class e{static clone(e){return e.rangeType===void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,t){return e==null||t==null?!1:e.endRow===t.endRow&&e.endColumn===t.endColumn&&e.startRow===t.startRow&&e.startColumn===t.startColumn&&(e.rangeType===t.rangeType||e.rangeType===void 0&&t.rangeType===0||t.rangeType===void 0&&e.rangeType===0)}static simpleRangesIntersect(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=e,{startRow:o,endRow:s,startColumn:c,endColumn:l}=t;return n<=s&&r>=o&&i<=l&&a>=c}static intersects(e,t){if(e.rangeType===1&&t.rangeType===2||e.rangeType===2&&t.rangeType===1)return!0;if(e.rangeType===1&&t.rangeType===1)return e.startRow<=t.endRow&&e.endRow>=t.startRow;if(e.rangeType===2&&t.rangeType===2)return e.startColumn<=t.endColumn&&e.endColumn>=t.startColumn;let n=Number.isNaN(e.startRow)?0:e.startRow,r=Number.isNaN(e.endRow)?Ju-1:e.endRow,i=Number.isNaN(e.startColumn)?0:e.startColumn,a=Number.isNaN(e.endColumn)?Yu-1:e.endColumn,o=Number.isNaN(t.startRow)?0:t.startRow,s=Number.isNaN(t.endRow)?Ju-1:t.endRow,c=Number.isNaN(t.startColumn)?0:t.startColumn,l=Number.isNaN(t.endColumn)?Yu-1:t.endColumn,u=Math.abs(i+a-c-l),d=Math.abs(i-a)+Math.abs(c-l),f=Math.abs(n+r-o-s),p=Math.abs(n-r)+Math.abs(o-s);return u<=d&&f<=p}static doAnyRangesIntersect(e,t){let n=new _f;return n.load(e.map(e=>({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}))),t.some(e=>n.search({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}).length>0)}static getIntersects(e,t){let n=e.startRow,r=e.endRow,i=e.startColumn,a=e.endColumn,o=t.startRow,s=t.endRow,c=t.startColumn,l=t.endColumn,u,d,f,p;if(o<=r)d=o>=n?o:n;else return null;if(s>=n)p=s>=r?r:s;else return null;if(c<=a)u=c>i?c:i;else return null;if(l>=i)f=l>=a?a:l;else return null;return{startRow:d,endRow:p,startColumn:u,endColumn:f,rangeType:0}}static contains(e,t){return e.startRow<=t.startRow&&e.endRow>=t.endRow&&e.startColumn<=t.startColumn&&e.endColumn>=t.endColumn}static realContain(t,n){return e.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...e){return e.reduce((e,t)=>({startRow:Math.min(e.startRow,t.startRow),startColumn:Math.min(e.startColumn,t.startColumn),endRow:Math.max(e.endRow,t.endRow),endColumn:Math.max(e.endColumn,t.endColumn),rangeType:0}),e[0])}static realUnion(...t){let n=t.some(e=>e.rangeType===2),r=t.some(e=>e.rangeType===1),i=e.union(...t);return{startColumn:r?NaN:i.startColumn,endColumn:r?NaN:i.endColumn,startRow:n?NaN:i.startRow,endRow:n?NaN:i.endRow,rangeType:r?1:n?2:0}}static subtract(e,t){if(t.startRow>e.endRow||t.endRow<e.startRow||t.startColumn>e.endColumn||t.endColumn<e.startColumn)return[e];let n=[];t.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:t.startRow-1,endColumn:e.endColumn}),t.endRow<=e.endRow&&n.push({startRow:t.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});let r=Math.max(e.startRow,t.startRow),i=Math.min(e.endRow,t.endRow);return t.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:t.startColumn-1}),t.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:t.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}static mergeRanges(e){return Lf(e)}static splitIntoGrid(e){return Pf(e)}static subtractMulti(e,t){if(!t.length)return e;let n=e;return t.forEach(e=>{n=Rf(n,e)}),n}static hasIntersectionBetweenTwoRect(e,t){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}static getIntersectionBetweenTwoRect(e,t){let n=Math.max(e.left,t.left),r=Math.min(e.right,t.right),i=Math.max(e.top,t.top),a=Math.min(e.bottom,t.bottom);return r<=n||a<=i?null:{left:n,right:r,top:i,bottom:a,width:r-n,height:a-i}}static sort(e){return e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn)}};T(Uf,`getRelativeRange`,(e,t)=>({startRow:e.startRow-t.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-t.startColumn,endColumn:e.endColumn-e.startColumn})),T(Uf,`getPositionRange`,(e,t,n)=>({...n||{},startRow:n&&[1,3].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+t.startRow,endRow:n&&[1,3].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+t.startRow,startColumn:n&&[2,3].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+t.startColumn,endColumn:n&&[2,3].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+t.startColumn})),T(Uf,`moveHorizontal`,(e,t=0,n=0)=>({...e,startColumn:e.startColumn+t,endColumn:e.endColumn+t+n})),T(Uf,`moveVertical`,(e,t=0,n=0)=>({...e,startRow:e.startRow+t,endRow:e.endRow+t+n})),T(Uf,`moveOffset`,(e,t,n)=>{let r={...e};switch(e.startAbsoluteRefType){case 1:r.startColumn+=t;break;case 2:r.startRow+=n;break;case 3:break;default:r.startRow+=n,r.startColumn+=t;break}switch(e.endAbsoluteRefType){case 1:r.endColumn+=t;break;case 2:r.endRow+=n;break;case 3:break;default:r.endRow+=n,r.endColumn+=t;break}return r});function Wf(e,t){if(e.length===0||e[0].length===0)return null;let n=Array(e[0].length).fill(0),r=0,i=null;for(let a=0;a<e.length;a++){for(let r=0;r<e[0].length;r++)n[r]=t(e[a][r])?n[r]+1:0;let o=Gf(n);o.area>r&&(r=o.area,i={startColumn:o.start,startRow:a-o.height+1,endColumn:o.end,endRow:a})}return i}function Gf(e){let t=[],n=0,r={area:0,height:0,start:0,end:0},i=0;for(;i<e.length;)if(t.length===0||e[i]>=e[t[t.length-1]])t.push(i++);else{let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}for(;t.length>0;){let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}return r}function Kf(e,t){pf.foreach(t,(t,n)=>{e[t][n]=void 0})}function qf(e,t){let n=e.toFullArray(),r=[];for(;;){let e=Wf(n,t);if(!e)break;r.push(e),Kf(n,e)}return r}function Jf(){let e=typeof crypto<`u`&&typeof crypto.getRandomValues==`function`?crypto:typeof self<`u`&&self.crypto&&typeof self.crypto.getRandomValues==`function`?self.crypto:typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`?window.crypto:void 0;return e==null?void 0:e.getRandomValues.bind(e)}function Yf(e,t){let n=``;for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function Xf(e,t,n){let r=256-256%t.length,i=Math.ceil(1.6*256*e/r),a=``;for(;a.length<e;){let o=n(new Uint8Array(i));for(let n=0;n<i&&a.length<e;n++){let e=o[n];e<r&&(a+=t[e%t.length])}}return a}function Zf(e=21,t=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`){if(!e)return``;let n=Jf();return n?Xf(e,t,n):Yf(e,t)}function Y(e=21,t){return Zf(e,t)}var Qf=class{constructor(e,t){T(this,`_values`,[]),T(this,`_keys`,[]),T(this,`_keyMaps`,new Map),this._values=e,this._keys=t,e.forEach(e=>{this._initKeyMap(e)})}_initKeyMap(e){this._keys.forEach(t=>{let n=e[t],r=this._keyMaps.get(t)||new Map;r.set(n,e),this._keyMaps.set(t,r)})}getValue(e,t){let n=t||this._keys;for(let t=0;t<n.length;t++){let r=this._keyMaps.get(n[t]);if(r!=null&&r.has(e))return r.get(e)}return null}hasValue(e){for(let t=0;t<this._keys.length;t++){let n=this._keyMaps.get(this._keys[t]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,t,n){let r=this.getValue(e);r&&Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=n)}deleteValue(e,t){let n=this.getValue(e,t);if(n){this._keys.forEach(e=>{let t=this._keyMaps.get(e),r=n[e];t==null||t.delete(r)});let e=this._values.findIndex(e=>e===n);this._values.splice(e,1)}}getValues(){return this._values}getKeyMap(e){var t;return[...((t=this._keyMaps.get(e))==null?void 0:t.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}};function $f(e,t,n,r){return{forEach(i){for(let a=e;a<=t;a++)for(let e=n;e<=r;e++)i(a,e)}}}function ep(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=e=>e.charCodeAt(0)-96,i=0,a=0;for(let e=0;e<n;e++)a=r(t[e]),i+=a*26**(n-e-1);return i===0?NaN:i-1}function tp(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+65)+t,e=Math.floor(e/26)-1;return t}function np(e,t){let n=``;for(;t>0;)n+=e,t--;return n}function rp(e,t=!1){let n=97;return t&&(n=65),np(String.fromCharCode(e%26+n),Math.floor(e/26)+1)}function ip(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function ap(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function op(e=`index`,t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}let sp=function(e){return e.Text=`text`,e.SingleSelect=`singleSelect`,e.MultiSelect=`multiSelect`,e.Person=`person`,e.Group=`group`,e.Date=`date`,e.Attachment=`attachment`,e.Number=`number`,e.Checkbox=`checkbox`,e.Link=`link`,e.Formula=`formula`,e.Lookup=`lookup`,e.Flow=`flow`,e.Button=`button`,e.Numbering=`numbering`,e.Phone=`phone`,e.Email=`email`,e.Location=`location`,e.Barcode=`barcode`,e.Progress=`progress`,e.Currency=`currency`,e.Rating=`rating`,e.TwoWayLink=`twoWayLink`,e.RecordId=`recordId`,e.CreatedBy=`createdBy`,e.UpdatedBy=`updatedBy`,e.CreatedAt=`createdAt`,e.UpdatedAt=`updatedAt`,e.Summary=`summary`,e}({}),cp=function(e){return e.Grid=`grid`,e.Kanban=`kanban`,e.Calendar=`calendar`,e.Gantt=`gantt`,e.Gallery=`gallery`,e}({}),lp=function(e){return e.IS=`is`,e.IS_NOT=`isNot`,e.CONTAINS=`contains`,e.NOT_CONTAINS=`notContains`,e.IS_EMPTY=`isEmpty`,e.IS_NOT_EMPTY=`isNotEmpty`,e.GREATER_THAN=`greaterThan`,e.GREATER_THAN_OR_EQUAL=`greaterThanOrEqual`,e.LESS_THAN=`lessThan`,e.LESS_THAN_OR_EQUAL=`lessThanOrEqual`,e.BEFORE=`before`,e.AFTER=`after`,e}({}),up=function(e){return e.AND=`and`,e.OR=`or`,e}({}),dp=function(e){return e.ASC=`asc`,e.DESC=`desc`,e}({});function fp(e){var t,n,r,i,a;let o=(t=e.now)==null?Date.now():t,s=(n=e.primaryFieldId)==null?Y(6):n,c=(r=e.gridViewId)==null?Y(6):r,l=(i=e.recordCount)==null?5:i,u={id:s,name:(a=e.primaryFieldName)==null?`Name`:a,type:`text`,config:{placeholder:`bases.fieldConfig.textPlaceholder`}},d={},f=[],p={},m={},h={};for(let t=0;t<l;t++){let n=`${e.id}-record-${t+1}`;d[n]={id:n,values:{},orderKey:String(t+1).padStart(4,`0`),createdAt:o,updatedAt:o},f.push(n),p[n]=t,m[t]=n,h[t]={}}let g={id:c,tableId:e.id,name:`Grid`,type:`grid`,fieldOrder:[s],fieldSettings:{},config:{frozenFieldCount:1}};return{id:e.id,name:e.name,primaryFieldId:s,fieldOrder:[s],fields:{[s]:u},records:d,recordOrder:f,rowIndex:p,rowId:m,colIndex:{[s]:0},colId:{0:s},cellData:h,resources:{attachmentSets:{},attachments:{}},views:{[c]:g},viewOrder:[c]}}function pp(e=Y(),t=``,n=`zhCN`){let r=Date.now(),i=`table-1`;return{id:e,name:t,locale:n,appVersion:Re,schemaVersion:1,tableOrder:[i],tables:{[i]:fp({id:i,name:`Table 1`,now:r,recordCount:5})},createdAt:r,updatedAt:r}}var mp=class extends M{constructor(e={}){super(),T(this,`type`,n.UniverType.UNIVER_BASE),T(this,`_name$`,void 0),T(this,`name$`,void 0),T(this,`_snapshot`,void 0);let r=pp();this._snapshot=hp(z.commonExtend(r,e)),this._snapshot.id||(this._snapshot.id=`base-${Math.random().toString(36).slice(2,10)}`),this._name$=new t.BehaviorSubject(this._snapshot.name),this.name$=this._name$.asObservable()}getUnitId(){return this._snapshot.id}setName(e){this._snapshot.name=e,this._snapshot.updatedAt=Date.now(),this._name$.next(e)}getSnapshot(){return this._snapshot}checkTableName(e){return Object.values(this._snapshot.tables).some(t=>t.name.toLowerCase()===e.toLowerCase())}uniqueTableName(e){let t=e,n=1;for(;this.checkTableName(t);)t=`${e}${n}`,n++;return t}setSnapshot(e){this._snapshot=gp(e)?e:hp(e),this._name$.next(e.name)}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}dispose(){super.dispose(),this._name$.complete()}};function hp(e){var t;return delete e.compress,delete e.kind,Object.values((t=e.tables)==null?{}:t).forEach(e=>{vp(e)}),e}function gp(e){var t;return Object.values((t=e.tables)==null?{}:t).every(e=>_p(e))}function _p(e){var t,n;let r=(t=e.records)==null?{}:t,i=(n=e.fields)==null?{}:n;if(!Array.isArray(e.recordOrder)||!e.rowIndex||!e.rowId||!e.colIndex||!e.colId||!e.cellData||!e.resources||!e.resources.attachmentSets||!e.resources.attachments||Object.keys(r).length!==e.recordOrder.length)return!1;for(let t=0;t<e.recordOrder.length;t++){let n=e.recordOrder[t];if(!r[n]||e.rowIndex[n]!==t||e.rowId[t]!==n)return!1}for(let t=0;t<e.fieldOrder.length;t++){let n=e.fieldOrder[t];if(i[n]&&(e.colIndex[n]!==t||e.colId[t]!==n))return!1}return!0}function vp(e){var t,n;yp(e);let r=(t=e.records)==null?{}:t,i=(n=e.fields)==null?{}:n,a=bp(e,r),o=xp(e,i);e.recordOrder=a,Sp(e),Cp(e,i),wp(e,r,a),Tp(e,i,o),Ep(e,r,i)}function yp(e){let t=e.cd;t&&!e.cellData&&(e.cellData=Object.create(null),t.forEach(([t,n,r])=>{var i;e.cellData[t]=(i=e.cellData[t])==null?{}:i;let{c:a,...o}=r;e.cellData[t][n]=o}),delete e.cd)}function bp(e,t){var n,r;let i=(n=(r=e.recordOrder)==null?void 0:r.filter(e=>t[e]))==null?[]:n,a=new Set(i),o=Object.values(t).filter(e=>!a.has(e.id));return o.length?[...i,...o.sort((e,t)=>e.orderKey.localeCompare(t.orderKey)).map(e=>e.id)]:i}function xp(e,t){return e.fieldOrder.filter(e=>t[e])}function Sp(e){e.rowIndex={...e.rowIndex},e.rowId={...e.rowId},e.colIndex={...e.colIndex},e.colId={...e.colId},e.cellData={...e.cellData},e.resources={...e.resources},e.resources.attachmentSets={...e.resources.attachmentSets},e.resources.attachments={...e.resources.attachments}}function Cp(e,t){var n;Object.entries((n=e.cellData)==null?{}:n).forEach(([n,r])=>{var i;let a=Number(n);e.cellData[a]={...r},Object.entries((i=e.cellData[a])==null?{}:i).forEach(([n,r])=>{var i;let o=Number(n),s=(i=e.colId)==null?void 0:i[o];e.cellData[a][o]=Op(r,s?t[s]:void 0)})})}function wp(e,t,n){var r;n.forEach((t,n)=>{e.rowIndex[t]==null&&(e.rowIndex[t]=n)}),Object.entries((r=e.rowIndex)==null?{}:r).forEach(([n,r])=>{t[n]&&(e.rowId[r]=n)})}function Tp(e,t,n){var r;n.forEach((t,n)=>{e.colIndex[t]==null&&(e.colIndex[t]=n)}),Object.entries((r=e.colIndex)==null?{}:r).forEach(([n,r])=>{t[n]&&(e.colId[r]=n)})}function Ep(e,t,n){Object.values(t).forEach(t=>{var r;let i=e.rowIndex[t.id];i!=null&&(e.cellData[i]={...e.cellData[i]},Object.entries((r=t.values)==null?{}:r).forEach(([r,a])=>{let o=n[r];(o==null?void 0:o.type)===`attachment`&&Ap(e,t.id,r,a);let s=e.colIndex[r];if(s==null)return;let c=e.cellData[i][s];if(c!=null){e.cellData[i][s]=Op(c,o),Mp(c,o,a)&&(e.cellData[i][s]=Dp(a,o));return}e.cellData[i][s]=Dp(a,o)}))})}function Dp(e,t){if(kp(e))return(t==null?void 0:t.type)===`attachment`?{...e,v:``,t:1}:Op(e,t);if((t==null?void 0:t.type)===`attachment`)return{v:``,t:1};if(Np(t))return{v:Pp(e).join(`, `),t:1};if((t==null?void 0:t.type)===`link`&&e&&typeof e==`object`&&!Array.isArray(e)){var n,r;let t=e;return{v:String((n=(r=t.text)==null?t.url:r)==null?``:n),t:1}}return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?{v:e,t:Ip(e)}:{v:null,t:null}}function Op(e,t){let n=Lp(e.t,e.v);if(n===void 0){let{t,...n}=e;return n}return{...e,t:n}}function kp(e){return!!e&&typeof e==`object`&&(Object.prototype.hasOwnProperty.call(e,`v`)||Object.prototype.hasOwnProperty.call(e,`t`)||Object.prototype.hasOwnProperty.call(e,`p`)||Object.prototype.hasOwnProperty.call(e,`f`)||Object.prototype.hasOwnProperty.call(e,`si`))}function Ap(e,t,n,r){let i=jp(r);e.resources={...e.resources},e.resources.attachmentSets={...e.resources.attachmentSets},e.resources.attachments={...e.resources.attachments};let a=`${n}${t}`;e.resources.attachmentSets[a]=i.map((t,n)=>{var r;let i=String((r=t.id)==null?`${a}${n}`:r),o={...t,id:i};return e.resources.attachments[i]=o,i})}function jp(e){if(e==null||e===``||kp(e)&&!(`id`in e)&&!(`name`in e))return[];let t=Array.isArray(e)?e:[e],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r&&typeof r==`object`){let e={...r};Object.keys(e).length>0&&n.push(e);continue}n.push({id:`attachment-${e}`,name:String(r)})}return n}function Mp(e,t,n){return(t==null?void 0:t.type)===`attachment`?e.v!==``:Np(t)?Array.isArray(n)&&(e.v==null||e.v===``):!1}function Np(e){return(e==null?void 0:e.type)===`multiSelect`||(e==null?void 0:e.type)===`person`||(e==null?void 0:e.type)===`group`}function Pp(e){if(e==null||e===``)return[];let t=[];if(Array.isArray(e)){for(let n=0;n<e.length;n++){let r=Fp(e[n]);r&&t.push(r)}return t}let n=String(e).split(`,`);for(let e=0;e<n.length;e++){let r=n[e].trim();r&&t.push(r)}return t}function Fp(e){if(e==null)return``;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){var t,n,r;let i=e;return String((t=(n=(r=i.id)==null?i.name:r)==null?i.text:n)==null?``:t)}return String(e)}function Ip(e){return e==null?null:typeof e==`number`?2:typeof e==`boolean`?3:1}function Lp(e,t){return e===1||e===2||e===3||e===4||e==null?e:Ip(t==null?null:t)}var Rp=f(((e,t)=>{var n=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(typeof process>`u`||process.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||n.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||n.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||n.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=n.DEFAULT_MAX_PENDING};n.DEFAULT_TIMEOUT=0,n.DEFAULT_MAX_OCCUPATION_TIME=0,n.DEFAULT_MAX_EXECUTION_TIME=0,n.DEFAULT_MAX_PENDING=1e3,n.prototype.acquire=function(e,t,n,r){if(Array.isArray(e))return this._acquireBatch(e,t,n,r);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var i=null,a=null,o=null;typeof n!=`function`&&(r=n,n=null,o=new this.Promise(function(e,t){i=e,a=t})),r=r||{};var s=!1,c=null,l=null,u=null,d=this,f=function(t,r,c){l&&(clearTimeout(l),l=null),u&&(clearTimeout(u),u=null),t&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?r?a(r):i(c):typeof n==`function`&&n(r,c),s=!0),t&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},p=function(n){if(s)return f(n);c&&(clearTimeout(c),c=null),d.domainReentrant&&n&&(d.domains[e]=process.domain);var i=r.maxExecutionTime||d.maxExecutionTime;if(i&&(u=setTimeout(function(){d.queues[e]&&f(n,Error(`Maximum execution time is exceeded `+e))},i)),t.length===1){var a=!1;try{t(function(e,t){a||(a=!0,f(n,e,t))})}catch(e){a||(a=!0,f(n,e))}}else d._promiseTry(function(){return t()}).then(function(e){f(n,void 0,e)},function(e){f(n,e)})};d.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=r.maxPending||d.maxPending;if(!d.queues[e])d.queues[e]=[],p(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[e])p(!1);else if(d.queues[e].length>=m)f(!1,Error(`Too many pending tasks in queue `+e));else{var h=function(){p(!0)};r.skipQueue?d.queues[e].unshift(h):d.queues[e].push(h);var g=r.timeout||d.timeout;g&&(c=setTimeout(function(){c=null,f(!1,Error(`async-lock timed out in queue `+e))},g))}var _=r.maxOccupationTime||d.maxOccupationTime;if(_&&(l=setTimeout(function(){d.queues[e]&&f(!1,Error(`Maximum occupation time is exceeded in queue `+e))},_)),o)return o},n.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},n.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},n.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},t.exports=n})),zp=h(f(((e,t)=>{t.exports=Rp()}))());let Bp=new Set([`true`,`false`]);function Vp(e){return Bp.has(e.toLowerCase())}function Hp(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r<n.length;r++){let a=n[r];if(!i(a)||e[a]!==t[a])return!1}return!0}function Up(){}function Wp(e,t=16){let n=0,r=null;return function(...i){let a=Date.now();a-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=a,e.apply(this,i)},t)):(n=a,e.apply(this,i))}}let Gp=function(e){return e[e.Style=1]=`Style`,e[e.Value=2]=`Value`,e}({});function Kp(e){return`sheet_interceptor_${e}`}let qp=e=>function(t,n){let r=-1,i=t,a=!1,o=e=>(a=!0,e);for(let t=0;t<e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);r=t;let s=e[t];if(a=!1,i=s.handler(i,n,o),!a)break}return i};var Jp=class{constructor(e){T(this,`_interceptorsByName`,new Map),T(this,`_interceptorPoints`,void 0),this._interceptorPoints=e}fetchThroughInterceptors(e,t){let n=e,r=this._interceptorsByName.get(n);return t&&(r=r.filter(t)),qp(r||[])}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);return r.push(t),this._interceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>ze(this._interceptorsByName.get(n),t)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}};function Yp(e){return`sheet_async_interceptor_${e}`}let Xp=e=>async function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=await a.handler(i,n,async e=>(o=!0,e)),!o)break}return i};var Zp=class{constructor(e){T(this,`_asyncInterceptorsByName`,new Map),T(this,`_asyncInterceptorPoints`,void 0),this._asyncInterceptorPoints=e}fetchThroughAsyncInterceptors(e,t){let n=e,r=this._asyncInterceptorsByName.get(n);return t&&(r=r.filter(t)),Xp(r||[])}async interceptAsync(e,t){let n=e;this._asyncInterceptorsByName.has(n)||this._asyncInterceptorsByName.set(n,[]);let r=this._asyncInterceptorsByName.get(n);return r.push(t),this._asyncInterceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>ze(this._asyncInterceptorsByName.get(n),t)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}};function Qp(e){return e.map(e=>e/255)}function $p(e){return e.map(e=>Math.round(e*255))}function em([e,t,n]){let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=0,s=0;if(r!==i){let c=r-i;switch(s=a>.5?c/(2-r-i):c/(r+i),r){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return[o,s,a]}function tm(e,t,n){let r=[e,t,n].map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function nm(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function rm(e,t,n){let r,i,a;if(t===0)r=i=a=n;else{let o=(e,t,n)=>{let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return[r,i,a]}let im={r:1,g:1,b:1},am={r:0,g:0,b:0},om=tm(im.r,im.g,im.b),sm=tm(am.r,am.g,am.b);function cm(e){let t=nm(om,tm(e[0],e[1],e[2])),n=em(e),r=1-n[2],i,a,o;do i=rm(n[0],n[1],r),a=tm(i[0],i[1],i[2]),o=nm(a,sm),r+=.01;while(r<=1&&r>=0&&Math.abs(o-t)<.01);return i}function lm(e){return $p(cm(Qp(e)))}let um=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function dm(e){let t=e[0],n=e[1],r=e[2],i=[um[0][0]*t+um[0][1]*n+um[0][2]*r+um[0][4],um[1][0]*t+um[1][1]*n+um[1][2]*r+um[1][4],um[2][0]*t+um[2][1]*n+um[2][2]*r+um[2][4]];return i=i.map(e=>e>1?1:e<0?0:e),i}function fm(e){return $p(dm(Qp(e)))}var pm=class{constructor(){T(this,`cursor`,0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}};function mm(e,t){for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function hm(e){return/^-?\d+(\.\d+)?$/.test(e)}function gm(e){return hm(e)?Number(e)<=2**53-1:!1}function _m(e){return Number(e)>2**53-1||e.length>=18}var vm=class e{constructor(){T(this,`_data`,[])}static create(){return new e}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){let t=this._data.indexOf(e);this._data.splice(t,1)}getData(){return this._data}},ym=class e{constructor(){T(this,`_data`,new Map)}static create(){return new e}add(e,t){this._data.has(e)||this._data.set(e,t)}delete(e){this._data.delete(e)}getData(){return this._data}};function bm(e){let t=new MessageChannel,n=!1,r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function xm(e,t){return t.forEach(t=>e.add(t)),e}let Sm=`para_`;function Cm(e){let t=`${Sm}${Y(12)}`;for(;e.has(t);)t=`${Sm}${Y(12)}`;return e.add(t),t}function wm(e,t){var n;let r=Dm(e),i=new Set;for(let e of(n=r.paragraphs)==null?[]:n)e.paragraphId=Cm(i);return r}function Tm(e,t,n){let r=Om(e);return n!==!1&&Em(r.paragraphId)&&!t.has(r.paragraphId)?(t.add(r.paragraphId),r):(r.paragraphId=Cm(t),r)}function Em(e){return typeof e==`string`&&e.startsWith(`para_`)&&e.length>5}function Dm(e){return JSON.parse(JSON.stringify(e))}function Om(e){return JSON.parse(JSON.stringify(e))}let km=`section_`;function Am(e){let t=`${km}${Y(12)}`;for(;e.has(t);)t=`${km}${Y(12)}`;return e.add(t),t}function jm(e,t,n=!0){let r=z.deepClone(e);return n&&Mm(r.sectionId)&&!t.has(r.sectionId)?(t.add(r.sectionId),r):(r.sectionId=Am(t),r)}function Mm(e){return typeof e==`string`&&e.startsWith(`section_`)&&e.length>8}function Nm(e=Y(6),t=`enUS`,n=``,r=2){let i={id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("rxjs"),require("@univerjs/protocol"),require("rxjs/operators"),require("@wendellhu/redi"),require("@univerjs/themes")):typeof define==`function`&&define.amd?define([`exports`,`rxjs`,`@univerjs/protocol`,`rxjs/operators`,`@wendellhu/redi`,`@univerjs/themes`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverCore={},e.rxjs,e.UniverProtocol,e.rxjs.operators,e[`@wendellhu/redi`],e.UniverThemes))})(this,function(e,t,n,r,i,a){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var o=Object.create,s=Object.defineProperty,c=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,u=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,f=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),p=(e,t)=>{let n={};for(var r in e)s(n,r,{get:e[r],enumerable:!0});return t||s(n,Symbol.toStringTag,{value:`Module`}),n},m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=l(t),a=0,o=i.length,u;a<o;a++)u=i[a],!d.call(e,u)&&u!==n&&s(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(r=c(t,u))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:o(u(e)),m(t||!e||!e.__esModule?s(n,`default`,{value:e,enumerable:!0}):n,e));let g=typeof global<`u`?global:typeof self<`u`?self:window;function _(){let e=new Map,t=0;typeof g.requestIdleCallback!=`function`&&(g.requestIdleCallback=function(n){let r=Date.now(),i=++t,a=setTimeout(function(){e.delete(i);let t=Math.max(0,50-(Date.now()-r));n({didTimeout:t===0,timeRemaining(){return t}})},1);return e.set(i,a),i}),typeof g.cancelIdleCallback!=`function`&&(g.cancelIdleCallback=function(t){let n=e.get(t);n!==void 0&&(clearTimeout(n),e.delete(t))})}function v(){typeof g.queueMicrotask!=`function`&&(g.queueMicrotask=function(e){Promise.resolve().then(e).catch(e=>{setTimeout(()=>{throw e},0)})})}function y(){typeof g.Array.prototype.findLastIndex!=`function`&&(g.Array.prototype.findLastIndex=function(e,t){if(this==null)throw TypeError(`Array.prototype.findLastIndex called on null or undefined`);if(typeof e!=`function`)throw TypeError(`callback must be a function`);let n=this.length>>>0;for(let r=n-1;r>=0;r--)if(r in this&&e.call(t,this[r],r,this))return r;return-1}),typeof g.Array.prototype.findLast!=`function`&&(g.Array.prototype.findLast=function(e,t){let n=this.findLastIndex(e,t);return n===-1?void 0:this[n]})}function b(){typeof g.String.prototype.at!=`function`&&(g.String.prototype.at=function(e){if(this==null)throw TypeError(`String.prototype.at called on null or undefined`);let t=this.length;if(e<0&&(e=t+e),!(e<0||e>=t))return this.charAt(e)})}function x(){_(),v(),y(),b()}function S(e){"@babel/helpers - typeof";return S=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S(e)}function C(e,t){if(S(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(S(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function w(e){var t=C(e,`string`);return S(t)==`symbol`?t:t+``}function T(e,t,n){return(t=w(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){return e instanceof t.Subscription||e instanceof t.Subject||e&&`closed`in e&&e.unsubscribe!==void 0}function D(e){let t=!1;return e?E(e)?{dispose:()=>e.unsubscribe()}:typeof e==`function`?{dispose:()=>{t||(t=!0,e())}}:e:D(()=>{})}var O=class{constructor(){T(this,`_disposables`,new Set)}add(e){let t=D(e);return this._disposables.add(t),{dispose:(e=!1)=>{e||t.dispose(),this._disposables.delete(t)}}}dispose(){this._disposables.forEach(e=>{e.dispose()}),this._disposables.clear()}},k=class{constructor(){T(this,`_disposed`,!1),T(this,`_collection`,new O)}disposeWithMe(e){return this._collection.add(e)}ensureNotDisposed(){if(this._disposed)throw Error(`[Disposable]: object is disposed!`)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}},A=class extends k{constructor(...e){super(...e),T(this,`dispose$`,new t.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}},j=class extends k{constructor(e){super(),this._rootDisposable=e,T(this,`_ref`,0)}inc(){if(this._disposed)throw Error(`[RCDisposable]: should not ref to a disposed.`);this._ref+=1}dec(){--this._ref,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}},M=class extends k{};let N=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`.split(`.`)),P=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 F(e){if(!Number.isNaN(+e))return!1;if(e.startsWith(`http://localhost:3002`)||e.startsWith(`localhost:3002`))return!0;if(P.test(e)){if(I(e))return!0;try{let t=new URL(L(e)).hostname.split(`.`).pop();if(t&&N.has(t))return!0}catch{return!1}}return!1}function I(e){return/^[a-zA-Z]+:\/\//.test(e)}function ee(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function L(e){return I(e)?e:ee(e)?`mailto://${e}`:`https://${e}`}function R(e){if(!e||typeof e!=`string`)return!1;try{let t=typeof window<`u`&&window.location?window.location.origin:`http://localhost`,n=new URL(e,t);return[`http:`,`https:`,`mailto:`].includes(n.protocol)}catch{return!1}}function te(e,t){try{let n=new URL(t),r=n.pathname.endsWith(`/`)?n.pathname:`${n.pathname}/`,i=e.startsWith(`/`)?e.substring(1):e;return new URL(i,n.origin+r).toString()}catch(t){return console.error(`Error resolving URL with base URL:`,t),e}}function ne(e,t){return z.getValueType(e)===z.getValueType(t)?z.isArray(e)?re(e,t):z.isObject(e)?ie(e,t):z.isDate(e)?e.getTime()===t.getTime():z.isRegExp(e)?e.toString()===t.toString():e===t:!1}function re(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){let r=e[n],i=t[n];if(!ne(r,i))return!1}return!0}function ie(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n){if(!Object.prototype.propertyIsEnumerable.call(t,r))return!1;let n=e[r],i=t[r];if(!ne(n,i))return!1}return!0}var z=class e{static deleteNull(e){for(let t in e)(e[t]===null||e[t]===void 0)&&delete e[t];return e}static getSystemType(){let e=navigator.userAgent,t=navigator.platform===`Win32`||navigator.platform===`Windows`,n=navigator.platform===`Mac68K`||navigator.platform===`MacPPC`||navigator.platform===`Macintosh`||navigator.platform===`MacIntel`;if(n)return`Mac`;if(navigator.platform===`X11`&&!t&&!n)return`Unix`;if(String(navigator.platform).indexOf(`Linux`)>-1)return`Linux`;if(t){if(e.indexOf(`Windows NT 5.0`)>-1||e.indexOf(`Windows 2000`)>-1)return`Windows 2000`;if(e.indexOf(`Windows NT 5.1`)>-1||e.indexOf(`Windows XP`)>-1)return`Windows XP`;if(e.indexOf(`Windows NT 5.2`)>-1||e.indexOf(`Windows 2003`)>-1)return`Windows 2003`;if(e.indexOf(`Windows NT 6.0`)>-1||e.indexOf(`Windows Vista`)>-1)return`Windows Vista`;if(e.indexOf(`Windows NT 6.1`)>-1||e.indexOf(`Windows 7`)>-1)return`Windows 7`;if(e.indexOf(`Windows NT 10`)>-1||e.indexOf(`Windows 10`)>-1)return`Windows 10`;if(e.indexOf(`Windows NT 11`)>-1||e.indexOf(`Windows 11`)>-1)return`Windows 11`}return`Unknown system`}static getBrowserType(){let e=navigator.userAgent,t=e.indexOf(`Opera`)>-1,n=e.indexOf(`compatible`)>-1&&e.indexOf(`MSIE`)>-1&&!t,r=e.indexOf(`Trident`)>-1&&e.indexOf(`rv:11.0`)>-1,i=e.indexOf(`Edge`)>-1,a=e.indexOf(`Firefox`)>-1,o=e.indexOf(`Safari`)>-1&&e.indexOf(`Chrome`)===-1,s=e.indexOf(`Chrome`)>-1&&e.indexOf(`Safari`)>-1;if(n){RegExp(`MSIE (\\d+\\.\\d+);`).test(e);let t=Number.parseFloat(RegExp.$1);return t===7?`IE7`:t===8?`IE8`:t===9?`IE9`:t===10?`IE10`:`0`}return a?`FF`:t?`Opera`:o?`Safari`:s?`Chrome`:i?`Edge`:r?`IE11`:`Unknown browser`}static deepMerge(t,...n){n.forEach(e=>e&&o(e));function r(e){return e===`__proto__`||e===`constructor`||e===`prototype`}function i(t,n){t.forEach((t,o)=>{if(!(typeof o==`string`&&r(o))){if(e.isArray(t)){var s;let e=(s=n[o])==null?[]:s;n[o]=e,i(t,e);return}if(e.isObject(t)){var c;let e=(c=n[o])==null?{}:c;n[o]=e,a(t,e);return}n[o]=t}})}function a(t,n){Object.keys(t).forEach(o=>{if(r(o))return;let s=t[o];if(e.isObject(s)){var c;let e=(c=n[o])==null?{}:c;n[o]=e,a(s,e);return}if(e.isArray(s)){var l;let e=(l=n[o])==null?[]:l;n[o]=e,i(s,e);return}n[o]=s})}function o(n){Object.keys(n).forEach(o=>{if(r(o))return;let s=n[o];if(e.isArray(s)){var c;let e=(c=t[o])==null?[]:c;t[o]=e,i(s,e);return}if(e.isObject(s)){var l;let e=(l=t[o])==null?{}:l;t[o]=e,a(s,e);return}t[o]=s})}return t}static diffValue(e,t){return ne(e,t)}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)){let n=[];return t.forEach((t,r)=>{n[r]=e.deepClone(t)}),n}if(this.isObject(t)){let n=t,r={};for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=e.deepClone(n[t]));return Object.setPrototypeOf(r,Object.getPrototypeOf(t)),r}return t}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()===``:!1:!0}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isDate(e){return this.getValueType(e)===`[object Date]`}static isRegExp(e){return this.getValueType(e)===`[object RegExp]`}static isArray(e){return this.getValueType(e)===`[object Array]`}static isString(e){return this.getValueType(e)===`[object String]`}static isNumber(e){return this.getValueType(e)===`[object Number]`}static isStringNumber(e){return!isNaN(Number.parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isEmptyObject(e){for(let t in e)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(e){return F(e)}static normalizeUrl(e){return L(e)}static topLevelDomainCombiningString(){return[...N].join(`|`)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{let r=t[n];r==null?delete t[n]:e.removeNull(r)}),t}static numToWord(e){let t=``;for(;e>0;){let n=e%26;n=n===0?n=26:n,t=String.fromCharCode(96+n)+t,e=(e-n)/26}return t.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=0,i=0;for(let e=0;e<n;e++)i=t[e].charCodeAt(0)-96,r+=i*26**(n-e-1);return r===0?NaN:r-1}static chatAtABC(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t.toUpperCase()}static commonExtend(e,t){let n={};for(let t in e)n[t]=e[t];for(let e in t)t[e]!=null&&(n[e]=t[e]);return n}static hasIntersectionBetweenTwoRanges(e,t,n,r){return t>=n&&r>=e}static isStartValidPosition(e){return/^[A-Za-zА-Яа-яЁё_]/.test(e)}static isValidParameter(e){let t=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(e),n=e.length<=255;return!t&&n}static clamp(e,t,n){return Math.max(t,Math.min(n,e))}static now(){return performance&&performance.now?performance.now():Date.now()}};function ae(...e){let t={},n=e.length;for(let r=n-1;r>=0;r--){let n=e[r];if(n){let e=Object.keys(n);for(let r of e)t[r]===void 0&&(t[r]=n[r])}}return t}let oe=()=>typeof process<`u`&&process.versions!=null&&process.versions.node!=null,se=function(e){return e[e.DEFAULT_SERIES=0]=`DEFAULT_SERIES`,e[e.ALTERNATE_SERIES=1]=`ALTERNATE_SERIES`,e}({}),ce=function(e){return e[e.NONE=0]=`NONE`,e[e.THIN=1]=`THIN`,e[e.HAIR=2]=`HAIR`,e[e.DOTTED=3]=`DOTTED`,e[e.DASHED=4]=`DASHED`,e[e.DASH_DOT=5]=`DASH_DOT`,e[e.DASH_DOT_DOT=6]=`DASH_DOT_DOT`,e[e.DOUBLE=7]=`DOUBLE`,e[e.MEDIUM=8]=`MEDIUM`,e[e.MEDIUM_DASHED=9]=`MEDIUM_DASHED`,e[e.MEDIUM_DASH_DOT=10]=`MEDIUM_DASH_DOT`,e[e.MEDIUM_DASH_DOT_DOT=11]=`MEDIUM_DASH_DOT_DOT`,e[e.SLANT_DASH_DOT=12]=`SLANT_DASH_DOT`,e[e.THICK=13]=`THICK`,e}({}),le=function(e){return 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}({}),ue=function(e){return e[e.UNSUPPORTED=0]=`UNSUPPORTED`,e[e.RGB=1]=`RGB`,e[e.HEX=2]=`HEX`,e[e.THEME=3]=`THEME`,e}({}),de=function(e){return e[e.ON=0]=`ON`,e[e.OFF=1]=`OFF`,e}({}),fe=function(e){return 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}({}),pe=function(e){return e[e.LEFT=0]=`LEFT`,e[e.RIGHT=1]=`RIGHT`,e}({}),me=function(e){return e[e.DOCUMENT=0]=`DOCUMENT`,e[e.PROJECT=1]=`PROJECT`,e}({}),he=function(e){return e[e.COLUMNS=0]=`COLUMNS`,e[e.ROWS=1]=`ROWS`,e}({}),ge=function(e){return e[e.UP=0]=`UP`,e[e.RIGHT=1]=`RIGHT`,e[e.DOWN=2]=`DOWN`,e[e.LEFT=3]=`LEFT`,e}({});function _e(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}let ve=function(e){return 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}({}),ye=function(e){return e.EN_US=`enUS`,e.FR_FR=`frFR`,e.ZH_CN=`zhCN`,e.RU_RU=`ruRU`,e.ZH_TW=`zhTW`,e.ZH_HK=`zhHK`,e.VI_VN=`viVN`,e.FA_IR=`faIR`,e.JA_JP=`jaJP`,e.KO_KR=`koKR`,e.ES_ES=`esES`,e.CA_ES=`caES`,e.SK_SK=`skSK`,e.PT_BR=`ptBR`,e.DE_DE=`deDE`,e.IT_IT=`itIT`,e.ID_ID=`idID`,e.PL_PL=`plPL`,e.AR_SA=`arSA`,e}({}),be={enUS:{name:`English`,tag:`en-US`,direction:`ltr`},frFR:{name:`Français`,tag:`fr-FR`,direction:`ltr`},zhCN:{name:`简体中文`,tag:`zh-CN`,direction:`ltr`},ruRU:{name:`Русский`,tag:`ru-RU`,direction:`ltr`},zhTW:{name:`繁體中文`,tag:`zh-TW`,direction:`ltr`},zhHK:{name:`繁體中文(香港)`,tag:`zh-HK`,direction:`ltr`},viVN:{name:`Tiếng Việt`,tag:`vi-VN`,direction:`ltr`},faIR:{name:`فارسی`,tag:`fa-IR`,direction:`rtl`,numberingSystem:`arabext`},jaJP:{name:`日本語`,tag:`ja-JP`,direction:`ltr`},koKR:{name:`한국어`,tag:`ko-KR`,direction:`ltr`},esES:{name:`Español`,tag:`es-ES`,direction:`ltr`},caES:{name:`Català`,tag:`ca-ES`,direction:`ltr`},skSK:{name:`Slovenčina`,tag:`sk-SK`,direction:`ltr`},ptBR:{name:`Português (Brasil)`,tag:`pt-BR`,direction:`ltr`},deDE:{name:`Deutsch`,tag:`de-DE`,direction:`ltr`},itIT:{name:`Italiano`,tag:`it-IT`,direction:`ltr`},idID:{name:`Bahasa Indonesia`,tag:`id-ID`,direction:`ltr`},plPL:{name:`Polski`,tag:`pl-PL`,direction:`ltr`},arSA:{name:`العربية`,tag:`ar-SA`,direction:`rtl`,numberingSystem:`arab`}},xe=function(e){return 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}({}),Se=function(e){return e[e.RANGE=0]=`RANGE`,e[e.SHEET=1]=`SHEET`,e}({}),Ce=function(e){return 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}({}),we=function(e){return e[e.GRID=0]=`GRID`,e[e.KANBAN=1]=`KANBAN`,e[e.GANTT=2]=`GANTT`,e}({}),Te=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.LEFT_TO_RIGHT=1]=`LEFT_TO_RIGHT`,e[e.RIGHT_TO_LEFT=2]=`RIGHT_TO_LEFT`,e}({}),Ee=function(e){return 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}({}),De=function(e){return 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}({}),Oe=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TOP=1]=`TOP`,e[e.MIDDLE=2]=`MIDDLE`,e[e.BOTTOM=3]=`BOTTOM`,e}({}),ke=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.OVERFLOW=1]=`OVERFLOW`,e[e.CLIP=2]=`CLIP`,e[e.WRAP=3]=`WRAP`,e}({}),Ae=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ITALIC=1]=`ITALIC`,e}({}),je=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.BOLD=1]=`BOLD`,e}({}),Me=function(e){return e[e.NORMAL=1]=`NORMAL`,e[e.SUBSCRIPT=2]=`SUBSCRIPT`,e[e.SUPERSCRIPT=3]=`SUPERSCRIPT`,e}({}),Ne=function(e){return e[e.FALSE=0]=`FALSE`,e[e.TRUE=1]=`TRUE`,e}({}),Pe=function(e){return e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`,e[e.BOOLEAN=3]=`BOOLEAN`,e[e.FORCE_STRING=4]=`FORCE_STRING`,e}({}),Fe=function(e){return 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}({}),Ie=function(e){return 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}({});var Le=`@univerjs/core`,Re=`1.0.0-alpha.7`;function ze(e,t){let n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Be(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ve(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function He(e,t){for(let n=e.length-1;n>-1;n--){let r=e[n];if(t(r,n))return r}return null}function Ue(e,t){if(e.length===0)return e;let n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function We(e,t){let n=new Map;return e.forEach(e=>{let r=t(e),i=n.get(r);n.has(r)||(i=[],n.set(r,i)),i.push(e)}),n}function Ge(e){return Array.isArray(e)?e:[e]}function Ke(e,t){t.forEach(t=>e.add(t))}function qe(e,t){t.forEach(([t])=>{e.has(t)&&e.get(t)})}var Je=class extends Error{constructor(e){super(e),this.name=`CustomCommandExecutionError`}},Ye=class extends Je{constructor(){super(`Canceled by facade`),this.name=`CanceledError`}};async function Xe(e){for(let[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function Ze(e){for(let[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(e){return{index:t,result:!1,error:e}}return{result:!0,index:-1}}function Qe(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var $e=typeof global==`object`&&global&&global.Object===Object&&global,et=typeof self==`object`&&self&&self.Object===Object&&self,tt=$e||et||Function(`return this`)(),nt=function(){return tt.Date.now()},rt=/\s/;function it(e){for(var t=e.length;t--&&rt.test(e.charAt(t)););return t}var at=/^\s+/;function ot(e){return e&&e.slice(0,it(e)+1).replace(at,``)}var st=tt.Symbol,ct=Object.prototype,lt=ct.hasOwnProperty,ut=ct.toString,dt=st?st.toStringTag:void 0;function ft(e){var t=lt.call(e,dt),n=e[dt];try{e[dt]=void 0;var r=!0}catch{}var i=ut.call(e);return r&&(t?e[dt]=n:delete e[dt]),i}var pt=Object.prototype.toString;function mt(e){return pt.call(e)}var ht=`[object Null]`,gt=`[object Undefined]`,_t=st?st.toStringTag:void 0;function vt(e){return e==null?e===void 0?gt:ht:_t&&_t in Object(e)?ft(e):mt(e)}function yt(e){return typeof e==`object`&&!!e}var bt=`[object Symbol]`;function xt(e){return typeof e==`symbol`||yt(e)&&vt(e)==bt}var St=NaN,Ct=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,Tt=/^0o[0-7]+$/i,Et=parseInt;function Dt(e){if(typeof e==`number`)return e;if(xt(e))return St;if(Qe(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=Qe(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=ot(e);var n=wt.test(e);return n||Tt.test(e)?Et(e.slice(2),n?2:8):Ct.test(e)?St:+e}var Ot=`Expected a function`,kt=Math.max,At=Math.min;function jt(e,t,n){var r,i,a,o,s,c,l=0,u=!1,d=!1,f=!0;if(typeof e!=`function`)throw TypeError(Ot);t=Dt(t)||0,Qe(n)&&(u=!!n.leading,d=`maxWait`in n,a=d?kt(Dt(n.maxWait)||0,t):a,f=`trailing`in n?!!n.trailing:f);function p(t){var n=r,a=i;return r=i=void 0,l=t,o=e.apply(a,n),o}function m(e){return l=e,s=setTimeout(_,t),u?p(e):o}function h(e){var n=e-c,r=e-l,i=t-n;return d?At(i,a-r):i}function g(e){var n=e-c,r=e-l;return c===void 0||n>=t||n<0||d&&r>=a}function _(){var e=nt();if(g(e))return v(e);s=setTimeout(_,h(e))}function v(e){return s=void 0,f&&r?p(e):(r=i=void 0,o)}function y(){s!==void 0&&clearTimeout(s),l=0,r=c=i=s=void 0}function b(){return s===void 0?o:v(nt())}function x(){var e=nt(),n=g(e);if(r=arguments,i=this,c=e,n){if(s===void 0)return m(c);if(d)return clearTimeout(s),s=setTimeout(_,t),p(c)}return s===void 0&&(s=setTimeout(_,t)),o}return x.cancel=y,x.flush=b,x}var Mt=Array.isArray,Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Pt=/^\w*$/;function Ft(e,t){if(Mt(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||xt(e)?!0:Pt.test(e)||!Nt.test(e)||t!=null&&e in Object(t)}var It=`[object AsyncFunction]`,Lt=`[object Function]`,Rt=`[object GeneratorFunction]`,zt=`[object Proxy]`;function Bt(e){if(!Qe(e))return!1;var t=vt(e);return t==Lt||t==Rt||t==It||t==zt}var Vt=tt[`__core-js_shared__`],Ht=function(){var e=/[^.]+$/.exec(Vt&&Vt.keys&&Vt.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function Ut(e){return!!Ht&&Ht in e}var Wt=Function.prototype.toString;function Gt(e){if(e!=null){try{return Wt.call(e)}catch{}try{return e+``}catch{}}return``}var Kt=/[\\^$.*+?()[\]{}|]/g,qt=/^\[object .+?Constructor\]$/,Jt=Function.prototype,Yt=Object.prototype,Xt=Jt.toString,Zt=Yt.hasOwnProperty,Qt=RegExp(`^`+Xt.call(Zt).replace(Kt,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function $t(e){return!Qe(e)||Ut(e)?!1:(Bt(e)?Qt:qt).test(Gt(e))}function en(e,t){return e==null?void 0:e[t]}function tn(e,t){var n=en(e,t);return $t(n)?n:void 0}var nn=tn(Object,`create`);function rn(){this.__data__=nn?nn(null):{},this.size=0}function an(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var on=`__lodash_hash_undefined__`,sn=Object.prototype.hasOwnProperty;function cn(e){var t=this.__data__;if(nn){var n=t[e];return n===on?void 0:n}return sn.call(t,e)?t[e]:void 0}var ln=Object.prototype.hasOwnProperty;function un(e){var t=this.__data__;return nn?t[e]!==void 0:ln.call(t,e)}var dn=`__lodash_hash_undefined__`;function fn(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=nn&&t===void 0?dn:t,this}function pn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}pn.prototype.clear=rn,pn.prototype.delete=an,pn.prototype.get=cn,pn.prototype.has=un,pn.prototype.set=fn;function mn(){this.__data__=[],this.size=0}function hn(e,t){return e===t||e!==e&&t!==t}function gn(e,t){for(var n=e.length;n--;)if(hn(e[n][0],t))return n;return-1}var _n=Array.prototype.splice;function vn(e){var t=this.__data__,n=gn(t,e);return n<0?!1:(n==t.length-1?t.pop():_n.call(t,n,1),--this.size,!0)}function yn(e){var t=this.__data__,n=gn(t,e);return n<0?void 0:t[n][1]}function bn(e){return gn(this.__data__,e)>-1}function xn(e,t){var n=this.__data__,r=gn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Sn(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])}}Sn.prototype.clear=mn,Sn.prototype.delete=vn,Sn.prototype.get=yn,Sn.prototype.has=bn,Sn.prototype.set=xn;var Cn=tn(tt,`Map`);function wn(){this.size=0,this.__data__={hash:new pn,map:new(Cn||Sn),string:new pn}}function Tn(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function En(e,t){var n=e.__data__;return Tn(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Dn(e){var t=En(this,e).delete(e);return this.size-=+!!t,t}function On(e){return En(this,e).get(e)}function kn(e){return En(this,e).has(e)}function An(e,t){var n=En(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function jn(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])}}jn.prototype.clear=wn,jn.prototype.delete=Dn,jn.prototype.get=On,jn.prototype.has=kn,jn.prototype.set=An;var Mn=`Expected a function`;function Nn(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(Mn);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Nn.Cache||jn),n}Nn.Cache=jn;var Pn=500;function Fn(e){var t=Nn(e,function(e){return n.size===Pn&&n.clear(),e}),n=t.cache;return t}var In=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ln=/\\(\\)?/g,Rn=Fn(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(In,function(e,n,r,i){t.push(r?i.replace(Ln,`$1`):n||e)}),t});function zn(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Bn=1/0,Vn=st?st.prototype:void 0,Hn=Vn?Vn.toString:void 0;function Un(e){if(typeof e==`string`)return e;if(Mt(e))return zn(e,Un)+``;if(xt(e))return Hn?Hn.call(e):``;var t=e+``;return t==`0`&&1/e==-Bn?`-0`:t}function Wn(e){return e==null?``:Un(e)}function Gn(e,t){return Mt(e)?e:Ft(e,t)?[e]:Rn(Wn(e))}var Kn=1/0;function qn(e){if(typeof e==`string`||xt(e))return e;var t=e+``;return t==`0`&&1/e==-Kn?`-0`:t}function Jn(e,t){t=Gn(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[qn(t[n++])];return n&&n==r?e:void 0}function Yn(e,t,n){var r=e==null?void 0:Jn(e,t);return r===void 0?n:r}function Xn(){this.__data__=new Sn,this.size=0}function Zn(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Qn(e){return this.__data__.get(e)}function $n(e){return this.__data__.has(e)}var er=200;function tr(e,t){var n=this.__data__;if(n instanceof Sn){var r=n.__data__;if(!Cn||r.length<er-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new jn(r)}return n.set(e,t),this.size=n.size,this}function nr(e){var t=this.__data__=new Sn(e);this.size=t.size}nr.prototype.clear=Xn,nr.prototype.delete=Zn,nr.prototype.get=Qn,nr.prototype.has=$n,nr.prototype.set=tr;var rr=function(){try{var e=tn(Object,`defineProperty`);return e({},``,{}),e}catch{}}();function ir(e,t,n){t==`__proto__`&&rr?rr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ar(e,t,n){(n!==void 0&&!hn(e[t],n)||n===void 0&&!(t in e))&&ir(e,t,n)}function or(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var sr=or(),cr=typeof e==`object`&&e&&!e.nodeType&&e,lr=cr&&typeof module==`object`&&module&&!module.nodeType&&module,ur=lr&&lr.exports===cr?tt.Buffer:void 0,dr=ur?ur.allocUnsafe:void 0;function fr(e,t){if(t)return e.slice();var n=e.length,r=dr?dr(n):new e.constructor(n);return e.copy(r),r}var pr=tt.Uint8Array;function mr(e){var t=new e.constructor(e.byteLength);return new pr(t).set(new pr(e)),t}function hr(e,t){var n=t?mr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function gr(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var _r=Object.create,vr=function(){function e(){}return function(t){if(!Qe(t))return{};if(_r)return _r(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function yr(e,t){return function(n){return e(t(n))}}var br=yr(Object.getPrototypeOf,Object),xr=Object.prototype;function Sr(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||xr)}function Cr(e){return typeof e.constructor==`function`&&!Sr(e)?vr(br(e)):{}}var wr=`[object Arguments]`;function Tr(e){return yt(e)&&vt(e)==wr}var Er=Object.prototype,Dr=Er.hasOwnProperty,Or=Er.propertyIsEnumerable,kr=Tr(function(){return arguments}())?Tr:function(e){return yt(e)&&Dr.call(e,`callee`)&&!Or.call(e,`callee`)},Ar=9007199254740991;function jr(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=Ar}function Mr(e){return e!=null&&jr(e.length)&&!Bt(e)}function Nr(e){return yt(e)&&Mr(e)}function Pr(){return!1}var Fr=typeof e==`object`&&e&&!e.nodeType&&e,Ir=Fr&&typeof module==`object`&&module&&!module.nodeType&&module,Lr=Ir&&Ir.exports===Fr?tt.Buffer:void 0,Rr=(Lr?Lr.isBuffer:void 0)||Pr,zr=`[object Object]`,Br=Function.prototype,Vr=Object.prototype,Hr=Br.toString,Ur=Vr.hasOwnProperty,Wr=Hr.call(Object);function Gr(e){if(!yt(e)||vt(e)!=zr)return!1;var t=br(e);if(t===null)return!0;var n=Ur.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Hr.call(n)==Wr}var Kr=`[object Arguments]`,qr=`[object Array]`,Jr=`[object Boolean]`,Yr=`[object Date]`,Xr=`[object Error]`,Zr=`[object Function]`,Qr=`[object Map]`,$r=`[object Number]`,ei=`[object Object]`,ti=`[object RegExp]`,ni=`[object Set]`,ri=`[object String]`,ii=`[object WeakMap]`,ai=`[object ArrayBuffer]`,oi=`[object DataView]`,si=`[object Float32Array]`,ci=`[object Float64Array]`,li=`[object Int8Array]`,ui=`[object Int16Array]`,di=`[object Int32Array]`,fi=`[object Uint8Array]`,pi=`[object Uint8ClampedArray]`,mi=`[object Uint16Array]`,hi=`[object Uint32Array]`,B={};B[si]=B[ci]=B[li]=B[ui]=B[di]=B[fi]=B[pi]=B[mi]=B[hi]=!0,B[Kr]=B[qr]=B[ai]=B[Jr]=B[oi]=B[Yr]=B[Xr]=B[Zr]=B[Qr]=B[$r]=B[ei]=B[ti]=B[ni]=B[ri]=B[ii]=!1;function gi(e){return yt(e)&&jr(e.length)&&!!B[vt(e)]}function _i(e){return function(t){return e(t)}}var vi=typeof e==`object`&&e&&!e.nodeType&&e,yi=vi&&typeof module==`object`&&module&&!module.nodeType&&module,bi=yi&&yi.exports===vi&&$e.process,xi=function(){try{return yi&&yi.require&&yi.require(`util`).types||bi&&bi.binding&&bi.binding(`util`)}catch{}}(),Si=xi&&xi.isTypedArray,Ci=Si?_i(Si):gi;function wi(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var Ti=Object.prototype.hasOwnProperty;function Ei(e,t,n){var r=e[t];(!(Ti.call(e,t)&&hn(r,n))||n===void 0&&!(t in e))&&ir(e,t,n)}function Di(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?ir(n,s,c):Ei(n,s,c)}return n}function Oi(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var ki=9007199254740991,Ai=/^(?:0|[1-9]\d*)$/;function ji(e,t){var n=typeof e;return t=t==null?ki:t,!!t&&(n==`number`||n!=`symbol`&&Ai.test(e))&&e>-1&&e%1==0&&e<t}var Mi=Object.prototype.hasOwnProperty;function Ni(e,t){var n=Mt(e),r=!n&&kr(e),i=!n&&!r&&Rr(e),a=!n&&!r&&!i&&Ci(e),o=n||r||i||a,s=o?Oi(e.length,String):[],c=s.length;for(var l in e)(t||Mi.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||ji(l,c)))&&s.push(l);return s}function Pi(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Fi=Object.prototype.hasOwnProperty;function Ii(e){if(!Qe(e))return Pi(e);var t=Sr(e),n=[];for(var r in e)r==`constructor`&&(t||!Fi.call(e,r))||n.push(r);return n}function Li(e){return Mr(e)?Ni(e,!0):Ii(e)}function Ri(e){return Di(e,Li(e))}function zi(e,t,n,r,i,a,o){var s=wi(e,n),c=wi(t,n),l=o.get(c);if(l){ar(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=Mt(c),p=!f&&Rr(c),m=!f&&!p&&Ci(c);u=c,f||p||m?Mt(s)?u=s:Nr(s)?u=gr(s):p?(d=!1,u=fr(c,!0)):m?(d=!1,u=hr(c,!0)):u=[]:Gr(c)||kr(c)?(u=s,kr(s)?u=Ri(s):(!Qe(s)||Bt(s))&&(u=Cr(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),ar(e,n,u)}function Bi(e,t,n,r,i){e!==t&&sr(t,function(a,o){if(i||(i=new nr),Qe(a))zi(e,t,o,n,Bi,r,i);else{var s=r?r(wi(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),ar(e,o,s)}},Li)}function Vi(e){return e}function Hi(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)}var Ui=Math.max;function Wi(e,t,n){return t=Ui(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Ui(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Hi(e,this,s)}}function Gi(e){return function(){return e}}var Ki=rr?function(e,t){return rr(e,`toString`,{configurable:!0,enumerable:!1,value:Gi(t),writable:!0})}:Vi,qi=800,Ji=16,Yi=Date.now;function Xi(e){var t=0,n=0;return function(){var r=Yi(),i=Ji-(r-n);if(n=r,i>0){if(++t>=qi)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Zi=Xi(Ki);function Qi(e,t){return Zi(Wi(e,t,Vi),e+``)}function $i(e,t,n){if(!Qe(n))return!1;var r=typeof t;return(r==`number`?Mr(n)&&ji(t,n.length):r==`string`&&t in n)?hn(n[t],e):!1}function ea(e){return Qi(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&$i(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var ta=ea(function(e,t,n){Bi(e,t,n)}),na=ea(function(e,t,n,r){Bi(e,t,n,r)});function ra(e,t,n,r){if(!Qe(e))return e;t=Gn(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=qn(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=Qe(u)?u:ji(t[i+1])?[]:{})}Ei(s,c,l),s=s[c]}return e}function ia(e,t,n){return e==null?e:ra(e,t,n)}let aa=(0,i.createIdentifier)(`univer.config-service`);var oa=class{constructor(){T(this,`_configChanged$`,new t.Subject),T(this,`configChanged$`,this._configChanged$.asObservable()),T(this,`_config`,new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(e){return this._config.get(e)}setConfig(e,t,n){var r;let{merge:i=!1}=n||{},a=(r=this._config.get(e))==null?{}:r;a=i?ta(a,t):t,this._config.set(e,a),this._configChanged$.next({[e]:a})}deleteConfig(e){return this._config.delete(e)}subscribeConfigValue$(e){return new t.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,e)&&n.next(this._config.get(e));let r=this.configChanged$.pipe((0,t.filter)(t=>Object.prototype.hasOwnProperty.call(t,e))).subscribe(t=>n.next(t[e]));return()=>r.unsubscribe()})}};let sa=(0,i.createIdentifier)(`univer.context-service`);var ca=class extends k{constructor(...e){super(...e),T(this,`_contextChanged$`,new t.Subject),T(this,`contextChanged$`,this._contextChanged$.asObservable()),T(this,`_contextMap`,new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(e){var t;return(t=this._contextMap.get(e))==null?!1:t}setContextValue(e,t){this._contextMap.set(e,t),this._contextChanged$.next({[e]:t})}subscribeContextValue$(e){return new t.Observable(n=>{let r=this._contextChanged$.pipe((0,t.filter)(t=>t[e]!==void 0)).subscribe(t=>n.next(t[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}};let la=function(e){return 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}({}),ua=(0,i.createIdentifier)(`univer.log`);var da=class extends k{constructor(...e){super(...e),T(this,`_logLevel`,3),T(this,`_deduction`,new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}deprecate(...e){this._logLevel>=2&&this._logWithDeduplication(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...t){let n=t[0];/^\[(.*?)\]/g.test(n)?e(`\x1B[97;104m${n}\x1B[0m`,...t.slice(1)):e(...t)}_logWithDeduplication(e,...t){let n=fa(...t);this._deduction.has(n)||(this._deduction.add(n),this._log(e,...t))}};function fa(...e){return e.map(e=>JSON.stringify(e)).join(``)}function V(e,t){return function(n,r){t(n,r,e)}}function pa(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let ma=`command.logExecution`,ha=function(e){return e[e.COMMAND=0]=`COMMAND`,e[e.OPERATION=1]=`OPERATION`,e[e.MUTATION=2]=`MUTATION`,e}({}),ga=(0,i.createIdentifier)(`univer.core.command-service`);var _a=class{constructor(){T(this,`_commands`,new Map),T(this,`_commandTypes`,new Map)}registerCommand(e){if(this._commands.has(e.id))throw Error(`[CommandRegistry]: command "${e.id}" has been registered before.`);return this._commands.set(e.id,e),this._commandTypes.set(e.id,e.type),D(()=>{this.unregisterCommand(e.id)})}unregisterCommand(e){this._commands.delete(e),this._commandTypes.delete(e)}hasCommand(e){return this._commands.has(e)}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}getCommandType(e){return this._commandTypes.get(e)}};let va={id:`nil`,type:0,handler:()=>!0},ya=class extends k{constructor(e,t,n){super(),this._injector=e,this._logService=t,this._configService=n,T(this,`_commandRegistry`,void 0),T(this,`_beforeCommandExecutionListeners`,[]),T(this,`_commandExecutedListeners`,[]),T(this,`_collabMutationListeners`,[]),T(this,`_multiCommandDisposables`,new Map),T(this,`_commandExecutingLevel`,0),T(this,`_commandExecutionStack`,[]),this._commandRegistry=new _a,this.registerCommand(va)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}disposed(){return this._disposed}_warnCommandSkippedAfterDisposed(e){this._logService.warn(`[CommandService]`,`command "${e}" skipped because CommandService is disposed.`)}hasCommand(e){return this._commandRegistry.hasCommand(e)}registerCommand(e){return this._commandRegistry.registerCommand(e)}unregisterCommand(e){var t;this._commandRegistry.unregisterCommand(e),(t=this._multiCommandDisposables.get(e))==null||t.dispose()}registerMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),D(()=>{let t=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),D(()=>{let t=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(t,1)});throw Error(`[CommandService]: could not add a listener twice.`)}onMutationExecutedForCollab(e){if(this._collabMutationListeners.indexOf(e)===-1)return this._collabMutationListeners.push(e),D(()=>{let t=this._collabMutationListeners.indexOf(e);this._collabMutationListeners.splice(t,1)});throw Error(`[CommandService]: could not add a collab mutation listener twice.`)}async executeCommand(e,t,n){if(this._disposed)return this._warnCommandSkippedAfterDisposed(e),!1;try{let r=this._commandRegistry.getCommand(e);if(r){let[i]=r,a={id:i.id,type:i.type,params:t},o=this._pushCommandExecutionStack(a),s=n==null?{}:n;if(this._beforeCommandExecutionListeners.forEach(e=>e(a,s)),this._disposed)return o.dispose(),this._warnCommandSkippedAfterDisposed(e),!1;let c=await this._execute(i,t,s);return s.syncOnly||this._commandExecutedListeners.forEach(e=>e(a,s)),i.type===2&&this._collabMutationListeners.forEach(e=>e(a,s)),o.dispose(),c}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Je)return!1;throw e}}syncExecuteCommand(e,t,n){if(this._disposed)return this._warnCommandSkippedAfterDisposed(e),!1;try{let i=this._commandRegistry.getCommand(e);if(i){let[a]=i,o={id:a.id,type:a.type,params:t};if(a.type===2){let e=He(this._commandExecutionStack,e=>e.type===0);if(e){var r;o.params=(r=o.params)==null?{}:r,o.params.trigger=e.id}}let s=this._pushCommandExecutionStack(o),c=n==null?{}:n;if(this._beforeCommandExecutionListeners.forEach(e=>e(o,c)),this._disposed)return s.dispose(),this._warnCommandSkippedAfterDisposed(e),!1;let l=this._syncExecute(a,t,c);return c.syncOnly||this._commandExecutedListeners.forEach(e=>e(o,c)),a.type===2&&this._collabMutationListeners.forEach(e=>e(o,c)),s.dispose(),l}throw Error(`[CommandService]: command "${e}" is not registered.`)}catch(e){if(e instanceof Je)return!1;throw e}}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),D(()=>ze(this._commandExecutionStack,e))}_registerMultiCommand(e){let t=this._commandRegistry.getCommand(e.id),n;if(!t){n=new ba(e.id);let t=new O;t.add(this._commandRegistry.registerCommand(n)),t.add(D(()=>{this._multiCommandDisposables.delete(e.id)})),this._multiCommandDisposables.set(e.id,t)}else if(t[0].multi!==!0)throw Error(`Command has registered as a single command.`);else n=t[0];let r=n.registerImplementation(e);return D(()=>{if(r.dispose(),!n.hasImplementations()){var t;(t=this._multiCommandDisposables.get(e.id))==null||t.dispose()}})}async _execute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(e.handler,t,n),this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}_syncExecute(e,t,n){if(n!=null&&n.syncOnly)return!0;this._configService.getConfig(`command.logExecution`)!==!1&&this._logService.debug(`[CommandService]`,`${`|-`.repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(e.handler,t,n),r instanceof Promise)throw TypeError(`[CommandService]: Command handler should not return a promise.`);this._commandExecutingLevel--}catch(e){throw r=!1,this._commandExecutingLevel=0,e}return r}};ya=pa([V(0,(0,i.Inject)(i.Injector)),V(1,ua),V(2,aa)],ya);var ba=class{constructor(e){this.id=e,T(this,`name`,void 0),T(this,`multi`,!0),T(this,`type`,0),T(this,`priority`,0),T(this,`_implementations`,[]),T(this,`handler`,async(e,t)=>{if(!this._implementations.length)return!1;let n=e.get(ua),r=e.get(sa),a=e.get(i.Injector);for(let e of this._implementations){let i=e.command.preconditions;if((!i||i&&i(r))&&(n.debug(`[MultiCommand]`,`executing implementation "${e.command.name}".`),await a.invoke(e.command.handler,t)))return!0}return!1}),this.name=e}registerImplementation(e){let t={command:e};return this._implementations.push(t),this._implementations.sort((e,t)=>t.command.priority-e.command.priority),D(()=>{let e=this._implementations.indexOf(t);this._implementations.splice(e,1)})}hasImplementations(){return this._implementations.length>0}};function xa(e,t,n){return Ze(e.map(e=>()=>t.syncExecuteCommand(e.id,e.params,n)))}function Sa(e,t,n){return Xe(e.map(e=>()=>t.executeCommand(e.id,e.params,n)))}function Ca(e){return new t.Observable(t=>{let n=e((...e)=>t.next(e));return()=>n==null?void 0:n.dispose()})}function wa(e){return function(n){return n.pipe((0,t.takeWhile)(t=>!e(t),!0))}}function Ta(e=0){return n=>{let r=[];return n.pipe((0,t.tap)(e=>r.push(e)),(0,t.debounceTime)(e),(0,t.map)(()=>r),(0,t.tap)(()=>r=[]))}}function Ea(e){let n=new t.ReplaySubject(1);return setTimeout(()=>n.next(),e),n.pipe((0,t.take)(1))}function Da(e,n){let r=new t.BehaviorSubject(n),i=e.subscribe(r),a=r.complete.bind(r);return r.complete=()=>{i.unsubscribe(),a()},r}let Oa=e=>new Promise(n=>{(0,t.merge)(Ca(e.onCommandExecuted.bind(e)).pipe((0,r.filter)(([e])=>e.type===2)),(0,t.timer)(300)).pipe((0,r.debounceTime)(16),(0,r.first)()).subscribe(()=>{n()})});function ka(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 Aa(e,t){let n=0,r=e.length-1;for(;n<=r;){let i=Math.floor((r+n)/2);if(t<e[i]&&(i===0||t>=e[i-1]))return i;if(t>=e[i])n=i+1;else if(t<e[i])r=i-1;else return-1}return-1}function ja(e,t){let n=0,r=e.length;for(;n<r;){let i=Math.floor((n+r)/2);e[i]<=t?n=i+1:r=i}return n<e.length?n:e.length-1}function Ma(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(r=e.length<40||t<=e[20]||t>=e[r-20]?ka(e,t):ja(e,t),n){let t=e[r];return e.indexOf(t)}return r}function Na(e){let t=new Blob([e],{type:`text/javascript`});return window.URL.createObjectURL(t)}function Pa(e,t){if(t==null||e==null)return!0;let{left:n=0,top:r=0,height:i=0,width:a=0,angle:o=0}=t,{left:s=0,top:c=0,height:l=0,width:u=0,angle:d=0}=e,f=u,p=l,m=a,h=i;return Math.abs(s-n)>2||Math.abs(c-r)>2||Math.abs(f-m)>2||Math.abs(p-h)>2||Math.abs(d-o)>1}let Fa={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],darkyellow:[139,128,0],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]};var Ia=class e{static mix(t,n,r){var i,a;r=Math.min(1,Math.max(0,r));let o=new e(t).toRgb(),s=new e(n).toRgb(),c=(i=o.a)==null?1:i,l=(a=s.a)==null?1:a;return new e({r:(s.r-o.r)*r+o.r,g:(s.g-o.g)*r+o.g,b:(s.b-o.b)*r+o.b,a:(l-c)*r+c})}static getContrastRatio(t,n){let r=new e(t).getLuminance(),i=new e(n).getLuminance();return(Math.max(r,i)+.05)/(Math.min(r,i)+.05)}constructor(t){if(T(this,`_color`,void 0),T(this,`_rgbColor`,void 0),T(this,`_isValid`,!1),t==null){this._setNullColor();return}if(t instanceof e){this._color={...t._color},this._rgbColor={...t._rgbColor};return}let n=za(t);if(n==null){this._setNullColor();return}this._color=n;let r=Wa(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){let{r:e,g:t,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?`a`:``}(${e},${t},${n}${i?`,${r}`:``})`}toString(){return this.toRgbString()}toHexString(e){let{r:t,g:n,b:r,a:i=1}=this.toRgb(),a=i<1,o=[La(Math.round(t).toString(16)),La(Math.round(n).toString(16)),La(Math.round(r).toString(16)),La(Math.round(i*255).toString(16))];return e&&o[0][0]===o[0][1]&&o[1][0]===o[1][1]&&o[2][0]===o[2][1]&&o[3][0]===o[3][1]?a?`#${o[0][0]}${o[1][0]}${o[2][0]}${o[3][0]}`:`#${o[0][0]}${o[1][0]}${o[2][0]}`:a?`#${o[0]}${o[1]}${o[2]}${o[3]}`:`#${o[0]}${o[1]}${o[2]}`}toHsv(){return Ya(this.toRgb())}toHsl(){return Ja(this.toRgb())}lighten(t=10){let n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}darken(t=10){let n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new e(n)}setAlpha(t){return new e({...this._rgbColor,a:t})}getLuminance(){let{r:e,g:t,b:n}=this.toRgb();return e=Ra(e),t=Ra(t),n=Ra(n),Number((.2126*e+.7152*t+.0722*n).toFixed(3))}getBrightness(){let{r:e,g:t,b:n}=this.toRgb();return(e*299+t*587+n*114)/1e3}getAlpha(){var e;return(e=this._color.a)==null?1:e}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}}};let La=e=>e.length===1?`0${e}`:e,Ra=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),za=e=>{if(Za(e)){if(`r`in e){let t={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(t.a=e.a),t}if(`l`in e){let t={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(t.a=e.a),t}let t={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(t.a=e.a),t}let t=e.trim().toLowerCase();if(Fa[t]){let e=Fa[t],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(t.startsWith(`#`))return Ba(t);if(t.startsWith(`rgb`))return Va(t);if(t.startsWith(`hsl`))return Ha(t);if(t.startsWith(`hsv`))return Ua(t)},Ba=e=>{let t=e.substring(1),n=RegExp(`.{1,${t.length>=6?2:1}}`,`g`),r=t.match(n);if(!r||r.length<3)throw Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(e=>e+e));let i={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(i.a=Number.parseInt(r[3],16)/255),i},Va=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal rgb color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal rgb color`);let 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},Ha=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsl color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsl color`);let 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},Ua=e=>{let t=e.indexOf(`(`);if(t===-1)throw Error(`The color '${e}' is illegal hsv color`);let n=e.substring(t+1,e.length-1).split(`,`);if(n.length<3)throw Error(`The color '${e}' is illegal hsv color`);let 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},Wa=e=>{let t=za(e);if(t!=null)return`r`in t?t:`l`in t?Ka(t):qa(t)},Ga=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Ka=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let i=0,a=0,o=0;if(n===0)i=a=o=r;else{let e=r<.5?r*(1+n):r+n-r*n,s=2*r-e;i=Ga(s,e,t+1/3),a=Ga(s,e,t),o=Ga(s,e,t-1/3)}let s={r:Math.round(i*255),g:Math.round(a*255),b:Math.round(o*255)};return e.a!==void 0&&(s.a=e.a),s},qa=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;let i=Math.floor(t),a=t-i,o=r*(1-n),s=r*(1-a*n),c=r*(1-(1-a)*n),l=i%6,u=[r,s,o,o,c,r][l],d=[c,r,r,s,o,o][l],f=[o,o,c,r,r,s][l],p={r:u*255,g:d*255,b:f*255};return e.a!==void 0&&(p.a=e.a),p},Ja=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s,c;if(i===a)s=c=0;else{let e=i-a;switch(c=o>.5?e/(2-i-a):e/(i+a),i){case t:s=(n-r)/e+(n<r?6:0);break;case n:s=(r-t)/e+2;break;default:s=(t-n)/e+4;break}s/=6}let l={h:Math.round(s*360),s:Math.round(c*100),l:Math.round(o*100)};return e.a!==void 0&&(l.a=e.a),l},Ya=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;let i=Math.max(t,n,r),a=Math.min(t,n,r),o,s=i,c=i-a,l=i===0?0:c/i;if(i===a)o=0;else{switch(i){case t:o=(n-r)/c+(n<r?6:0);break;case n:o=(r-t)/c+2;break;default:o=(t-n)/c+4;break}o/=6}let u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(s*100)};return e.a!==void 0&&(u.a=e.a),u},Xa=e=>e==null,Za=e=>!Xa(e)&&typeof e==`object`;function Qa(e){return!!(/^#(?:[0]{3}|[0]{6})\b/.test(e)||/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/.test(e)||/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}function $a(e){return!!(/^#(?:[Ff]{3}|[Ff]{6})\b/.test(e)||/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/.test(e)||/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e)||/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/.test(e)||/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/.test(e))}let eo=function(e){return e[e.COVER=0]=`COVER`,e[e.REPLACE=1]=`REPLACE`,e}({});function to(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 no(e){if(e.t!==void 0)return e.t;if(typeof e.v==`string`)return 1;if(typeof e.v==`number`)return 2;if(typeof e.v==`boolean`)return 3}function ro(e){if(e==null)return!0;let{v:t,f:n,si:r,p:i}=e;return!(!(t==null||typeof t==`string`&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||i!=null)}function io(e){return e!=null&&(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)}let ao=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({}),oo=function(e){return e[e.NONE=0]=`NONE`,e[e.ROW=1]=`ROW`,e[e.COLUMN=2]=`COLUMN`,e[e.ALL=3]=`ALL`,e}({});function so(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}let co=function(e){return e.NONE=`none`,e.BACKWARD=`backward`,e.FORWARD=`forward`,e}({}),lo=function(e){return e.RECT=`RECT`,e.TEXT=`TEXT`,e}({});function uo(e,t,n){let r=!1,i=!1,a=e,o=t,s=e,c=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c};for(let l=0;l<n.length;l++){let{startRow:u,endRow:d,startColumn:f,endColumn:p}=n[l];if(e===u&&t===f){a=d,o=p,s=u,c=f,i=!0;break}if(e>=u&&e<=d&&t>=f&&t<=p){a=d,o=p,s=u,c=f,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}let fo=function(e){return e.Raw=`raw`,e.Intercepted=`intercepted`,e.Both=`both`,e}({}),po={Office:{4:`#4472C4`,5:`#ED7D31`,6:`#A5A5A5`,7:`#70AD47`,8:`#5B9BD5`,9:`#70AD47`,0:`#000000`,2:`#44546A`,1:`#FFFFFF`,3:`#E7E6E6`,10:`#0563C1`,11:`#954F72`}},mo=`general`,ho=`hash`,go=`zero`,_o=`qmark`,vo=`slash`,yo=`group`,bo=`scale`,xo=`comma`,So=`break`,Co=`text`,wo=`plus`,To=`minus`,Eo=`point`,Do=`space`,Oo=`percent`,ko=`digit`,Ao=`calendar`,jo=`error`,Mo=`datetime`,No=`duration`,Po=`condition`,Fo=`dbnum`,Io=`natnum`,Lo=`locale`,Ro=`color`,zo=`modifier`,Bo=`ampm`,Vo=`escaped`,Ho=`string`,Uo=`skip`,Wo=`fill`,Go=`paren`,Ko=`char`,qo=`#000000.#FFFFFF.#FF0000.#00FF00.#0000FF.#FFFF00.#FF00FF.#00FFFF.#800000.#008000.#000080.#808000.#800080.#008080.#C0C0C0.#808080.#9999FF.#993366.#FFFFCC.#CCFFFF.#660066.#FF8080.#0066CC.#CCCCFF.#000080.#FF00FF.#FFFF00.#00FFFF.#800080.#800000.#008080.#0000FF.#00CCFF.#CCFFFF.#CCFFCC.#FFFF99.#99CCFF.#FF99CC.#CC99FF.#FFCC99.#3366FF.#33CCCC.#99CC00.#FFCC00.#FF9900.#FF6600.#666699.#969696.#003366.#339966.#003300.#333300.#993300.#993366.#333399.#333333`.split(`.`),Jo=`¤.$.£.¥.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿`.split(`.`),Yo=RegExp(`[${Jo.join(``)}]`);function Xo(e){return!!e&&`scale`in e}function Zo(e){return!!e&&`generated`in e&&!!e.generated}function Qo(e){return!!(Xo(e[0])&&e[0].percent||Xo(e[1])&&e[1].percent||Xo(e[2])&&e[2].percent||Xo(e[3])&&e[3].percent)}function $o(e){return!!(Xo(e[0])&&e[0].date||Xo(e[1])&&e[1].date||Xo(e[2])&&e[2].date||Xo(e[3])&&e[3].date)}function es(e){let[t,n,r,i]=e;return!!((!t||Zo(t))&&(!n||Zo(n))&&(!r||Zo(r))&&Xo(i)&&i.text&&!Zo(i))}let ts={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},ns=[[`DMY`,1],[`DM`,2],[`MY`,3],[`MDY`,4],[`MD`,5],[`hmsa`,6],[`hma`,7],[`hms`,8],[`hm`,9]];function rs(e,t=null){var n;let[r,i]=e;if(!r)throw TypeError(`Cannot read properties of undefined (reading 'frac_max')`);let a=Xo(r)?r:void 0,o=Xo(i)?i:void 0,s=`error`in r,c=a==null?void 0:a.frac_max,l={type:`general`,isDate:$o(e),isText:es(e),isPercent:Qo(e),maxDecimals:a!=null&&a.general?9:c==null?0:c,scale:(n=a==null?void 0:a.scale)==null?1:n,color:0,parentheses:0,grouped:a!=null&&a.grouping?1:0,code:``,level:0},u=!l.isDate&&!l.isText&&!s&&r.tokens.some(e=>e.type===`string`&&typeof e.value==`string`&&(t?e.value===t:Yo.test(e.value))),d=`G`,f=c!==void 0&&c>=0?Math.min(15,c):``,p=``,m=``;if(o!=null&&o.color&&(m=`-`,l.color=1),a!=null&&a.parens&&(p=`()`,l.parentheses=1),u)d=`C`,l.type=`currency`;else if(s)l.type=`error`,l.maxDecimals=0;else if(l.isDate){let e=0,t=0,n=``;r.tokens.forEach(r=>{let i=r.type;/^(b-)?year/.test(i)?(n+=`Y`,t++):i.startsWith(`month`)?(n+=`M`,t++):/^(week)?day/.test(i)?(n+=`D`,t++):(i===`hour`||i===`min`||i===`sec`||i===`ampm`)&&(n+=i[0],e++)}),l.type=`date`,t&&e?l.type=`datetime`:!t&&e&&(l.type=`time`);let i=ns.find(([e])=>n.startsWith(e));d=i?`D`:`G`,f=i?i[1]:``}else l.isText?(d=`G`,l.type=`text`,f=``,l.maxDecimals=0):a!=null&&a.general?(d=`G`,l.type=`general`,f=``):a!=null&&a.fractions?(d=`G`,l.type=`fraction`,f=``):a!=null&&a.exponential?(d=`S`,l.type=`scientific`):l.isPercent?(d=`P`,l.type=`percent`):a!=null&&a.grouping?(d=`,`,l.type=`grouped`):a&&(a.int_max||c)&&(d=`F`,l.type=`number`);return l.code=d+f+m+p,l.level=ts[l.type],Object.freeze(l)}function is(e){var t;let[n]=e;if(!n)throw TypeError(`Cannot read properties of undefined (reading 'date')`);let r=Xo(n)?n:void 0,i=(t=r==null?void 0:r.date)==null?0:t;return{year:!!(i&2),month:!!(i&4),day:!!(i&8),hours:!!(i&16),minutes:!!(i&32),seconds:!!(i&64),clockType:(r==null?void 0:r.clock)===12?12:24}}function as(e){if(!Number.isFinite(e))throw RangeError(`decimalFromNumber requires a finite number`);let t=e<0||Object.is(e,-0);if(e===0)return{negative:t,digits:`0`,exponent:0};let[n,r]=Math.abs(e).toExponential(14).split(`e`);return{negative:t,digits:n.replace(`.`,``).replace(/0+$/,``)||`0`,exponent:Number(r)}}function os(e,t){return{...e,exponent:e.digits===`0`?0:e.exponent+Math.trunc(t)}}function ss(e){let t=[...e];for(let e=t.length-1;e>=0;e--){if(t[e]!==`9`)return t[e]=String(Number(t[e])+1),t.join(``);t[e]=`0`}return`1${t.join(``)}`}function cs(e,t=0){let n=Math.trunc(t),r=e.exponent+1+n,i;if(r<0?i=`0`:r===0?i=e.digits[0]>=`5`?`1`:`0`:(i=e.digits.slice(0,r).padEnd(r,`0`)||`0`,r<e.digits.length&&e.digits[r]>=`5`&&(i=ss(i))),/^0+$/.test(i))return{negative:e.negative,integer:`0`,fraction:``,zero:!0};if(n<=0)return{negative:e.negative,integer:i+`0`.repeat(-n),fraction:``,zero:!1};let a=i.padStart(n+1,`0`);return{negative:e.negative,integer:a.slice(0,-n),fraction:a.slice(-n).replace(/0+$/,``),zero:!1}}function ls(e){let t=Number(e.fraction?`${e.integer}.${e.fraction}`:e.integer);return e.negative&&!e.zero?-t:t}function us(e){return`${e.negative&&!e.zero?`-`:``}${e.integer}${e.fraction?`.${e.fraction}`:``}`}function ds(e,t,n,r){if(e.digits===`0`)return{exponent:0,rounded:cs(e,r)};let i=t>1?Math.floor(e.exponent/t)*t:e.exponent;n||i++;let a=cs(os(e,-i),r);return t===1&&a.integer.length>1&&(i++,a=cs(os(e,-i),r)),{exponent:i,rounded:a}}let fs=Object.freeze({1078:`af`,1052:`sq`,1118:`am`,5121:`ar_DZ`,15361:`ar_BH`,3073:`ar_EG`,2049:`ar_IQ`,11265:`ar_JO`,13313:`ar_KW`,12289:`ar_LB`,4097:`ar_LY`,6145:`ar_MA`,8193:`ar_OM`,16385:`ar_QA`,1025:`ar_SA`,10241:`ar_SY`,7169:`ar_TN`,14337:`ar_AE`,9217:`ar_YE`,1067:`hy`,1101:`as`,2092:`az_AZ`,1068:`az_AZ`,1069:`eu`,1059:`be`,2117:`bn`,1093:`bn_IN`,5146:`bs`,1026:`bg`,1109:`my`,1027:`ca`,2052:`zh_CN`,3076:`zh_HK`,5124:`zh_MO`,4100:`zh_SG`,1028:`zh_TW`,1050:`hr`,1029:`cs`,1030:`da`,1125:`dv`,2067:`nl_BE`,1043:`nl_NL`,1126:`bin`,3081:`en_AU`,10249:`en_BZ`,4105:`en_CA`,9225:`en_CB`,2057:`en_GB`,16393:`en_IN`,6153:`en_IE`,8201:`en_JM`,5129:`en_NZ`,13321:`en_PH`,7177:`en_ZA`,11273:`en_TT`,1033:`en_US`,12297:`en_ZW`,1061:`et`,1071:`mk`,1080:`fo`,1065:`fa`,1124:`fil`,1035:`fi`,2060:`fr_BE`,11276:`fr_CM`,3084:`fr_CA`,9228:`fr_CG`,12300:`fr_CI`,1036:`fr_FR`,5132:`fr_LU`,13324:`fr_ML`,6156:`fr_MC`,14348:`fr_MA`,10252:`fr_SN`,4108:`fr_CH`,7180:`fr`,1122:`fy_NL`,2108:`gd_IE`,1084:`gd`,1110:`gl`,1079:`ka`,3079:`de_AT`,1031:`de_DE`,5127:`de_LI`,4103:`de_LU`,2055:`de_CH`,1032:`el`,1140:`gn`,1095:`gu`,1279:`en`,1037:`he`,1081:`hi`,1038:`hu`,1039:`is`,1136:`ig_NG`,1057:`id`,1040:`it_IT`,2064:`it_CH`,1041:`ja`,1099:`kn`,1120:`ks`,1087:`kk`,1107:`km`,1111:`kok`,1042:`ko`,1088:`ky`,1108:`lo`,1142:`la`,1062:`lv`,1063:`lt`,2110:`ms_BN`,1086:`ms_MY`,1100:`ml`,1082:`mt`,1112:`mni`,1153:`mi`,1102:`mr`,1104:`mn`,2128:`mn`,1121:`ne`,1044:`no_NO`,2068:`no_NO`,1096:`or`,1045:`pl`,1046:`pt_BR`,2070:`pt_PT`,1094:`pa`,1047:`rm`,2072:`ro_MO`,1048:`ro_RO`,1049:`ru`,2073:`ru_MO`,1083:`se`,1103:`sa`,3098:`sr_SP`,2074:`sr_SP`,1072:`st`,1074:`tn`,1113:`sd`,1115:`si`,1051:`sk`,1060:`sl`,1143:`so`,1070:`sb`,11274:`es_AR`,16394:`es_BO`,13322:`es_CL`,9226:`es_CO`,5130:`es_CR`,7178:`es_DO`,12298:`es_EC`,17418:`es_SV`,4106:`es_GT`,18442:`es_HN`,2058:`es_MX`,19466:`es_NI`,6154:`es_PA`,15370:`es_PY`,10250:`es_PE`,20490:`es_PR`,1034:`es_ES`,14346:`es_UY`,8202:`es_VE`,1089:`sw`,2077:`sv_FI`,1053:`sv_SE`,1114:`syc`,1064:`tg`,1097:`ta`,1092:`tt`,1098:`te`,1054:`th`,1105:`bo`,1073:`ts`,1055:`tr`,1090:`tk`,1058:`uk`,1056:`ur`,2115:`uz_UZ`,1091:`uz_UZ`,1075:`ve`,1066:`vi`,1106:`cy`,1076:`xh`,1085:`yi`,1077:`zu`}),ps=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,ms={},H=(e,t=``)=>e.replace(/~/g,t).split(`;`),U=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(e=>{let n=e.slice(0,t%10);return n+(t<10||e===n?``:`.`)})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(e=>{let t=e.slice(0,n%10);return t+(n<10||e===t?``:`.`)})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),hs={group:`\xA0`,decimal:`.`,positive:`+`,negative:`-`,percent:`%`,exponent:`E`,nan:`NaN`,infinity:`∞`,ampm:H(`AM;PM`),mmmm6:H(`Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah`),mmm6:H(`Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H.`),mmmm:H(`January;February;March;April;May;June;July;August;September;October;November;December`),mmm:H(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec`),dddd:H(`Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday`),ddd:H(`Sun;Mon;Tue;Wed;Thu;Fri;Sat`),bool:H(`TRUE;FALSE`),preferMDY:!1};function gs(e){let t=ps.exec(e);if(!t)throw SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?`_${t[2]}`:``),language:t[1],territory:t[2]||``}}function _s(e){if(typeof e==`number`)return fs[e&65535]||null;let t=Number.parseInt(e,16);return Number.isFinite(t)&&fs[t&65535]?fs[t&65535]||null:ps.test(e)?e:null}function vs(e){let t=_s(e),n=null;if(t){let e=gs(t);n=ms[e.lang]||ms[e.language]||null}return n}function ys(e){return Object.assign({},hs,e)}function W(e,t){let n=typeof t==`object`?t:gs(t);return ms[n.lang]=ys(e),n.language!==n.lang&&!ms[n.language]&&(ms[n.language]=ys(e)),ms[n.lang]}let bs=ys({group:`,`,preferMDY:!0});bs.isDefault=!0,W({group:`,`,ampm:H(`上午;下午`),mmmm:H(`一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月`),mmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:H(`周日;周一;周二;周三;周四;周五;周六`)},`zh_CN`);let xs={group:`,`,ampm:H(`上午;下午`),mmmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),mmm:H(`1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月`),dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`),ddd:H(`周日;周一;周二;周三;周四;周五;周六`)};W({...xs,nan:`非數值`,dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_TW`),W({...xs,dddd:H(`~日;~一;~二;~三;~四;~五;~六`,`星期`)},`zh_HK`),W({...xs,ampm:H(`午前;午後`),dddd:H(`日~;月~;火~;水~;木~;金~;土~`,`曜日`),ddd:H(`日;月;火;水;木;金;土`)},`ja`),W({group:`,`,ampm:H(`오전;오후`),mmmm:H(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),mmm:H(`1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월`),dddd:H(`일요일;월요일;화요일;수요일;목요일;금요일;토요일`),ddd:H(`일;월;화;수;목;금;토`)},`ko`),W({group:`,`,ampm:H(`ก่อนเที่ยง;หลังเที่ยง`),mmmm:H(`มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~`,`าคม`),mmm:H(`ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค.`),dddd:H(`วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์`),ddd:H(`อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.`)},`th`),W(U({decimal:`,`,ampm:H(`dop.;odp.`),mmmm:H(`ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince`),mmm:H(`I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII`),dddd:H(`neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota`),bool:H(`PRAVDA;NEPRAVDA`)},-1,2),`cs`),W(U({group:`.`,decimal:`,`,mmmm:H(`januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december`),dddd:H(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:H(`SAND;FALSK`)},13,13),`da`),W(U({group:`.`,decimal:`,`,ampm:H(`a.m.;p.m.`),mmmm:H(`januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december`),mmm:H(`jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec.`),dddd:H(`zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag`),bool:H(`WAAR;ONWAAR`)},-1,2),`nl`),W({group:`,`,preferMDY:!0},`en`),W({group:`,`,preferMDY:!0},`en_US`),W({group:`,`},`en_AU`),W({group:`,`},`en_CA`),W({group:`,`},`en_GB`),W({group:`,`,mmm:H(`Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec`)},`en_IE`),W(U({decimal:`,`,nan:`epäluku`,ampm:H(`ap.;ip.`),mmmm:H(`tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~`,`kuuta`),mmm:H(`tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk.`),dddd:H(`sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~`,`taina`),bool:H(`TOSI;EPÄTOSI`)},-1,2),`fi`);let Ss=U({group:` `,decimal:`,`,mmmm:H(`janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre`),mmm:H(`janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc.`),dddd:H(`~manche;lun~;mar~;mercre~;jeu~;vendre~;same~`,`di`),bool:H(`VRAI;FAUX`)},-1,13);W({...Ss},`fr`),W({...Ss,mmm:H(`janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.`)},`fr_CA`),W({group:`'`,decimal:`.`,...Ss},`fr_CH`);let Cs=U({mmmm:H(`Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember`),mmm:H(`Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez.`),dddd:H(`Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~`,`tag`),bool:H(`WAHR;FALSCH`)},-1,12);W({group:`.`,decimal:`,`,...Cs},`de`),W({group:`'`,decimal:`.`,...Cs},`de_CH`),W(U({group:`.`,decimal:`,`,ampm:H(`π.μ.;μ.μ.`),mmmm:H(`Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~`,`ίου`),mmm:H(`Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ`),dddd:H(`Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο`)},-1,3),`el`),W({decimal:`,`,ampm:H(`de.;du.`),mmmm:H(`január;február;március;április;május;június;július;augusztus;szeptember;október;november;december`),mmm:H(`jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec.`),dddd:H(`vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat`),ddd:H(`V;H;K;Sze;Cs;P;Szo`),bool:H(`IGAZ;HAMIS`)},`hu`),W(U({group:`.`,decimal:`,`,ampm:H(`f.h.;e.h.`),mmmm:H(`janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember`),dddd:H(`sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~`,`dagur`)},13,13),`is`),W(U({group:`.`,decimal:`,`,mmmm:H(`Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember`),dddd:H(`Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu`)},3,3),`id`);let ws=U({mmmm:H(`gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre`),dddd:H(`domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato`),bool:H(`VERO;FALSO`)},3,3);W({group:`.`,decimal:`,`,...ws},`it`),W({group:`'`,decimal:`.`,...ws},`it_CH`);let Ts={decimal:`,`,ampm:H(`a.m.;p.m.`),mmmm:H(`januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember`),mmm:H(`jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des.`),dddd:H(`søn~;man~;tirs~;ons~;tors~;fre~;lør~`,`dag`),bool:H(`SANN;USANN`)};W(U({...Ts},-1,13),`nb`),W(U({...Ts},-1,13),`no`),W(U({decimal:`,`,mmmm:H(`stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia`),dddd:H(`niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota`),ddd:H(`niedz.;pon.;wt.;śr.;czw.;pt.;sob.`),bool:H(`PRAWDA;FAŁSZ`)},3,-1),`pl`);let Es={group:`.`,decimal:`,`,mmmm:H(`janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro`),dddd:H(`domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado`),bool:H(`VERDADEIRO;FALSO`)};W(U(Es,13,13),`pt`),W(U(Es,13,13),`pt_BR`),W({decimal:`,`,nan:`не\xA0число`,mmmm:H(`января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря`),mmm:H(`янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек.`),dddd:H(`воскресенье;понедельник;вторник;среда;четверг;пятница;суббота`),ddd:H(`вс;пн;вт;ср;чт;пт;сб`),mmmm6:H(`рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан`),mmm6:H(`рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам.`),bool:H(`ИСТИНА;ЛОЖЬ`)},`ru`),W(U({decimal:`,`,mmmm:H(`januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra`),dddd:H(`nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota`)},3,2),`sk`);let Ds={group:`.`,decimal:`,`,ampm:H(`a.\xA0m.;p.\xA0m.`),mmmm:H(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~`,`bre`),mmm:H(`ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic`),dddd:H(`domingo;lunes;martes;miércoles;jueves;viernes;sábado`),ddd:H(`dom;lun;mar;mié;jue;vie;sáb`),bool:H(`VERDADERO;FALSO`)},Os=H(`ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic`),ks=H(`ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.`);W({...Ds},`es`),W({...Ds},`es_AR`),W({...Ds},`es_BO`),W({...Ds},`es_CL`),W({...Ds},`es_CO`),W({...Ds},`es_EC`),W({...Ds,mmm:Os,ampm:H(`a.m.;p.m.`)},`es_MX`),W({...Ds,mmm:ks},`es_PY`),W({...Ds,mmm:ks},`es_UY`),W({...Ds,mmm:ks,mmmm:H(`enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre`)},`es_VE`),W({decimal:`,`,ampm:H(`fm;em`),mmmm:H(`januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december`),mmm:H(`jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec.`),dddd:H(`sön~;mån~;tis~;ons~;tors~;fre~;lör~`,`dag`),ddd:H(`sön;mån;tis;ons;tors;fre;lör`)},`sv`),W(U({group:`.`,decimal:`,`,ampm:H(`ÖÖ;ÖS`),mmmm:H(`Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık`),mmm:H(`Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara`),dddd:H(`Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi`),ddd:H(`Paz;Pzt;Sal;Çar;Per;Cum;Cmt`),bool:H(`DOĞRU;YANLIŞ`)},3,-1),`tr`),W({group:`,`,ampm:H(`yb;yh`),mmmm:H(`Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr`),mmm:H(`Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag`),dddd:H(`Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn`),ddd:H(`Sul;Llun;Maw;Mer;Iau;Gwen;Sad`)},`cy`),W({group:`.`,decimal:`,`,mmmm:H(`yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr`),mmm:H(`yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek`),dddd:H(`bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə`),ddd:H(`B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.`)},`az`),W(U({decimal:`,`,mmmm:H(`студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня`),dddd:H(`нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота`),ddd:H(`нд;пн;аў;ср;чц;пт;сб`)},3,-1),`be`),W({decimal:`,`,ampm:H(`пр.об.;сл.об.`),mmmm:H(`януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември`),mmm:H(`яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек`),dddd:H(`неделя;понеделник;вторник;сряда;четвъртък;петък;събота`),ddd:H(`нд;пн;вт;ср;чт;пт;сб`),bool:H(`ИСТИНА;ЛОЖЬ`)},`bg`),W({group:`.`,decimal:`,`,mmmm:H(`de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre`),mmm:H(`de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des.`),dddd:H(`diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte`),ddd:H(`dg.;dl.;dt.;dc.;dj.;dv.;ds.`),ampm:H(`a.\xA0m.;p.\xA0m.`)},`ca`),W(U({group:`,`,decimal:`.`,mmmm:H(`Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre`),dddd:H(`Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado`)},3,3),`fil`),W({group:`,`,decimal:`.`,mmmm:H(`જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર`),mmm:H(`જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે`),dddd:H(`રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~`,`વાર`),ddd:H(`રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ`)},`gu`),W({group:`,`,decimal:`.`,ampm:H(`לפנה״צ;אחה״צ`),dddd:H(`~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת`,`יום `),ddd:H(`~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת`,`יום `),mmmm:H(`ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר`),mmm:H(`ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳`),mmmm6:H(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן`),mmm6:H(`רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן`)},`he`),W(U({group:`.`,decimal:`,`,mmmm:H(`siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca`),mmm:H(`sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro`),dddd:H(`nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota`)},-1,3),`hr`),W({decimal:`,`,mmmm:H(`հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի`),mmm:H(`հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ`),dddd:H(`կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ`),ddd:H(`կիր;երկ;երք;չրք;հնգ;ուր;շբթ`)},`hy`),W(U({decimal:`,`,mmmm:H(`იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი`),dddd:H(`კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი`)},3,3),`ka`),W(U({decimal:`,`,mmmm:H(`қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан`),dddd:H(`жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі`),ddd:H(`жс;дс;сс;ср;бс;жм;сб`)},13,-1),`kk`),W({group:`,`,mmmm:H(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್`),mmm:H(`ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ`),dddd:H(`ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~`,`ವಾರ`),ddd:H(`ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ`),ampm:H(`ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ`)},`kn`),W({decimal:`,`,mmmm:H(`sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio`),mmm:H(`saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod.`),dddd:H(`sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis`),ddd:H(`sk;pr;an;tr;kt;pn;št`),ampm:H(`priešpiet;popiet`)},`lt`),W({decimal:`,`,mmmm:H(`janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris`),mmm:H(`janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec.`),dddd:H(`svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena`),ddd:H(`svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd.`),ampm:H(`priekšpusdienā;pēcpusdienā`)},`lv`),W({group:`,`,decimal:`.`,mmmm:H(`ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ`),mmm:H(`ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം`),dddd:H(`ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച`),ddd:H(`ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി`)},`ml`),W({group:`,`,decimal:`.`,mmmm:H(`нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~`,`р сар`),mmm:H(`1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~`,`-р сар`),dddd:H(`ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба`),ddd:H(`Ня;Да;Мя;Лх;Пү;Ба;Бя`),ampm:H(`ү.ө.;ү.х.`)},`mn`),W({group:`,`,decimal:`.`,mmmm:H(`जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर`),mmm:H(`जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें`),dddd:H(`रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:H(`रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि`)},`mr`),W(U({group:`,`,decimal:`.`,mmmm:H(`ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ`),mmm:H(`ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ`),dddd:H(`တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ`),ampm:H(`နံနက်;ညနေ`)},-1,0),`my`),W({group:`,`,decimal:`.`,mmmm:H(`ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ`),mmm:H(`ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ`),dddd:H(`ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ`),ddd:H(`ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ`),ampm:H(`ਪੂ.ਦੁ.;ਬਾ.ਦੁ.`)},`pa`),W({group:`.`,decimal:`,`,mmmm:H(`ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~`,`brie`),mmm:H(`ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec.`),dddd:H(`duminică;luni;marți;miercuri;joi;vineri;sâmbătă`),ddd:H(`dum.;lun.;mar.;mie.;joi;vin.;sâm.`),ampm:H(`a.m.;p.m.`)},`ro`),W(U({group:`.`,decimal:`,`,mmmm:H(`januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december`),mmm:H(`jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec.`),dddd:H(`nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota`),ampm:H(`dop.;pop.`)},-1,13),`sl`),W(U({group:`.`,decimal:`,`,mmmm:H(`јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар`),dddd:H(`недеља;понедељак;уторак;среда;четвртак;петак;субота`)},3,3),`sr`),W({group:`,`,decimal:`.`,mmmm:H(`ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்`),mmm:H(`ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச.`),dddd:H(`ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி`),ddd:H(`ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி`)},`ta`),W({group:`,`,decimal:`.`,mmmm:H(`జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్`),mmm:H(`జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం`),dddd:H(`ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం`),ddd:H(`ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని`)},`te`),W({decimal:`,`,mmmm:H(`січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня`),mmm:H(`січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд.`),dddd:H(`неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу`),ddd:H(`нд;пн;вт;ср;чт;пт;сб`),ampm:H(`дп;пп`)},`uk`),W({group:`.`,decimal:`,`,mmmm:H(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`tháng `),mmm:H(`~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12`,`thg `),dddd:H(`Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy`),ddd:H(`CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7`),ampm:H(`SA;CH`)},`vi`),W(U({group:`٬`,decimal:`٫`,ampm:H(`ص;م`),mmmm:H(`يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر`),dddd:H(`الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت`),mmmm6:H(`رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان`)},0,0),`ar`),W({group:`,`,decimal:`.`,mmmm:H(`জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর`),mmm:H(`জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ`),dddd:H(`রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার`),ddd:H(`রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি`)},`bn`),W({group:`,`,decimal:`.`,mmmm:H(`जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर`),mmm:H(`जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰`),dddd:H(`रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार`),ddd:H(`रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि`),ampm:H(`am;pm`)},`hi`);function As(e,t){switch(t){case`int`:return e.int_pattern;case`frac`:return e.frac_pattern;case`man`:return e.man_pattern;case`den`:return e.den_pattern;case`num`:return e.num_pattern}}function js(e,t,n){let r=e.length,i=e.replace(/#/g,``).length;switch(n){case`int`:t.int_max=r,t.int_min=i;break;case`frac`:t.frac_max=r,t.frac_min=i;break;case`man`:t.man_max=r,t.man_min=i;break;case`den`:t.den_max=r,t.den_min=i;break;case`num`:t.num_max=r,t.num_min=i;break}return t}function G(e,t){typeof e==`string`?t.push({type:`string`,value:e}):t.push(e)}function Ms(e,t){let n=e==null?void 0:e.type;return n===`hash`||n===`zero`||n===`qmark`||n===`digit`&&t===`den`}function Ns(e){if(e===null)throw TypeError(`Cannot read properties of null (reading 'num')`)}function Ps(e){let t=[],n={scale:1,scaleExponent:0,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:t,tokensUsed:0,pattern:``,int_max:0,int_min:0,frac_max:0,frac_min:0,man_max:0,man_min:0,num_max:0,num_min:0,den_max:0,den_min:0,int_p:``,man_p:``,num_p:``,den_p:``,integer:!1},r=`int`,i=null,a=[],o,s=!1,c=-1,l=!1,u=``,d=!1;for(;++c<e.length&&!l;){var f;let h=e[c],g=h.type||`error`;if(u+=h.raw,g===`general`)n.general=!0,G(h,t);else if(Ms(h,r)){let e=As(n,r);Ms(o,r)||(o==null?void 0:o.type)===`group`?(e.push((e.pop()||``)+h.value),Ns(i),i.num+=h.value):(e.push(h.value),i={type:r,num:h.value},G(i,t))}else if(g===`paren`)h.value===`(`&&(n.parens=!0),G(h.value,t);else if(g===`digit`)G(h.value,t);else if(g===`slash`){d=!0;let e=As(n,r);if(e.length){if(!i)throw SyntaxError(`Format pattern is missing a numerator`);n.fractions=!0;let a=e.pop();if(a===void 0)throw SyntaxError(`Format pattern is missing a numerator`);n.num_pattern.push(a),i.type=`num`,r=`den`,G({type:`div`},t)}else G(h.value,t)}else if(g===`comma`)G(`,`,t);else if(g===`scale`)n.scale=.001**h.raw.length,n.scaleExponent=-3*h.raw.length;else if(g===`group`){if(r===`int`&&(n.grouping=!0),r===`den`)throw SyntaxError(`Cannot group denominator digits`)}else if(g===`space`)G(h,t);else if(g===`break`){l=!0;break}else if(g===`text`)n.text=!0,G(h,t);else if(g===`plus`||g===`minus`)G(h,t);else if(g===`duration`){let e=h.value.toLowerCase(),r=e[0],i={type:``,size:0,date:1,pad:e.length};r===`h`?(i.size=16,i.type=`hour-elap`):r===`m`?(i.size=32,i.type=`min-elap`):(i.size=64,i.type=`sec-elap`),n.date|=i.size,a.push(i),G(i,t)}else if(n.date&&g===`point`&&((f=e[c+1])==null?void 0:f.type)===`zero`){var p,m;let r=1;c++;let i=`0`;((p=e[c+1])==null?void 0:p.type)===`zero`&&(i+=`0`,r=2,c++),((m=e[c+1])==null?void 0:m.type)===`zero`&&(i+=`0`,r=3,c++),u+=i;let a=[64,128,256,512][r];n.date|=a,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,r),G({type:`subsec`,size:a,decimals:r,date:1},t)}else if(g===`calendar`)s||(h.value===`B2`||h.value===`b2`?n.date_system=6:n.date_system=1);else if(g===`datetime`){let e={type:``,size:0,date:1},r=h.value.toLowerCase(),i=r[0];if(r===`y`||r===`yy`)e.size=2,e.type=`year-short`;else if(i===`y`||i===`e`)e.size=2,e.type=`year`;else if(r===`b`||r===`bb`)e.size=2,e.type=`b-year-short`;else if(i===`b`)e.size=2,e.type=`b-year`;else if(r===`d`||r===`dd`)e.size=8,e.type=`day`,e.pad=/dd/.test(r);else if(r===`ddd`||r===`aaa`)e.size=8,e.type=`weekday-short`;else if(i===`d`||i===`a`)e.size=8,e.type=`weekday`;else if(i===`h`)e.size=16,e.type=`hour`,e.pad=/hh/i.test(r);else if(i===`m`){r.length===3?(e.size=4,e.type=`monthname-short`):r.length===5?(e.size=4,e.type=`monthname-single`):r.length>=4&&(e.size=4,e.type=`monthname`);let t=a[a.length-1];!e.type&&t&&!t.used&&t.size&80&&(t.used=!0,e.size=32,e.type=`min`,e.pad=/mm/.test(r)),e.type||(e.size=4,e.type=`month`,e.pad=/mm/.test(r),e.indeterminate=!0)}else if(i===`s`){e.size=64,e.type=`sec`,e.pad=/ss/.test(r);let t=a[a.length-1];t&&t.size&32?e.used=!0:t!=null&&t.indeterminate&&(delete t.indeterminate,t.size=32,t.type=`min`,e.used=!0)}n.date|=e.size,n.date_eval=!0,a.push(e),G(e,t)}else if(g===`ampm`)n.clock=12,n.date|=16,n.date_eval=!0,h.short=h.value===`A/P`,G(h,t);else if(g===`string`||g===`escaped`||g===`char`)G(h.value,t);else if(g===`condition`)n.condition=[h.value[0],Number.parseFloat(h.value[1])];else if(g===`locale`){let e=h.value.split(`-`),r=e.length<2?``:e.slice(1).join(`-`),i=e[0];i&&G(i,t);let a=_s(r);a&&(n.locale=a);let o=Number.parseInt(r,16);Number.isFinite(o)&&o&16711680&&(o>>16&255)==6&&(n.date_system=6),s=!0}else if(g===`color`){let e=h.value.toLowerCase(),t=e,r=/^color\s*(\d+)$/i.exec(e);r&&(t=Number.parseInt(r[1],10)),n.color=t}else if(g===`percent`)n.scale=100,n.scaleExponent=2,n.percent=!0,G(`%`,t);else if(g===`point`)G(h,t),n.date||(n.dec_fractions=!0,r=`frac`);else if(g===`exp`)n.exponential=!0,n.exp_plus=h.value.includes(`+`),r=`man`,G({type:`exp`,plus:n.exp_plus},t);else if(g===`skip`||g===`fill`)G(h,t);else if(!(g===`dbnum`||g===`natnum`))throw SyntaxError(g===`error`?`Illegal character: ${u}`:`Unknown token ${g} in ${u}`);o=h}if(n.tokensUsed=c,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&G({type:`text`},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||d&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw SyntaxError(`Invalid pattern: ${u}`);let h=n.int_pattern.join(``),g=n.man_pattern.join(``),_=n.frac_pattern.join(``);js(h,n,`int`);let v=0;for(let e=0;e<h.length;e++){let t=h[h.length-1-e];/^[0-9?]/.test(t)&&(v=e+1)}n.int_min=v,js(_,n,`frac`),js(g,n,`man`);let y=n.num_pattern.join(``),b=n.den_pattern[0]||``;if(b.includes(`?`)||y.includes(`?`)?(b=b.replace(/\d/g,`?`),b=b.replace(/#$/g,`?`),js(y,n,`num`),js(b,n,`den`),y=y.replace(/#$/g,`?`)):(js(y,n,`num`),js(b,n,`den`)),n.int_p=h,n.man_p=g,n.num_p=y,n.den_p=b,n.den_pattern.length&&(n.denominator=Number.parseInt(n.den_pattern.join(``).replace(/\D/g,``),10)),n.integer=!!h.length,!n.integer&&!n.exponential&&_.length){let e=n.tokens.findIndex(e=>e.type===`point`);n.tokens.splice(e,0,{type:`int`,value:`#`}),n.integer=!0,n.int_pattern=[`#`],n.int_p=`#`}if(n.fractions)for(let e=0;e<t.length-1;e++){let n=t[e];if(n.type!==`string`&&n.type!==`space`)continue;let r=t[e+1].type;r===`num`?n.rule=`num+int`:r===`div`?n.rule=`num`:r===`den`&&(n.rule=`den`)}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Fs(e){if(e===0)return e;let t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Is(e,t=2,n=2){let r=e<0?-1:1,i=10**(t||2),a=10**(n||2),o=Math.abs(e),s=0,c=0,l=0,u=1,d,f;if(e=o,e%1==0)f=[e*r,1];else if(e<1e-19)f=[r,0x8ac7230489e80000];else if(e>0x8ac7230489e80000)f=[0x8ac7230489e80000*r,1];else{do if(o=1/(o-Math.floor(o)),d=u,u=u*Math.floor(o)+s,s=d,c=l,l=Math.floor(e*u+.5),l>=i||u>=a)return[r*c,s];while(Math.abs(e-l/u)>=1e-13&&o!==Math.floor(o));f=[r*l,u]}return f}let Ls={total:1,sign:0,period:0,int:1,frac:0};function Rs(e,t=!0){let n=as(e);if(n.digits===`0`)return Ls;let r=n.exponent+1,i=Math.max(r,1),a=Math.max(0,n.digits.length-r),o=t&&n.negative?1:0,s=+(a>0);return{total:o+i+s+a,digits:Math.max(r,0)+a,sign:o,period:s,int:i,frac:a}}function zs(e,t=0){let n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function Bs(e,t=1){return t<-300?Number.parseFloat(e.toExponential().split(`e`)[0]):e*10**-t}function Vs(e,t=0){if(e<0)return-Vs(-e,t);if(t){let n=10**t||1;return Vs(e*n,0)/n}return Math.round(e)}function Hs(e,t=0){if(typeof e!=`number`)return e;if(!Number.isFinite(e)||e===0)return e===0?0:e;if(!Number.isFinite(t))return Vs(e,t);let n=Math.trunc(t);if(Number.isInteger(e)&&n>=0||n>324)return e;let r=ls(cs(as(e),n));return Number.isFinite(r)?r:e}function Us(e,t){return e.replace(/\./,t.decimal)}function Ws(e){return e?e.negative?{...e,negative:!1}:e:null}function Gs(e){var t;return(t=e==null?void 0:e.exponent)==null?0:t}function Ks(e){return!e||e.exponent<-308}function qs(e,t){let n=ds(e,1,!0,5),r=n.exponent,i=Math.abs(r);return[Us(us(n.rounded),t),t.exponent,r<0?t.negative:t.positive,i<10?`0`:``,i]}function Js(e,t,n){let r=Math.abs(t),i=e===1?e:Math.round(e*1e5)/1e5;return[Us(String(i),n),n.exponent,t<0?n.negative:n.positive,r<10?`0`:``,r]}function Ys(e,t,n,r,i=null){let a=typeof n==`number`?n|0:0;if(typeof n==`string`)e.push(n);else if(n===a)e.push(Math.abs(a));else{let t=Math.abs(n),a=Ws(i),o=Gs(a),s=null;Ks(a)&&(o=zs(t),s=Bs(t,o),s===10&&(s=1,o++));let c=Rs(t);if(o>=-4&&o<=-1){let n=t.toPrecision(10+o).replace(/\.?0+$/,``);e.push(Us(n,r))}else if(o===10){let n=t.toFixed(10).slice(0,12).replace(/\.$/,``);e.push(Us(n,r))}else if(Math.abs(o)<=9)if(c.total<=11){let n=Hs(t,9).toFixed(c.frac);e.push(Us(n,r))}else o===9?e.push(Math.floor(t)):o>=0&&o<9?e.push(Us(String(Hs(t,9-o)),r)):e.push(...s===null?qs(a,r):Js(s,o,r));else c.total>=12?e.push(...s===null?qs(a,r):Js(s,o,r)):e.push(Us(Hs(t,9).toFixed(c.frac),r))}return e}function Xs(e,t=!1){return e===`0`?`0`:e===`?`?t?`\xA0`:` `:``}let Zs=Math.floor;function Qs(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019,r=Zs(4*n/146097);n-=Zs((146097*r+3)/4);let i=Zs(4e3*(n+1)/1461001);n=n-Zs(1461*i/4)+31;let a=Zs(80*n/2447),o=n-Zs(2447*a/80);n=Zs(a/11);let s=a+2-12*n;return[100*(r-49)+i+n|0,s|0,o|0]}function $s(e){return Qs(e+1462)}function ec(e){if(e===60)throw Error(`#VALUE!`);if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];let t=10631/30,n=8.01/60,r=e+466935,i=Zs(r/10631);r-=10631*i;let a=Zs((r-n)/t);r-=Zs(a*t+n);let o=Zs((r+28.5001)/29.5);return o===13?[30*i+a,12,30]:[30*i+a,o,r-Zs(29.5001*o-29)]}function tc(e,t=0,n=!0){let r=Zs(e);return t===6?ec(r):t===-1?$s(r):Qs(r,n)}let nc=86400;function rc(e,t,n){return n?e<-694324||t>=35830291:e<0||t>=2958466}function ic(e,t=0){if(e<0)return-ic(-e,t);if(t){let n=10**t||1;return ic(e*n,0)/n}return Math.round(e)}function ac(e,t,n,r,i=null){var a,o;let s=t,c=e,l=e,u=``,d=``,f=``,p=``,m=``,h=``,g=0,_=null,v=0;if(typeof c==`bigint`){if(c<=2**53-1&&c>=-(2**53-1))l=Number(c),c=l;else return n.bigintErrorNumber?String(c):n.overflow;v=l}else v=Math.trunc(l);let y=0,b=0,x=1,S=0,C=0,w=0,T=0,E=0,D=0,O=r||bs,k=i;if(!k&&typeof e==`number`&&Number.isFinite(e)&&(k=as(e)),k&&!s.text&&s.scaleExponent&&(k=os(k,s.scaleExponent)),!s.text&&Number.isFinite(s.scale)&&s.scale!==1&&(l=Fs(l*s.scale),c=l),s.exponential&&k&&k.exponent>=-308){let e=ds(k,s.int_max,!!s.integer,s.frac_max);g=e.exponent,_=e.rounded,u+=Math.abs(g)}else if(s.exponential){let e=Math.abs(l);e&&(g=zs(e,s.int_max)),l&&!s.integer&&g++,e=Bs(e,g),s.int_max===1&&ic(e,s.frac_max)===10&&(e=1,g++),l=l<0?-e:e,c=l,u+=Math.abs(g)}let A=!Number.isSafeInteger(l)||!!s.scaleExponent;if(_=_||(k&&A&&!s.date&&!s.fractions&&!s.exponential&&(s.integer||s.dec_fractions)?cs(k,s.frac_max):null),s.integer)if(_)h=_.integer===`0`?``:_.integer;else{let e=s.fractions?1:s.frac_max,t=Math.abs(Number.isSafeInteger(l)&&e===0?l:ic(l,e));h+=t<1?``:Math.floor(t)}let j=(a=n.grouping[0])==null?3:a,M=(o=n.grouping[1])==null?j:o;s.dec_fractions&&(m=_?_.fraction:String(ic(l,s.frac_max)).split(`.`)[1]||``);let N=!s.error&&(s.num_p.includes(`0`)||s.den_p.includes(`0`)),P=N;if(s.fractions){P=N||!!(l%1);let e=Math.abs(s.integer?l%1:l);if(e)if(P=!0,s.denominator&&Number.isFinite(s.denominator))p+=s.denominator,f+=ic(e*s.denominator),f===`0`&&(f=``,p=``,P=N);else{let t=Is(e,1/0,s.den_max);f+=t[0],p+=t[1],s.integer&&f===`0`&&(f=``,p=``,P=N)}else!l&&!s.integer&&(P=!0,f=`0`,p=`1`);s.integer&&!P&&!Math.trunc(l)&&(h=`0`)}if(s.date){v=Math.trunc(l);let e=nc*(l-v);if(y=Math.floor(e),D=e-y,Math.abs(D)<1e-6?D=0:D>.9999&&(D=0,y+=1,y===nc&&(y=0,v+=1)),D){let e=s.date&512||s.date&256||s.date&128;(e===512&&D>.9995||e===256&&D>.995||e===128&&D>.95||!e&&D>=.5)&&(y++,D=0)}if(v||s.date_system){let e=tc(l,s.date_system,n.leap1900);b=e[0],x=e[1],S=e[2]}if(y){let e=y<0?nc+y:y;E=Math.floor(e)%60,T=Math.floor(e/60)%60,w=Math.floor(e/60/60)%60}if(C=(6+v)%7,s.date_eval&&rc(l,v+y/nc,n.dateSpanLarge)){if(n.dateErrorThrows)throw Error(`Date out of bounds`);return n.dateErrorNumber?Ys(l<0?[O.negative]:[],{},l,O,k).join(``):n.overflow}}let F=Xs(`?`,n.nbsp);g<0?d=`-`:s.exp_plus&&(d=`+`);let I=[],ee=(e,t,r,i)=>{let a=i,o=!a&&e.length>t.length?r.length+e.length-t.length:r.length;e.length<t.length&&(a+=e.length-t.length);for(let t=0;t<o;t++)I.push(e[t+a]||Xs(r[t],n.nbsp));return o},L=!1,R={int:0,frac:0,man:0,num:0,den:0};for(let e=0,t=s.tokens.length;e<t;e++){let t=s.tokens[e],i=t.type,a=t.num?t.num.length:0;if(i===`string`){let e=t.value;t.rule?t.rule===`num`?P?I.push(e.replace(/ /g,F)):(s.num_min>0||s.den_min>0)&&I.push(e.replace(/./g,F)):t.rule===`num+int`?P&&h?I.push(e.replace(/ /g,F)):s.den_min>0&&(h||s.num_min)&&I.push(e.replace(/./g,F)):t.rule===`den`&&(P?I.push(e.replace(/ /g,F)):s.den_min>0&&I.push(e.replace(/./g,F))):I.push(e.replace(/ /g,F))}else if(i===`space`)t.rule===`num+int`?(P||s.num_min||s.den_min)&&(h||s.num_min)&&I.push(F):I.push(F);else if(i===`error`)I.push(n.invalid);else if(i===`point`)I.push(s.date?t.value:O.decimal);else if(i===`general`)Ys(I,s,c,O,k);else if(i===`exp`)I.push(O.exponent);else if(i===`minus`)t.volatile&&s.date||(t.volatile&&_?_.negative&&!_.zero&&I.push(O.negative):t.volatile&&(l>=0||typeof c!=`number`)||(t.volatile&&!s.fractions&&(s.integer||s.dec_fractions)?(l<0&&h&&h!==`0`||m)&&I.push(O.negative):I.push(O.negative)));else if(i===`plus`)I.push(O.positive);else if(i===`text`)I.push(c);else if(i===`fill`)n.fillChar&&I.push(n.fillChar,t.value);else if(i===`skip`)n.skipChar?I.push(n.skipChar,t.value):I.push(n.nbsp?`\xA0`:` `);else if(i===`div`)P?I.push(`/`):s.num_min>0||s.den_min>0?I.push(F):I.push(Xs(`#`,n.nbsp));else if(i===`int`)if(s.int_pattern.length===1){let e=s.int_p,t=Math.max(s.int_min,h.length),r=``;for(let i=t;i>0;i--){let t=h.charAt(h.length-i),a=t?``:e.charAt(e.length-i)||e[0],o=``;if(s.grouping){let e=i-1-j;e>=0&&!(e%M)&&(o=t||a===`0`?O.group:Xs(`?`,n.nbsp))}r+=(t||Xs(a,n.nbsp))+o}I.push(r)}else R.int+=ee(h,s.int_p,t.num,R.int);else if(i===`frac`){let e=R.frac;for(let r=0;r<a;r++)I.push(m[r+e]||Xs(t.num[r],n.nbsp));R.frac+=a}else if(i===`man`)!R[i]&&!R.man&&I.push(d),R.man+=ee(u,s.man_p,t.num,R.man);else if(i===`num`)R.num+=ee(f,s.num_p,t.num,R.num);else if(i===`den`){let e=R.den;for(let r=0;r<a;r++){let i=p[r+e];if(!i){let e=t.num[r];`123456789`.includes(e)||L&&e===`0`?(L=!0,i=n.nbsp?`\xA0`:` `):i=!L&&r===a-1&&e===`0`&&!p?`1`:Xs(e,n.nbsp)}I.push(i)}R.den+=a}else if(i===`year`)b<0&&I.push(O.negative),I.push(String(Math.abs(b)).padStart(4,`0`));else if(i===`year-short`){let e=b%100;I.push(e<10?`0`:``,e)}else if(i===`month`)I.push(t.pad&&x<10?`0`:``,x);else if(i===`monthname-single`)s.date_system===6?I.push(O.mmmm6[x-1].charAt(0)):I.push(O.mmmm[x-1].charAt(0));else if(i===`monthname-short`)s.date_system===6?I.push(O.mmm6[x-1]):I.push(O.mmm[x-1]);else if(i===`monthname`)s.date_system===6?I.push(O.mmmm6[x-1]):I.push(O.mmmm[x-1]);else if(t.type===`weekday-short`)I.push(O.ddd[C]);else if(i===`weekday`)I.push(O.dddd[C]);else if(i===`day`)I.push(t.pad&&S<10?`0`:``,S);else if(i===`hour`){let e=w%s.clock||(s.clock<24?s.clock:0);I.push(t.pad&&e<10?`0`:``,e)}else if(i===`min`)I.push(t.pad&&T<10?`0`:``,T);else if(i===`sec`)I.push(t.pad&&E<10?`0`:``,E);else if(i===`subsec`){I.push(O.decimal);let e=D.toFixed(s.sec_decimals);I.push(e.slice(2,2+t.decimals))}else if(i===`ampm`){let e=w<12?0:1;t.short&&!r?I.push(`AP`[e]):I.push(O.ampm[e])}else if(i===`hour-elap`){l<0&&I.push(O.negative);let e=v*24+Math.floor(Math.abs(y)/3600);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`min-elap`){l<0&&I.push(O.negative);let e=v*1440+Math.floor(Math.abs(y)/60);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`sec-elap`){l<0&&I.push(O.negative);let e=v*nc+Math.abs(y);I.push(String(Math.abs(e)).padStart(t.pad,`0`))}else if(i===`b-year`)I.push(b+543);else if(i===`b-year-short`){let e=(b+543)%100;I.push(e<10?`0`:``,e)}}return I.join(``)}let oc=Ps([{type:Co,value:`@`,raw:`@`}]);function sc(e){return!!e&&`scale`in e}function cc(e,t){for(let n=0;n<3;n++){let r=t[n];if(sc(r)){let t;if(r.condition){let n=r.condition[0],i=r.condition[1];n===`=`?t=e===i:n===`>`?t=e>i:n===`<`?t=e<i:n===`>=`?t=e>=i:n===`<=`?t=e<=i:n===`<>`&&(t=e!==i)}else t=!0;if(t)return r}else if(r)return r}}function lc(e,t,n){let r=t.partitions,i=r[3],a=null;return(typeof e==`number`||typeof e==`bigint`)&&isFinite(e)&&(i=cc(e,r)),sc(i)&&i.color&&(a=i.color),a&&typeof a==`number`&&n.indexColors&&(a=qo[a-1]||`#000`),a}function uc(e,t,n){let r=t.partitions,i=vs(t.locale||n.locale),a=e,o=r[3]?r[3]:oc;if(typeof a==`boolean`&&(a=(i||bs).bool[+!a]),a==null)return``;let s=typeof a==`bigint`;if(typeof a!=`number`&&!s)return ac(a,o,n,i);if(!s&&!Number.isFinite(a)){let e=i||bs;return Number.isNaN(a)?e.nan:(a<0?e.negative:``)+e.infinity}let c=cc(e,r),l=c&&typeof e==`number`&&Number.isFinite(e)?as(e):null;return c?ac(e,c,n,i,l):n.overflow}let dc={overflow:`######`,dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:`######`,locale:``,ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:``,fillChar:``},fc=[[mo,/^General/i,0],[ho,/^#/,0],[go,/^0/,0],[_o,/^\?/,0],[vo,/^\//,0],[So,/^;/,0],[Co,/^@/,0],[wo,/^\+/,0],[To,/^-/,0],[Eo,/^\./,0],[Do,/^ /,0],[Oo,/^%/,0],[ko,/^[1-9]/,0],[Ao,/^(?:B[12])/i,0],[jo,/^B$/,0],[Mo,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[No,/^(?:\[(h+|m+|s+)\])/i,1],[Po,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[Fo,/^\[(DBNum[0-4]?\d)\]/i,1],[Io,/^\[(NatNum[0-4]?\d)\]/i,1],[Lo,/^\[\$([^\]]+)\]/,1],[Ro,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[zo,/^\[([^\]]+)\]/,1],[Bo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[Vo,/^\\(.)/,1],[Ho,/^"([^"]*?)"/,1],[Uo,/^_(\\.|.)/,1],[`exp`,/^[Ee]([+-])/,1],[Wo,/^\*(\\.|.)/,1],[Go,/^[()]/,0],[jo,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Ko,/^./,0]],pc=e=>{let t=(e||`\0`).charCodeAt(0);return t===63||t===35||t>=48&&t<=57};function mc(e){let t=0,n=[],r=[];for(;t<e.length;){let i=e.slice(t),a=0,o=/^(,+)(.)?/.exec(i);if(o){let i=o[1];a=i.length;let s=e[t-1]||``,c=!1,l=!1;pc(s)?(c=!0,l=!0):s===`.`&&(l=!0);let u=o[2]||``;if(c&&(!u||u===`;`)&&(c=!1),l&&pc(u)&&(l=!1),c&&!l)n.push({type:yo,value:`,`,raw:i});else if(!c&&l)n.push({type:bo,value:`,`,raw:i});else if(c&&l){let e={type:bo,value:`,`,raw:i};n.push(e),r.push(e)}else n.push({type:xo,value:`,`,raw:i})}else{let e;for(let[t,r,o]of fc){let s=r.exec(i);if(s){e={type:t,value:typeof o==`number`?s[o||0]:o.map(e=>s[e]),raw:s[0]},n.push(e),a=s[0].length;break}}r.length&&(e==null?void 0:e.raw)===`;`&&(r.length=0),r.length&&pc(e==null?void 0:e.raw)&&(r.forEach(e=>e.type=yo),r.length=0)}if(!a){let e=i[0];a=1,n.push({type:Ko,value:e,raw:e})}t+=a}return n}function hc(e){var t,n;let r=(t=e.condition)==null?void 0:t[0],i=(n=e.condition)==null?void 0:n[1];typeof i==`number`&&i<0&&(r===`<`||r===`<=`||r===`=`)||i===0&&r===`<`||e.tokens.unshift({type:`minus`,volatile:!0})}function gc(e,t=null){let n={...e,int_pattern:[...e.int_pattern],frac_pattern:[...e.frac_pattern],man_pattern:[...e.man_pattern],den_pattern:[...e.den_pattern],num_pattern:[...e.num_pattern],tokens:[...e.tokens]};return e.condition&&(n.condition=[...e.condition]),t&&n.tokens.unshift(t),n.generated=!0,n}function _c(e){let t=[],n=!1,r,i=null,a=0,o=0,s=0,c=mc(e);do{var l;let e=Ps(c);if((e.date||e.general)&&(e.int_pattern.length||e.frac_pattern.length||e.scale!==1||e.text))throw Error(`Illegal format`);if(e.condition&&(s++,n=!0),e.text){if(i)throw Error(`Unexpected partition`);i=e}e.locale&&(r=_s(e.locale)),t.push(e),a=+(((l=c[e.tokensUsed])==null?void 0:l.type)===`break`),c=c.slice(e.tokensUsed+a),o++}while(a&&o<4&&s<3);if(a)throw Error(`Unexpected partition`);if(s>2)throw Error(`Unexpected condition`);let u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw Error(`Unexpected partition`);if(n){t[0].condition||(t[0].condition=[`>`,0]);let e=t.length;if(e===1){let e=Ps(mc(`General`));e.generated=!0,t[1]=e}if(e<3){let e=t[0],n=t[1];if(hc(e),n.condition)hc(n);else{let t=e.condition;((t==null?void 0:t[0])===`=`||typeof(t==null?void 0:t[1])==`number`&&t[1]>=0&&(t[0]===`>`||t[0]===`>=`))&&n.tokens.unshift({type:`minus`,volatile:!0})}}else t.forEach(hc)}else{if(t.length<4&&i)for(let e=0,n=t.length;e<n;e++)t[e]===i&&t.splice(e,1);if(t.length<1&&i){let e=Ps(mc(`General`));e.generated=!0,t[0]=e}if(t.length<2&&t.push(gc(t[0],{type:`minus`,volatile:!0})),t.length<3&&t.push(gc(t[0])),t.length<4)if(i)t.push(i);else{let e=Ps(mc(`@`));e.generated=!0,t.push(e)}t[0].condition=[`>`,0],t[1].condition=[`<`,0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}let vc=Math.floor,yc=86400,bc=Date.UTC;function xc(e,t){let n=null;if(Array.isArray(e)){let[t,r,i,a,o,s]=e;n=bc(t,r==null?0:r-1,i==null?1:i,a||0,o||0,s||0)}else if(e instanceof Date&&(n=e.getTime(),!(t!=null&&t.ignoreTimezone))){let t=new Date;t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=t.getTime()}if(n!=null&&Number.isFinite(n)){let e=n/864e5;return e-(e<=-25509?-25568:-25569)}return null}function Sc(e,t){let n=e|0,r=yc*(e-n),i=vc(r);r-i>.9999&&(i+=1,i===yc&&(i=0,n+=1));let a=i<0?yc+i:i,[o,s,c]=tc(e,0,t==null?void 0:t.leap1900);return[o,s,c,vc(a/60/60)%60,vc(a/60)%60,vc(a)%60]}let Cc=`!d-m-y.!d-m-Y.!j-m-y.!j-m-Y.!d-n-y.!d-n-Y.!j-n-y.!j-n-Y.?m-d-y.?m-d-Y.?m-j-y.?m-j-Y.?n-d-y.?n-d-Y.?n-j-y.?n-j-Y.d-M-y.d-M-Y.j-M-y.j-M-Y.M-d-y.M-d-Y.M-j-y.M-j-Y.d-F-y.d-F-Y.F-d-y.F-d-Y.F-j-y.F-j-Y.j-F-y.j-F-Y.y-F-d.y-F-j.y-M-d.y-M-j.Y-F-d.Y-F-j.Y-M-d.Y-m-d.Y-M-j.Y-m-j.Y-n-d.Y-n-j.j-F.j-M.d-F.d-M.n-d.n-j.n-Y.m-d.m-j.m-Y.M-Y.M-y.F-y.F-Y.Y-M.Y-n.Y-m.Y-F.Y-M`.split(`.`),wc={j:`d`,d:`d`,D:`ddd`,l:`dddd`,n:`m`,m:`m`,M:`mmm`,F:`mmmm`,y:`yy`,Y:`yyyy`},Tc={j:`dd`,d:`dd`,D:`ddd`,l:`dddd`,n:`mm`,m:`mm`,M:`mmm`,F:`mmmm`,y:`yy`,Y:`yyyy`},Ec={},Dc={};function Oc(e,t,n=1){if(e){let r=e[0],i=e.slice(1);if(r===`!`)Oc(i,t,4);else if(r===`?`)Oc(i,t,2);else{let e=t[r];typeof e!=`object`&&(e={},t[r]=e),Oc(i,e,n)}}else t.$=n}function kc(e,t){Oc(e,t),Oc(`${e} x`,t),Oc(`${e} l`,t),Oc(`${e} l x`,t),Oc(`l ${e}`,t),Oc(`l ${e} x`,t),Oc(`${e} D`,t),Oc(`${e} D x`,t),Oc(`D ${e}`,t),Oc(`D ${e} x`,t)}Cc.forEach(e=>{e.startsWith(`?`)||kc(e,Ec),e.startsWith(`!`)||kc(e,Dc)});let Ac=new Date().getUTCFullYear(),jc={".":[`,`,`\xA0`,` `,`'`,`٬`],",":[`.`,`\xA0`,` `,`'`,`٬`],"٫":[`.`,`\xA0`,` `,`'`,`٬`]},Mc=e=>(e==null?void 0:e.length)===1&&e>=`0`&&e<=`9`;function Nc(e,t={}){let n=vs(t.locale||``)||bs,r=n.decimal,i=[...jc[r]||[`'`,`٬`]];!i.includes(n.group)&&n.group!==` `&&n.group!==r&&i.push(n.group);let a=``,o=``,s=1,c=``,l=!1,u=!1,d=!1,f=!1,p=!1,m=``,h=!1,g=0,_=[` `,`\xA0`,` `,`+`,`%`,`(`,`-`].concat(Jo);for(;_.includes(e.charAt(g));){let t=e.charAt(g);if(t===`-`){if(l||u)return null;l=!0,s=-1}else if(Yo.test(t)){if(p)return null;p=!0,m=t}else if(t===`(`){if(u||l)return null;u=!0,s=-1}else if(t===`%`){if(f)return null;f=!0}g++}let v=!1,y;if(e.charAt(g)===r||Mc(e.charAt(g)))for(;g<e.length;){let t=e.charAt(g);if(!y&&i.includes(t))y=t;else if(!(y&&y===t))if(t===r){if(v)break;a+=`.`,v=!0}else if(Mc(t))a+=t;else break;g++}if(e.charAt(g)===`e`||e.charAt(g)===`E`){o+=e.charAt(g),g++,(e.charAt(g)===`+`||e.charAt(g)===`-`)&&(o+=e.charAt(g),g++);let t=g;for(;Mc(e.charAt(g));)o+=e.charAt(g),g++;if(t===g)return null}let b=[` `,`\xA0`,` `,`%`,`$`,`)`].concat(Jo);for(;b.includes(e.charAt(g));){let t=e.charAt(g);if(Yo.test(t)){if(p)return null;p=!0,m=t,h=!0}else if(t===`)`){if(d||!u)return null;d=!0}else if(t===`%`){if(f)return null;f=!0}g++}if(g!==e.length)return null;let x=Number.parseFloat(a+o);if(!Number.isFinite(x))return null;if(o){if(f||p)return null;c=`0.00E+00`}else if(f){if(p)return null;c=a.includes(`.`)?`0.00%`:`0%`,x*=.01}else if(p){let e=a.includes(`.`)?`#,##0.00`:`#,##0`;c=h?e+m:m+e}else y&&(c=a.includes(`.`)?`#,##0.00`:`#,##0`);let S={v:x*s};return c&&(S.z=c),S}function Pc(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){if(n>(e%4==0&&e%100!=0||e%400==0||e===1900?29:28))return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}let Fc=(e,t,n=!1)=>{for(let r of t)if(e.startsWith(r[0])){let t=r[0].length;return n&&(r[2]===`D`||r[2]===`M`)&&e[t]===`.`&&t++,[e.slice(0,t),r]}return[``,null]},Ic=(e,t,n,r)=>{let i=n.path||``,a=Object.keys(t);for(let o of a){let a=t[o],s;if(a){if(o===`$`||o===`€`)e||(s=n);else{if(typeof a!=`object`)continue;if(o===`-`){let t=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(t){let o=t[1]===`-`||t[1]===`/`||t[1]===`.`?t[1]:` `;if(!n.sep||n.sep===o){let c=t[0].replace(/\s+/g,` `);s=Ic(e.slice(t[0].length),a,{...n,sep:o,path:i+c},r)}}}else if(o===` `){let t=/^[,.]?\s+/.exec(e);if(t){let o=t[0].replace(/\s+/g,` `);s=Ic(e.slice(t[0].length),a,{...n,path:i+o},r)}}else if(o===`j`||o===`d`){let t=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,day:t[0],path:i+o},r))}else if(o===`n`||o===`m`){let t=/^(0?[1-9]|1[012])\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,month:+t[0],_mon:t[0],path:i+o},r))}else if(o===`F`||o===`M`){let[t,c]=Fc(e,r.mon,r.mp);(c==null?void 0:c[2])===o&&(s=Ic(e.slice(t.length),a,{...n,month:c[1],_mon:t,path:i+o},r))}else if(o===`l`||o===`D`){let[t,c]=Fc(e,r.day,r.dp);(c==null?void 0:c[2])===o&&(s=Ic(e.slice(t.length),a,{...n,path:i+o},r))}else if(o===`y`){let t=/^\d\d\b/.exec(e);if(t){let c=+t[0]>=30?+t[0]+1900:+t[0]+2e3;s=Ic(e.slice(t[0].length),a,{...n,year:c,path:i+o},r)}}else if(o===`Y`){let t=/^\d\d\d\d\b/.exec(e);t&&(s=Ic(e.slice(t[0].length),a,{...n,year:+t[0],path:i+o},r))}else if(o===`x`){let t=Vc(e,{locale:r.locale});t&&(s=Ic(``,a,{...n,time:t.v,tf:t.z,path:i+o},r))}else throw Error(`Unknown date token "${o}"`)}if(s&&Pc(n.year||1916,n.month||1,n.day?+n.day:1))return s}}},Lc=e=>e.replace(/\s+/g,` `).trim().replace(/’/,`'`).replace(/\.$/,``).toLowerCase(),Rc=(e,t)=>{let n=e.map((e,n)=>[Lc(e),n+1,t]);return n.sort((e,t)=>t[0].length-e[0].length),n};function zc(e,t={}){var n,r;let i=vs(t.locale||``)||bs,a={mon:Rc(i.mmmm,`F`).concat(Rc(i.mmm,`M`)),mp:i.mmm[0].at(-1)===`.`,day:Rc(i.dddd,`l`).concat(Rc(i.ddd,`D`)),dp:i.ddd[0].at(-1)===`.`,locale:t.locale},o=Ic(Lc(e),i.preferMDY?Dc:Ec,{path:``},a);if(!o||o.sep===`.`&&o.path.length===3||o.month==null||o._mon==null)return null;let s=+((n=o.year)==null?Ac:n),c=(r=o.day)==null?`1`:r,l=-1/0;if(s<1900)return null;s<=1900&&o.month<=2?l=25568:s<1e4&&(l=25569);let u=Date.UTC(s,o.month-1,+c)/864e5+l+(o.time||0);if(u<0||u>2958465)return null;let d=o._mon[0]===`0`||c[0]===`0`||o._mon.length===2&&c.length===2;return{v:u,z:o.path.replace(/[jdlDnmMFyYx]/g,e=>e===`x`?o.tf||``:(d?Tc[e]:wc[e])||e)}}let Bc=e=>e.replace(/\s+/g,``).trim().replace(/\./g,``).toLowerCase();function Vc(e,t={}){let n=vs(t.locale||``)||bs,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e),i=``;if(r){let t=Bc(e.slice(r[0].length));if(t===Bc(n.ampm[0])||t===`a`||t===`am`)i=`a`;else if(t===Bc(n.ampm[1])||t===`p`||t===`pm`)i=`p`;else if(t===`:`)r[3]||(r[3]=`0`),r[2]||(r[2]=`0`);else if(t)return null}if(!r)return null;let[,a,o,s,c]=r;if(c&&!s||!i&&!o&&!s)return null;let l=+(a||0);if(i){if(l>=13)return null;i===`a`?l===12&&(l=0):i===`p`&&l!==12&&(l+=12)}let u=+(o||0),d=+(s||0),f=+(c||0),p=a.length===2?`hh`:`h`,m=s?`:ss`:``,h=i?` AM/PM`:``;return{v:(l*60*60+u*60+d+f)/(3600*24),z:`${p}:mm${m}${h}`}}function Hc(e,t={}){let n=vs(t.locale||``)||bs,r=e.trim().toLowerCase(),i=n.bool[0].toLowerCase();if(r===`true`||r===i)return{v:!0};let a=n.bool[1].toLowerCase();return r===`false`||r===a?{v:!1}:null}function Uc(e,t){var n,r,i;return(n=(r=(i=Nc(e,t))==null?zc(e,t):i)==null?Vc(e,t):r)==null?Hc(e,t):n}var Wc=p({addLocale:()=>W,dateFromSerial:()=>Sc,dateToSerial:()=>xc,dec2frac:()=>Is,format:()=>qc,formatColor:()=>Jc,getFormatDateInfo:()=>el,getFormatInfo:()=>$c,getLocale:()=>vs,isDateFormat:()=>Yc,isPercentFormat:()=>Xc,isTextFormat:()=>Zc,isValidFormat:()=>Qc,parseBool:()=>Hc,parseDate:()=>zc,parseLocale:()=>gs,parseNumber:()=>Nc,parseTime:()=>Vc,parseValue:()=>Uc,round:()=>Hs,tokenTypes:()=>tl,tokenize:()=>mc});let Gc=Object.create({});function Kc(e,t=!1){let n=e||`General`,r=Gc[n];if(!r)try{r=_c(n),Gc[n]=r}catch(e){if(t)throw e;let i=e instanceof Error?e.message:String(e),a={tokens:[{type:`error`}],error:i};r={pattern:n,partitions:[a,a,a,a],error:i,locale:null}}return r}function qc(e,t,n={}){var r;let i=Object.assign({},dc,n),a=Kc(e,i.throws);return uc((r=xc(t,i))==null?t:r,a,i)}function Jc(e,t,n){var r;let i=Object.assign({},dc,n),a=Kc(e,i.throws);return lc((r=xc(t,i))==null?t:r,a,i)}function Yc(e){return $o(Kc(e,!1).partitions)}function Xc(e){return Qo(Kc(e,!1).partitions)}function Zc(e){return es(Kc(e,!1).partitions)}function Qc(e){try{return Kc(e,!0),!0}catch{return!1}}function $c(e,t={}){let n=Kc(e,!1);return n.info||(n.info=rs(n.partitions,t==null?void 0:t.currency)),n.info}function el(e){let t=Kc(e,!1);return t.dateInfo||(t.dateInfo=is(t.partitions)),t.dateInfo}let tl=Object.freeze({AMPM:Bo,BREAK:So,CALENDAR:Ao,CHAR:Ko,COLOR:Ro,COMMA:xo,CONDITION:Po,DATETIME:Mo,DBNUM:Fo,DIGIT:ko,DURATION:No,ERROR:jo,ESCAPED:Vo,EXP:`exp`,FILL:Wo,GENERAL:mo,GROUP:yo,HASH:ho,LOCALE:Lo,MINUS:To,MODIFIER:zo,NATNUM:Io,PAREN:Go,PERCENT:Oo,PLUS:wo,POINT:Eo,QMARK:_o,SCALE:bo,SKIP:Uo,SLASH:vo,SPACE:Do,STRING:Ho,TEXT:Co,ZERO:go}),nl=new Set([`d`,`g`,`i`,`m`,`s`,`u`,`v`,`y`]);function rl(e,t){let n=il(t);return new RegExp(e,n)}function il(e){if(e===void 0)return;let t=new Set;for(let n of e){if(!nl.has(n)||t.has(n))throw SyntaxError(`Invalid regular expression flags: ${e}`);t.add(n)}return e}var al=class e{constructor(...e){T(this,`data`,void 0),this.data=ll(e.flatMap(e=>sl(e)))}union(...t){return new e(this,...t)}subtract(...t){let n=ll(t.flatMap(e=>sl(e))),r=this.data.slice();for(let[e,t]of n){let n=[];for(let[i,a]of r){if(t<i||e>a){n.push([i,a]);continue}e>i&&n.push([i,e-1]),t<a&&n.push([t+1,a])}r=n}return new e(...r)}intersect(...t){let n=ll(t.flatMap(e=>sl(e))),r=[];for(let[e,t]of this.data)for(let[i,a]of n){let n=Math.max(e,i),o=Math.min(t,a);n<=o&&r.push([n,o])}return new e(...r)}isEmpty(){return this.data.length===0}toString(){return this.isEmpty()?`(?!)`:`[${this.data.map(ul).join(``)}]`}toRegExp(e){return rl(this.toString(),e)}};let ol=(...e)=>new al(...e);function sl(e){if(e instanceof al)return e.data;if(Array.isArray(e)){let t=cl(e[0]),n=cl(e[1]);return[[Math.min(t,n),Math.max(t,n)]]}let t=cl(e);return[[t,t]]}function cl(e){if(typeof e==`number`){if(!Number.isInteger(e)||e<0||e>1114111)throw RangeError(`Invalid code point: ${e}`);return e}let t=e.codePointAt(0);if(t==null||String.fromCodePoint(t)!==e)throw RangeError(`Charset string inputs must contain exactly one code point: ${e}`);return t}function ll(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]||e[1]-t[1]),n=[];for(let[e,r]of t){let t=n[n.length-1];!t||e>t[1]+1?n.push([e,r]):t[1]=Math.max(t[1],r)}return n}function ul([e,t]){return e===t?dl(e):`${dl(e)}-${dl(t)}`}function dl(e){let t=String.fromCodePoint(e);return t===`\\`||t===`]`||t===`-`||t===`^`?`\\${t}`:e<=31||e===127?`\\u${e.toString(16).padStart(4,`0`)}`:t}function fl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function pl(e,t){return rl(fl(e),t)}function ml(e){return rl(`^${fl(e).replace(/\\\*/g,`.*`).replace(/\\\?/g,`.`)}$`,`i`)}var hl=class e{constructor(...t){T(this,`charset`,void 0),T(this,`strings`,void 0);let n=[],r=[];for(let i of t)i instanceof e?(n.push(i.charset),r.push(...i.strings)):i instanceof al||typeof i==`number`||Array.isArray(i)?n.push(i):r.push(i);this.charset=ol(...n),this.strings=Array.from(new Set(r))}union(...t){return new e(this,...t)}subtract(...t){let n=new e(...t),r=this.strings.filter(e=>!n.strings.includes(e));return new e(this.charset.subtract(n.charset),...r)}isEmpty(){return this.charset.isEmpty()&&this.strings.length===0}toString(){if(this.isEmpty())return`(?!)`;let e=[...this.charset.isEmpty()?[]:[this.charset.toString()],...this.strings.map(fl)];return e.length===1?e[0]:`(?:${e.join(`|`)})`}toRegExp(e){return rl(this.toString(),e)}};let gl={Charset:al,Or:hl,charset:ol,or:(...e)=>new hl(...e),createRegExpFromSafeFragment:rl,escapeRegExp:fl,createLiteralRegExp:pl,createFromWildcard:ml};function _l(e){return e===`@@@`||e===`@`}function vl(e){return e==null||e===`General`}let yl=(e,t)=>{if(e&&!t||!e&&t)return!1;let n=e=>{let t=mc(e),n=``,r=!1,i=!1;for(let e of t){if(e.type===tl.POINT){r=!0;continue}if(!(i&&e.type===tl.MINUS)&&e.type!==tl.SKIP){if(e.type===tl.COLOR){i=!0;continue}else i=!1;r&&e.type===tl.ZERO||(r=!1,r||(n+=e.value||``))}}return n};return n(e)===n(t)},bl=new Set([`m d`]),xl=new Set([`h:mm AM/PM`,`hh:mm AM/PM`]),Sl=`Rp.zł.NT$.R$.HK$.$.£.¥.¤.֏.؋.৳.฿.៛.₡.₦.₩.₪.₫.€.₭.₮.₱.₲.₴.₸.₹.₺.₼.₽.₾.₿.﷼`.split(`.`),Cl=RegExp(`^${gl.charset(...Array.from(new Set(Sl.join(``))))}+`),wl=e=>{var t,n;let r=(t=(n=zc(e))==null?Vc(e):n)==null?Nc(e):t;if(!r)return null;let{z:i}=r;if(i){if(bl.has(i)||xl.has(i)&&!/\s(A|AM|P|PM)$/i.test(e))return null;if(i.includes(`#,##0`)){if(/[.,]$/.test(e))return null;let t=e.replace(Cl,``).trim();if(t.includes(`,`)&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(t))return null}}return r};function Tl(e,t){let n={};for(let r in e){let i=Number(r),a=e[i];for(let e in a){let r=Number(e),o=a[r],s=t(i,r,o);s!==void 0&&(n[i]?n[i][r]=s:n[i]={[r]:s})}}return n}function El(e){let t=0,n=Object.keys(e);for(let e of n){let n=Number(e);t=Math.max(t,n)}return t+1}let Dl=e=>e==null||typeof e==`object`&&Object.keys(e).length===0;function Ol(e,t,n){let r=El(n),i=n;for(let t=r-1;t>=e;t--)Dl(i[t])?delete i[t+1]:i[t+1]=i[t];Dl(t)||(i[e]=t)}function kl(e,t,n){let r=Object.keys(n).reduce((e,t)=>Math.max(e,Number.parseInt(t)),0)+1;for(let i=e;i<r;i++)i<e+t?delete n[i]:n[i]!==void 0&&(n[i-t]=n[i],delete n[i])}function Al(e,t){let n=e,r=Object.keys(n),i=r.length,a=t,o=Object.keys(a),s=o.length,c={},l=0;for(let e=0;e<i;e++,l++)c[l]=n[r[e]];for(let e=0;e<s;e++,l++)c[l]=a[o[e]];return c}function jl(e,t,n){let r=n;if(El(n)>0){let n={},i=0;for(let a=e;a<=t;a++)r[a]&&(n[i]=r[a],i++);return n}return{}}function Ml(e,t,n,r){let i=e>n;if(!i&&e+t>n)throw Error(`Invalid move operation`);i?Nl(e,t,n,r):Pl(e,t,n,r)}function Nl(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e-1;r>=n;r--){let e=i[r];i[r+t]=e,e===void 0&&delete i[r+t]}a.forEach((e,t)=>{i[n+t]=e,e===void 0&&delete i[n+t]})}function Pl(e,t,n,r){let i=r,a=[];for(let n=e;n<e+t;n++)a.push(i[n]);for(let r=e+t;r<n;r++){let e=i[r];i[r-t]=e,e===void 0&&delete i[r-t]}a.forEach((e,r)=>{i[n+r-t]=e,e===void 0&&delete i[n+r-t]})}var Fl=class e{constructor(e={}){T(this,`_matrix`,void 0),this._setOriginValue(e)}static MakeObjectMatrixSize(t){return new e({[t-1]:{}})}getMatrix(){return this._matrix}forEach(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,i)===!1)return this}return this}forRow(e){let t=this._matrix,n=Object.keys(t);for(let r of n){let n=Number(r),i=t[n];if(e(n,Object.keys(i).map(e=>Number(e)))===!1)return this}return this}forValue(e){let t=this._matrix;for(let n in t){let r=Number(n),i=t[r];if(i)for(let t in i){let n=Number(t),a=i[n];if(e(r,n,a)===!1)return this}}return this}swapRow(e,t){let n=this._matrix[e],r=this._matrix[t];this._matrix[e]=r,this._matrix[t]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let t=this.getRow(e);return t==null&&(t={},this._matrix[e]=t),t}reset(){this._setOriginValue({})}hasValue(){let e=this._matrix,t=Object.keys(e);if(t.length===0)return!1;for(let n of t){let t=e[Number(n)];if(Object.keys(t).length>0)return!0}return!1}getValue(e,t){var n;return(n=this._matrix)==null||(n=n[e])==null?void 0:n[t]}setValue(e,t,n){let r=this.getRowOrCreate(e);r[t]=n}deleteValue(e,t){var n;(n=this._matrix)==null||(n=n[e])==null||delete n[t]}realDeleteValue(e,t){var n;if((n=this._matrix)==null||(n=n[e])==null||delete n[t],this.getRow(e)){let t=this.getRow(e);if(t==null)return;if(Object.keys(t).length===0){var r;(r=this._matrix)==null||delete r[e]}}}setRow(e,t){this._matrix[e]=t}moveRows(e,t,n){Ml(e,t,n,this._matrix)}moveColumns(e,t,n){this.forEach((r,i)=>{Ml(e,t,n,i)})}insertRows(e,t){let n=Object.keys(this._matrix);for(let r=n.length-1;r>=0;r--){let i=Number(n[r]);if(i>=e){let e=this._matrix[i];delete this._matrix[i],this._matrix[i+t]=e}}}insertColumns(e,t){let n=Object.keys(this._matrix);for(let r=0;r<n.length;r++){let i=Number(n[r]),a=this._matrix[i],o=Object.keys(a);for(let n=o.length-1;n>=0;n--){let r=Number(o[n]);if(r>=e){let e=a[r];delete a[r],a[r+t]=e}}}}removeRows(e,t){kl(e,t,this._matrix)}removeColumns(e,t){this.forEach((n,r)=>{r&&kl(e,t,r)})}getFragment(t,n,r,i){let a=new e,o=0;for(let e=t;e<=n;e++){let t={},n=0;for(let a=r;a<=i;a++)t[n]=this.getValue(e,a),n++;a.setRow(o,t),o++}return a}getSlice(t,n,r,i){let a=new e;for(let e=t;e<=n;e++)for(let t=r;t<=i;t++){let n=this.getValue(e,t);n&&a.setValue(e,t,z.deepClone(n))}return a}getSliceDataAndCellCountByRows(t,n){let r=new e,i=0;for(let e=t;e<=n;e++){let t=this.getRow(e);t&&(r.setRow(e,t),i+=Object.keys(t).length)}return{sliceData:r,cellCount:i}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return El(this._matrix)}getRange(){let e=this.getLength()-1,t=0,n=this.getLength();for(let e=0;e<n;e++){let n=this.getRow(e);if(n){let e=El(n)-1;t=e>t?e:t}}return{startRow:0,startColumn:0,endRow:e,endColumn:t}}getRealRange(){let e=Object.keys(this._matrix),t=e.length,n=t>0?Number(e[0]):0,r=t>0?Number(e[t-1]):0,i=-1/0,a=0;for(let t of e){let e=this.getRow(Number(t));if(e){let t=Object.keys(e);if(t.length>0){let e=Number(t[0]),n=Number(t[t.length-1]);(i===-1/0||e<i)&&(i=e),n>a&&(a=n)}}}return i===-1/0&&(i=0),{startRow:n,endRow:r,startColumn:i,endColumn:a}}getRealRowRange(){let e=Object.keys(this._matrix),t=e.length;return{startRow:t>0?Number(e[0]):0,endRow:t>0?Number(e[t-1]):0}}toNativeArray(){let e=[];return this.forValue((t,n,r)=>{e.push(r)}),e}toArray(){let e=[];return this.forRow((t,n)=>{e[t]==null&&(e[t]=[]),n.forEach(n=>{e[t][n]=this.getValue(t,n)})}),e}toFullArray(){let{endColumn:e,endRow:t}=this.getRange(),n=[];for(let r=0;r<=t;r++){let t=Array(e+1).fill(void 0);n.push(t)}return this.forValue((e,t,r)=>{n[e][t]=r}),n}toJSON(){return this._matrix}clone(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){let e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let t=0,n=0,r=!1,i=!1,a=new e;return this.forEach((e,o)=>{r||(r=!0,t=e),Object.keys(o).forEach(r=>{let o=Number(r);i?o<n&&(n=o):(i=!0,n=o);let s=this.getValue(e,o);a.setValue(e-t,o-n,s)})}),a.getData()}getStartEndScope(){let e=-1,t=-1,n=-1,r=-1,i=Object.keys(this._matrix);i.length>0&&(e=+i[0],t=+i[i.length-1]);for(let e of i){let t=Object.keys(this._matrix[e]);t.length>0&&(n=n===-1?+t[0]:Math.min(n,+t[0]),r=Math.max(r,+t[t.length-1]))}return{startRow:e,endRow:t,startColumn:n,endColumn:r}}getDataRange(){let e=0,t=0,n=0,r=-1,i=!1,a=!1;return this.forEach((o,s)=>{if(i||(i=!0,e=o),s==null)return;let c=El(s)-1;c>n&&(n=c),Object.keys(s).forEach(e=>{let n=Number(e);a?n<t&&(t=n):(a=!0,t=n)}),o>r&&(r=o)}),{startRow:e,startColumn:t,endRow:r,endColumn:n}}getDiscreteRanges(){let e=[];return this.forEach((t,n)=>{Object.keys(n).forEach(n=>{let r=Number(n),i=!1;for(let n of e)if(t>=n.startRow&&t<=n.endRow+1&&r>=n.startColumn&&r<=n.endColumn+1){n.endRow=Math.max(t,n.endRow),n.endColumn=Math.max(r,n.endColumn),i=!0;break}i||e.push({startRow:t,endRow:t,startColumn:r,endColumn:r})})}),e}merge(e){this.forValue((t,n)=>{let r=e.getValue(t,n);r!=null&&this.setValue(t,n,r)})}concatRows(e){let t=e.getMatrix();for(let e in t){let n=Number(e);this.setRow(n,t[n])}}_setOriginValue(e={}){this._matrix=e}};function Il(e){let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,mergeInfo:a}=e,{startY:o,endY:s,startX:c,endX:l}=e,u=t,d=n,f=t,p=n;if(r&&a){let{startRow:e,startColumn:t,endRow:n,endColumn:r,startY:i,endY:m,startX:h,endX:g}=a;u=e,d=t,f=n,p=r,o=i,s=m,c=h,l=g}return i&&(o=a.startY,s=a.endY,c=a.startX,l=a.endX,f=a.endRow,p=a.endColumn),{startRow:u,startColumn:d,endRow:f,endColumn:p,startY:o,endY:s,startX:c,endX:l}}let Ll=Il;function Rl(e){if(!e)return;let{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:i,startRow:a,startColumn:o,endRow:s,endColumn:c}=e,l=t,u=n,d=t,f=n;return(r||i)&&(l=a,u=o,d=s,f=c),{startRow:l,startColumn:u,endRow:d,endColumn:f}}function zl(e){var t;return!e||((e==null||(t=e.v)==null?void 0:t.toString())||``).length===0&&!e.p}function Bl(e){return zl(e)&&(e==null?void 0:e.coverable)!==!1}function Vl(e){if(e){if(e.rgb)return new Ia(e.rgb).toHexString();if(e.th!=null){var t;let n=(t=po.Office)==null?void 0:t[e.th];if(n)return new Ia(n).toRgbString()}}return null}function Hl(e){return z.isString(e)&&e.substring(0,1)===`=`&&e.length>1}function Ul(e){return z.isString(e)&&e.length>0}function Wl(e,t=!1){let n=``,r=new Map([[`ff`,()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],[`fs`,()=>{if(e.fs){let t=e.fs;e.va&&(t/=2),n+=`font-size: ${t}pt; `}}],[`it`,()=>{e.it&&(n+=`font-style: italic; `)}],[`bl`,()=>{e.bl&&(n+=`font-weight: bold; `)}],[`ul`,()=>{var t;(t=e.ul)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} underline`):n+=`text-decoration: underline; `,e.ul.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.ul.cl)}; `),e.ul.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],[`st`,()=>{var t;(t=e.st)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} line-through`):n+=`text-decoration-line: line-through; `,e.st.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.st.cl)}; `),e.st.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],[`ol`,()=>{var t;(t=e.ol)!=null&&t.s&&(n.indexOf(`text-decoration-line`)>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(e,t)=>`${t} overline`):n+=`text-decoration-line: overline; `,e.ol.cl&&n.indexOf(`text-decoration-color`)===-1&&(n+=`text-decoration-color: ${Vl(e.ol.cl)}; `),e.ol.t&&n.indexOf(`text-decoration-style`)===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],[`bg`,()=>{e.bg&&(n+=`background: ${Vl(e.bg)}; `)}],[`bd`,()=>{var t,r,i,a;if((t=e.bd)!=null&&t.b){var o,s;n+=`border-bottom: ${Gl((o=e.bd)==null?void 0:o.b.s)} ${(s=Vl(e.bd.b.cl))==null?``:s}; `}if((r=e.bd)!=null&&r.t){var c,l;n+=`border-top: ${Gl((c=e.bd)==null?void 0:c.t.s)} ${(l=Vl(e.bd.t.cl))==null?``:l}; `}if((i=e.bd)!=null&&i.r){var u,d;n+=`border-right: ${Gl((u=e.bd)==null?void 0:u.r.s)} ${(d=Vl(e.bd.r.cl))==null?``:d}; `}if((a=e.bd)!=null&&a.l){var f,p;n+=`border-left: ${Gl((f=e.bd)==null?void 0:f.l.s)} ${(p=Vl(e.bd.l.cl))==null?``:p}; `}}],[`cl`,()=>{e.cl&&(n+=`color: ${Vl(e.cl)}; `)}],[`va`,()=>{e.va===2?n+=`vertical-align: sub; `:e.va===3&&(n+=`vertical-align: super; `)}],[`td`,()=>{e.td===1?n+=`direction: ltr; `:e.td===2&&(n+=`direction: rtl; `)}],[`tr`,()=>{if(e.tr){var t,r,i;n+=`--data-rotate: (${(t=e.tr)==null?void 0:t.a}deg${(r=e.tr)!=null&&r.v?` ,${(i=e.tr)==null?void 0:i.v}`:``});`}}],[`ht`,()=>{e.ht===1?n+=`text-align: left; `:e.ht===3?n+=`text-align: right; `:e.ht===2?n+=`text-align: center; `:e.ht===4&&(n+=`text-align: justify; `)}],[`vt`,()=>{e.vt===3?n+=`vertical-align: bottom; `:e.vt===1?n+=`vertical-align: top; `:e.vt===2&&(n+=`vertical-align: middle; `)}],[`tb`,()=>{e.tb===2?n+=`white-space: nowrap; overflow-x: hidden; `:e.tb===3&&(n+=`white-space: normal;`)}],[`pd`,()=>{var t,r,i,a,o,s,c,l;let u=`${(t=e.pd)==null?void 0:t.b}pt`,d=`${(r=e.pd)==null?void 0:r.t}pt`,f=`${(i=e.pd)==null?void 0:i.l}pt`,p=`${(a=e.pd)==null?void 0:a.r}pt`;(o=e.pd)!=null&&o.b&&(n+=`padding-bottom: ${u}; `),(s=e.pd)!=null&&s.t&&(n+=`padding-top: ${d}; `),(c=e.pd)!=null&&c.l&&(n+=`padding-left: ${f}; `),(l=e.pd)!=null&&l.r&&(n+=`padding-right: ${p}; `)}]]),i=[`bd`,`tr`,`tb`];for(let n in e){var a;t&&i.includes(n)||(a=r.get(n))==null||a()}return n}function Gl(e){let t=``;return e===0?t=`none`:e===1?t=`0.5pt solid`:e===2?t=`0.5pt double`:e===3?t=`0.5pt dotted`:e===4||e===5?t=`0.5pt dashed`:e===6?t=`0.5pt dotted`:e===7?t=`0.5pt double`:e===8?t=`1pt solid`:e===9||e===10?t=`1pt dashed`:e===11?t=`1pt dotted`:e===12?t=`0.5pt dashed`:e===13&&(t=`1.5pt solid`),t}function Kl(e){let t=0;if(e=e.trim(),e===`none`)t=0;else if(e===`0.5pt solid`)t=1;else if(e===`0.5pt double`)t=2;else if(e===`0.5pt dotted`)t=3;else if(e===`0.5pt dashed`)t=4;else if(e===`1pt solid`)t=8;else if(e===`1pt dashed`)t=9;else if(e===`1pt dotted`)t=11;else if(e===`1.5pt solid`)t=13;else if(!e.includes(`none`))t=1;else return 0;return t}function ql(e,t){let n=e.body;if(t){let{headers:r,footers:i}=e;r!=null&&r[t]?n=r[t].body:i!=null&&i[t]&&(n=i[t].body)}return n}function Jl(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a,rangeType:o}=e;if(n<0||i<0||r<0||a<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===2||!(Number.isNaN(i)&&Number.isNaN(a))&&o===1||o!==1&&o!==2&&(Number.isNaN(i)||Number.isNaN(n)||Number.isNaN(a)||Number.isNaN(r)))return!1;if(t){let e=t.getRowCount(),n=t.getColumnCount();if(r>=e||a>=n)return!1}return!0}function Yl(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Xl(e){if(Hl(e))return{f:e,v:null,p:null};if(io(e)){if(typeof e==`string`){let t=wl(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||`General`}}}}return{v:e,p:null,f:null}}return to(e),e}function Zl(e,t){let n=new Fl,{startRow:r,startColumn:i,endRow:a,endColumn:o}=t;if(z.isArray(e))for(let t=0;t<=a-r;t++)for(let a=0;a<=o-i;a++)n.setValue(t+r,a+i,Xl(e[t][a]));else new Fl(e).forValue((e,t,r)=>{n.setValue(e,t,Xl(r))});return n.getMatrix()}function Ql(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?Object.keys(e).every(n=>Ql(e[n],t[n])):!1:e===t:!1}function $l(e,t){let n=e.ts||{},r=t.ts||{};return e.sId===t.sId?Ql(n,r):!1}function eu(e,t){return t.some(t=>e.indexOf(t)>-1)}let tu=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],nu=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],ru=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],iu=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],au=[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],ou={L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`,l:`M/D/YYYY`,ll:`MMM D, YYYY`,lll:`MMM D, YYYY h:mm A`,llll:`ddd, MMM D, YYYY h:mm A`},su={millisecond:`millisecond`,milliseconds:`millisecond`,ms:`millisecond`,second:`second`,seconds:`second`,s:`second`,minute:`minute`,minutes:`minute`,m:`minute`,hour:`hour`,hours:`hour`,h:`hour`,day:`day`,days:`day`,d:`day`,week:`week`,weeks:`week`,w:`week`,month:`month`,months:`month`,M:`month`,year:`year`,years:`year`,y:`year`};var cu=class e{constructor(e,t){this._date=e,this._isUTC=t}isValid(){return!Number.isNaN(this._date.getTime())}format(e=`YYYY-MM-DDTHH:mm:ssZ`){return this.isValid()?Cu(this._date,e,this._isUTC):`Invalid Date`}formatIntl(e,t={}){if(!this.isValid())return`Invalid Date`;if(typeof Intl>`u`||typeof Intl.DateTimeFormat!=`function`)return this.format();let n=this._isUTC&&!t.timeZone?{...t,timeZone:`UTC`}:t;return new Intl.DateTimeFormat(e,n).format(this._date)}valueOf(){return this._date.getTime()}toDate(){return new Date(this.valueOf())}_clone(){return new e(this.toDate(),this._isUTC)}add(t,n=`millisecond`){let r=mu(n);return!this.isValid()||!r||!Number.isFinite(t)?this._clone():new e(_u(this._date,t,r,this._isUTC),this._isUTC)}subtract(e,t=`millisecond`){return this.add(-e,t)}startOf(t){let n=mu(t);return!n||!this.isValid()?this._clone():new e(vu(this._date,n,this._isUTC),this._isUTC)}endOf(e){let t=mu(e);return!t||!this.isValid()||t===`millisecond`?this._clone():this.startOf(t).add(1,t).subtract(1,`millisecond`)}utc(){return new e(this.toDate(),!0)}local(){return new e(this.toDate(),!1)}weekday(e){let t=(uu(this._date,this._isUTC).dayOfWeek-0+7)%7;return e===void 0?t:this.add(e-t,`day`)}week(e){let t=yu(this._date,this._isUTC);return e===void 0?t:this.add((e-t)*7,`day`)}};function lu(e,t=2){return String(Math.abs(e)).padStart(t,`0`)}function uu(e,t){return t?{year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),millisecond:e.getUTCMilliseconds(),dayOfWeek:e.getUTCDay()}:{year:e.getFullYear(),month:e.getMonth()+1,day:e.getDate(),hour:e.getHours(),minute:e.getMinutes(),second:e.getSeconds(),millisecond:e.getMilliseconds(),dayOfWeek:e.getDay()}}function du(e,t){return e instanceof cu?e.toDate():e===void 0?new Date:e===null?new Date(NaN):e instanceof Date?new Date(e.getTime()):typeof e==`number`?new Date(e):typeof e==`string`?pu(e,t):new Date(NaN)}function fu(e,t,n,r,i,a,o,s){let c=s?new Date(Date.UTC(e,t-1,n,r,i,a,o)):new Date(e,t-1,n,r,i,a,o),l=uu(c,s);return l.year!==e||l.month!==t||l.day!==n||l.hour!==r||l.minute!==i||l.second!==a?new Date(NaN):c}function pu(e,t){let n=e.trim();if(!n)return new Date(NaN);let r=n.match(/^(\d{4})年(\d{1,2})月(\d{1,2})日(?:\s+(\d{1,2})(?::(\d{1,2})(?::(\d{1,2}))?)?)?$/);if(r){let[,e,n,i,a=`0`,o=`0`,s=`0`]=r;return fu(Number(e),Number(n),Number(i),Number(a),Number(o),Number(s),0,t)}let i=n.match(/^(\d{4})[-/](\d{1,2})[-/](\d{1,2})(?:[ T](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?)?$/);if(i){let[,e,n,r,a=`0`,o=`0`,s=`0`,c=`0`]=i;return fu(Number(e),Number(n),Number(r),Number(a),Number(o),Number(s),Number(c),t)}return/^-?\d+(\.\d+)?$/.test(n)?new Date(Number(n)):new Date(n)}function mu(e){var t;return(t=su[e])==null?su[String(e).toLowerCase()]:t}function hu(e,t,n){return n?new Date(Date.UTC(e,t,0)).getUTCDate():new Date(e,t,0).getDate()}function gu(e,t,n,r){let i=new Date(e.getTime());if(t){switch(n){case`year`:i.setUTCFullYear(r);break;case`month`:i.setUTCMonth(r);break;case`day`:i.setUTCDate(r);break;case`hour`:i.setUTCHours(r);break;case`minute`:i.setUTCMinutes(r);break;case`second`:i.setUTCSeconds(r);break;case`millisecond`:i.setUTCMilliseconds(r);break}return i}switch(n){case`year`:i.setFullYear(r);break;case`month`:i.setMonth(r);break;case`day`:i.setDate(r);break;case`hour`:i.setHours(r);break;case`minute`:i.setMinutes(r);break;case`second`:i.setSeconds(r);break;case`millisecond`:i.setMilliseconds(r);break}return i}function _u(e,t,n,r){switch(n){case`millisecond`:return new Date(e.getTime()+t);case`second`:return new Date(e.getTime()+t*1e3);case`minute`:return new Date(e.getTime()+t*6e4);case`hour`:return new Date(e.getTime()+t*36e5);case`day`:return gu(e,r,`day`,(r?e.getUTCDate():e.getDate())+t);case`week`:return gu(e,r,`day`,(r?e.getUTCDate():e.getDate())+t*7);case`month`:{let n=uu(e,r),i=fu(n.year,n.month,1,n.hour,n.minute,n.second,n.millisecond,r),a=gu(i,r,`month`,(r?i.getUTCMonth():i.getMonth())+t),o=uu(a,r),s=hu(o.year,o.month,r);return gu(a,r,`day`,Math.min(n.day,s))}case`year`:return _u(e,t*12,`month`,r)}}function vu(e,t,n){let r=uu(e,n);switch(t){case`year`:return fu(r.year,1,1,0,0,0,0,n);case`month`:return fu(r.year,r.month,1,0,0,0,0,n);case`week`:{let e=(r.dayOfWeek-0+7)%7,t=fu(r.year,r.month,r.day,0,0,0,0,n);return gu(t,n,`day`,(n?t.getUTCDate():t.getDate())-e)}case`day`:return fu(r.year,r.month,r.day,0,0,0,0,n);case`hour`:return fu(r.year,r.month,r.day,r.hour,0,0,0,n);case`minute`:return fu(r.year,r.month,r.day,r.hour,r.minute,0,0,n);case`second`:return fu(r.year,r.month,r.day,r.hour,r.minute,r.second,0,n);default:return new Date(e.getTime())}}function yu(e,t){let n=vu(e,`week`,t),r=vu(vu(e,`year`,t),`week`,t);return Math.floor((n.getTime()-r.getTime())/864e5/7)+1}function bu(e,t,n=!1){if(t)return n?`+0000`:`+00:00`;let r=-e.getTimezoneOffset(),i=r>=0?`+`:`-`,a=Math.abs(r),o=lu(Math.floor(a/60),2),s=lu(a%60,2);return n?`${i}${o}${s}`:`${i}${o}:${s}`}function xu(e){let t=e%100;if(t>=11&&t<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`;default:return`${e}th`}}function Su(e){return e.replace(/LLLL|LLL|LL|L|llll|lll|ll|l/g,e=>{var t;return(t=ou[e])==null?e:t})}function Cu(e,t,n){let r=uu(e,n),i=r.hour%12,a=i===0?12:i,o=Math.ceil(r.month/3),s={YYYY:String(r.year),YY:lu(r.year%100,2),MMMM:tu[r.month-1],MMM:nu[r.month-1],MM:lu(r.month,2),M:String(r.month),DD:lu(r.day,2),D:String(r.day),Do:xu(r.day),dddd:ru[r.dayOfWeek],ddd:iu[r.dayOfWeek],dd:au[r.dayOfWeek],d:String(r.dayOfWeek),HH:lu(r.hour,2),H:String(r.hour),hh:lu(a,2),h:String(a),mm:lu(r.minute,2),m:String(r.minute),ss:lu(r.second,2),s:String(r.second),SSS:lu(r.millisecond,3),A:r.hour>=12?`PM`:`AM`,a:r.hour>=12?`pm`:`am`,Q:String(o),Qo:xu(o),X:String(Math.floor(e.getTime()/1e3)),x:String(e.getTime()),Z:bu(e,n,!1),ZZ:bu(e,n,!0)},c=[];return Su(t.replace(/\[([^\]]+)]/g,(e,t)=>`\u0000${c.push(t)-1}\u0000`)).replace(/YYYY|YY|MMMM|MMM|MM|M|DD|Do|D|dddd|ddd|dd|d|HH|H|hh|h|mm|m|ss|s|SSS|A|a|Qo|Q|X|x|ZZ|Z/g,e=>{var t;return(t=s[e])==null?e:t}).replace(/\u0000(\d+)\u0000/g,(e,t)=>{var n;return(n=c[Number(t)])==null?``:n})}function wu(e){return new cu(du(e,!1),!1)}let Tu=Object.assign(wu,{utc:e=>new cu(du(e,!0),!0),isDateKit:e=>e instanceof cu,unix:e=>wu(e*1e3)});function Eu(e,t,n,r){if(e>t)throw Error(`a1 should be less than a2`);if(n>r)throw Error(`b1 should be less than b2`);if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];let i=r-n+1;return e<n&&t>r?[e,t-i]:n<=e&&r<t?[r+1-i,t-i]:n>e&&r>=t?[e,n-1]:[e,t]}function Du(e){if(e==null)return!1;let t=e.bullet;return(t==null?void 0:t.listId)!=null}function Ou(e){if(e==null)return!1;let t=e.paragraphStyle;return ku(t)}function ku(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 Au(e,t,n){return e.slice(0,t)+n+e.slice(t)}function ju(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Mu(e){if(e==null||typeof e==`boolean`)return!1;if(typeof e==`number`)return!isNaN(e);if(typeof e==`string`){let t=e.trim();return t===``?!1:!isNaN(Number(t))}return!1}function Nu(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function Pu(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>(Array.isArray(e)?e[0]:e)-(Array.isArray(t)?t[0]:t)),n=[],r=Array.isArray(t[0])?t[0][0]:t[0],i=r;for(let e=1;e<t.length;e++){let a=t[e],o,s;Array.isArray(a)?(o=a[0],s=a[1]):(o=a,s=a),o<=i+1?i=Math.max(i,s):(n.push([r,i]),r=o,i=s)}return n.push([r,i]),n}function Fu(e){if(e.length===0)return[];let t=e.slice().sort((e,t)=>e[0]-t[0]),n=[],[r,i]=t[0];for(let e=1;e<t.length;e++){let[a,o]=t[e];a<=i+1?i=Math.max(i,o):(n.push([r,i]),r=a,i=o)}return n.push([r,i]),n}function Iu(...e){let t;return t=e.length===1&&Array.isArray(e[0])?e[0]:e,Object.assign({},...t)}let Lu,Ru,zu,Bu,K=Symbol(`newer`),q=Symbol(`older`);Lu=Symbol.iterator;var Vu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[Lu](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:e.key}):{done:!0,value:void 0}}};Ru=Symbol.iterator;var Hu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[Ru](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:e.value}):{done:!0,value:void 0}}};zu=Symbol.iterator;var Uu=class{constructor(e){T(this,`entry`,void 0),this.entry=e}[zu](){return this}next(){let e=this.entry;return e?(this.entry=e[K],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}},Wu=class{constructor(e,t){T(this,`key`,void 0),T(this,`value`,void 0),T(this,K,void 0),T(this,q,void 0),this.key=e,this.value=t,this[K]=void 0,this[q]=void 0}toJSON(){return{key:this.key,value:this.value}}};Bu=Symbol.iterator;var Gu=class{onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),D(()=>ze(this._onShiftListeners,e));throw Error(`[LRUMap]: the listener has been registered!`)}constructor(...e){if(T(this,`_keymap`,void 0),T(this,`size`,0),T(this,`limit`,void 0),T(this,`oldest`,void 0),T(this,`newest`,void 0),T(this,`_onShiftListeners`,[]),Ku.hasLength(e,1)){if(Ku.isNumber(e[0])){let t=e[0];this._initialize(t,void 0);return}if(Ku.isIterable(e[0])){let t=e[0];this._initialize(0,t);return}return}if(Ku.hasLength(e,2)){let t=e[0],n=e[1];this._initialize(t,n)}}_initialize(e,t){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[K]&&(e===this.oldest&&(this.oldest=e[K]),e[K][q]=e[q]),e[q]&&(e[q][K]=e[K]),e[K]=void 0,e[q]=this.newest,this.newest&&(this.newest[K]=e),this.newest=e)}assign(e){let t,n=this.limit||Number.MAX_VALUE;this._keymap.clear();let r=e[Symbol.iterator]();for(let e=r.next();!e.done;e=r.next()){let r=new Wu(e.value[0],e.value[1]);if(this._keymap.set(r.key,r),t?(t[K]=r,r[q]=t):this.oldest=r,t=r,n--===0)throw Error(`overflow`)}this.newest=t,this.size=this._keymap.size}set(e,t){let n=this._keymap.get(e);return n?(n.value=t,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new Wu(e,t)),this.newest?(this.newest[K]=n,n[q]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let e=this.oldest;if(e)return this.oldest&&this.oldest[K]?(this.oldest=this.oldest[K],this.oldest[q]=void 0):(this.oldest=void 0,this.newest=void 0),e[K]=e[q]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(t=>t(e)),[e.key,e.value]}get(e){let t=this._keymap.get(e);if(t)return this._markEntryAsUsed(t),t.value}has(e){return this._keymap.has(e)}find(e){let t=this._keymap.get(e);return t?t.value:void 0}delete(e){let t=this._keymap.get(e);if(t)return this._keymap.delete(t.key),t[K]&&t[q]?(t[q][K]=t[K],t[K][q]=t[q]):t[K]?(t[K][q]=void 0,this.oldest=t[K]):t[q]?(t[q][K]=void 0,this.newest=t[q]):this.oldest=this.newest=void 0,this.size--,t.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Vu(this.oldest)}values(){return new Hu(this.oldest)}entries(){return this[Symbol.iterator]()}[Bu](){return new Uu(this.oldest)}forEach(e,t){typeof t!=`object`&&(t=this);let n=this.oldest;for(;n;)e.call(t,n.value,n.key,this),n=n[K]}toJSON(){let e=Array(this.size),t=0,n=this.oldest;for(;n;)e[t++]={key:n.key,value:n.value},n=n[K];return e}toString(){let e=``,t=this.oldest;for(;t;)e+=`${String(t.key)}:${t.value}`,t=t[K],t&&(e+=` < `);return e}},Ku=class{static hasLength(e,t){return e.length===t}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)===`[object Object]`}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)===`[object Number]`}};function qu(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r<65||r>90)return-1;t=t*26+(r-64)}return t}let Ju=1048576,Yu=16384,Xu=`__INTERNAL_EDITOR__`,Zu=`${Xu}DOCS_NORMAL`,Qu=`${Xu}DOCS_FORMULA_BAR`,$u=`${Xu}COMMENT_EDITOR`,ed=Symbol(`AUTO_HEIGHT_FOR_MERGED_CELLS`);function td(e){return`${Xu}${e}`}function nd(e){return e.startsWith(Xu)}function rd(e){return e.startsWith($u)}let id=function(e){return e.PARAGRAPH=`paragraph`,e.BLOCK_RANGE=`blockRange`,e.TABLE=`table`,e.CUSTOM_BLOCK=`customBlock`,e.COLUMN_GROUP=`columnGroup`,e}({}),ad=function(e){return e[e.character=0]=`character`,e[e.paragraph=1]=`paragraph`,e[e.table=2]=`table`,e[e.numbering=3]=`numbering`,e}({}),od=function(e){return e[e.TAB=0]=`TAB`,e[e.SPACE=1]=`SPACE`,e[e.NOTHING=2]=`NOTHING`,e}({}),sd=function(e){return 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}({}),cd=function(e){return 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}({}),ld=function(e){return e.CALLOUT=`callout`,e.QUOTE=`quote`,e.CODE=`code`,e}({}),ud=function(e){return 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}({}),dd=function(e){return e[e.COMMENT=0]=`COMMENT`,e[e.DELETED=9999]=`DELETED`,e}({}),fd=function(e){return e[e.DRAWING=0]=`DRAWING`,e[e.CUSTOM=1]=`CUSTOM`,e}({}),pd=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRADITIONAL=1]=`TRADITIONAL`,e[e.MODERN=2]=`MODERN`,e}({}),md=function(e){return 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}({}),hd=function(e){return 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}({}),gd=function(e){return 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}({}),_d=function(e){return e[e.NORMAL=0]=`NORMAL`,e[e.TBRL=1]=`TBRL`,e[e.LRTBV=2]=`LRTBV`,e}({}),vd=function(e){return 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}({}),yd=function(e){return e[e.BOTH_SIDES=0]=`BOTH_SIDES`,e[e.LEFT=1]=`LEFT`,e[e.RIGHT=2]=`RIGHT`,e[e.LARGEST=3]=`LARGEST`,e}({}),bd=function(e){return 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}({}),xd=function(e){return 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}({}),Sd=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Cd=function(e){return 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}({}),wd=function(e){return 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}({}),Td=function(e){return e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.SPECIFIED=1]=`SPECIFIED`,e}({}),Ed=function(e){return e[e.START=0]=`START`,e[e.CENTER=1]=`CENTER`,e[e.END=2]=`END`,e}({}),Dd=function(e){return e[e.AUTO_FIT=0]=`AUTO_FIT`,e[e.FIXED=1]=`FIXED`,e}({}),Od=function(e){return e[e.NONE=0]=`NONE`,e[e.WRAP=1]=`WRAP`,e}({}),kd=function(e){return e.FIXED=`fixed`,e.AUTO=`auto`,e}({}),Ad=function(e){return e.STACK=`stack`,e.SHRINK=`shrink`,e}({}),jd=function(e){return e[e.AUTO=0]=`AUTO`,e[e.AT_LEAST=1]=`AT_LEAST`,e[e.EXACT=2]=`EXACT`,e}({}),Md=function(e){return 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}({}),Nd=function(e){return e.NORMAL=`normal`,e.BOLD=`bold`,e.ITALIC=`italic`,e}({}),Pd=function(e){return 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}({}),Fd=function(e){return 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}({}),Id=function(e){return 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}({}),Ld=function(e){return 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}({}),Rd=function(e){return 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}({}),zd=function(e){return e[e.compressPunctuation=0]=`compressPunctuation`,e[e.compressPunctuationAndJapaneseKana=1]=`compressPunctuationAndJapaneseKana`,e[e.doNotCompress=2]=`doNotCompress`,e}({}),Bd=function(e){return e[e.PORTRAIT=0]=`PORTRAIT`,e[e.LANDSCAPE=1]=`LANDSCAPE`,e}({}),Vd=function(e){return e.Letter=`Letter`,e.Tabloid=`Tabloid`,e.Legal=`Legal`,e.Statement=`Statement`,e.Executive=`Executive`,e.Folio=`Folio`,e.A3=`A3`,e.A4=`A4`,e.A5=`A5`,e.B4=`B4`,e.B5=`B5`,e}({}),Hd=[`A3`,`A4`,`A5`,`B4`,`B5`,`Letter`,`Tabloid`,`Legal`,`Statement`,`Executive`,`Folio`],Ud=function(e){return e[e.forward=0]=`forward`,e[e.backward=1]=`backward`,e[e.front=2]=`front`,e[e.back=3]=`back`,e}({}),Wd=function(e){return 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[e.DRAWING_BLOCK=9]=`DRAWING_BLOCK`,e}({});function Gd(){return e=>e}let Kd=Gd()([`s`,`c`,`cl`,`t`]),qd=Gd()([`rgb`,`th`]),Jd=Gd()([`s`,`cl`]),Yd=Gd()([`t`,`r`,`b`,`l`,`tl_br`,`tl_bc`,`tl_mr`,`bl_tr`,`ml_tr`,`bc_tr`]),Xd=Gd()([`a`,`v`]),Zd=Gd()([`t`,`r`,`b`,`l`]),Qd=Gd()([`ff`,`fs`,`it`,`bl`,`ul`,`bbl`,`st`,`ol`,`bg`,`bd`,`cl`,`va`,`n`,`stf`,`tr`,`td`,`ht`,`vt`,`tb`,`pd`]),$d={sheetId:``,range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},ef={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},tf={startRow:0,startColumn:0,endRow:0,endColumn:0},nf={row:0,column:0},J={ff:`Arial`,fs:11,it:0,bl:0,ul:{s:0},st:{s:0},ol:{s:0},tr:{a:0,v:0},td:0,cl:{rgb:`#000000`},bg:{rgb:`#fff`},ht:0,vt:0,tb:0,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},rf=[Zu,Qu],af={4:{fs:20,bl:1},5:{fs:18,bl:1},6:{fs:16,bl:1},7:{fs:14,bl:1},8:{fs:12,bl:1},1:null,2:{fs:26,bl:1},3:{fs:15,cl:{rgb:`#999999`}},0:null},of=1.5,sf={4:{spaceAbove:{v:20},spaceBelow:{v:10}},5:{spaceAbove:{v:18},spaceBelow:{v:10}},6:{spaceAbove:{v:16},spaceBelow:{v:10}},7:{spaceAbove:{v:14},spaceBelow:{v:8}},8:{spaceAbove:{v:12},spaceBelow:{v:8}},1:{spaceAbove:{v:0},spaceBelow:{v:12}},2:{spaceAbove:{v:0},spaceBelow:{v:7}},3:{spaceAbove:{v:0},spaceBelow:{v:16}},0:null},cf=function(e){return e.ARRAY_CONVERTOR=`ARRAY_CONVERTOR`,e.MATRIX_CONVERTOR=`MATRIX_CONVERTOR`,e}({}),lf={A3:{width:1123,height:1587},A4:{width:794,height:1124},A5:{width:559,height:794},B4:{width:944,height:1344},B5:{width:665,height:944},Executive:{width:696,height:1008},Folio:{width:816,height:1248},Legal:{width:816,height:1344},Letter:{width:816,height:1056},Statement:{width:528,height:816},Tabloid:{width:1056,height:1632}},uf=function(e){return e.NARROW=`narrow`,e.MEDIUM=`medium`,e.WIDE=`wide`,e}({}),df={narrow:lf.A4.width,medium:960,wide:lf.A3.width};function ff(e,t){let{textRuns:n=[]}=t,r=0;for(let t of n){let{ts:n={},st:i,ed:a}=t;if(n[e]==null)return 0;switch(e){case`bl`:case`it`:if(n[e]===0)return 0;break;case`ul`:case`st`:if(n[e].s===0)return 0;break;default:throw Error(`unknown style key: ${e} in IStyleBase`)}r+=a-i}return+(t.dataStream.indexOf(`\r
|
|
2
|
+
`)===r)}var pf=class e{constructor(e,t,n){this._deps=n,T(this,`_range`,void 0),T(this,`_worksheet`,void 0),this._range=t,this._worksheet=e}static foreach(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e;for(let e=n;e<=i;e++)for(let n=r;n<=a;n++)t(e,n)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=[];for(let a=e;a<=t;a++){let e=[];for(let t=n;t<=r;t++)e.push(this.getMatrix().getValue(a,t)||null);i.push(e)}return i}getMatrix(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Fl;for(let o=e;o<=t;o++)for(let e=n;e<=r;e++)a.setValue(o,e,i.getValue(o,e)||null);return a}getMatrixObject(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),a=new Fl;for(let o=e;o<=t;o++)for(let t=n;t<=r;t++)a.setValue(o-e,t-n,i.getValue(o,t)||{});return a}getA1Notation(){let{startRow:e,endRow:t,startColumn:n,endColumn:r}=this._range,i,a;return n<r?(i=z.numToWord(n+1)+(e+1),a=z.numToWord(r+1)+(t+1)):(i=z.numToWord(r+1)+(t+1),a=z.numToWord(n+1)+(e+1)),i===a?`${i}`:`${i}:${a}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.bg)==null?void 0:n.rgb)||J.bg.rgb}))}getCell(t,n){let{startRow:r,startColumn:i}=this._range,a={startRow:r+t,endRow:r+t,startColumn:i+n,endColumn:i+n};return new e(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){let{startRow:t,endRow:n,startColumn:r,endColumn:i}=this._range,a=this._worksheet.getCellMatrix().getFragment(t,n,r,i).getData();if(e.isIncludeStyle){let e=this._deps.getStyles();for(let s=0;s<=n-t;s++)for(let t=0;t<=i-r;t++){var o;if(a==null||(a==null||(o=a[s])==null?void 0:o[t])==null)continue;let n=a[s][t].s;n&&(a[s][t].s=e.get(n))}}return a}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>{var n;let r=e.getStyleByCell(t);return(r==null||(n=r.cl)==null?void 0:n.rgb)||J.cl.rgb}))}getFontFamilies(){return this._getStyles(`ff`)}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles(`ul`)}getUnderline(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?ff(`ul`,n.body)===1?{s:1}:{s:0}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles(`ol`)}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?ff(`st`,n.body)===1?{s:1}:{s:0}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles(`st`)}getFontSize(){var e,t;let n=((e=this.getValue())==null?void 0:e.p)||{};return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0&&n.body.textRuns.some(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)!=null})?Math.max(...n.body.textRuns.map(e=>{var t;return(e==null||(t=e.ts)==null?void 0:t.fs)||0})):this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles(`fs`)}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles(`bd`)}getFontStyle(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?+(ff(`it`,n.body)===1):this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles(`it`)}getFontWeight(){var e,t;let{p:n}=(e=this.getValue())==null?{}:e;return n&&Array.isArray((t=n.body)==null?void 0:t.textRuns)&&n.body.textRuns.length>0?+(ff(`bl`,n.body)===1):this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles(`bl`)}getGridId(){return this._worksheet.getSheetId()}getHeight(){let{_range:e,_worksheet:t}=this,{startRow:n,endRow:r}=e,i=0;for(let e=0;e<=r-n;e++){let n=t.getRowHeight(e);i+=n}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles(`ht`)}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){let{startColumn:e,endColumn:t}=this._range;return t-e+1}getNumRows(){let{startRow:e,endRow:t}=this._range;return t-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(e=>(e==null?void 0:e.p)||``))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles(`td`)}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles(`tr`)}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){let e=this._deps.getStyles();return this.getValues().map(t=>t.map(t=>e.getStyleByCell(t)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles(`vt`)}getWidth(){let{_range:e,_worksheet:t}=this,{startColumn:n,endColumn:r}=e,i=0;for(let e=0;e<=r-n;e++)i+=t.getColumnWidth(e);return i}getWrap(){return+(this.getWrapStrategy()===3)}getWrapStrategies(){return this._getStyles(`tb`)}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){e.foreach(this._range,t)}_getStyles(e){let t=this._deps.getStyles();return this.getValues().map(n=>n.map(n=>{let r=t&&t.getStyleByCell(n);return r&&r[e]||J[e]}))}};T(pf,`transformRange`,(e,t)=>{let n=t.getMaxColumns()-1,r=t.getMaxRows()-1;return e.rangeType===3?{startColumn:0,startRow:0,endColumn:n,endRow:r}:e.rangeType===2?{startRow:0,endRow:r,startColumn:e.startColumn,endColumn:e.endColumn}:e.rangeType===1?{startColumn:0,endColumn:n,startRow:e.startRow,endRow:e.endRow}:{startColumn:e.startColumn,endColumn:Math.min(e.endColumn,n),startRow:e.startRow,endRow:Math.min(e.endRow,r)}});function mf(e,t,n=0,r=e.length-1,i=gf){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);mf(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(hf(e,n,t),i(e[r],a)>0&&hf(e,n,r);o<s;){for(hf(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?hf(e,n,s):(s++,hf(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function hf(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function gf(e,t){return e<t?-1:+(e>t)}var _f=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!kf(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;kf(e,s)&&(t.leaf?n.push(o):Of(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!kf(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(kf(e,a)){if(t.leaf||Of(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Af([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=vf(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&Of(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=Af(e.slice(t,n+1)),yf(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=Af([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));jf(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);jf(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return yf(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=wf(o),c=Ef(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),xf(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=Af(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,yf(n,this.toBBox),yf(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=Af([e,t]),this.data.height=e.height+1,this.data.leaf=!1,yf(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=bf(e,0,o,this.toBBox),s=bf(e,o,n,this.toBBox),c=Df(t,s),l=wf(t)+wf(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Sf,i=e.leaf?this.compareMinY:Cf;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=bf(e,0,t,i),o=bf(e,n-t,n,i),s=Tf(a)+Tf(o);for(let r=t;r<n-t;r++){let t=e.children[r];xf(a,e.leaf?i(t):t),s+=Tf(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];xf(o,e.leaf?i(t):t),s+=Tf(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)xf(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():yf(e[t],this.toBBox)}};function vf(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 yf(e,t){bf(e,0,e.children.length,t,e)}function bf(e,t,n,r,i){i||(i=Af(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];xf(i,e.leaf?r(t):t)}return i}function xf(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 Sf(e,t){return e.minX-t.minX}function Cf(e,t){return e.minY-t.minY}function wf(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Tf(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Ef(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 Df(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function Of(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function kf(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Af(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function jf(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;mf(e,o,t,n,i),a.push(t,o,o,n)}}function Mf(e,t,n,r=!1){if(t===0&&n===0)return e;let i={...e},a=i.startAbsoluteRefType||0,o=i.endAbsoluteRefType||0,s=i.rangeType||0;if(!r&&a===3&&o===3)return i;let c=Nf(i.startRow,n,i.startColumn,t,s),l=Nf(i.endRow,n,i.endColumn,t,s);return r||a===0&&o===0?i={...i,startRow:c.row,startColumn:c.column,endRow:l.row,endColumn:l.column}:(a===0?i={...i,startRow:c.row,startColumn:c.column}:a===2?i={...i,startRow:c.row}:a===1&&(i={...i,startColumn:c.column}),o===0?i={...i,endRow:l.row,endColumn:l.column}:o===2?i={...i,endRow:l.row}:o===1&&(i={...i,endColumn:l.column}),i)}function Nf(e,t,n,r,i){return i===0?{row:e+t,column:n+r}:i===1?{row:e+t,column:n}:i===2?{row:e,column:n+r}:{row:e,column:n}}function Pf(e){let t=new Set,n=new Set;for(let r of e)t.add(r.startColumn),t.add(r.endColumn+1),n.add(r.startRow),n.add(r.endRow+1);let r=Array.from(t).sort((e,t)=>e-t),i=Array.from(n).sort((e,t)=>e-t);e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let a=[];for(let t=0;t<i.length-1;t++)for(let n=0;n<r.length-1;n++){let o=r[n],s=r[n+1]-1,c=i[t],l=i[t+1]-1;for(let t of e){if(t.startRow>l)break;if(t.startRow<=c&&t.endRow>=l&&t.startColumn<=o&&t.endColumn>=s){a.push({startColumn:o,endColumn:s,startRow:c,endRow:l});break}}}return a}function Ff(e){e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn);let t={};for(let n of e)t[n.startRow]||(t[n.startRow]=[]),t[n.startRow].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startColumn-t.startColumn);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startColumn<=i.endColumn+1&&t.startRow===i.startRow&&t.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,t.endColumn):(n.push(i),i=t)}n.push(i)}return n}function If(e){e.sort((e,t)=>e.startColumn-t.startColumn||e.startRow-t.startRow);let t={};for(let n of e)t[n.startColumn]||(t[n.startColumn]=[]),t[n.startColumn].push(n);let n=[];for(let e in t){let r=t[+e];r.sort((e,t)=>e.startRow-t.startRow);let i=r[0];for(let e=1;e<r.length;e++){let t=r[e];t.startRow<=i.endRow+1&&t.startColumn===i.startColumn&&t.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,t.endRow):(n.push(i),i=t)}n.push(i)}return n}function Lf(e){return If(Ff(Pf(e)))}function Rf(e,t){let n=[];return e.forEach(e=>{n.push(...Uf.subtract(e,t))}),Uf.mergeRanges(n)}function zf(e,t){let n=Bf(e.startRow,e.endRow,t.startRow,t.endRow),r=Bf(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;let[i,a]=n,[o,s]=r;return{startRow:i,endRow:a,startColumn:o,endColumn:s,rangeType:Vf(e.rangeType,t.rangeType,i,a,o,s)}}function Bf(e,t,n,r){let i=isNaN(e)?-1/0:e,a=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,s=isNaN(r)?1/0:r,c=Math.max(i,o),l=Math.min(a,s);return c<=l?[c===-1/0?NaN:c,l===1/0?NaN:l]:null}function Vf(e,t,n,r,i,a){let o=e===void 0?Hf(n,r,i,a):e,s=t===void 0?Hf(n,r,i,a):t;return o===3||s===3?o===s?o:o===3?s:o:o===s?o:0}function Hf(e,t,n,r){let i=!isNaN(e)&&!isNaN(t),a=!isNaN(n)&&!isNaN(r);return i&&a?0:i?1:a?2:3}var Uf=class e{static clone(e){return e.rangeType===void 0?{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}:{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,t){return e==null||t==null?!1:e.endRow===t.endRow&&e.endColumn===t.endColumn&&e.startRow===t.startRow&&e.startColumn===t.startColumn&&(e.rangeType===t.rangeType||e.rangeType===void 0&&t.rangeType===0||t.rangeType===void 0&&e.rangeType===0)}static simpleRangesIntersect(e,t){let{startRow:n,endRow:r,startColumn:i,endColumn:a}=e,{startRow:o,endRow:s,startColumn:c,endColumn:l}=t;return n<=s&&r>=o&&i<=l&&a>=c}static intersects(e,t){if(e.rangeType===1&&t.rangeType===2||e.rangeType===2&&t.rangeType===1)return!0;if(e.rangeType===1&&t.rangeType===1)return e.startRow<=t.endRow&&e.endRow>=t.startRow;if(e.rangeType===2&&t.rangeType===2)return e.startColumn<=t.endColumn&&e.endColumn>=t.startColumn;let n=Number.isNaN(e.startRow)?0:e.startRow,r=Number.isNaN(e.endRow)?Ju-1:e.endRow,i=Number.isNaN(e.startColumn)?0:e.startColumn,a=Number.isNaN(e.endColumn)?Yu-1:e.endColumn,o=Number.isNaN(t.startRow)?0:t.startRow,s=Number.isNaN(t.endRow)?Ju-1:t.endRow,c=Number.isNaN(t.startColumn)?0:t.startColumn,l=Number.isNaN(t.endColumn)?Yu-1:t.endColumn,u=Math.abs(i+a-c-l),d=Math.abs(i-a)+Math.abs(c-l),f=Math.abs(n+r-o-s),p=Math.abs(n-r)+Math.abs(o-s);return u<=d&&f<=p}static doAnyRangesIntersect(e,t){let n=new _f;return n.load(e.map(e=>({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}))),t.some(e=>n.search({minX:e.startColumn,minY:e.startRow,maxX:e.endColumn,maxY:e.endRow}).length>0)}static getIntersects(e,t){let n=e.startRow,r=e.endRow,i=e.startColumn,a=e.endColumn,o=t.startRow,s=t.endRow,c=t.startColumn,l=t.endColumn,u,d,f,p;if(o<=r)d=o>=n?o:n;else return null;if(s>=n)p=s>=r?r:s;else return null;if(c<=a)u=c>i?c:i;else return null;if(l>=i)f=l>=a?a:l;else return null;return{startRow:d,endRow:p,startColumn:u,endColumn:f,rangeType:0}}static contains(e,t){return e.startRow<=t.startRow&&e.endRow>=t.endRow&&e.startColumn<=t.startColumn&&e.endColumn>=t.endColumn}static realContain(t,n){return e.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...e){return e.reduce((e,t)=>({startRow:Math.min(e.startRow,t.startRow),startColumn:Math.min(e.startColumn,t.startColumn),endRow:Math.max(e.endRow,t.endRow),endColumn:Math.max(e.endColumn,t.endColumn),rangeType:0}),e[0])}static realUnion(...t){let n=t.some(e=>e.rangeType===2),r=t.some(e=>e.rangeType===1),i=e.union(...t);return{startColumn:r?NaN:i.startColumn,endColumn:r?NaN:i.endColumn,startRow:n?NaN:i.startRow,endRow:n?NaN:i.endRow,rangeType:r?1:n?2:0}}static subtract(e,t){if(t.startRow>e.endRow||t.endRow<e.startRow||t.startColumn>e.endColumn||t.endColumn<e.startColumn)return[e];let n=[];t.startRow>=e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:t.startRow-1,endColumn:e.endColumn}),t.endRow<=e.endRow&&n.push({startRow:t.endRow+1,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});let r=Math.max(e.startRow,t.startRow),i=Math.min(e.endRow,t.endRow);return t.startColumn>=e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:t.startColumn-1}),t.endColumn<=e.endColumn&&n.push({startRow:r,startColumn:t.endColumn+1,endRow:i,endColumn:e.endColumn}),n.filter(e=>e.startRow<=e.endRow&&e.startColumn<=e.endColumn)}static mergeRanges(e){return Lf(e)}static splitIntoGrid(e){return Pf(e)}static subtractMulti(e,t){if(!t.length)return e;let n=e;return t.forEach(e=>{n=Rf(n,e)}),n}static hasIntersectionBetweenTwoRect(e,t){return!(e.left>t.right||e.right<t.left||e.top>t.bottom||e.bottom<t.top)}static getIntersectionBetweenTwoRect(e,t){let n=Math.max(e.left,t.left),r=Math.min(e.right,t.right),i=Math.max(e.top,t.top),a=Math.min(e.bottom,t.bottom);return r<=n||a<=i?null:{left:n,right:r,top:i,bottom:a,width:r-n,height:a-i}}static sort(e){return e.sort((e,t)=>e.startRow-t.startRow||e.startColumn-t.startColumn)}};T(Uf,`getRelativeRange`,(e,t)=>({startRow:e.startRow-t.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-t.startColumn,endColumn:e.endColumn-e.startColumn})),T(Uf,`getPositionRange`,(e,t,n)=>({...n||{},startRow:n&&[1,3].includes(n.startAbsoluteRefType||0)?n.startRow:e.startRow+t.startRow,endRow:n&&[1,3].includes(n.endAbsoluteRefType||0)?n.endRow:e.endRow+e.startRow+t.startRow,startColumn:n&&[2,3].includes(n.startAbsoluteRefType||0)?n.startColumn:e.startColumn+t.startColumn,endColumn:n&&[2,3].includes(n.endAbsoluteRefType||0)?n.endColumn:e.endColumn+e.startColumn+t.startColumn})),T(Uf,`moveHorizontal`,(e,t=0,n=0)=>({...e,startColumn:e.startColumn+t,endColumn:e.endColumn+t+n})),T(Uf,`moveVertical`,(e,t=0,n=0)=>({...e,startRow:e.startRow+t,endRow:e.endRow+t+n})),T(Uf,`moveOffset`,(e,t,n)=>{let r={...e};switch(e.startAbsoluteRefType){case 1:r.startColumn+=t;break;case 2:r.startRow+=n;break;case 3:break;default:r.startRow+=n,r.startColumn+=t;break}switch(e.endAbsoluteRefType){case 1:r.endColumn+=t;break;case 2:r.endRow+=n;break;case 3:break;default:r.endRow+=n,r.endColumn+=t;break}return r});function Wf(e,t){if(e.length===0||e[0].length===0)return null;let n=Array(e[0].length).fill(0),r=0,i=null;for(let a=0;a<e.length;a++){for(let r=0;r<e[0].length;r++)n[r]=t(e[a][r])?n[r]+1:0;let o=Gf(n);o.area>r&&(r=o.area,i={startColumn:o.start,startRow:a-o.height+1,endColumn:o.end,endRow:a})}return i}function Gf(e){let t=[],n=0,r={area:0,height:0,start:0,end:0},i=0;for(;i<e.length;)if(t.length===0||e[i]>=e[t[t.length-1]])t.push(i++);else{let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}for(;t.length>0;){let a=e[t.pop()],o=t.length===0?i:i-t[t.length-1]-1;a*o>n&&(n=a*o,r={area:n,height:a,start:t.length===0?0:t[t.length-1]+1,end:i-1})}return r}function Kf(e,t){pf.foreach(t,(t,n)=>{e[t][n]=void 0})}function qf(e,t){let n=e.toFullArray(),r=[];for(;;){let e=Wf(n,t);if(!e)break;r.push(e),Kf(n,e)}return r}function Jf(){let e=typeof crypto<`u`&&typeof crypto.getRandomValues==`function`?crypto:typeof self<`u`&&self.crypto&&typeof self.crypto.getRandomValues==`function`?self.crypto:typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`?window.crypto:void 0;return e==null?void 0:e.getRandomValues.bind(e)}function Yf(e,t){let n=``;for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function Xf(e,t,n){let r=256-256%t.length,i=Math.ceil(1.6*256*e/r),a=``;for(;a.length<e;){let o=n(new Uint8Array(i));for(let n=0;n<i&&a.length<e;n++){let e=o[n];e<r&&(a+=t[e%t.length])}}return a}function Zf(e=21,t=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`){if(!e)return``;let n=Jf();return n?Xf(e,t,n):Yf(e,t)}function Y(e=21,t){return Zf(e,t)}var Qf=class{constructor(e,t){T(this,`_values`,[]),T(this,`_keys`,[]),T(this,`_keyMaps`,new Map),this._values=e,this._keys=t,e.forEach(e=>{this._initKeyMap(e)})}_initKeyMap(e){this._keys.forEach(t=>{let n=e[t],r=this._keyMaps.get(t)||new Map;r.set(n,e),this._keyMaps.set(t,r)})}getValue(e,t){let n=t||this._keys;for(let t=0;t<n.length;t++){let r=this._keyMaps.get(n[t]);if(r!=null&&r.has(e))return r.get(e)}return null}hasValue(e){for(let t=0;t<this._keys.length;t++){let n=this._keyMaps.get(this._keys[t]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,t,n){let r=this.getValue(e);r&&Object.prototype.hasOwnProperty.call(r,t)&&(r[t]=n)}deleteValue(e,t){let n=this.getValue(e,t);if(n){this._keys.forEach(e=>{let t=this._keyMaps.get(e),r=n[e];t==null||t.delete(r)});let e=this._values.findIndex(e=>e===n);this._values.splice(e,1)}}getValues(){return this._values}getKeyMap(e){var t;return[...((t=this._keyMaps.get(e))==null?void 0:t.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}};function $f(e,t,n,r){return{forEach(i){for(let a=e;a<=t;a++)for(let e=n;e<=r;e++)i(a,e)}}}function ep(e){if(e==null||e.length===0)return NaN;let t=e.toLowerCase().split(``),n=t.length,r=e=>e.charCodeAt(0)-96,i=0,a=0;for(let e=0;e<n;e++)a=r(t[e]),i+=a*26**(n-e-1);return i===0?NaN:i-1}function tp(e){let t=``;for(;e>=0;)t=String.fromCharCode(e%26+65)+t,e=Math.floor(e/26)-1;return t}function np(e,t){let n=``;for(;t>0;)n+=e,t--;return n}function rp(e,t=!1){let n=97;return t&&(n=65),np(String.fromCharCode(e%26+n),Math.floor(e/26)+1)}function ip(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function ap(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function op(e=`index`,t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}let sp=function(e){return e.Text=`text`,e.SingleSelect=`singleSelect`,e.MultiSelect=`multiSelect`,e.Person=`person`,e.Group=`group`,e.Date=`date`,e.Attachment=`attachment`,e.Number=`number`,e.Checkbox=`checkbox`,e.Link=`link`,e.Formula=`formula`,e.Lookup=`lookup`,e.Flow=`flow`,e.Button=`button`,e.Numbering=`numbering`,e.Phone=`phone`,e.Email=`email`,e.Location=`location`,e.Barcode=`barcode`,e.Progress=`progress`,e.Currency=`currency`,e.Rating=`rating`,e.TwoWayLink=`twoWayLink`,e.RecordId=`recordId`,e.CreatedBy=`createdBy`,e.UpdatedBy=`updatedBy`,e.CreatedAt=`createdAt`,e.UpdatedAt=`updatedAt`,e.Summary=`summary`,e}({}),cp=function(e){return e.Grid=`grid`,e.Kanban=`kanban`,e.Calendar=`calendar`,e.Gantt=`gantt`,e.Gallery=`gallery`,e}({}),lp=function(e){return e.IS=`is`,e.IS_NOT=`isNot`,e.CONTAINS=`contains`,e.NOT_CONTAINS=`notContains`,e.IS_EMPTY=`isEmpty`,e.IS_NOT_EMPTY=`isNotEmpty`,e.GREATER_THAN=`greaterThan`,e.GREATER_THAN_OR_EQUAL=`greaterThanOrEqual`,e.LESS_THAN=`lessThan`,e.LESS_THAN_OR_EQUAL=`lessThanOrEqual`,e.BEFORE=`before`,e.AFTER=`after`,e}({}),up=function(e){return e.AND=`and`,e.OR=`or`,e}({}),dp=function(e){return e.ASC=`asc`,e.DESC=`desc`,e}({});function fp(e){var t,n,r,i,a;let o=(t=e.now)==null?Date.now():t,s=(n=e.primaryFieldId)==null?Y(6):n,c=(r=e.gridViewId)==null?Y(6):r,l=(i=e.recordCount)==null?5:i,u={id:s,name:(a=e.primaryFieldName)==null?`Name`:a,type:`text`,config:{placeholder:`bases.fieldConfig.textPlaceholder`}},d={},f=[],p={},m={},h={};for(let t=0;t<l;t++){let n=`${e.id}-record-${t+1}`;d[n]={id:n,values:{},orderKey:String(t+1).padStart(4,`0`),createdAt:o,updatedAt:o},f.push(n),p[n]=t,m[t]=n,h[t]={}}let g={id:c,tableId:e.id,name:`Grid`,type:`grid`,fieldOrder:[s],fieldSettings:{},config:{frozenFieldCount:1}};return{id:e.id,name:e.name,primaryFieldId:s,fieldOrder:[s],fields:{[s]:u},records:d,recordOrder:f,rowIndex:p,rowId:m,colIndex:{[s]:0},colId:{0:s},cellData:h,resources:{attachmentSets:{},attachments:{}},views:{[c]:g},viewOrder:[c]}}function pp(e=Y(),t=``,n=`zhCN`){let r=Date.now(),i=`table-1`;return{id:e,name:t,locale:n,appVersion:Re,schemaVersion:1,tableOrder:[i],tables:{[i]:fp({id:i,name:`Table 1`,now:r,recordCount:5})},createdAt:r,updatedAt:r}}var mp=class extends M{constructor(e={}){super(),T(this,`type`,n.UniverType.UNIVER_BASE),T(this,`_name$`,void 0),T(this,`name$`,void 0),T(this,`_snapshot`,void 0);let r=pp();this._snapshot=hp(z.commonExtend(r,e)),this._snapshot.id||(this._snapshot.id=`base-${Math.random().toString(36).slice(2,10)}`),this._name$=new t.BehaviorSubject(this._snapshot.name),this.name$=this._name$.asObservable()}getUnitId(){return this._snapshot.id}setName(e){this._snapshot.name=e,this._snapshot.updatedAt=Date.now(),this._name$.next(e)}getSnapshot(){return this._snapshot}checkTableName(e){return Object.values(this._snapshot.tables).some(t=>t.name.toLowerCase()===e.toLowerCase())}uniqueTableName(e){let t=e,n=1;for(;this.checkTableName(t);)t=`${e}${n}`,n++;return t}setSnapshot(e){this._snapshot=gp(e)?e:hp(e),this._name$.next(e.name)}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}dispose(){super.dispose(),this._name$.complete()}};function hp(e){var t;return delete e.compress,delete e.kind,Object.values((t=e.tables)==null?{}:t).forEach(e=>{vp(e)}),e}function gp(e){var t;return Object.values((t=e.tables)==null?{}:t).every(e=>_p(e))}function _p(e){var t,n;let r=(t=e.records)==null?{}:t,i=(n=e.fields)==null?{}:n;if(!Array.isArray(e.recordOrder)||!e.rowIndex||!e.rowId||!e.colIndex||!e.colId||!e.cellData||!e.resources||!e.resources.attachmentSets||!e.resources.attachments||Object.keys(r).length!==e.recordOrder.length)return!1;for(let t=0;t<e.recordOrder.length;t++){let n=e.recordOrder[t];if(!r[n]||e.rowIndex[n]!==t||e.rowId[t]!==n)return!1}for(let t=0;t<e.fieldOrder.length;t++){let n=e.fieldOrder[t];if(i[n]&&(e.colIndex[n]!==t||e.colId[t]!==n))return!1}return!0}function vp(e){var t,n;yp(e);let r=(t=e.records)==null?{}:t,i=(n=e.fields)==null?{}:n,a=bp(e,r),o=xp(e,i);e.recordOrder=a,Sp(e),Cp(e,i),wp(e,r,a),Tp(e,i,o),Ep(e,r,i)}function yp(e){let t=e.cd;t&&!e.cellData&&(e.cellData=Object.create(null),t.forEach(([t,n,r])=>{var i;e.cellData[t]=(i=e.cellData[t])==null?{}:i;let{c:a,...o}=r;e.cellData[t][n]=o}),delete e.cd)}function bp(e,t){var n,r;let i=(n=(r=e.recordOrder)==null?void 0:r.filter(e=>t[e]))==null?[]:n,a=new Set(i),o=Object.values(t).filter(e=>!a.has(e.id));return o.length?[...i,...o.sort((e,t)=>e.orderKey.localeCompare(t.orderKey)).map(e=>e.id)]:i}function xp(e,t){return e.fieldOrder.filter(e=>t[e])}function Sp(e){e.rowIndex={...e.rowIndex},e.rowId={...e.rowId},e.colIndex={...e.colIndex},e.colId={...e.colId},e.cellData={...e.cellData},e.resources={...e.resources},e.resources.attachmentSets={...e.resources.attachmentSets},e.resources.attachments={...e.resources.attachments}}function Cp(e,t){var n;Object.entries((n=e.cellData)==null?{}:n).forEach(([n,r])=>{var i;let a=Number(n);e.cellData[a]={...r},Object.entries((i=e.cellData[a])==null?{}:i).forEach(([n,r])=>{var i;let o=Number(n),s=(i=e.colId)==null?void 0:i[o];e.cellData[a][o]=Op(r,s?t[s]:void 0)})})}function wp(e,t,n){var r;n.forEach((t,n)=>{e.rowIndex[t]==null&&(e.rowIndex[t]=n)}),Object.entries((r=e.rowIndex)==null?{}:r).forEach(([n,r])=>{t[n]&&(e.rowId[r]=n)})}function Tp(e,t,n){var r;n.forEach((t,n)=>{e.colIndex[t]==null&&(e.colIndex[t]=n)}),Object.entries((r=e.colIndex)==null?{}:r).forEach(([n,r])=>{t[n]&&(e.colId[r]=n)})}function Ep(e,t,n){Object.values(t).forEach(t=>{var r;let i=e.rowIndex[t.id];i!=null&&(e.cellData[i]={...e.cellData[i]},Object.entries((r=t.values)==null?{}:r).forEach(([r,a])=>{let o=n[r];(o==null?void 0:o.type)===`attachment`&&Ap(e,t.id,r,a);let s=e.colIndex[r];if(s==null)return;let c=e.cellData[i][s];if(c!=null){e.cellData[i][s]=Op(c,o),Mp(c,o,a)&&(e.cellData[i][s]=Dp(a,o));return}e.cellData[i][s]=Dp(a,o)}))})}function Dp(e,t){if(kp(e))return(t==null?void 0:t.type)===`attachment`?{...e,v:``,t:1}:Op(e,t);if((t==null?void 0:t.type)===`attachment`)return{v:``,t:1};if(Np(t))return{v:Pp(e).join(`, `),t:1};if((t==null?void 0:t.type)===`link`&&e&&typeof e==`object`&&!Array.isArray(e)){var n,r;let t=e;return{v:String((n=(r=t.text)==null?t.url:r)==null?``:n),t:1}}return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`?{v:e,t:Ip(e)}:{v:null,t:null}}function Op(e,t){let n=Lp(e.t,e.v);if(n===void 0){let{t,...n}=e;return n}return{...e,t:n}}function kp(e){return!!e&&typeof e==`object`&&(Object.prototype.hasOwnProperty.call(e,`v`)||Object.prototype.hasOwnProperty.call(e,`t`)||Object.prototype.hasOwnProperty.call(e,`p`)||Object.prototype.hasOwnProperty.call(e,`f`)||Object.prototype.hasOwnProperty.call(e,`si`))}function Ap(e,t,n,r){let i=jp(r);e.resources={...e.resources},e.resources.attachmentSets={...e.resources.attachmentSets},e.resources.attachments={...e.resources.attachments};let a=`${n}${t}`;e.resources.attachmentSets[a]=i.map((t,n)=>{var r;let i=String((r=t.id)==null?`${a}${n}`:r),o={...t,id:i};return e.resources.attachments[i]=o,i})}function jp(e){if(e==null||e===``||kp(e)&&!(`id`in e)&&!(`name`in e))return[];let t=Array.isArray(e)?e:[e],n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r&&typeof r==`object`){let e={...r};Object.keys(e).length>0&&n.push(e);continue}n.push({id:`attachment-${e}`,name:String(r)})}return n}function Mp(e,t,n){return(t==null?void 0:t.type)===`attachment`?e.v!==``:Np(t)?Array.isArray(n)&&(e.v==null||e.v===``):!1}function Np(e){return(e==null?void 0:e.type)===`multiSelect`||(e==null?void 0:e.type)===`person`||(e==null?void 0:e.type)===`group`}function Pp(e){if(e==null||e===``)return[];let t=[];if(Array.isArray(e)){for(let n=0;n<e.length;n++){let r=Fp(e[n]);r&&t.push(r)}return t}let n=String(e).split(`,`);for(let e=0;e<n.length;e++){let r=n[e].trim();r&&t.push(r)}return t}function Fp(e){if(e==null)return``;if(typeof e==`string`||typeof e==`number`||typeof e==`boolean`)return String(e);if(typeof e==`object`){var t,n,r;let i=e;return String((t=(n=(r=i.id)==null?i.name:r)==null?i.text:n)==null?``:t)}return String(e)}function Ip(e){return e==null?null:typeof e==`number`?2:typeof e==`boolean`?3:1}function Lp(e,t){return e===1||e===2||e===3||e===4||e==null?e:Ip(t==null?null:t)}var Rp=f(((e,t)=>{var n=function(e){if(e=e||{},this.Promise=e.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=e.domainReentrant||!1,this.domainReentrant){if(typeof process>`u`||process.domain===void 0)throw Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=e.timeout||n.DEFAULT_TIMEOUT,this.maxOccupationTime=e.maxOccupationTime||n.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=e.maxExecutionTime||n.DEFAULT_MAX_EXECUTION_TIME,e.maxPending===1/0||Number.isInteger(e.maxPending)&&e.maxPending>=0?this.maxPending=e.maxPending:this.maxPending=n.DEFAULT_MAX_PENDING};n.DEFAULT_TIMEOUT=0,n.DEFAULT_MAX_OCCUPATION_TIME=0,n.DEFAULT_MAX_EXECUTION_TIME=0,n.DEFAULT_MAX_PENDING=1e3,n.prototype.acquire=function(e,t,n,r){if(Array.isArray(e))return this._acquireBatch(e,t,n,r);if(typeof t!=`function`)throw Error(`You must pass a function to execute`);var i=null,a=null,o=null;typeof n!=`function`&&(r=n,n=null,o=new this.Promise(function(e,t){i=e,a=t})),r=r||{};var s=!1,c=null,l=null,u=null,d=this,f=function(t,r,c){l&&(clearTimeout(l),l=null),u&&(clearTimeout(u),u=null),t&&(d.queues[e]&&d.queues[e].length===0&&delete d.queues[e],d.domainReentrant&&delete d.domains[e]),s||(o?r?a(r):i(c):typeof n==`function`&&n(r,c),s=!0),t&&d.queues[e]&&d.queues[e].length>0&&d.queues[e].shift()()},p=function(n){if(s)return f(n);c&&(clearTimeout(c),c=null),d.domainReentrant&&n&&(d.domains[e]=process.domain);var i=r.maxExecutionTime||d.maxExecutionTime;if(i&&(u=setTimeout(function(){d.queues[e]&&f(n,Error(`Maximum execution time is exceeded `+e))},i)),t.length===1){var a=!1;try{t(function(e,t){a||(a=!0,f(n,e,t))})}catch(e){a||(a=!0,f(n,e))}}else d._promiseTry(function(){return t()}).then(function(e){f(n,void 0,e)},function(e){f(n,e)})};d.domainReentrant&&process.domain&&(p=process.domain.bind(p));var m=r.maxPending||d.maxPending;if(!d.queues[e])d.queues[e]=[],p(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[e])p(!1);else if(d.queues[e].length>=m)f(!1,Error(`Too many pending tasks in queue `+e));else{var h=function(){p(!0)};r.skipQueue?d.queues[e].unshift(h):d.queues[e].push(h);var g=r.timeout||d.timeout;g&&(c=setTimeout(function(){c=null,f(!1,Error(`async-lock timed out in queue `+e))},g))}var _=r.maxOccupationTime||d.maxOccupationTime;if(_&&(l=setTimeout(function(){d.queues[e]&&f(!1,Error(`Maximum occupation time is exceeded in queue `+e))},_)),o)return o},n.prototype._acquireBatch=function(e,t,n,r){typeof n!=`function`&&(r=n,n=null);var i=this,a=function(e,t){return function(n){i.acquire(e,t,n,r)}},o=e.reduceRight(function(e,t){return a(t,e)},t);if(typeof n==`function`)o(n);else return new this.Promise(function(e,t){o.length===1?o(function(n,r){n?t(n):e(r)}):e(o())})},n.prototype.isBusy=function(e){return e?!!this.queues[e]:Object.keys(this.queues).length>0},n.prototype._promiseTry=function(e){try{return this.Promise.resolve(e())}catch(e){return this.Promise.reject(e)}},t.exports=n})),zp=h(f(((e,t)=>{t.exports=Rp()}))());let Bp=new Set([`true`,`false`]);function Vp(e){return Bp.has(e.toLowerCase())}function Hp(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=Object.prototype.hasOwnProperty.bind(t);for(let r=0;r<n.length;r++){let a=n[r];if(!i(a)||e[a]!==t[a])return!1}return!0}function Up(){}function Wp(e,t=16){let n=0,r=null;return function(...i){let a=Date.now();a-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=a,e.apply(this,i)},t)):(n=a,e.apply(this,i))}}let Gp=function(e){return e[e.Style=1]=`Style`,e[e.Value=2]=`Value`,e}({});function Kp(e){return`sheet_interceptor_${e}`}let qp=e=>function(t,n){let r=-1,i=t,a=!1,o=e=>(a=!0,e);for(let t=0;t<e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);r=t;let s=e[t];if(a=!1,i=s.handler(i,n,o),!a)break}return i};var Jp=class{constructor(e){T(this,`_interceptorsByName`,new Map),T(this,`_interceptorPoints`,void 0),this._interceptorPoints=e}fetchThroughInterceptors(e,t){let n=e,r=this._interceptorsByName.get(n);return t&&(r=r.filter(t)),qp(r||[])}intercept(e,t){let n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);let r=this._interceptorsByName.get(n);return r.push(t),this._interceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>ze(this._interceptorsByName.get(n),t)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}};function Yp(e){return`sheet_async_interceptor_${e}`}let Xp=e=>async function(t,n){let r=-1,i=t;for(let t=0;t<=e.length;t++){if(t<=r)throw Error(`[SheetInterceptorService]: next() called multiple times!`);if(r=t,t===e.length)return i;let a=e[t],o=!1;if(i=await a.handler(i,n,async e=>(o=!0,e)),!o)break}return i};var Zp=class{constructor(e){T(this,`_asyncInterceptorsByName`,new Map),T(this,`_asyncInterceptorPoints`,void 0),this._asyncInterceptorPoints=e}fetchThroughAsyncInterceptors(e,t){let n=e,r=this._asyncInterceptorsByName.get(n);return t&&(r=r.filter(t)),Xp(r||[])}async interceptAsync(e,t){let n=e;this._asyncInterceptorsByName.has(n)||this._asyncInterceptorsByName.set(n,[]);let r=this._asyncInterceptorsByName.get(n);return r.push(t),this._asyncInterceptorsByName.set(n,r.sort((e,t)=>{var n,r;return((n=t.priority)==null?0:n)-((r=e.priority)==null?0:r)})),()=>ze(this._asyncInterceptorsByName.get(n),t)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}};function Qp(e){return e.map(e=>e/255)}function $p(e){return e.map(e=>Math.round(e*255))}function em([e,t,n]){let r=Math.max(e,t,n),i=Math.min(e,t,n),a=(r+i)/2,o=0,s=0;if(r!==i){let c=r-i;switch(s=a>.5?c/(2-r-i):c/(r+i),r){case e:o=(t-n)/c+(t<n?6:0);break;case t:o=(n-e)/c+2;break;case n:o=(e-t)/c+4;break}o/=6}return[o,s,a]}function tm(e,t,n){let r=[e,t,n].map(e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function nm(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function rm(e,t,n){let r,i,a;if(t===0)r=i=a=n;else{let o=(e,t,n)=>{let r=n;return r<0&&(r+=1),r>1&&--r,r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return[r,i,a]}let im={r:1,g:1,b:1},am={r:0,g:0,b:0},om=tm(im.r,im.g,im.b),sm=tm(am.r,am.g,am.b);function cm(e){let t=nm(om,tm(e[0],e[1],e[2])),n=em(e),r=1-n[2],i,a,o;do i=rm(n[0],n[1],r),a=tm(i[0],i[1],i[2]),o=nm(a,sm),r+=.01;while(r<=1&&r>=0&&Math.abs(o-t)<.01);return i}function lm(e){return $p(cm(Qp(e)))}let um=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function dm(e){let t=e[0],n=e[1],r=e[2],i=[um[0][0]*t+um[0][1]*n+um[0][2]*r+um[0][4],um[1][0]*t+um[1][1]*n+um[1][2]*r+um[1][4],um[2][0]*t+um[2][1]*n+um[2][2]*r+um[2][4]];return i=i.map(e=>e>1?1:e<0?0:e),i}function fm(e){return $p(dm(Qp(e)))}var pm=class{constructor(){T(this,`cursor`,0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}};function mm(e,t){for(let n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function hm(e){return/^-?\d+(\.\d+)?$/.test(e)}function gm(e){return hm(e)?Number(e)<=2**53-1:!1}function _m(e){return Number(e)>2**53-1||e.length>=18}var vm=class e{constructor(){T(this,`_data`,[])}static create(){return new e}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){let t=this._data.indexOf(e);this._data.splice(t,1)}getData(){return this._data}},ym=class e{constructor(){T(this,`_data`,new Map)}static create(){return new e}add(e,t){this._data.has(e)||this._data.set(e,t)}delete(e){this._data.delete(e)}getData(){return this._data}};function bm(e){let t=new MessageChannel,n=!1,r=()=>{t.port1.onmessage=null,t.port1.close(),t.port2.close()},i=()=>{n||(n=!0,r(),e())};return t.port1.onmessage=i,t.port2.postMessage(null),()=>{n||(n=!0,r())}}function xm(e,t){return t.forEach(t=>e.add(t)),e}let Sm=`para_`;function Cm(e){let t=`${Sm}${Y(12)}`;for(;e.has(t);)t=`${Sm}${Y(12)}`;return e.add(t),t}function wm(e,t){var n;let r=Dm(e),i=new Set;for(let e of(n=r.paragraphs)==null?[]:n)e.paragraphId=Cm(i);return r}function Tm(e,t,n){let r=Om(e);return n!==!1&&Em(r.paragraphId)&&!t.has(r.paragraphId)?(t.add(r.paragraphId),r):(r.paragraphId=Cm(t),r)}function Em(e){return typeof e==`string`&&e.startsWith(`para_`)&&e.length>5}function Dm(e){return JSON.parse(JSON.stringify(e))}function Om(e){return JSON.parse(JSON.stringify(e))}let km=`section_`;function Am(e){let t=`${km}${Y(12)}`;for(;e.has(t);)t=`${km}${Y(12)}`;return e.add(t),t}function jm(e,t,n=!0){let r=z.deepClone(e);return n&&Mm(r.sectionId)&&!t.has(r.sectionId)?(t.add(r.sectionId),r):(r.sectionId=Am(t),r)}function Mm(e){return typeof e==`string`&&e.startsWith(`section_`)&&e.length>8}function Nm(e=Y(6),t=`enUS`,n=``,r=2){let i={id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
3
3
|
`,textRuns:[],customBlocks:[],tables:[],columnGroups:[],blockRanges:[],customRanges:[],customDecorations:[],paragraphs:[{startIndex:0,paragraphId:Cm(new Set),paragraphStyle:{lineSpacing:1}}],sectionBreaks:[{sectionId:Am(new Set),startIndex:1}]},documentStyle:{pageSize:lf.A4,documentFlavor:r,marginTop:72,marginBottom:72,marginRight:72,marginLeft:72,autoHyphenation:1,doNotHyphenateCaps:0,consecutiveHyphenLimit:2,defaultHeaderId:``,defaultFooterId:``,evenPageHeaderId:``,evenPageFooterId:``,firstPageHeaderId:``,firstPageFooterId:``,evenAndOddHeaders:0,useFirstPageHeaderFooter:0,marginHeader:30,marginFooter:30},settings:{}};return r===2&&(i.body.paragraphs[0].paragraphStyle={},i.documentStyle.defaultParagraphStyle={spaceAbove:{v:0},lineSpacing:of,spaceBelow:{v:12}},i.documentStyle.pageSize={width:df.medium,height:842/.75},i.documentStyle.marginTop=50,i.documentStyle.marginBottom=50,i.documentStyle.marginRight=50,i.documentStyle.marginLeft=50,i.documentStyle.renderConfig={zeroWidthParagraphBreak:0,vertexAngle:0,centerAngle:0,background:{rgb:`#ccc`}}),i}var Pm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e,t){if(Array.isArray(t))return!1;for(let n in e)if(!r(e[n],t[n]))return!1;for(let n in t)if(e[n]===void 0)return!1;return!0}function n(e,t){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function r(e,r){return e===r?!0:e===null||r===null||typeof e!=`object`||typeof r!=`object`?!1:Array.isArray(e)?n(e,r):t(e,r)}e.default=r})),Fm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(e){if(e===null)return null;if(Array.isArray(e))return e.map(t);if(typeof e==`object`){let n={};for(let r in e)n[r]=t(e[r]);return n}else return e}e.default=t})),Im=f((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(e,t){if(!e)throw Error(t)}let n=e=>typeof e==`object`&&!!e&&!Array.isArray(e),r=(e,t)=>typeof e==typeof t?e>t:typeof e==`string`&&typeof t==`number`;function i(e,t){for(let n in e){let r=n;t.write(r,e[r])}}e.isValidPathItem=e=>typeof e==`number`||typeof e==`string`&&e!==`__proto__`;var a=class{constructor(e=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=e}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(){let e=[],t=this.container,r=this.parents.length-1,i=this.idx;for(;i>=0;)e.unshift(t[i]),i===0?(i=this.indexes[r*2],t=this.parents[r--]):i-=n(t[i-1])?2:1;return e}},o=class e extends a{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 e;return this.container&&this.container.length>this.idx+1&&n(e=this.container[this.idx+1])?e:null}descendFirst(){let e=this.idx+1;if(!this.container||e>=this.container.length||n(this.container[e])&&e+1>=this.container.length)return!1;n(this.container[e])&&e++;let t=this.container[e];return Array.isArray(t)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(e),this.idx=0,this.container=t):this.idx=e,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;let e=this.indexes[this.indexes.length-1]+1,n=this.parents[this.parents.length-1];return e>=n.length?!1:(t(!isNaN(e)),this.indexes[this.indexes.length-1]=e,this.container=n[e],!0)}_init(e,t,n,r){this.container=e,this.idx=t,this.parents=n.slice(),this.indexes=r.slice()}clone(){let t=new e;return t._init(this.container,this.idx,this.parents,this.indexes),t}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(e,t){let n=this.getComponent();n&&t(n,e);for(let n of this)e&&e.descend(n),this.traverse(e,t),e&&e.ascend()}eachPick(e,t){this.traverse(e,(e,n)=>{e.p!=null&&t(e.p,n)})}eachDrop(e,t){this.traverse(e,(e,n)=>{e.d!=null&&t(e.d,n)})}};e.ReadCursor=o;var s=class extends a{constructor(e=null){super(e),this.pendingDescent=[],this._op=e}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let e=0;e<this.pendingDescent.length;e++){let i=this.pendingDescent[e],a=this.idx+1;if(a<this.container.length&&n(this.container[a])&&a++,t(a===this.container.length||!n(this.container[a])),a===this.container.length)this.container.push(i),this.idx=a;else if(this.container[a]===i)this.idx=a;else{if(!Array.isArray(this.container[a])){let e=this.container.splice(a,this.container.length-a);this.container.push(e),this.lcIdx>-1&&(this.lcIdx=a)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(i,this.container[this.lcIdx][0])),a=this.lcIdx+1,this.lcIdx=-1);a<this.container.length&&r(i,this.container[a][0]);)a++;if(this.indexes.push(a),this.idx=0,a<this.container.length&&this.container[a][0]===i)this.container=this.container[a];else{let e=[i];this.container.splice(a,0,e),this.container=e}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();let e=this.idx+1;if(e<this.container.length&&n(this.container[e]))return this.container[e];{let t={};return this.container.splice(e,0,t),t}}write(e,n){let r=this.getComponent();t(r[e]==null||r[e]===n,`Internal consistency error: Overwritten component. File a bug`),r[e]=n}get(){return this._op}descend(t){if(!e.isValidPathItem(t))throw Error(`Invalid JSON key`);this.pendingDescent.push(t)}descendPath(e){return this.pendingDescent.push(...e),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(e,n=i){if(e===null)return;if(t(Array.isArray(e)),e===this._op)throw Error(`Cannot merge into my own tree`);let r=this.lcIdx,a=this.parents.length,o=0;for(let t=0;t<e.length;t++){let r=e[t];typeof r==`string`||typeof r==`number`?(o++,this.descend(r)):Array.isArray(r)?this.mergeTree(r,n):typeof r==`object`&&n(r,this)}for(;o--;)this.ascend();this.lcIdx=this.parents.length===a?r:-1}at(e,t){this.descendPath(e),t(this);for(let t=0;t<e.length;t++)this.ascend();return this}writeAtPath(e,t,n){return this.at(e,()=>this.write(t,n)),this.reset(),this}writeMove(e,t,n=0){return this.writeAtPath(e,`p`,n).writeAtPath(t,`d`,n)}getPath(){let e=super.getPath();return e.push(...this.pendingDescent),e}};e.WriteCursor=s,e.writeCursor=()=>new s,e.readCursor=e=>new o(e);function c(e,t,n){let i,a;a=i=e?e.descendFirst():!1;function o(i){let o;for(;a;){let s=o=e.getKey();if(i!=null){let n=!1;if(t&&typeof s==`number`&&(o=t(s,e.getComponent()),o<0&&(o=~o,n=!0)),r(o,i))return null;if(o===i&&!n)return e}n&&typeof o==`number`&&n(o,e.getComponent()),a=e.nextSibling()}return null}return o.end=()=>{i&&e.ascend()},o}e.advancer=c;function l(e,t,n){let i,a,o,s;for(i=a=e&&e.descendFirst(),o=s=t&&t.descendFirst();i||o;){let a=i?e.getKey():null,s=o?t.getKey():null;a!==null&&s!==null&&(r(s,a)?s=null:a!==s&&(a=null)),n(a==null?s:a,a==null?null:e,s==null?null:t),a!=null&&i&&(i=e.nextSibling()),s!=null&&o&&(o=t.nextSibling())}a&&e.ascend(),s&&t.ascend()}e.eachChildOf=l})),Lm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,(function(e){e[e.RM_UNEXPECTED_CONTENT=1]=`RM_UNEXPECTED_CONTENT`,e[e.DROP_COLLISION=2]=`DROP_COLLISION`,e[e.BLACKHOLE=3]=`BLACKHOLE`})(e.ConflictType||(e.ConflictType={}))})),Rm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uniToStrPos=e.strPosToUni=void 0,e.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){let t=e.charCodeAt(r);t>=55296&&t<=57343&&(n++,r++)}if(r!==t)throw Error(`Invalid offset - splits unicode bytes`);return r-n},e.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){let t=e.charCodeAt(n);n+=t>=55296&&t<=57343?2:1}return n}})),zm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;let t=Rm(),n=t=>{if(!Array.isArray(t))throw Error(`Op must be an array of components`);let n=null;for(let r=0;r<t.length;r++){let i=t[r];switch(typeof i){case`object`:if(typeof i.d!=`number`&&typeof i.d!=`string`)throw Error(`Delete must be number or string`);if(e.dlen(i.d)<=0)throw Error(`Deletes must not be empty`);break;case`string`:if(!(i.length>0))throw Error(`Inserts cannot be empty`);break;case`number`:if(!(i>0))throw Error(`Skip components must be >0`);if(typeof n==`number`)throw Error(`Adjacent skip components should be combined`);break}n=i}if(typeof n==`number`)throw Error(`Op has a trailing skip`)};function r(n,r){let i=0,a=0;for(let o=0;o<n.length;o++){let s=n[o];switch(r(s,i,a),typeof s){case`object`:i+=e.dlen(s.d);break;case`string`:a+=t.strPosToUni(s);break;case`number`:i+=s,a+=s;break}}}e.eachOp=r;function i(e,t){let n=[],i=s(n);return r(e,(e,n,r)=>{i(t(e,n,r))}),d(n)}let a=e=>e,o=e=>i(e,a);e.dlen=e=>typeof e==`number`?e:t.strPosToUni(e);let s=t=>n=>{if(!(!n||n.d===0||n.d===``))if(t.length===0)t.push(n);else if(typeof n==typeof t[t.length-1])if(typeof n==`object`){let r=t[t.length-1];r.d=typeof r.d==`string`&&typeof n.d==`string`?r.d+n.d:e.dlen(r.d)+e.dlen(n.d)}else t[t.length-1]+=n;else t.push(n)},c=e=>typeof e==`number`?e:typeof e==`string`?t.strPosToUni(e):typeof e.d==`number`?e.d:t.strPosToUni(e.d);e.uniSlice=(e,n,r)=>{let i=t.uniToStrPos(e,n),a=r==null?1/0:t.uniToStrPos(e,r);return e.slice(i,a)};let l=(t,n,r)=>typeof t==`number`?r==null?t-n:Math.min(t,r)-n:e.uniSlice(t,n,r),u=n=>{let r=0,i=0;return{take:(a,o)=>{if(r===n.length)return a===-1?null:a;let s=n[r],c;if(typeof s==`number`)return a===-1||s-i<=a?(c=s-i,++r,i=0,c):(i+=a,a);if(typeof s==`string`){if(a===-1||o===`i`||t.strPosToUni(s.slice(i))<=a)return c=s.slice(i),++r,i=0,c;{let e=i+t.uniToStrPos(s.slice(i),a);return c=s.slice(i,e),i=e,c}}else if(a===-1||o===`d`||e.dlen(s.d)-i<=a)return c={d:l(s.d,i)},++r,i=0,c;else{let e=l(s.d,i,i+a);return i+=a,{d:e}}},peek:()=>n[r]}},d=e=>(e.length>0&&typeof e[e.length-1]==`number`&&e.pop(),e);function f(r,i,a){if(a!==`left`&&a!==`right`)throw Error(`side (`+a+`) must be 'left' or 'right'`);n(r),n(i);let o=[],l=s(o),{take:f,peek:p}=u(r);for(let n=0;n<i.length;n++){let r=i[n],o,s;switch(typeof r){case`number`:for(o=r;o>0;)s=f(o,`i`),l(s),typeof s!=`string`&&(o-=c(s));break;case`string`:a===`left`&&typeof p()==`string`&&l(f(-1)),l(t.strPosToUni(r));break;case`object`:for(o=e.dlen(r.d);o>0;)switch(s=f(o,`i`),typeof s){case`number`:o-=s;break;case`string`:l(s);break;case`object`:o-=e.dlen(s.d)}break}}let m;for(;m=f(-1);)l(m);return d(o)}function p(r,i){n(r),n(i);let a=[],o=s(a),{take:f}=u(r);for(let n=0;n<i.length;n++){let r=i[n],a,s;switch(typeof r){case`number`:for(a=r;a>0;)s=f(a,`d`),o(s),typeof s!=`object`&&(a-=c(s));break;case`string`:o(r);break;case`object`:a=e.dlen(r.d);let n=0;for(;n<a;)switch(s=f(a-n,`d`),typeof s){case`number`:o({d:l(r.d,n,n+s)}),n+=s;break;case`string`:n+=t.strPosToUni(s);break;case`object`:o(s)}break}}let p;for(;p=f(-1);)o(p);return d(a)}let m=(n,r)=>{let i=0;for(let a=0;a<r.length&&n>i;a++){let o=r[a];switch(typeof o){case`number`:i+=o;break;case`string`:let r=t.strPosToUni(o);i+=r,n+=r;break;case`object`:n-=Math.min(e.dlen(o.d),n-i);break}}return n},h=(e,t)=>typeof e==`number`?m(e,t):e.map(e=>m(e,t));function g(e,t,n){return i(e,(e,r)=>typeof e==`object`&&typeof e.d==`number`?{d:n.slice(t,r,r+e.d)}:e)}function _(e){return i(e,e=>{switch(typeof e){case`object`:if(typeof e.d==`number`)throw Error(`Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.`);return e.d;case`string`:return{d:e};case`number`:return e}})}function v(e){return i(e,e=>typeof e==`object`&&typeof e.d==`string`?{d:t.strPosToUni(e.d)}:e)}function y(e){let t=!0;return r(e,e=>{typeof e==`object`&&typeof e.d==`number`&&(t=!1)}),t}function b(t){return{name:`text-unicode`,uri:`http://sharejs.org/types/text-unicode`,trim:d,normalize:o,checkOp:n,create(e=``){if(typeof e!=`string`)throw Error(`Initial data must be a string`);return t.create(e)},apply(r,i){n(i);let a=t.builder(r);for(let t=0;t<i.length;t++){let n=i[t];switch(typeof n){case`number`:a.skip(n);break;case`string`:a.append(n);break;case`object`:a.del(e.dlen(n.d));break}}return a.build()},transform:f,compose:p,transformPosition:m,transformSelection:h,isInvertible:y,makeInvertible(e,n){return g(e,n,t)},stripInvertible:v,invert:_,invertWithDoc(e,n){return _(g(e,n,t))},isNoop:e=>e.length===0}}e.default=b})),Bm=f((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zm(),n=Rm();function r(e,r){return{get:e,getLength(){return e().length},insert(t,i,a){return r([n.strPosToUni(e(),t),i],a)},remove(t,i,a){return r([n.strPosToUni(e(),t),{d:i}],a)},_onOp(e){t.eachOp(e,(e,n,r)=>{switch(typeof e){case`string`:this.onInsert&&this.onInsert(r,e);break;case`object`:let n=t.dlen(e.d);this.onRemove&&this.onRemove(r,n)}})},onInsert:null,onRemove:null}}e.default=r,r.provides={text:!0}})),Vm=f((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)Object.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;let a=Rm(),o=r(zm()),s=i(Bm()),c={create(e){return e},toString(e){return e},builder(e){if(typeof e!=`string`)throw Error(`Invalid document snapshot: `+e);let t=[];return{skip(n){let r=a.uniToStrPos(e,n);if(r>e.length)throw Error(`The op is too long for this document`);t.push(e.slice(0,r)),e=e.slice(r)},append(e){t.push(e)},del(t){e=e.slice(a.uniToStrPos(e,t))},build(){return t.join(``)+e}}},slice:o.uniSlice},l=o.default(c);e.type=Object.assign(Object.assign({},l),{api:s.default}),e.insert=(e,t)=>t.length===0?[]:e===0?[t]:[e,t],e.remove=(e,t)=>o.dlen(t)===0?[]:e===0?[{d:t}]:[e,{d:t}];var u=zm();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return u.default}})})),Hm=f((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;let n=t(Pm()),r=t(Fm()),i=Im(),a=Lm(),o=()=>{};function s(e,t){if(!e)throw Error(t)}let c=!1;e.type={name:`json1`,uri:`http://sharejs.org/types/JSONv1`,readCursor:i.readCursor,writeCursor:i.writeCursor,create:e=>e,isNoop:e=>e==null,setDebug(e){c=e,o.quiet=!e},registerSubtype:y,checkValidOp:D,normalize:O,apply:k,transformPosition:A,compose:j,tryTransform:ee,transform:R,makeInvertible:P,invert:M,invertWithDoc:F,RM_UNEXPECTED_CONTENT:a.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:a.ConflictType.DROP_COLLISION,BLACKHOLE:a.ConflictType.BLACKHOLE,transformNoConflict:(e,t,n)=>re(()=>!0,e,t,n),typeAllowingConflictsPred:t=>Object.assign(Object.assign({},e.type),{transform:(e,n,r)=>re(t,e,n,r)})};let l=e=>e?e.getComponent():null;function u(e){return e&&typeof e==`object`&&!Array.isArray(e)}let d=e=>Array.isArray(e)?e.slice():typeof e==`object`&&e?Object.assign({},e):e,f=e=>e&&(e.p!=null||e.r!==void 0),p=e=>e&&(e.d!=null||e.i!==void 0);function m(e,t){return s(e!=null),typeof t==`number`?(s(Array.isArray(e),`Invalid key - child is not an array`),(e=e.slice()).splice(t,1)):(s(u(e),`Invalid key - child is not an object`),delete(e=Object.assign({},e))[t]),e}function h(e,t,n){return typeof t==`number`?(s(e!=null,`Container is missing for key`),s(Array.isArray(e),`Cannot use numerical key for object container`),s(e.length>=t,`Cannot insert into out of bounds index`),e.splice(t,0,n)):(s(u(e),`Cannot insert into missing item`),s(e[t]===void 0,`Trying to overwrite value at key. Your op needs to remove it first`),e[t]=n),n}e.removeOp=(e,t=!0)=>i.writeCursor().writeAtPath(e,`r`,t).get(),e.moveOp=(e,t)=>i.writeCursor().writeMove(e,t).get(),e.insertOp=(e,t)=>i.writeCursor().writeAtPath(e,`i`,t).get(),e.replaceOp=(e,t,n)=>i.writeCursor().at(e,e=>{e.write(`r`,t),e.write(`i`,n)}).get(),e.editOp=(e,t,n,r=!1)=>i.writeCursor().at(e,e=>w(e,t,n,r)).get();let g=(e,t)=>e!=null&&(typeof t==`number`?Array.isArray(e):typeof e==`object`),_=(e,t)=>g(e,t)?e[t]:void 0,v={};function y(e){let t=e.type?e.type:e;t.name&&(v[t.name]=t),t.uri&&(v[t.uri]=t)}let b=e=>{let t=v[e];if(t)return t;throw Error(`Missing type: `+e)};y(Vm());let x=(e,t)=>e+t;y({name:`number`,apply:x,compose:x,invert:e=>-e,transform:e=>e});let S=e=>e==null?null:e.et?b(e.et):e.es?v[`text-unicode`]:e.ena==null?null:v.number,C=e=>e.es?e.es:e.ena==null?e.e:e.ena,w=(e,t,n,r=!1)=>{let[i,a]=typeof t==`string`?[b(t),t]:[t,t.name];!r&&i.isNoop&&i.isNoop(n)||(a===`number`?e.write(`ena`,n):a===`text-unicode`?e.write(`es`,n):(e.write(`et`,a),e.write(`e`,n)))};function T(e){s(typeof e==`number`),s(e>=0),s(e===(0|e))}function E(e){typeof e==`number`?T(e):s(typeof e==`string`)}function D(e){if(e===null)return;let t=new Set,n=new Set,r=e=>{let r=!0,i=!1;for(let a in e){let o=e[a];if(r=!1,s(a===`p`||a===`r`||a===`d`||a===`i`||a===`e`||a===`es`||a===`ena`||a===`et`,`Invalid component item '`+a+`'`),a===`p`)T(o),s(!t.has(o)),t.add(o),s(e.r===void 0);else if(a===`d`)T(o),s(!n.has(o)),n.add(o),s(e.i===void 0);else if(a===`e`||a===`es`||a===`ena`){s(!i),i=!0;let t=S(e);s(t,`Missing type in edit`),t.checkValidOp&&t.checkValidOp(C(e))}}s(!r)},a=(e,t,n)=>{if(!Array.isArray(e))throw Error(`Op must be null or a list`);if(e.length===0)throw Error(`Empty descent`);t||E(e[0]);let o=1,c=0,l=0;for(let t=0;t<e.length;t++){let u=e[t];if(s(u!=null),Array.isArray(u)){let e=a(u,!1,n);if(c){let t=typeof l,n=typeof e;t===n?s(l<e,`descent keys are not in order`):s(t===`number`&&n===`string`)}l=e,c++,o=3}else typeof u==`object`?(s(o===1,`Prev not scalar - instead ${o}`),r(u),o=2):(s(o!==3),E(u),s(i.isValidPathItem(u),`Invalid path key`),o=1)}return s(c!==1,`Operation makes multiple descents. Remove some []`),s(o===2||o===3),e[0]};a(e,!0,!1),s(t.size===n.size,`Mismatched picks and drops in op`);for(let e=0;e<t.size;e++)s(t.has(e)),s(n.has(e))}function O(e){let t=0,n=[],r=i.writeCursor();return r.mergeTree(e,(e,r)=>{let i=S(e);if(i){let t=C(e);w(r,i,i.normalize?i.normalize(t):t)}for(let i of[`r`,`p`,`i`,`d`])if(e[i]!==void 0){let o=i===`p`||i===`d`?(a=e[i],n[a]==null&&(n[a]=t++),n[a]):e[i];r.write(i,o)}var a}),r.get()}function k(e,t){if(o.quiet=!c,D(t),t===null)return e;let n=[];return function e(t,r){let i=t,a=0,o={root:t},c=0,l=o,u=`root`;function f(){for(;c<a;c++){let e=r[c];typeof e!=`object`&&(s(g(l,u)),l=l[u]=d(l[u]),u=e)}}for(;a<r.length;a++){let t=r[a];if(Array.isArray(t)){let n=e(i,t);n!==i&&n!==void 0&&(f(),i=l[u]=n)}else if(typeof t==`object`){t.d==null?t.i!==void 0&&(f(),i=h(l,u,t.i)):(f(),i=h(l,u,n[t.d]));let e=S(t);if(e)f(),i=l[u]=e.apply(i,C(t));else if(t.e!==void 0)throw Error(`Subtype `+t.et+` undefined`)}else i=_(i,t)}return o.root}(e=function e(t,r){let i=[],a=0;for(;a<r.length;a++){let e=r[a];if(Array.isArray(e))break;typeof e!=`object`&&(i.push(t),t=_(t,e))}for(let n=r.length-1;n>=a;n--)t=e(t,r[n]);for(--a;a>=0;a--){let e=r[a];if(typeof e!=`object`){let n=i.pop();t=t===_(n,e)?n:t===void 0?m(n,e):(c=e,l=t,(o=d(o=n))[c]=l,o)}else f(e)&&(s(t!==void 0,`Cannot pick up or remove undefined`),e.p!=null&&(n[e.p]=t),t=void 0)}var o,c,l;return t}(e,t),t)}function A(e,t){e=e.slice(),D(t);let n=i.readCursor(t),r,a,o=!1,s=[];for(let t=0;;t++){let c=e[t],l=n.getComponent();if(l&&(l.r===void 0?l.p!=null&&(o=!1,r=l.p,a=t):o=!0),t>=e.length)break;let u=0,d=i.advancer(n,void 0,(e,t)=>{f(t)&&u++});s.unshift(d);let p=d(c);if(typeof c==`number`&&(e[t]-=u),!p)break}if(s.forEach(e=>e.end()),o)return null;let c=()=>{let t=0;if(r!=null){let r=n.getPath();t=r.length,e=r.concat(e.slice(a))}for(;t<e.length;t++){let r=e[t],a=l(n),o=S(a);if(o){let n=C(a);o.transformPosition&&(e[t]=o.transformPosition(e[t],n));break}let s=0,c=i.advancer(n,(e,t)=>p(t)?~(e-s):e-s,(e,t)=>{p(t)&&s++})(r);if(typeof r==`number`&&(e[t]+=s),!c)break}};return r==null?c():n.eachDrop(null,e=>{e===r&&c()}),e}function j(e,t){if(D(e),D(t),e==null)return t;if(t==null)return e;let n=0,r=i.readCursor(e),a=i.readCursor(t),o=i.writeCursor(),c=[],u=[],d=[],m=[],h=[],g=[],_=new Set;r.traverse(null,e=>{e.p!=null&&(d[e.p]=r.clone())}),a.traverse(null,e=>{e.d!=null&&(m[e.d]=a.clone())});let v=i.writeCursor();return function e(t,r,a,o,v,y,b,x){s(r||a);let T=l(r),E=l(a),D=!!E&&E.r!==void 0,O=!!T&&T.i!==void 0,k=T?T.d:null,A=E?E.p:null,j=(y||D)&&A==null;if(A!=null)o=m[A],b=u[A]=new i.WriteCursor;else if(E&&E.r!==void 0)o=null;else{let e=l(o);e&&e.d!=null&&(o=null)}let M=l(o);if(k!=null)if(t=d[k],x=c[k]=new i.WriteCursor,j)y&&!D&&x.write(`r`,!0);else{let e=h[k]=n++;b.write(`d`,e)}else if(T&&T.i!==void 0)t=null;else{let e=l(t);e&&e.p!=null&&(t=null)}let N;O?(s(v===void 0),N=T.i):N=v;let P=(A==null?!O||y||D:N===void 0)?null:b.getComponent();if(A!=null){if(!(v!==void 0||O)){let e=k==null?n++:h[k];g[A]=e,x.write(`p`,e)}}else D&&(O||v!==void 0||(E.r,x.write(`r`,E.r)));let F=j?null:S(T),I=S(M);if((F||I)&&(F&&F.name,I&&I.name),F&&I){s(F===I);let e=C(T),t=C(M),n=F.compose(e,t);w(b,F,n),_.add(M)}else F?w(b,F,C(T)):I&&(w(b,I,C(M)),_.add(M));let ee=typeof N==`object`&&!!N,L=!1,R=0,te=0,ne=0,re=0,ie=0,z=i.advancer(o,(e,t)=>p(t)?re-e-1:e-re,(e,t)=>{p(t)&&re++}),ae=i.advancer(t,(e,t)=>f(t)?R-e-1:e-R,(e,t)=>{f(t)&&R++});if(i.eachChildOf(r,a,(t,n,r)=>{let i,a,o=t,c=t,u=t;if(typeof t==`number`){let e=t+ne;a=z(e),c=e+re;let d=t+te;i=ae(d),p(l(a))&&(i=null),o=d+R,u=t+ie,s(o>=0,`p1PickKey is negative`),s(c>=0,`p2DropKey is negative`);let m=p(l(n)),h=f(l(r));(m||h&&!j)&&ie--,m&&te--,h&&ne--}else i=ae(t),a=z(t);x.descend(o),b.descend(c);let d=ee&&!p(l(n))?N[u]:void 0,m=e(i,n,r,a,d,j,b,x);var h,g,_;ee&&!j?d!==m&&(L||(N=Array.isArray(N)?N.slice():Object.assign({},N),L=!0),h=N,_=m,typeof(g=u)==`number`?(s(Array.isArray(h)),s(g<h.length)):(s(!Array.isArray(h)),s(h[g]!==void 0)),_===void 0?typeof g==`number`?h.splice(g,1):delete h[g]:h[g]=_):s(m===void 0),b.ascend(),x.ascend()}),ae.end(),z.end(),P!=null)P.i=N;else if(!y&&!D&&A==null)return N}(r,r.clone(),a,a.clone(),void 0,!1,o,v),o.reset(),o.mergeTree(v.get()),o.reset(),o.get(),c.map(e=>e.get()),u.map(e=>e.get()),r.traverse(o,(e,t)=>{let n=e.p;if(n!=null){let e=h[n];e!=null&&t.write(`p`,e);let r=c[n];r&&r.get(),r&&t.mergeTree(r.get())}else e.r!==void 0&&t.write(`r`,e.r)}),o.reset(),o.get(),a.traverse(o,(e,t)=>{let n=e.d;if(n!=null){let e=g[n];e!=null&&t.write(`d`,e);let r=u[n];r&&t.mergeTree(r.get())}else e.i!==void 0&&t.write(`i`,e.i);let r=S(e);r&&!_.has(e)&&w(t,r,C(e))}),o.get()}function M(e){if(e==null)return null;let t=new i.ReadCursor(e),n=new i.WriteCursor,r,a=[],o=[];return function e(t,n,i){let o=t.getComponent(),s,c=!1;if(o){o.p!=null&&(n.write(`d`,o.p),a[o.p]=t.clone()),o.r!==void 0&&n.write(`i`,o.r),o.d!=null&&(n.write(`p`,o.d),i=void 0),o.i!==void 0&&(i=s=o.i);let e=S(o);e&&(i===void 0?(r||(r=new Set),r.add(o)):(C(o),i=e.apply(i,C(o)),c=!0))}let l=0;for(let r of t){n.descend(r);let a=typeof r==`number`?r-l:r,o=_(i,a);p(t.getComponent())&&l++;let s=e(t,n,o);if(i!==void 0&&s!==void 0){if(c||(c=!0,i=d(i)),!g(i,a))throw Error(`Cannot modify child - invalid operation`);i[a]=s}n.ascend()}if(s===void 0)return c?i:void 0;n.write(`r`,i)}(t,n,void 0),r&&(n.reset(),function e(t,n,s){let c=n.getComponent();if(c){let e=c.d;if(e!=null&&(t=a[e],s=o[e]=i.writeCursor()),r.has(c)){let e=S(c);if(!e.invert)throw Error(`Cannot invert subtype ${e.name}`);w(s,e,e.invert(C(c)))}}let l=0,u=0,d=i.advancer(t,(e,t)=>f(t)?l-e-1:e-l,(e,t)=>{f(t)&&l++});for(let t of n)if(typeof t==`number`){let r=t-u,i=d(r),a=r+l;s.descend(a),e(i,n,s),p(n.getComponent())&&u++,s.ascend()}else s.descend(t),e(d(t),n,s),s.ascend();d.end()}(t.clone(),t,n),o.length&&(n.reset(),t.traverse(n,(e,t)=>{let n=e.p;if(n!=null){let e=o[n];e&&e.get(),e&&t.mergeTree(e.get())}}))),n.get()}let N=(e,t)=>e.some(e=>typeof e==`object`&&(Array.isArray(e)?N(e,t):t(e)));function P(e,t){if(e==null||!N(e,e=>{var t;return e.r!==void 0||((t=S(e))==null?void 0:t.makeInvertible)!=null}))return e;let n=new i.ReadCursor(e),a=new i.WriteCursor,o=!1,c=[],l=[],u=(e,t,n)=>{let i=e.getComponent(),a=!1;if(i){i.d!=null&&t.write(`d`,i.d),i.i!==void 0&&t.write(`i`,i.i);let r=i.p;if(r!=null&&(c[r]=e.clone(),s(n!==void 0,`Operation picks up at an invalid key`),l[r]=n,t.write(`p`,i.p)),i.r!==void 0&&n===void 0)throw Error(`Invalid doc / op in makeInvertible: removed item missing from doc`);let a=S(i);a&&(a.makeInvertible?o=!0:w(t,a,C(i),!0))}let f=0;for(let r of e){t.descend(r);let i=typeof r==`number`?r-f:r,o=_(n,i),s=u(e,t,o);o!==s&&(a||(a=!0,n=d(n)),s===void 0?(n=m(n,i),typeof r==`number`&&f++):n[i]=s),t.ascend()}return i&&(i.r===void 0?i.p!=null&&(n=void 0):(t.write(`r`,r.default(n)),n=void 0)),n};return u(n,a,t),a.get(),o&&(a.reset(),function e(t,n,r,a,o){let s=n.getComponent();if(s){s.i===void 0?s.d!=null&&(a=l[s.d],t=c[s.d],o=!1,s.d):(a=s.i,o=!0);let e=S(s);if(e&&e.makeInvertible){let t=C(s);w(r,e,e.makeInvertible(t,a),!0)}}let u=0,d=0,m=i.advancer(t,(e,t)=>f(t)?u-e-1:e-u,(e,t)=>{f(t)&&u++});for(let t of n)if(typeof t==`number`){let i=t-d,s=m(i),c=i+u,l=_(a,o?i:c);r.descend(t),e(s,n,r,l,o),p(n.getComponent())&&d++,r.ascend()}else{let i=_(a,t);r.descend(t),e(m(t),n,r,i,o),r.ascend()}m.end()}(n.clone(),n,a,t,!1)),a.get()}function F(e,t){return M(P(e,t))}let I=e=>{if(e==null)return null;let t=e.slice();for(let n=0;n<e.length;n++){let e=t[n];Array.isArray(e)&&(t[n]=I(e))}return t};function ee(t,u,d){s(d===`left`||d===`right`,`Direction must be left or right`);let m=d===`left`?0:1;if(o.quiet=!c,o.prefix=0,u==null)return{ok:!0,result:t};D(t),D(u);let h=null,g=[],_=[],v=[],y=[],b=[],x=[],T=[],E=[],O=[],k=[],A=[],j=[],M=[],N=[],P=[],F=0,ee=i.readCursor(t),L=i.readCursor(u),R=i.writeCursor();if(function e(t,n=null,r){let a=l(n);a&&(a.r===void 0?a.p!=null&&(r=null,x[a.p]=t.clone()):r=n.clone());let o=t.getComponent(),s;o&&(s=o.p)!=null&&(b[s]=n?n.clone():null,v[s]=t.clone(),r&&(k[s]=!0,O[s]=r),a&&a.p!=null&&(N[s]=a.p));let c=i.advancer(n);for(let n of t)e(t,c(n),r);c.end()}(L,ee,null),function t(n,r,o,s,c){let u=o.getComponent(),d,p=!1;u&&((d=u.d)==null?u.i!==void 0&&(n=r=null,p=!0,c&&h==null&&(h={type:a.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(c.getPath()),op2:e.insertOp(o.getPath(),u.i)})):(y[d]=o.clone(),s!=null&&(P[s]==null&&(P[s]=[]),P[s].push(d)),k[d],n=b[d]||null,r=v[d]||null,k[d]?(c&&(A[d]=!0),c=O[d]||null):!c||m!==1&&N[d]!=null||h==null&&(h={type:a.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(c.getPath()),op2:e.moveOp(r.getPath(),o.getPath())}),p=!0));let g=l(n);g&&(g.r===void 0?g.p!=null&&(g.p,s=g.p,c=null):c=n.clone());let _=S(u);_&&c&&h==null&&(h={type:a.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(c.getPath()),op2:e.editOp(o.getPath(),_,C(u),!0)});let x=0,w=0,T=i.advancer(r,(e,t)=>f(t)?x-e-1:e-x,(e,t)=>{f(t)&&x++}),E=i.advancer(n);for(let e of o)if(typeof e==`number`){let n=e-w,r=T(n);w+=+t(E(n+x),r,o,s,c)}else{let n=T(e);t(E(e),n,o,s,c)}return T.end(),E.end(),p}(ee,L,L.clone(),null,null),y.map(e=>e&&e.get()),h)return{ok:!1,conflict:h};A.map(e=>!!e);let te=[],ne=null;(function e(t,n,r,a,o){let c=!1,u=l(n);if(f(u)){let e=u.p;e==null?(r=null,o=n.clone()):(r=y[e],a=j[e]=i.writeCursor(),c=!0,o=null)}else p(l(r))&&(r=null);let d=t.getComponent();if(d){let e=d.p;e==null?d.r!==void 0&&(o||a.write(`r`,!0),(o||c)&&(ne==null&&(ne=new Set),ne.add(d))):(o&&(E[e]=o),te[e]=o||m===1&&c?null:a.getComponent(),g[e]=t.clone(),r&&(T[e]=r.clone()))}let h=0,_=0,v=i.advancer(n,void 0,(e,t)=>{f(t)&&h++}),b=i.advancer(r,(e,t)=>p(t)?~(e-_):e-_,(e,t)=>{p(t)&&_++});if(t)for(let n of t)if(typeof n==`string`){let r=v(n),i=b(n);a.descend(n),e(t,r,i,a,o),a.ascend()}else{let r=v(n),i=n-h,c=f(l(r))?null:b(i),u=i+_;s(u>=0),a.descend(u),e(t,r,c,a,o),a.ascend()}v.end(),b.end()})(ee,L,L.clone(),R,null),R.reset();let re=[];if(function t(o,c,u,b,D,O){s(c);let A=c.getComponent(),j=l(b),P=!1,I=(t,n,r)=>t?e.moveOp(t.getPath(),n.getPath()):e.insertOp(n.getPath(),r.i);if(p(A)){let t=A.d;t!=null&&(_[t]=c.clone());let i=t==null?null:te[t],s=!1;if(A.i!==void 0||t!=null&&i){let o;j&&(j.i!==void 0||(o=j.d)!=null&&!k[o])&&(s=o==null?n.default(j.i,A.i):t!=null&&t===N[o],s||o!=null&&m!==1&&N[o]!=null||h==null&&(h={type:a.ConflictType.DROP_COLLISION,op1:I(t==null?null:g[t],c,A),op2:I(o==null?null:v[o],b,j)})),s||(O?h==null&&(h={type:a.ConflictType.RM_UNEXPECTED_CONTENT,op1:I(t==null?null:g[t],c,A),op2:e.removeOp(O.getPath())}):(t==null?D.write(`i`,r.default(A.i)):(re[F]=t,D.write(`d`,i.p=F++)),P=!0))}else if(t!=null&&!i){let e=E[t];e&&(O=e.clone())}t==null?A.i!==void 0&&(o=u=null,s||(b=null)):(o=g[t],u=x[t],b=T[t])}else f(l(o))&&(o=u=b=null);let ee=l(o),L=l(u);if(f(L)){let e=L.p;L.r!==void 0&&(!ee||ee.r===void 0)||k[e]?(b=null,O=u.clone()):e!=null&&(b=y[e],m!==1&&N[e]!=null||((D=M[e])||(D=M[e]=i.writeCursor()),D.reset(),O=null))}else!p(A)&&p(j)&&(b=null);j=b==null?null:b.getComponent();let R=S(A);if(R){let t=C(A);if(O)h==null&&(h={type:a.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(c.getPath(),R,t,!0),op2:e.removeOp(O.getPath())});else{let e=S(j),n;if(e){if(R!==e)throw Error(`Transforming incompatible types`);let r=C(j);n=R.transform(t,r,d)}else n=r.default(t);w(D,R,n)}}let ie=0,z=0,ae=0,oe=0,se=0,ce=0,le=o!=null&&o.descendFirst(),ue=le,de=i.advancer(u,void 0,(e,t)=>{f(t)&&ae++}),fe=b!=null&&b.descendFirst(),pe=fe;for(let e of c)if(typeof e==`number`){let n,r=p(c.getComponent()),i=e-z;{let e;for(;le&&typeof(e=o.getKey())==`number`;){e+=ie;let t=o.getComponent(),n=f(t);if(e>i||e===i&&(!n||m===0&&r))break;if(n){ie--;let e=t.p;te[e],N.includes(e),t.d,l(M[t.d]),f(l(M[t.d])),(t.r===void 0||ne&&ne.has(t))&&(e==null||!te[e]||m!==1&&N.includes(e))||se--}le=o.nextSibling()}n=le&&e===i?o:null}let a=i-ie,u=de(a),d=a-ae,h=null;{let e,t;for(;fe&&typeof(e=b.getKey())==`number`;){t=e-oe;let n=b.getComponent(),i=p(n);if(t>d)break;if(t===d){if(!i){h=b;break}{if(m===0&&r){h=b;break}let e=u&&f(u.getComponent());if(m===0&&e)break}}if(i){let e=n.d;k[e],N[e],n.i===void 0&&(k[e]||N[e]!=null&&m!==1)?(k[e]||N[e]!=null&&m===0)&&(oe++,ce--):oe++}fe=b.nextSibling()}}let g=d+oe+se+ce;s(g>=0,`trying to descend to a negative index`),D.descend(g),r&&(n=u=h=null,z++),t(n,c,u,h,D,O)&&ce++,D.ascend()}else{let n;for(;le&&(n=o.getKey(),typeof n!=`string`||!(n>e||n===e));)le=o.nextSibling();let r=le&&n===e?o:null,i=de(e),a;for(;fe&&(a=b.getKey(),typeof a!=`string`||!(a>e||a===e));)fe=b.nextSibling();let s=fe&&a===e?b:null;D.descend(e),t(r,c,i,s,D,O),D.ascend()}return de.end(),ue&&o.ascend(),pe&&b.ascend(),P}(ee,ee.clone(),L,L.clone(),R,null),h)return{ok:!1,conflict:h};R.reset();let ie=(e,t,n)=>e.traverse(t,(t,r)=>{t.d!=null&&n(t.d,e,r)});(k.length||j.length)&&(ie(L,R,(e,t,n)=>{k[e]&&!A[e]&&n.write(`r`,!0),j[e]&&n.mergeTree(j[e].get())}),R.reset());let z=[],ae=[];if((M.length||k.length)&&!h){let e=i.readCursor(I(R.get()));if(ie(e,null,(e,t)=>{z[e]=t.clone()}),M.forEach(e=>{e&&ie(i.readCursor(e.get()),null,(e,t)=>{z[e]=t.clone()})}),function e(t,n,r,a,s,c){o.prefix++;let u=l(n);if(u&&f(u))if(u.p!=null){s=u;let e=u.p;z[e].getPath(),r=z[e],a=ae[e]=i.writeCursor()}else u.r!==void 0&&(r=null,c=!0);else p(l(r))&&(r=null);let d=t.getComponent();if(d){let e;if((e=d.d)!=null){let t=M[e];t&&(t.get(),a.mergeTree(t.get()),r=i.readCursor(t.get()))}}let m=0,h=0,g=i.advancer(n,void 0,(e,t)=>{f(t)&&m--}),_=i.advancer(r,(e,t)=>p(t)?-(e-h)-1:e-h,(e,t)=>{p(t)&&h++});for(let n of t)if(typeof n==`number`){let r=g(n),i=n+m,o=_(i),l=i+h;a.descend(l),e(t,r,o,a,s,c),a.ascend()}else a.descend(n),e(t,g(n),_(n),a,s,c),a.ascend();g.end(),_.end()}(L,e,e.clone(),R,null,!1),R.reset(),h)return{ok:!1,conflict:h};if(R.get(),ae.length){let e=ae.map(e=>e?e.get():null);if(ie(i.readCursor(I(R.get())),R,(t,n,r)=>{let i=e[t];i&&(r.mergeTree(i),e[t]=null)}),e.find(e=>e)){let t=i.writeCursor(),n=i.writeCursor(),r=0,o=0;e.forEach(e=>{e!=null&&ie(i.readCursor(e),null,e=>{let i=re[e];t.writeMove(g[i].getPath(),_[i].getPath(),r++);let a=P[i];a&&a.forEach(e=>{k[e]||m!==1&&N[e]!=null||n.writeMove(v[e].getPath(),y[e].getPath(),o++)})})}),h={type:a.ConflictType.BLACKHOLE,op1:t.get(),op2:n.get()}}}}return h?{ok:!1,conflict:h}:{ok:!0,result:R.get()}}let L=e=>{let t=Error(`Transform detected write conflict`);throw t.conflict=e,t.type=t.name=`writeConflict`,t};function R(e,t,n){let r=ee(e,t,n);if(r.ok)return r.result;L(r.conflict)}let te=e=>{let t=i.writeCursor();return i.readCursor(e).traverse(t,(e,t)=>{(p(e)||S(e))&&t.write(`r`,!0)}),t.get()},ne=(e,t)=>{let{type:n,op1:r,op2:o}=e;switch(n){case a.ConflictType.DROP_COLLISION:return t===`left`?[null,te(o)]:[te(r),null];case a.ConflictType.RM_UNEXPECTED_CONTENT:let e=!1;return i.readCursor(r).traverse(null,t=>{t.r!==void 0&&(e=!0)}),e?[null,te(o)]:[te(r),null];case a.ConflictType.BLACKHOLE:return[te(r),te(o)];default:throw Error(`Unrecognised conflict: `+n)}};function re(e,t,n,r){let i=null;for(;;){let a=ee(t,n,r);if(a.ok)return j(i,a.result);{let{conflict:o}=a;e(o)||L(o);let[s,c]=ne(o,r);t=j(O(t),s),n=j(O(n),c),i=j(i,c)}}}})),Um=h(f((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!n.hasOwnProperty(r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(Hm(),e);var r=Im();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var i=Lm();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return i.ConflictType}})}))());let Wm=`__textXPreserveParagraphIds`,Gm=function(e){return e.RETAIN=`r`,e.INSERT=`i`,e.DELETE=`d`,e}({}),Km=function(e){return e.PARAGRAPH=`PARAGRAPH`,e.SECTION_BREAK=`SECTION_BREAK`,e.TABLE=`TABLE`,e.TABLE_ROW=`TABLE_ROW`,e.TABLE_CELL=`TABLE_CELL`,e.COLUMN_GROUP=`COLUMN_GROUP`,e.COLUMN=`COLUMN`,e.BLOCK=`BLOCK`,e.CUSTOM_BLOCK=`CUSTOM_BLOCK`,e}({}),qm=function(e){return e.PARAGRAPH=`\r`,e.SECTION_BREAK=`
|
|
4
4
|
`,e.TABLE_START=``,e.TABLE_ROW_START=`\x1B`,e.TABLE_CELL_START=``,e.TABLE_CELL_END=``,e.TABLE_ROW_END=``,e.TABLE_END=``,e.COLUMN_GROUP_START=``,e.COLUMN_START=``,e.COLUMN_END=``,e.COLUMN_GROUP_END=``,e.BLOCK_START=``,e.BLOCK_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}({});function Jm(e){return`${e}`}function Ym(e){return{startOffset:e.startIndex,endOffset:e.endIndex+1}}function Xm(e){return{startOffset:e.startIndex,endOffset:e.endIndex}}function Zm(e){return Xm(e)}function Qm(e){return Ym(e)}function $m(e){return Ym(e)}function eh(e){return Ym(e)}function th(e){return{startOffset:e.startIndex,endOffset:e.startIndex+1}}function nh(e,t){return dh(e,t,`\x1B`,``)}function rh(e,t){return dh(e,t,``,``)}function ih(e,t){return e.startOffset<=t&&t<e.endOffset}function ah(e,t){return e.startOffset<t&&t<e.endOffset}function oh(e,t){return Math.max(e.startOffset,t.startOffset)<Math.min(e.endOffset,t.endOffset)}function sh(e,t,n){return e.startIndex>=t?{...e,startIndex:e.startIndex+n,endIndex:e.endIndex+n}:e.endIndex>=t?{...e,endIndex:e.endIndex+n}:e}function ch(e,t,n){return e.startIndex>=t?{...e,startIndex:e.startIndex+n,endIndex:e.endIndex+n}:e.endIndex>t?{...e,endIndex:e.endIndex+n}:e}function lh(e,t,n){if(n<=0||e.endIndex<t)return e;let r=t+n;if(e.startIndex>=r)return{...e,startIndex:e.startIndex-n,endIndex:e.endIndex-n};let i=e.startIndex<t,a=e.endIndex>=r;if(!i&&!a)return null;let o=i?e.startIndex:t,s=a?e.endIndex-n:t-1;return s>=o?{...e,startIndex:o,endIndex:s}:null}function uh(e,t,n){if(n<=0||e.endIndex<=t)return e;let r=t+n;if(e.startIndex>=r)return{...e,startIndex:e.startIndex-n,endIndex:e.endIndex-n};let i=e.startIndex<t,a=e.endIndex>r;if(!i&&!a)return null;let o=i?e.startIndex:t,s=a?e.endIndex-n:t;return s>o?{...e,startIndex:o,endIndex:s}:null}function dh(e,t,n,r){if(!Number.isInteger(t)||t<0||e[t]!==n)return null;let i=0;for(let a=t;a<e.length;a++){let o=e[a];if(o===n)i++;else if(o===r&&(i--,i===0))return{startOffset:t,endOffset:a+1}}return null}let fh=`__textXRestoreParagraphIds`;function ph(e,t=!1){let n=[];for(let r of e){let{st:e,ed:i,ts:a}=r;if(r.sId===void 0&&delete r.sId,e===i||!t&&z.isEmptyObject(a)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}let o=n.pop();$l(r,o)&&z.hasIntersectionBetweenTwoRanges(o.st,o.ed,r.st,r.ed)?n.push({...r,st:o.st,ed:i}):n.push(o,r)}return n}function mh(e,t,n,r){var i;let{textRuns:a}=e;if(a==null)return;let o=[],s=a.length,c=!1,l=(i=t.textRuns)==null?[]:i;if(l.length)for(let e of l)e.st+=r,e.ed+=r;for(let e=0;e<s;e++){let t=a[e],{st:i,ed:s}=t;if(s<=r)o.push(t);else if(r>i&&r<s){c=!0;let e={...t,ed:r};o.push(e),l.length&&o.push(...l);let i={...t,st:r+n,ed:s+n};o.push(i)}else t.st+=n,t.ed+=n,c||(c=!0,o.push(...l)),o.push(t)}c||(c=!0,o.push(...l)),e.textRuns=ph(o)}function hh(e,t,n,r,i=!1,a=e.dataStream){var o;if(!e.paragraphs&&!((o=t.paragraphs)!=null&&o.length))return;e.paragraphs!=null||(e.paragraphs=[]);let{paragraphs:s}=e,{paragraphs:c}=t;gh(s,c,r,{freshenSplitParagraph:!0,preserveMissingParagraphIds:i,preserveExplicitSplitParagraphIds:!!t[fh],preserveExplicitParagraphIds:!!t[Wm],dataStream:a});let l=[],u=-1;for(let e=0,t=s.length;e<t;e++){let t=s[e],{startIndex:i}=t;i>=r&&(t.startIndex+=n),u===-1&&i>=r&&(u=e),l.push(t.startIndex)}let d=-1;if(c){for(let e=0,t=c.length;e<t;e++){let t=c[e];t.startIndex+=r;let n=t.startIndex;d=l.indexOf(n)}d!==-1&&s.splice(d,1),s.push(...c),s.sort(op(`startIndex`))}}function gh(e,t,n,r){var i;if(!e||!(t!=null&&t.length))return;let a=bh(e,n,r.dataStream),o=a?xh(t):-1,s=a==null?void 0:a.paragraphId,c=o===-1?void 0:t[o].paragraphId,l=(r.preserveExplicitSplitParagraphIds||r.preserveExplicitParagraphIds)&&c!=null&&c!==s,u=_h(e),d=new Set;s&&u.delete(s);for(let e of(i=r.reservedParagraphIds)==null?[]:i)u.add(e);let f;if(s&&o!==-1&&!l){var p;let e=t[o];f=c!=null&&c!==s?vh(e,u,(p=r.preserveMissingParagraphIds)==null?!1:p):Tm(e,u,!1),r.freshenSplitParagraph&&f.paragraphId&&(a.paragraphId=f.paragraphId)}for(let e=0,n=t.length;e<n;e++){let n=t[e].paragraphId;if(r.preserveExplicitParagraphIds&&n&&!d.has(n)){t[e]={...t[e]},d.add(n);continue}if(e!==o||s==null||l){var m;t[e]=vh(t[e],u,(m=r.preserveMissingParagraphIds)==null?!1:m);continue}t[e]=r.freshenSplitParagraph||c==null||c===s?Tm({...t[e],paragraphId:s},u):f}for(let e of t)if(e.paragraphId){var h;(h=r.reservedParagraphIds)==null||h.add(e.paragraphId)}}function _h(e){let t=new Set;for(let n of e==null?[]:e)n.paragraphId&&t.add(n.paragraphId);return t}function vh(e,t,n){return n&&e.paragraphId==null?z.deepClone(e):Tm(e,t)}let yh=new Set([`
|
|
5
5
|
`,``,`\x1B`,``,``,``,``,``,``,``,``,``,``]);function bh(e,t,n){let r=[...e].sort((e,t)=>e.startIndex-t.startIndex);for(let e=0;e<r.length;e++){let i=r[e],a=e>0?r[e-1].startIndex+1:0;for(;a<i.startIndex;){let e=n==null?void 0:n[a];if(!e||!yh.has(e))break;a++}if(t>a&&t<i.startIndex)return i}}function xh(e){let t=0;for(let n=1;n<e.length;n++)e[n].startIndex<e[t].startIndex&&(t=n);return t}function Sh(e,t,n,r){var i;if(!e.sectionBreaks&&!((i=t.sectionBreaks)!=null&&i.length))return;e.sectionBreaks!=null||(e.sectionBreaks=[]);let{sectionBreaks:a}=e,o=t.sectionBreaks;Ch(a,o);for(let e=0,t=a.length;e<t;e++){let t=a[e],{startIndex:i}=t;i>=r&&(t.startIndex+=n)}if(o){for(let e=0,t=o.length;e<t;e++){let t=o[e];t.startIndex+=r}a.push(...o),a.sort(op(`startIndex`))}}function Ch(e,t,n=new Set){var r;if(!(t!=null&&t.length))return;let i=new Set((r=e==null?void 0:e.map(e=>e.sectionId))==null?[]:r);for(let e of n)i.add(e);for(let e=0;e<t.length;e++)t[e]=jm(t[e],i),n.add(t[e].sectionId)}function wh(e,t,n,r){let{customBlocks:i=[]}=e;for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n)}let a=t.customBlocks;if(a){for(let e=0,t=a.length;e<t;e++){let t=a[e];t.startIndex+=r}i.push(...a),i.sort(op(`startIndex`))}i.length&&!e.customBlocks&&(e.customBlocks=i)}function Th(e,t,n,r){var i;if(!e.tables&&!((i=t.tables)!=null&&i.length))return;e.tables||(e.tables=[]);let{tables:a}=e;for(let e=0,t=a.length;e<t;e++){let t=a[e];Object.assign(t,ch(t,r,n))}let o=t.tables;if(o){for(let e=0,t=o.length;e<t;e++){let t=o[e];t.startIndex+=r,t.endIndex+=r}a.push(...o),a.sort(op(`startIndex`))}}function Eh(e,t,n,r){var i;if(!e.columnGroups&&!((i=t.columnGroups)!=null&&i.length))return;e.columnGroups||(e.columnGroups=[]);let{columnGroups:a}=e;for(let e=0,t=a.length;e<t;e++){let t=a[e];Object.assign(t,sh(t,r,n))}let o=t.columnGroups;if(o){for(let e=0,t=o.length;e<t;e++){let t=o[e];t.startIndex+=r,t.endIndex+=r}a.push(...o),a.sort(op(`startIndex`))}}function Dh(e,t,n,r){var i;if(!e.blockRanges&&!((i=t.blockRanges)!=null&&i.length))return;e.blockRanges||(e.blockRanges=[]);let{blockRanges:a}=e;for(let e=0,t=a.length;e<t;e++){let t=a[e];Object.assign(t,sh(t,r,n))}let o=t.blockRanges;if(o){for(let e=0,t=o.length;e<t;e++){let t=o[e];t.startIndex+=r,t.endIndex+=r}a.push(...o),a.sort(op(`startIndex`))}}let Oh=e=>e.split(`$`)[0];function kh(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};n.rangeId=Oh(n.rangeId);for(let r=1;r<e.length;r++){let i=e[r];i.rangeId=Oh(i.rangeId),i.rangeId===n.rangeId&&Hp(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);let r=Object.create(null);for(let e=0,n=t.length;e<n;e++){let n=t[e],i=n.rangeId;r[i]?(n.rangeId=`${i}\$${r[i]}`,r[i]=r[i]+1):r[i]=1}return t}function Ah(e,t){let n=e.findIndex(e=>e.startIndex<t&&e.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 jh(e){if(e.length<=1)return e;e.sort((e,t)=>e.startIndex-t.startIndex);let t=[],n={...e[0]};for(let r=1;r<e.length;r++){let i=e[r];i.id===n.id&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}return t.push(n),t}function Mh(e,t){e.filter(e=>e.startIndex<t&&e.endIndex>=t).forEach(n=>{let r=e.indexOf(n);e.splice(r,1,{id:n.id,type:n.type,startIndex:n.startIndex,endIndex:t-1},{id:n.id,type:n.type,startIndex:t,endIndex:n.endIndex})})}function Nh(e,t,n,r){e.customRanges||(e.customRanges=[]);let{customRanges:i}=e;Ah(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customRanges){for(let e=0,n=t.customRanges.length;e<n;e++){let n=t.customRanges[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customRanges=kh(i)}function Ph(e,t,n,r){e.customDecorations||(e.customDecorations=[]);let{customDecorations:i}=e;Mh(i,r);for(let e=0,t=i.length;e<t;e++){let t=i[e],{startIndex:a}=t;a>=r&&(t.startIndex+=n,t.endIndex+=n)}let a=[];if(t.customDecorations){for(let e=0,n=t.customDecorations.length;e<n;e++){let n=t.customDecorations[e];n.startIndex+=r,n.endIndex+=r,a.push(n)}i.push(...a)}e.customDecorations=jh(i)}function Fh(e,t,n){let{textRuns:r}=e,i=n,a=n+t,o=[];if(r){let n=[];for(let e=0,s=r.length;e<s;e++){let s=r[e],{st:c,ed:l}=s;if(i<=c&&a>=l){o.push({...s,st:c-i,ed:l-i});continue}else c<=i&&l>=a?(o.push({...s,st:i-i,ed:a-i}),s.ed-=t):i>=c&&i<l?(o.push({...s,st:i-i,ed:l-i}),s.ed=i):a>c&&a<=l?(o.push({...s,st:c-i,ed:a-i}),s.st=a-t,s.ed-=t):c>=a&&(s.st-=t,s.ed-=t);n.push(s)}e.textRuns=n}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Ih(e,t,n){let{paragraphs:r}=e,i=n,a=n+t,o=[],s=null,c=!1;if(r){let l=[];for(let e=0,u=r.length;e<u;e++){let u=r[e],{startIndex:d}=u;if(d>=i&&d<a){o.push({...u,startIndex:d-n}),c=!0;continue}else d>=a&&(u.startIndex-=t);l.push(u),s==null&&c&&(s=u)}e.paragraphs=l}return o}function Lh(e,t,n){let{sectionBreaks:r}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.sectionBreaks=s}return o}function Rh(e,t,n){let{customBlocks:r=[]}=e,i=n,a=n+t-1,o=[];if(r){let s=[];for(let e=0,c=r.length;e<c;e++){let c=r[e],{startIndex:l}=c;if(l>=i&&l<=a){o.push({...c,startIndex:l-n});continue}else l>a&&(c.startIndex-=t);s.push(c)}e.customBlocks=s}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function zh(e,t,n){let{tables:r}=e,i=[];if(r){let a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e],s=uh(o,n,t);if(!s){i.push({...o,startIndex:o.startIndex-n,endIndex:o.endIndex-n});continue}Object.assign(o,s),a.push(o)}e.tables=a}return i}function Bh(e,t,n){let{columnGroups:r}=e,i=[];if(r){let a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e],s=lh(o,n,t);if(!s){i.push({...o,startIndex:o.startIndex-n,endIndex:o.endIndex-n});continue}Object.assign(o,s),a.push(o)}e.columnGroups=a}return i}function Vh(e,t,n){let{customRanges:r}=e,i=[];if(r){let a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e],s=lh(o,n,t);if(!s){i.push(o);continue}Object.assign(o,s),a.push(o)}e.customRanges=kh(a)}return i}function Hh(e,t,n){let{blockRanges:r}=e,i=[];if(r){let a=[];for(let e=0,o=r.length;e<o;e++){let o=r[e],s=lh(o,n,t);if(!s){i.push(o);continue}Object.assign(o,s),a.push(o)}e.blockRanges=a}return i}function Uh(e,t,n,r=!0){let{customDecorations:i}=e,a=n,o=n+t-1,s=[];if(i){let n=[];for(let e=0,c=i.length;e<c;e++){let c=i[e],{startIndex:l,endIndex:u}=c;if(l>=a&&u<=o){s.push(c);continue}else if(Math.max(a,l)<=Math.min(o,u)){let e=Eu(l,u,a,o);if(e.length===0)continue;c.startIndex=e[0],c.endIndex=e[1]}else o<l&&r&&(c.startIndex-=t,c.endIndex-=t);n.push(c)}e.customDecorations=n}return s}let Wh=function(e){return e.ORDER_LIST_QUICK_1=`1.`,e.ORDER_LIST_QUICK_2=`a)`,e.ORDER_LIST_QUICK_3=`a.`,e.ORDER_LIST_QUICK_4=`i.`,e.ORDER_LIST_QUICK_5=`A.`,e.ORDER_LIST_QUICK_6=`I.`,e.ORDER_LIST_QUICK_7=`01.`,e.BULLET_LIST=`*`,e}({}),Gh=function(e){return 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}({}),Kh={"a)":{glyphFormat:`%1)`,glyphType:2},"1.":{glyphFormat:`%1.`,glyphType:2},"a.":{glyphFormat:`%1.`,glyphType:5},"A.":{glyphFormat:`%1.`,glyphType:4},"i.":{glyphFormat:`%1.`,glyphType:7},"I.":{glyphFormat:`%1.`,glyphType:4}},qh=e=>[...e,...e,...e].map((e,t)=>({glyphFormat:` %${t+1}`,glyphSymbol:e,bulletAlignment:1,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),Jh=e=>e.map((e,t)=>({...e,bulletAlignment:1,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*t}}})),Yh=(e,t)=>Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:1,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),Xh={BULLET_LIST:{listType:`BULLET_LIST`,nestingLevel:qh([`●`,`○`,`■`])},BULLET_LIST_1:{listType:`BULLET_LIST`,nestingLevel:qh([`❖`,`➢`,`■`])},BULLET_LIST_2:{listType:`BULLET_LIST`,nestingLevel:qh([`✔`,`●`,`◆`])},BULLET_LIST_3:{listType:`BULLET_LIST`,nestingLevel:qh([`■`,`◆`,`○`])},BULLET_LIST_4:{listType:`BULLET_LIST`,nestingLevel:qh([`✦`,`○`,`■`])},BULLET_LIST_5:{listType:`BULLET_LIST`,nestingLevel:qh([`➢`,`○`,`◆`])},ORDER_LIST:{listType:`ORDER_LIST`,nestingLevel:Jh([{glyphFormat:`%1.`,glyphType:2},{glyphFormat:`%2.`,glyphType:5},{glyphFormat:`%3.`,glyphType:7},{glyphFormat:`%4.`,glyphType:2},{glyphFormat:`%5.`,glyphType:5},{glyphFormat:`%6.`,glyphType:7},{glyphFormat:`%7.`,glyphType:2},{glyphFormat:`%8.`,glyphType:5},{glyphFormat:`%9.`,glyphType:7}])},ORDER_LIST_1:{listType:`ORDER_LIST`,nestingLevel:Jh([{glyphFormat:`%1)`,glyphType:2},{glyphFormat:`%2)`,glyphType:5},{glyphFormat:`%3)`,glyphType:7},{glyphFormat:`%4)`,glyphType:2},{glyphFormat:`%5)`,glyphType:5},{glyphFormat:`%6)`,glyphType:7},{glyphFormat:`%7)`,glyphType:2},{glyphFormat:`%8)`,glyphType:5},{glyphFormat:`%9)`,glyphType:7}])},ORDER_LIST_2:{listType:`ORDER_LIST`,nestingLevel:Jh([`%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:2})))},ORDER_LIST_3:{listType:`ORDER_LIST`,nestingLevel:Jh([{glyphFormat:`%1.`,glyphType:4},{glyphFormat:`%2.`,glyphType:5},{glyphFormat:`%3.`,glyphType:7},{glyphFormat:`%4.`,glyphType:4},{glyphFormat:`%5.`,glyphType:5},{glyphFormat:`%6.`,glyphType:7},{glyphFormat:`%7.`,glyphType:4},{glyphFormat:`%8.`,glyphType:5},{glyphFormat:`%9.`,glyphType:7}])},ORDER_LIST_4:{listType:`ORDER_LIST`,nestingLevel:Jh([{glyphFormat:`%1.`,glyphType:4},{glyphFormat:`%2.`,glyphType:2},{glyphFormat:`%3.`,glyphType:7},{glyphFormat:`%4.`,glyphType:4},{glyphFormat:`%5.`,glyphType:2},{glyphFormat:`%6.`,glyphType:7},{glyphFormat:`%7.`,glyphType:4},{glyphFormat:`%8.`,glyphType:2},{glyphFormat:`%9.`,glyphType:7}])},ORDER_LIST_5:{listType:`ORDER_LIST`,nestingLevel:Jh([{glyphFormat:`%1.`,glyphType:3},{glyphFormat:`%2.`,glyphType:5},{glyphFormat:`%3.`,glyphType:7},{glyphFormat:`%4.`,glyphType:3},{glyphFormat:`%5.`,glyphType:5},{glyphFormat:`%6.`,glyphType:7},{glyphFormat:`%7.`,glyphType:3},{glyphFormat:`%8.`,glyphType:5},{glyphFormat:`%9.`,glyphType:7}])},CHECK_LIST:{listType:`CHECK_LIST`,nestingLevel:Yh(`☐`)},CHECK_LIST_CHECKED:{listType:`CHECK_LIST_CHECKED`,nestingLevel:Yh(`☑`,{st:{s:1}})}},Zh=e=>{let{glyphFormat:t,glyphType:n}=e,r=z.deepClone(Xh.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},Qh={ORDER_LIST_QUICK_2:Zh(Kh[`a)`]),ORDER_LIST_QUICK_3:Zh(Kh[`a.`]),ORDER_LIST_QUICK_4:Zh(Kh[`i.`]),ORDER_LIST_QUICK_6:Zh(Kh[`I.`])};Object.assign(Xh,Qh);let $h={"1.":`ORDER_LIST`,"a)":`ORDER_LIST_QUICK_2`,"a.":`ORDER_LIST_QUICK_3`,"i.":`ORDER_LIST_QUICK_4`,"A.":`ORDER_LIST_3`,"I.":`ORDER_LIST_QUICK_6`,"01.":`ORDER_LIST_5`,"*":`BULLET_LIST`};function eg(e,t,n,r,i){return{dataStream:``,textRuns:tg(e,t,n,r,i),paragraphs:rg(e,t,n,r,i),sectionBreaks:ig(e,t,n,r,i),customBlocks:ag(e,t,n,r,i),tables:og(e,t,n,r,i),columnGroups:sg(e,t,n,r,i),blockRanges:cg(e,t,n,r,i),customRanges:lg(e,t,n,r,i),customDecorations:ug(e,t,n,r,i)}}function tg(e,t,n,r,i){let{textRuns:a}=e,{textRuns:o}=t;if(a==null||o==null)return;let s=Fh(e,n,r);return i!==1&&(t.textRuns=ng(o,s,i)),mh(e,t,n,r),s}function ng(e,t,n){if(t.length===0)return e;e=z.deepClone(e),t=z.deepClone(t);let r=[],i=e.length,a=t.length,o=0,s=0,c=null;function l(){return c?(r.push(c),c=null,!0):!1}for(;o<i&&s<a;){let{st:i,ed:a,ts:u}=e[o],{st:d,ed:f,ts:p,sId:m}=t[s],h;if(h=n===0?{...p,...u}:{...u},a<d)l()||r.push(e[o]),o++;else if(f<i)l()||r.push(t[s]),s++;else{let n={st:Math.min(i,d),ed:Math.max(i,d),ts:i<d?{...u}:{...p},sId:i<d?void 0:m};n.ed>n.st&&r.push(n),r.push({st:Math.max(i,d),ed:Math.min(a,f),ts:h,sId:m}),a<f?(o++,t[s].st=a,t[s].st===t[s].ed&&s++):(s++,e[o].st=f,e[o].st===e[o].ed&&o++);let l={st:Math.min(a,f),ed:Math.max(a,f),ts:a<f?{...p}:{...u},sId:a<f?m:void 0};c=l.ed>l.st?l:null}}l();let u=r[r.length-1],d=e[i-1],f=t[a-1];return u&&u.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?r.push(d):r.push(f)),ph(r)}function rg(e,t,n,r,i){let{paragraphs:a}=e,{paragraphs:o}=t;if(a==null||o==null)return;let s=Ih(e,n,r);if(i!==1){let e=[];for(let t of o){let{startIndex:n,paragraphId:r,paragraphStyle:a,bullet:o}=t,c=[];for(let e of s){let{startIndex:t,paragraphId:s,paragraphStyle:l,bullet:u}=e,d,f;if(i===0?(d={...l,...a},f={listId:``,listType:`BULLET_LIST`,nestingLevel:0,textStyle:{},...u,...o}):(d={...a,...l},f={listId:``,listType:`BULLET_LIST`,nestingLevel:0,textStyle:{},...o,...u}),n===t){c.push({startIndex:n,paragraphId:r==null?s:r,paragraphStyle:d,bullet:f});break}}e.push(...c),c=[]}t.paragraphs=e}else for(let e of o){let t=s.find(t=>t.startIndex===e.startIndex);t&&e.paragraphId==null&&(e.paragraphId=t.paragraphId)}return hh(e,t,n,r,!0),s}function ig(e,t,n,r,i){let{sectionBreaks:a}=e,{sectionBreaks:o}=t;if(a==null||o==null)return;let s=Lh(e,n,r);if(i!==1){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===0?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.sectionBreaks=e.map(e=>{let t=s.find(t=>t.startIndex===e.startIndex);return t?{...e,sectionId:t.sectionId}:e})}else t.sectionBreaks=o.map(e=>{let t=s.find(t=>t.startIndex===e.startIndex);return t?{...e,sectionId:t.sectionId}:e});return Sh(e,t,n,r),s}function ag(e,t,n,r,i){let{customBlocks:a=[]}=e,{customBlocks:o}=t;if(a==null||o==null)return;let s=Rh(e,n,r);if(i!==1){let e=[];for(let t of o){let{startIndex:n}=t,r=[];for(let e of s){let{startIndex:a}=e;if(n===a){i===0?r.push({...e,...t}):r.push({...t,...e});break}}e.push(...r),r=[]}t.customBlocks=e}return wh(e,t,n,r),a.length&&!e.customBlocks&&(e.customBlocks=a),s}function og(e,t,n,r,i){let{tables:a}=e,{tables:o}=t;if(a==null||o==null)return;let s=zh(e,n,r);if(i!==1){let e=[];for(let t of o){let{startIndex:n,endIndex:r}=t,a=[];for(let e of s){let{startIndex:o,endIndex:s}=e;if(o>=n&&s<=r){i===0?a.push({...e,...t}):a.push({...t,...e});break}}e.push(...a),a=[]}t.tables=e}return Th(e,t,n,r),s}function sg(e,t,n,r,i){let{columnGroups:a}=e,{columnGroups:o}=t;if(a==null||o==null)return;let s=Bh(e,n,r);if(i!==1){let e=[];for(let t of o){let{startIndex:n,endIndex:r}=t,a=[];for(let e of s){let{startIndex:o,endIndex:s}=e;if(o>=n&&s<=r){i===0?a.push({...e,...t}):a.push({...t,...e});break}}e.push(...a),a=[]}t.columnGroups=e}return Eh(e,t,n,r),s}function cg(e,t,n,r,i){let{blockRanges:a}=e,{blockRanges:o}=t;if(a==null||o==null)return;let s=Hh(e,n,r);return i!==1&&(t.blockRanges=o.map(e=>{let t=s.find(t=>t.blockId===e.blockId);return t?{...t,...e}:e})),Dh(e,t,n,r),s}function lg(e,t,n,r,i){e.customRanges||(e.customRanges=[]),Ah(e.customRanges,r),Ah(e.customRanges,r+n);let a=r,o=r+n-1,{customRanges:s}=t,c=[],l=new Map;return e.customRanges.forEach(e=>{let{startIndex:t,endIndex:n}=e;t>=a&&n<=o?l.set(e.rangeId,e):c.push(e)}),s?(s.forEach(e=>{let{startIndex:t,endIndex:n}=e;c.push({...e,startIndex:t+r,endIndex:n+r})}),e.customRanges=kh(c),[]):[]}function ug(e,t,n,r,i){e.customDecorations||(e.customDecorations=[]),Mh(e.customDecorations,r),Mh(e.customDecorations,r+n);let a=[],{customDecorations:o}=e,{customDecorations:s=[]}=t;if(i===1){for(let e=0;e<o.length;e++){let t=o[e],{startIndex:i,endIndex:s}=t;i>=r&&s<=r+n-1&&a.push(t)}s.forEach(e=>{let{startIndex:t,endIndex:n}=e;o.push({...e,startIndex:t+r,endIndex:n+r})})}else for(let e of s){let{id:t}=e;if(e.type===9999){let e=o.filter(e=>e.id===t);e.length&&a.push(...e)}else o.push({...e,startIndex:e.startIndex+r,endIndex:e.endIndex+r})}for(let e of a){let{id:t}=e,n=o.findIndex(e=>e.id===t);n!==-1&&o.splice(n,1)}return e.customDecorations=jh(o),a}function dg(e,t){if(t===void 0)return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function fg(e){let{startOffset:t,endOffset:n,collapsed:r}=e;return{startOffset:Math.min(t,n),endOffset:Math.max(t,n),collapsed:r}}function pg(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function mg(e,t,n,r){let{startOffset:i,endOffset:a}=e,o=r==null?_g(t,n):r,s=[],c=-1;for(let e=0;e<o.length;e++){let t=o[e],{startIndex:n}=t;(i>c&&i<=n||a>c&&a<=n||n>=i&&n<=a)&&s.push(t),c=n}return s}function hg(e,t,n){let r=[],i=_g(t,n);for(let a of e){let e=mg(a,t,n,i);r.push(...e)}return r}let gg=[`\r`,``,``,`\x1B`,``,``];function _g(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r],{startIndex:a}=i,o=a-1;for(;!gg.includes(t[o])&&o>=0;)o--;n.push({...i,paragraphStart:o+1,paragraphEnd:i.startIndex})}return n}let vg=e=>{var t,n;let{paragraphs:r,segmentId:i,document:a}=e,o=e.listType,s=(t=(n=a.getSelfOrHeaderFooterModel(i))==null||(n=n.getBody())==null?void 0:n.paragraphs)==null?[]:t,c=r.every(e=>{var t;return((t=e.bullet)==null?void 0:t.listType.indexOf(o))===0}),l=Y(6);if(r.length===1){let e=s.indexOf(r[0]),t=s[e-1],n=s[e+1];t&&t.bullet&&t.bullet.listType.indexOf(o)===0?(l=t.bullet.listId,o!==`CHECK_LIST`&&(o=t.bullet.listType)):n&&n.bullet&&n.bullet.listType.indexOf(o)===0&&(l=n.bullet.listId,o!==`CHECK_LIST`&&(o=n.bullet.listType))}let u=new pm;u.reset();let d=new X;for(let e of r){var f;let{startIndex:t,paragraphId:n,paragraphStyle:r={},bullet:i}=e;d.push({t:`r`,len:t-u.cursor}),d.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[c?{paragraphId:n,paragraphStyle:r,startIndex:0}:{startIndex:0,paragraphId:n,paragraphStyle:{...r},bullet:{nestingLevel:(f=i==null?void 0:i.nestingLevel)==null?0:f,textStyle:{fs:20},listType:o,listId:l}}]},coverType:1}),u.moveCursorTo(t+1)}return d},yg=e=>{var t;let{paragraphIndex:n,segmentId:r,document:i}=e,a=(t=i.getSelfOrHeaderFooterModel(r))==null||(t=t.getBody())==null?void 0:t.paragraphs;if(a==null)return!1;let o=a.find(e=>e.startIndex===n);if(!(o!=null&&o.bullet)||o.bullet.listType.indexOf(`CHECK_LIST`)===-1)return!1;let s=new pm;s.reset();let c=new X,{startIndex:l,paragraphStyle:u={}}=o,d=o.bullet.listType===`CHECK_LIST`?`CHECK_LIST_CHECKED`:`CHECK_LIST`;return c.push({t:`r`,len:l-s.cursor}),c.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{...o,paragraphStyle:u,startIndex:0,bullet:{...o.bullet,listType:d}}]},coverType:1}),s.moveCursorTo(l+1),c},bg=e=>{var t;let{paragraphs:n,listType:r,listId:i,segmentId:a,document:o}=e;if(((t=o.getSelfOrHeaderFooterModel(a))==null||(t=t.getBody())==null?void 0:t.paragraphs)==null)return!1;let s=i==null?Y(6):i,c=new pm;c.reset();let l=new X;for(let e of n){var u;let{startIndex:t,paragraphId:n,paragraphStyle:i={},bullet:a}=e;l.push({t:`r`,len:t-c.cursor}),l.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{startIndex:0,paragraphId:n,paragraphStyle:i,bullet:{nestingLevel:(u=a==null?void 0:a.nestingLevel)==null?0:u,textStyle:(a==null?void 0:a.listType)===r?a.textStyle:{fs:20},listType:r,listId:s}}]},coverType:1}),c.moveCursorTo(t+1)}return l};function xg(e,t){return t.some(t=>{let n=Zm(t);return e.startIndex>n.startOffset&&ih(n,e.startIndex)})}let Sg=new Set([`
|
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
`)?t.slice(0,-2):t},__=e=>e?g_(e).replaceAll(`\r`,``)===``:!0,v_=e=>{let t=e.replace(/\n/g,`\r`),n=[],r=new Set,i=[],a=0,o=``,s=(s,c=!0)=>{let l=t.slice(a,s);if(z.isLegalUrl(l)){let t=Y(),u=`${l}`,d={startIndex:a,endIndex:a+u.length-1,rangeId:t,rangeType:0,properties:{url:e}};i.push(d),o+=u,a=s+1,c&&(o+=`\r`,n.push({startIndex:s,paragraphId:Cm(r)}))}else o+=t.slice(a,s+1),a=s+1,c&&n.push({startIndex:s,paragraphId:Cm(r)})},c=0;for(let e=0;e<t.length;e++)t[e]===`\r`&&(s(e),c=e);return(c!==t.length-1||t.length===1)&&s(t.length,!1),{dataStream:o,paragraphs:n,customRanges:i}},y_={id:`default_doc`,documentStyle:{}};function b_(e){var t,n;if(e.id!=null&&nd(e.id))return{...y_,...e};let r=Nm(e.id,e.locale,e.title,(t=e.documentStyle)==null?void 0:t.documentFlavor);if(z.isEmptyObject(e))return r;let i=na({},r,e,(e,t,n)=>{if(Array.isArray(t)||n===`body`&&typeof t==`object`&&t)return t});return e.body!=null&&((n=e.documentStyle)==null?void 0:n.defaultParagraphStyle)===void 0&&delete i.documentStyle.defaultParagraphStyle,i}var x_=class extends M{getUnitId(){throw Error(`Method not implemented.`)}constructor(e){var r;super(),T(this,`type`,n.UniverType.UNIVER_DOC),T(this,`_name$`,new t.BehaviorSubject(``)),T(this,`name$`,this._name$.asObservable()),T(this,`snapshot`,void 0),this.snapshot=b_(e),this._name$.next((r=this.snapshot.title)==null?`No Title`:r)}getRev(){var e;return(e=this.snapshot.rev)==null?1:e}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(e){this.snapshot.rev=e}setName(e){this.snapshot.title=e,this._name$.next(e)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}resetDrawing(e,t){this.snapshot.drawings=e,this.snapshot.drawingsOrder=t}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var e;let t=(e=this.snapshot.lists)==null?{}:e;return{...Xh,...t}}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){let{documentStyle:t}=this.snapshot;t.renderConfig==null?t.renderConfig=e:t.renderConfig={...t.renderConfig,...e}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(e){this.snapshot.documentStyle==null?this.snapshot.documentStyle=e:this.snapshot.documentStyle={...this.snapshot.documentStyle,...e}}updateDocumentDataMargin(e){let{t,l:n,b:r,r:i}=e,{documentStyle:a}=this.snapshot;t!=null&&(a.marginTop=t),n!=null&&(a.marginLeft=n),r!=null&&(a.marginBottom=r),i!=null&&(a.marginRight=i)}updateDocumentDataPageSize(e,t){let{documentStyle:n}=this.snapshot;if(!n.pageSize){n.pageSize={width:e==null?1/0:e,height:t==null?1/0:t};return}e!==void 0&&(n.pageSize.width=e),t!==void 0&&(n.pageSize.height=t)}updateDrawing(e,t){let{drawings:n}=this,{width:r,height:i,left:a,top:o}=t,s=n==null?void 0:n[e];if(!s)return;let c=s.docTransform;c.size.width=r,c.size.height=i,c.positionH.posOffset=a,c.positionV.posOffset=o}setZoomRatio(e=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=e:this.snapshot.settings={zoomRatio:e}}setDisabled(e){this.snapshot.disabled=e}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}},S_=class e extends x_{constructor(e){var n,r;super(z.isEmptyObject(e)?Nm():e),T(this,`_unitId`,void 0),T(this,`headerModelMap`,new Map),T(this,`footerModelMap`,new Map),T(this,`change$`,new t.BehaviorSubject(0)),this._unitId=(n=this.snapshot.id)==null?Y(6):n,this._initializeHeaderFooterModel(),this._name$.next((r=this.snapshot.title)==null?``:r)}dispose(){super.dispose(),this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var e;return(e=this.snapshot.body)==null?void 0:e.customRanges}getCustomDecorations(){var e;return(e=this.snapshot.body)==null?void 0:e.customDecorations}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw Error(`Cannot reset a document model with a different unit id!`);this.snapshot=b_(e),this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(e){return e==null||e===``?this:this.headerModelMap.has(e)?this.headerModelMap.get(e):this.footerModelMap.has(e)?this.footerModelMap.get(e):null}getUnitId(){return this._unitId}apply(e){if(!m_.isNoop(e))return this.snapshot=m_.apply(this.snapshot,e),e!=null&&e.some(e=>Array.isArray(e)&&((e==null?void 0:e[0])===`headers`||(e==null?void 0:e[0])===`footers`))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(e,t,n=0){let r=this.getBody();if(r!=null)return Rg(r,e,t,!1,n)}_initializeHeaderFooterModel(){let{headers:t,footers:n}=this.getSnapshot();if(t)for(let n in t){let r=t[n];this.headerModelMap.set(n,new e(r)),this.headerModelMap.get(n).updateDocumentId(this.getUnitId())}if(n)for(let t in n){let r=n[t];this.footerModelMap.set(t,new e(r)),this.footerModelMap.get(t).updateDocumentId(this.getUnitId())}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}getPlainText(){var e,t;return g_((e=(t=this.getBody())==null?void 0:t.dataStream)==null?``:e)}};function C_(e){return e==null?{}:Object.fromEntries(Object.entries(e).filter(([,e])=>e!=null))}function w_(e,t,n={}){var r;let i={...((r=n.useLegacyModernDefaults)==null?(e==null?void 0:e.documentFlavor)===2:r)?{lineSpacing:of,spaceAbove:{v:0},spaceBelow:{v:12}}:{},...C_(e==null?void 0:e.defaultParagraphStyle)};n.excludeDocumentOuterSpacing&&(delete i.spaceAbove,delete i.spaceBelow);let a=C_(t),o=a.namedStyleType==null?null:sf[a.namedStyleType];return z.deepClone({...i,...o,...a})}function T_(e,t,n,r){if(t===``)return e;let i=new S_({id:`mock-id`,body:e,documentStyle:{}}),a=t.length,o;for(;(o=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){let e=new X,t=m_.getInstance();if(o>0&&e.retain(o),n.length>0){var s;let t=i.sliceBody(o,o+a),r={dataStream:n};Array.isArray(t==null?void 0:t.textRuns)&&t.textRuns.length&&(r.textRuns=[{...t.textRuns[0],st:0,ed:n.length}]),!(t==null||(s=t.customRanges)==null)&&s.length&&(r.customRanges=[{...t.customRanges[0],startIndex:0,endIndex:n.length-1}]),e.insert(n.length,r)}e.delete(a),i.apply(t.editOp(e.serialize()))}let c=i.getBody();return i.dispose(),c}function E_(e){let{ranges:t,id:n,type:r}=e,i=new X,a=0;for(let e=0;e<t.length;e++){let{startOffset:o,endOffset:s}=t[e];o>0&&i.push({t:`r`,len:o-a}),i.push({t:`r`,body:{dataStream:``,customDecorations:[{id:n,type:r,startIndex:0,endIndex:s-o-1}]},len:s-o}),a=s}return i}function D_(e){var t;let{id:n,segmentId:r,documentDataModel:i}=e,a=i==null?void 0:i.getBody();if(!i||!a)return!1;let o=(t=i.getSelfOrHeaderFooterModel(r))==null||(t=t.getBody())==null||(t=t.customDecorations)==null?void 0:t.find(e=>e.id===n);if(!o)return!1;let s=new X,{startIndex:c,endIndex:l}=o,u=l-c+1;return s.push({t:`r`,len:c}),s.push({t:`r`,len:u,body:{dataStream:``,customDecorations:[{startIndex:0,endIndex:u-1,id:n,type:9999}]}}),s}function O_(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function k_(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];e.collapsed?ah(eh(i),e.startOffset)&&n.push(i):oh({startOffset:e.startOffset,endOffset:e.endOffset},eh(i))&&n.push(i)}return n}function A_(e){return{...z.deepClone(e),rangeId:Y()}}function j_(e,t){let n=[],r=e[0];for(let i of t)i<e[0]||i>e[1]||(r<i&&n.push([r,i-1]),r=i+1);return r<=e[1]&&n.push([r,e[1]]),n}function M_(e,t,n,r){let i=[],a=Ym({startIndex:e,endIndex:t});for(let e=0,o=n.length;e<o;e++){let o=n[e];if((r===void 0||o.rangeType===r)&&oh(a,eh(o))&&i.push({...o}),o.startIndex>t)break}return i}function N_(e,t){var n,r,i,a,o;let s=M_(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(n=t.customRanges)==null?[]:n),c=Math.min(e.startOffset,(r=(i=s[0])==null?void 0:i.startIndex)==null?1/0:r),l=Math.max(e.endOffset,((a=(o=s[s.length-1])==null?void 0:o.endIndex)==null?-1/0:a)+1);return{startOffset:c,endOffset:l,collapsed:c===l}}var P_=h(f(((e,t)=>{var n=-1,r=1,i=0;function a(e,t,n,r,a){if(e===t)return e?[[i,e]]:[];if(n!=null){var s=D(e,t,n);if(s)return s}var c=l(e,t),u=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=d(e,t);var f=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var m=o(e,t);return u&&m.unshift([i,u]),f&&m.push([i,f]),b(m,a),r&&p(m),m}function o(e,t){var o;if(!e)return[[r,t]];if(!t)return[[n,e]];var c=e.length>t.length?e:t,l=e.length>t.length?t:e,u=c.indexOf(l);if(u!==-1)return o=[[r,c.substring(0,u)],[i,l],[r,c.substring(u+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=n),o;if(l.length===1)return[[n,e],[r,t]];var d=f(e,t);if(d){var p=d[0],m=d[1],h=d[2],g=d[3],_=d[4],v=a(p,h),y=a(m,g);return v.concat([[i,_]],y)}return s(e,t)}function s(e,t){for(var i=e.length,a=t.length,o=Math.ceil((i+a)/2),s=o,l=2*o,u=Array(l),d=Array(l),f=0;f<l;f++)u[f]=-1,d[f]=-1;u[s+1]=0,d[s+1]=0;for(var p=i-a,m=p%2!=0,h=0,g=0,_=0,v=0,y=0;y<o;y++){for(var b=-y+h;b<=y-g;b+=2){for(var x=s+b,S=b===-y||b!==y&&u[x-1]<u[x+1]?u[x+1]:u[x-1]+1,C=S-b;S<i&&C<a&&e.charAt(S)===t.charAt(C);)S++,C++;if(u[x]=S,S>i)g+=2;else if(C>a)h+=2;else if(m){var w=s+p-b;if(w>=0&&w<l&&d[w]!==-1){var T=i-d[w];if(S>=T)return c(e,t,S,C)}}}for(var E=-y+_;E<=y-v;E+=2){for(var w=s+E,T=E===-y||E!==y&&d[w-1]<d[w+1]?d[w+1]:d[w-1]+1,D=T-E;T<i&&D<a&&e.charAt(i-T-1)===t.charAt(a-D-1);)T++,D++;if(d[w]=T,T>i)v+=2;else if(D>a)_+=2;else if(!m){var x=s+p-E;if(x>=0&&x<l&&u[x]!==-1){var S=u[x],C=s+S-x;if(T=i-T,S>=T)return c(e,t,S,C)}}}}return[[n,e],[r,t]]}function c(e,t,n,r){var i=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=a(i,o),u=a(s,c);return l.concat(u)}function l(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return x(e.charCodeAt(i-1))&&i--,i}function u(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}}function d(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return S(e.charCodeAt(e.length-i))&&i--,i}function f(e,t){var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;function i(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),i=-1,a=``,o,s,c,u;(i=t.indexOf(r,i+1))!==-1;){var f=l(e.substring(n),t.substring(i)),p=d(e.substring(0,n),t.substring(0,i));a.length<p+f&&(a=t.substring(i-p,i)+t.substring(i,i+f),o=e.substring(0,n-p),s=e.substring(n+f),c=t.substring(0,i-p),u=t.substring(i+f))}return a.length*2>=e.length?[o,s,c,u,a]:null}var a=i(n,r,Math.ceil(n.length/4)),o=i(n,r,Math.ceil(n.length/2)),s;if(!a&&!o)return null;s=o?a&&a[4].length>o[4].length?a:o:a;var c,u,f,p;e.length>t.length?(c=s[0],u=s[1],f=s[2],p=s[3]):(f=s[0],p=s[1],c=s[2],u=s[3]);var m=s[4];return[c,u,f,p,m]}function p(e){for(var t=!1,a=[],o=0,s=null,c=0,l=0,d=0,f=0,p=0;c<e.length;)e[c][0]==i?(a[o++]=c,l=f,d=p,f=0,p=0,s=e[c][1]):(e[c][0]==r?f+=e[c][1].length:p+=e[c][1].length,s&&s.length<=Math.max(l,d)&&s.length<=Math.max(f,p)&&(e.splice(a[o-1],0,[n,s]),e[a[o-1]+1][0]=r,o--,o--,c=o>0?a[o-1]:-1,l=0,d=0,f=0,p=0,s=null,t=!0)),c++;for(t&&b(e),y(e),c=1;c<e.length;){if(e[c-1][0]==n&&e[c][0]==r){var m=e[c-1][1],h=e[c][1],g=u(m,h),_=u(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(c,0,[i,h.substring(0,g)]),e[c-1][1]=m.substring(0,m.length-g),e[c+1][1]=h.substring(g),c++):(_>=m.length/2||_>=h.length/2)&&(e.splice(c,0,[i,m.substring(0,_)]),e[c-1][0]=r,e[c-1][1]=h.substring(0,h.length-_),e[c+1][0]=n,e[c+1][1]=m.substring(_),c++),c++}c++}}var m=/[^a-zA-Z0-9]/,h=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,v=/^\r?\n\r?\n/;function y(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(m),a=r.match(m),o=i&&n.match(h),s=a&&r.match(h),c=o&&n.match(g),l=s&&r.match(g),u=c&&e.match(_),d=l&&t.match(v);return u||d?5:c||l?4:i&&!o&&s?3:o||s?2:i||a?1:0}for(var n=1;n<e.length-1;){if(e[n-1][0]==i&&e[n+1][0]==i){var r=e[n-1][1],a=e[n][1],o=e[n+1][1],s=d(r,a);if(s){var c=a.substring(a.length-s);r=r.substring(0,r.length-s),a=c+a.substring(0,a.length-s),o=c+o}for(var l=r,u=a,f=o,p=t(r,a)+t(a,o);a.charAt(0)===o.charAt(0);){r+=a.charAt(0),a=a.substring(1)+o.charAt(0),o=o.substring(1);var y=t(r,a)+t(a,o);y>=p&&(p=y,l=r,u=a,f=o)}e[n-1][1]!=l&&(l?e[n-1][1]=l:(e.splice(n-1,1),n--),e[n][1]=u,f?e[n+1][1]=f:(e.splice(n+1,1),n--))}n++}}function b(e,t){e.push([i,``]);for(var a=0,o=0,s=0,c=``,u=``,f;a<e.length;){if(a<e.length-1&&!e[a][1]){e.splice(a,1);continue}switch(e[a][0]){case r:s++,u+=e[a][1],a++;break;case n:o++,c+=e[a][1],a++;break;case i:var p=a-s-o-1;if(t){if(p>=0&&w(e[p][1])){var m=e[p][1].slice(-1);if(e[p][1]=e[p][1].slice(0,-1),c=m+c,u=m+u,!e[p][1]){e.splice(p,1),a--;var h=p-1;e[h]&&e[h][0]===r&&(s++,u=e[h][1]+u,h--),e[h]&&e[h][0]===n&&(o++,c=e[h][1]+c,h--),p=h}}if(C(e[a][1])){var m=e[a][1].charAt(0);e[a][1]=e[a][1].slice(1),c+=m,u+=m}}if(a<e.length-1&&!e[a][1]){e.splice(a,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(f=l(u,c),f!==0&&(p>=0?e[p][1]+=u.substring(0,f):(e.splice(0,0,[i,u.substring(0,f)]),a++),u=u.substring(f),c=c.substring(f)),f=d(u,c),f!==0&&(e[a][1]=u.substring(u.length-f)+e[a][1],u=u.substring(0,u.length-f),c=c.substring(0,c.length-f)));var g=s+o;c.length===0&&u.length===0?(e.splice(a-g,g),a-=g):c.length===0?(e.splice(a-g,g,[r,u]),a=a-g+1):u.length===0?(e.splice(a-g,g,[n,c]),a=a-g+1):(e.splice(a-g,g,[n,c],[r,u]),a=a-g+2)}a!==0&&e[a-1][0]===i?(e[a-1][1]+=e[a][1],e.splice(a,1)):a++,s=0,o=0,c=``,u=``;break}}e[e.length-1][1]===``&&e.pop();var _=!1;for(a=1;a<e.length-1;)e[a-1][0]===i&&e[a+1][0]===i&&(e[a][1].substring(e[a][1].length-e[a-1][1].length)===e[a-1][1]?(e[a][1]=e[a-1][1]+e[a][1].substring(0,e[a][1].length-e[a-1][1].length),e[a+1][1]=e[a-1][1]+e[a+1][1],e.splice(a-1,1),_=!0):e[a][1].substring(0,e[a+1][1].length)==e[a+1][1]&&(e[a-1][1]+=e[a+1][1],e[a][1]=e[a][1].substring(e[a+1][1].length)+e[a+1][1],e.splice(a+1,1),_=!0)),a++;_&&b(e,t)}function x(e){return e>=55296&&e<=56319}function S(e){return e>=56320&&e<=57343}function C(e){return S(e.charCodeAt(0))}function w(e){return x(e.charCodeAt(e.length-1))}function T(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}function E(e,t,a,o){return w(e)||C(o)?null:T([[i,e],[n,t],[r,a],[i,o]])}function D(e,t,n){var r=typeof n==`number`?{index:n,length:0}:n.oldRange,i=typeof n==`number`?null:n.newRange,a=e.length,o=t.length;if(r.length===0&&(i===null||i.length===0)){var s=r.index,c=e.slice(0,s),l=e.slice(s),u=i?i.index:null;editBefore:{var d=s+o-a;if(u!==null&&u!==d||d<0||d>o)break editBefore;var f=t.slice(0,d),p=t.slice(d);if(p!==l)break editBefore;var m=Math.min(s,d),h=c.slice(0,m),g=f.slice(0,m);if(h!==g)break editBefore;var _=c.slice(m),v=f.slice(m);return E(h,_,v,l)}editAfter:{if(u!==null&&u!==s)break editAfter;var y=s,f=t.slice(0,y),p=t.slice(y);if(f!==c)break editAfter;var b=Math.min(a-y,o-y),x=l.slice(l.length-b),S=p.slice(p.length-b);if(x!==S)break editAfter;var _=l.slice(0,l.length-b),v=p.slice(0,p.length-b);return E(c,_,v,x)}}if(r.length>0&&i&&i.length===0)replaceRange:{var h=e.slice(0,r.index),x=e.slice(r.index+r.length),m=h.length,b=x.length;if(o<m+b)break replaceRange;var g=t.slice(0,m),S=t.slice(o-b);if(h!==g||x!==S)break replaceRange;var _=e.slice(m,a-b),v=t.slice(m,o-b);return E(h,_,v,x)}return null}function O(e,t,n,r){return a(e,t,n,r,!0)}O.INSERT=r,O.DELETE=n,O.EQUAL=i,t.exports=O}))());function F_(e){var t,n;let{rangeId:r,segmentId:i,documentDataModel:a,insert:o}=e,s=(t=a.getSelfOrHeaderFooterModel(i))==null||(t=t.getBody())==null||(t=t.customRanges)==null?void 0:t.find(e=>e.rangeId===r);if(!s)return!1;let{startIndex:c,endIndex:l}=s,u=new X,d=l-c+1;u.push({t:`r`,len:c}),u.push({t:`r`,len:d,body:{dataStream:``,customRanges:[]}}),o&&u.push({t:`i`,body:o,len:o.dataStream.length});let f=l+1+((n=o==null?void 0:o.dataStream.length)==null?0:n);return u.selections=[{startOffset:f,endOffset:f,collapsed:!0}],u}function I_(e){let{ranges:t,rangeId:n,rangeType:r,wholeEntity:i,properties:a,body:o}=e,s=0,c=new X,l=!1;return t.forEach(e=>{var t,u,d;let f=N_(e,o);if(!f||!o)return!1;let{startOffset:p,endOffset:m}=f,h=(t=o.customRanges)==null?[]:t,g=(e,t,o)=>{var l,u,d,f;let p=M_(e,t,h,r),m=Math.min((l=(u=p[0])==null?void 0:u.startIndex)==null?1/0:l,e),g=Math.max((d=(f=p[p.length-1])==null?void 0:f.endIndex)==null?-1/0:d,t),_={rangeId:o?`${n}$${o}`:n,rangeType:r,startIndex:0,endIndex:g-m,wholeEntity:i,properties:{...a}};c.push({t:`r`,len:m-s}),c.push({t:`r`,len:g-m+1,body:{dataStream:``,customRanges:[_]},coverType:0}),s=g+1},_=((u=o.paragraphs)==null?[]:u).filter(e=>e.startIndex<m&&e.startIndex>p),v=((d=o.customBlocks)==null?[]:d).filter(e=>e.startIndex<m&&e.startIndex>p);j_([p,m-1],[..._.map(e=>e.startIndex),...v.map(e=>e.startIndex)]).forEach(([e,t],n)=>g(e,t,n)),l=!0,c.selections=[{startOffset:f.endOffset,endOffset:f.endOffset,collapsed:!0}]}),l?c:!1}function L_(e,t){return!!(e.atomicRange&&t.some(t=>t.startOffset<=e.atomicRange.startOffset&&t.endOffset>=e.atomicRange.endOffset))}function R_(e,t){return t.some(t=>e>=t.startOffset&&e<t.endOffset)}function z_(e,t){return e>=t.startOffset&&e<=t.endOffset}function B_(e,t,n){e.length&&e.every(e=>R_(e,t))&&n.add(e[e.length-1])}function V_(e,t,n){for(let r=0;r<e.dataStream.length;r++){let i=e.dataStream[r];(i===``||i===``||i===``||i===``)&&R_(r,t)&&n.add(r)}}function H_(e,t,n){var r;for(let i of(r=e.blockRanges)==null?[]:r){let e=Qm(i);t.some(t=>t.startOffset<=e.startOffset&&t.endOffset>=e.endOffset)||(R_(i.startIndex,t)&&n.add(i.startIndex),R_(i.endIndex,t)&&n.add(i.endIndex))}}function U_(e){var t,n,r;let i=[...(t=e.blockRanges)==null?[]:t].sort((e,t)=>e.startIndex-t.startIndex),a=i.map(e=>{let t=Qm(e);return{atomicRange:t,startOffset:t.startOffset+1,endOffset:t.endOffset-1,paragraphs:[],sectionBreaks:[],require:`paragraph-or-section`}}),o=(e,t)=>{let n=0,r=i.length-1,o=-1;for(;n<=r;){let t=Math.floor((n+r)/2),a=i[t];if(e<=a.startIndex)r=t-1;else if(e>=a.endIndex)n=t+1;else{o=t;break}}o>=0&&a[o][t].push(e)};return((n=e.paragraphs)==null?[]:n).forEach(e=>o(e.startIndex,`paragraphs`)),((r=e.sectionBreaks)==null?[]:r).forEach(e=>o(e.startIndex,`sectionBreaks`)),a}function W_(e){let t=[{startOffset:0,endOffset:e.dataStream.length,paragraphs:[],sectionBreaks:[],require:`paragraph-and-section`}],n=[],r=[],i=()=>r.length?r[r.length-1]:n.length?n[n.length-1]:t[0];for(let a=0;a<e.dataStream.length;a++){let o=e.dataStream[a];if(o===``)n.push({startOffset:a+1,endOffset:a+1,paragraphs:[],sectionBreaks:[],require:`paragraph-or-section`});else if(o===``){let e=n.pop();e&&(e.endOffset=a,t.push(e))}else if(o===``)r.push({startOffset:a+1,endOffset:a+1,paragraphs:[],sectionBreaks:[],require:`paragraph-and-section`});else if(o===``){let e=r.pop();e&&(e.endOffset=a,t.push(e))}else o===`\r`?i().paragraphs.push(a):o===`
|
|
8
8
|
`&&i().sectionBreaks.push(a)}return t.push(...U_(e)),t}function G_(e,t,n,r,i){var a;if(L_(e,t))return;let o=n&&z_(r,e),s=(a=n==null?void 0:n.dataStream)==null?``:a,c=s.includes(`\r`),l=s.includes(`
|
|
9
9
|
`);if(e.require===`paragraph-or-section`){let n=[...e.paragraphs,...e.sectionBreaks].sort((e,t)=>e-t);(!o||!c&&!l)&&B_(n,t,i);return}(!o||!c)&&B_(e.paragraphs,t,i),(!o||!l)&&B_(e.sectionBreaks,t,i)}function K_(e,t,n){if(!e.length)return e;let r=e[0].startOffset,i=new Set;if(W_(t).forEach(t=>{G_(t,e,n,r,i)}),V_(t,e,i),H_(t,e,i),!i.size)return e;let a=[];return e.forEach(e=>{let t=e.startOffset;for(let n=e.startOffset;n<e.endOffset;n++)i.has(n)&&(t<n&&a.push({...e,startOffset:t,endOffset:n,collapsed:!1}),t=n+1);t<e.endOffset&&a.push({...e,startOffset:t,endOffset:e.endOffset,collapsed:!1})}),a.length?a:[{...e[0],endOffset:e[0].startOffset,collapsed:!0}]}function q_(e,t,n=0,r=null,i=!0){e.sort((e,t)=>e.startOffset-t.startOffset),e=K_(e,t,r);let a=[],{paragraphs:o=[]}=t,s=o==null?void 0:o.find(t=>t.startIndex>=e[0].startOffset&&t.startIndex<e[0].endOffset),c=n;if(e.forEach(e=>{let{startOffset:t,endOffset:n}=e;t>c&&(a.push({t:`r`,len:t-c}),c=t),c<n&&(a.push({t:`d`,len:n-c}),c=n)}),r&&a.push({t:`i`,body:r,len:r.dataStream.length}),s!=null&&s.bullet&&i){let t=o.find(t=>t.startIndex-n>=e[e.length-1].endOffset-1);t&&(t.startIndex>c&&(a.push({t:`r`,len:t.startIndex-c}),c=t.startIndex),a.push({t:`r`,len:1,body:{dataStream:``,paragraphs:[{...t,startIndex:0,bullet:s==null?void 0:s.bullet}]},coverType:0}))}return a}function J_(e,t,n=0){let r=[],i=n;return e.forEach(e=>{let{startOffset:n,endOffset:a}=e;n>i&&(r.push({t:`r`,len:n-i}),i=n),a>i&&(r.push({t:`r`,len:a-i,body:{...z.deepClone(t),dataStream:``}}),i=a)}),r}let Y_=e=>{var t;let{selection:n,body:r,doc:i}=e,a=n.segmentId,o=(t=i.getSelfOrHeaderFooterModel(a))==null?void 0:t.getBody();if(!o)return!1;let s=K_([n],o,r);if(s.length!==1||s[0].startOffset!==n.startOffset||s[0].endOffset!==n.endOffset){let e=new X;return e.push(...q_([n],o,0,r)),e}let c=n.collapsed?null:Rg(o,n.startOffset,n.endOffset),l=(0,P_.default)(c?c.dataStream:``,r.dataStream),u=0,d=l.map(([e,t])=>{switch(e){case 0:{let e={t:`r`,body:{...zg(r,u,u+t.length,!1),dataStream:``},len:t.length};return u+=t.length,e}case 1:{let e={t:`i`,body:zg(r,u,u+t.length),len:t.length};return u+=t.length,e}default:return{t:`d`,len:t.length}}}),f=new X;return f.push({t:`r`,len:n.startOffset}),f.push(...d),f};function X_(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&e!=null&&e.every((e,n)=>JSON.stringify(e)===JSON.stringify(t==null?void 0:t[n])))}let Z_=e=>{var t;let{selection:n,body:r,doc:i,themeService:a}=e,o=n.segmentId,s=(t=i.getSelfOrHeaderFooterModel(o))==null?void 0:t.getBody();if(!s)return!1;let c=K_([n],s,r);if(c.length!==1||c[0].startOffset!==n.startOffset||c[0].endOffset!==n.endOffset){let e=new X;return e.push(...q_([n],s,0,r)),e}let l=n.collapsed?null:Rg(s,n.startOffset,n.endOffset),u=(0,P_.default)(l?l.dataStream:``,r.dataStream),d=0,f=u.map(([e,t])=>{switch(e){case 0:{let e=jg(r,d,d+t.length,!1),n={t:`r`,body:X_(e,jg(l,d,d+t.length,!1))?void 0:{textRuns:e==null?void 0:e.map(e=>{var t,n,r,i;return{...e,ts:{...e.ts,cl:!((t=e.ts)==null||(t=t.cl)==null||(t=t.rgb)==null)&&t.includes(`.`)?{rgb:a.getColorFromTheme((n=(r=e.ts)==null||(r=r.cl)==null?void 0:r.rgb)==null?``:n)}:(i=e.ts)==null?void 0:i.cl}}}),dataStream:``},len:t.length};return d+=t.length,n}case 1:{let e={t:`i`,body:zg(r,d,d+t.length),len:t.length};return d+=t.length,e}default:return{t:`d`,len:t.length}}});if(f.every(e=>e.t===`r`&&!e.body))return!1;let p=new X;return p.push({t:`r`,len:n.startOffset}),p.push(...f),p};function Q_(e,t){let n=[],{customBlocks:r=[]}=e;for(let e of t){let{startOffset:t,endOffset:i}=e;if(!(t==null||i==null))for(let e of r){let{startIndex:r}=e;r>=t&&r<i&&n.push(e.blockId)}}return n}let $_=e=>{var t,n,r;let{selection:i,documentDataModel:a,drawings:o}=e,{collapsed:s,startOffset:c,segmentId:l}=i,u=new X,d=m_.getInstance(),f=[],p=(t=a.getSelfOrHeaderFooterModel(l))==null?void 0:t.getBody();if(!p)return!1;let m=(n=(r=a.getSnapshot().drawingsOrder)==null?void 0:r.length)==null?0:n,h=0,g=s?ev(p,c==null?0:c):c==null?0:c;if(s)g>0&&u.push({t:`r`,len:g});else{var _,v;let e=q_([i],p,0,null,!1);u.push(...e);let t=Q_(p,[i]),n=(_=a.getDrawings())==null?{}:_,r=(v=a.getDrawingsOrder())==null?[]:v,o=t.sort((e,t)=>r.indexOf(e)>r.indexOf(t)?-1:+(r.indexOf(e)<r.indexOf(t)));if(o.length>0)for(let e of o){let t=n[e],i=r.indexOf(e);if(t==null||i<0)continue;let a=d.removeOp([`drawings`,e],t),o=d.removeOp([`drawingsOrder`,i],e);f.push(a),f.push(o),h++}}let y=tv(p,o,g);u.push({t:`i`,body:y,len:y.dataStream.length});let b=Zg(a,l),x=d.editOp(u.serialize(),b);f.push(x);for(let e of o){let{drawingId:t}=e,n=d.insertOp([`drawings`,t],e),r=d.insertOp([`drawingsOrder`,m-h],t);f.push(n),f.push(r)}return f.reduce((e,t)=>m_.compose(e,t),null)};function ev(e,t){return t===0&&e.dataStream[0]===`\r`?1:t}function tv(e,t,n){var r;let i=`\b`.repeat(t.length),a=e.dataStream[n]===`
|
|
10
|
-
`||e.dataStream[n]===void 0;return{dataStream:a?`${i}\r`:i,customBlocks:t.map((e,t)=>({startIndex:t,blockId:e.drawingId})),...a?{paragraphs:[{startIndex:i.length,paragraphId:Cm(new Set((r=e.paragraphs)==null?void 0:r.map(e=>e.paragraphId)))}]}:{}}}function nv(e,t){if(e==null||t==null)return null;let n=e.dataStream,r=t.dataStream;if(n===r)return null;let i=r.length-n.length;if(i>0){let a=
|
|
11
|
-
`&&e.sectionBreaks.push({startIndex:n,sectionId:Am(t)})}return e.tables||(e.tables=[]),e}function
|
|
12
|
-
`)}getParagraphStyle(){var e;return
|
|
13
|
-
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0,paragraphId:Cm(new Set)}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),T(this,`_doc`,void 0),T(this,`_trackedRanges`,new Set),this._doc=new S_(e)}getParagraphs(){var e;let t=this._data.body;if(!t)return[];let n=wg(t);return((e=t.paragraphs)==null?[]:e).map(e=>{var t;return this._createParagraphBuilder(e.paragraphId,(t=n.get(e.startIndex))==null?0:t,e.startIndex)})}getTextRuns(){return this.getParagraphs().flatMap(e=>e.getTextRuns())}_createTextRunBuilders(e){var t,n,r;let i=this._data.body;if(!i||e.startOffset>=e.endOffset)return[];let a=new Set([e.startOffset,e.endOffset]),o=(t,n)=>{let r=Math.max(t,e.startOffset),i=Math.min(n,e.endOffset);r<i&&(a.add(r),a.add(i))};for(let e of(t=i.textRuns)==null?[]:t)o(e.st,e.ed);for(let e of(n=i.customRanges)==null?[]:n)o(e.startIndex,e.endIndex+1);for(let e of(r=i.customDecorations)==null?[]:r)o(e.startIndex,e.endIndex+1);for(let t=e.startOffset;t<e.endOffset;t++)
|
|
14
|
-
`))throw RangeError(`Rich text run replacement cannot contain paragraph or section breaks.`);let s=this._doc.getBody();if(!s)throw Error(`Rich text body is not available.`);let{startOffset:c,endOffset:l}=e;if(s.dataStream.slice(c,l)===t)return;let u=Rg(s,c,l),d={dataStream:t};t&&i&&(d.textRuns=[{st:0,ed:t.length,sId:r,ts:z.deepClone(n)}]),t&&(a=u.customRanges)!=null&&a.length&&(d.customRanges=u.customRanges.map(e=>({...z.deepClone(e),startIndex:0,endIndex:t.length-1}))),t&&(o=u.customDecorations)!=null&&o.length&&(d.customDecorations=u.customDecorations.map(e=>({...z.deepClone(e),startIndex:0,endIndex:t.length-1})));let f=Z.selection.replace({doc:this._doc,selection:{startOffset:c,endOffset:l,collapsed:c===l},body:d});if(!f)throw Error(`Replace rich text run failed.`);X.apply(s,f.serialize()),this._rebaseTrackedRanges(c,l,t.length)}_createParagraphBuilder(e,t,n){return new
|
|
15
|
-
`}:n,o=(r=a.sectionBreaks)==null?a.sectionBreaks=[]:r;if(!o.length){var s,c;o.push({sectionId:Am(new Set),startIndex:Math.max(0,((s=(c=a.dataStream)==null?void 0:c.length)==null?0:s)-1)})}let l=Math.max(0,(i=e.spacing)==null?0:i),u=e.count===1?void 0:Array.from({length:e.count},(t,n)=>({width:0,paddingEnd:n===e.count-1?0:l}));for(let e of o)u?e.columnProperties=u.map(e=>({...e})):delete e.columnProperties;return this}span(e,t){return e?this.insertRichText(
|
|
16
|
-
`)||t.push(Q(n,`missing-root-section-break`,`Document body must contain at least one section break sentinel.`))}function
|
|
17
|
-
`)t.push(Q(n,`section-break-token-mismatch`,`Section break metadata must point to a section break sentinel.`,c.startIndex));else{var s;i.set(c.startIndex,((s=i.get(c.startIndex))==null?0:s)+1)}}
|
|
18
|
-
`)u&&(u.hasChild=!0),d&&(d.hasSectionBreak=!0);else if(l===``)r.push(c);else if(l===``)i.push({startIndex:c,hasChild:!1});else if(l===``){let e=i.pop();e?e.hasChild||t.push(Q(n,`empty-column`,`Column must contain at least one paragraph or section child.`,e.startIndex)):t.push(Q(n,`unbalanced-column-group`,`Column end token has no matching column start.`,c))}else if(l===``)i.length>0||r.length===0?(t.push(Q(n,`unbalanced-column-group`,`Column group closes while a column is still open.`,c)),i.length=0):r.pop();else if(l===``)a.push(c);else if(l===`\x1B`)o.push(c);else if(l===``)s.push({startIndex:c,hasParagraph:!1,hasSectionBreak:!1});else if(l===``){let e=s.pop();e?(!e.hasParagraph||!e.hasSectionBreak)&&t.push(Q(n,`empty-table-cell`,`Table cell must contain a paragraph and section break child.`,e.startIndex)):t.push(Q(n,`unbalanced-table`,`Table cell end token has no matching start.`,c))}else l===``?s.length>0||o.length===0?(t.push(Q(n,`unbalanced-table`,`Table row closes while a cell is still open.`,c)),s.length=0):o.pop():l===``&&(s.length>0||o.length>0||a.length===0?(t.push(Q(n,`unbalanced-table`,`Table closes while a row or cell is still open.`,c)),s.length=0,o.length=0):a.pop())}(r.length>0||i.length>0)&&t.push(Q(n,`unbalanced-column-group`,`Column group or column token is not closed.`,e.dataStream.length)),(a.length>0||o.length>0||s.length>0)&&t.push(Q(n,`unbalanced-table`,`Table, row, or cell token is not closed.`,e.dataStream.length))}function Pv(e,t={segmentType:`body`}){let n=[];return wv(e,n,t),Tv(e,n,t),Ev(e,n,t),kv(e,n,t),Av(e,n,t),jv(e,n,t),Mv(e,n,t),Nv(e,n,t),n}function Fv(e){var t,n;let r=[];e.body&&r.push(...Pv(e.body,{segmentType:`body`}));for(let[n,i]of Object.entries((t=e.headers)==null?{}:t))r.push(...Pv(i.body,{segmentType:`header`,segmentId:n}));for(let[t,i]of Object.entries((n=e.footers)==null?{}:n))r.push(...Pv(i.body,{segmentType:`footer`,segmentId:t}));return r}function Iv(e,t){return`${t==="default"?`default`:t===`first`?`firstPage`:`evenPage`}${e===`header`?`Header`:`Footer`}Id`}function Lv(e,t,n,r){if(n<0||n>=t.length)return{linkedToPrevious:!1};let i=t[n],a=i[r];if(typeof a==`string`&&a)return{segmentId:a,linkedToPrevious:!1,sourceSectionId:i.sectionId};if(n===0){let t=e[r];return{...typeof t==`string`&&t?{segmentId:t}:{},linkedToPrevious:!1}}let o=Lv(e,t,n-1,r);return{...o.segmentId?{segmentId:o.segmentId}:{},linkedToPrevious:!0,sourceSectionId:o.sourceSectionId}}function Rv(e,t,n){let r={};for(let i of[`defaultHeaderId`,`defaultFooterId`,`firstPageHeaderId`,`firstPageFooterId`,`evenPageHeaderId`,`evenPageFooterId`]){let{segmentId:a}=Lv(e,t,n,i);a&&(r[i]=a)}return r}var zv=class{constructor(){T(this,`skipNextObservers`,!1),T(this,`lastReturnValue`,void 0),T(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},Bv=class extends t.Subject{constructor(...e){super(...e),T(this,`_sortedObservers`,[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(e){let t;t=typeof e==`function`?{next:([t,n])=>e(t,n)}:e;let n=super.subscribe(t);return this._sortedObservers.push(t),this._sortedObservers.sort((e,t)=>{var n,r;return((n=e.priority)==null?0:n)-((r=t.priority)==null?0:r)}),n.add(()=>this._sortedObservers=this._sortedObservers.filter(e=>e!==t)),n}clearObservers(){this._sortedObservers.forEach(e=>{var t;return(t=e.complete)==null?void 0:t.call(e)}),this._sortedObservers.length=0}emitEvent(e){if(!this.closed){let n=new zv;n.lastReturnValue=e;for(let r of this._sortedObservers){var t;if(n.lastReturnValue=(t=r.next)==null?void 0:t.call(r,[e,n]),n.skipNextObservers)return{handled:!0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}throw Error(`[EventSubject]: cannot emit event on a closed subject.`)}};function Vv(e){return new t.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}let Hv=(0,i.createIdentifier)(`core.resource-manager.service`),Uv={[n.UnitRole.Editor]:`Editor`,[n.UnitRole.Owner]:`Owner`,[n.UnitRole.Reader]:`Reader`,[n.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},Wv=e=>e?{userID:`${Uv[e]}_${Y(8)}`,name:Uv[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},Gv=(e,t)=>e.startsWith(Uv[t]);var Kv=class extends k{constructor(...e){super(...e),T(this,`_model`,new Map),T(this,`_userChange$`,new t.Subject),T(this,`userChange$`,this._userChange$.asObservable()),T(this,`_currentUser$`,new t.BehaviorSubject(Wv())),T(this,`currentUser$`,this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:`add`,user:e})}getUser(e,t){let n=this._model.get(e);if(n)return n;t&&t()}delete(e){let t=this.getUser(e);this._model.delete(e),t&&this._userChange$.next({type:`delete`,user:t})}clear(){this._model.clear(),this._userChange$.next({type:`clear`})}list(){return Array.from(this._model.values())}};let qv=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,T(this,`_permissionMap`,new Map([])),T(this,`_permissionOverrides`,new Map),T(this,`_cfgEnableObjInherit`,!1),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(Wv(n.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?Gv(t.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{let t=[...this._permissionMap.keys()].reduce((e,t)=>(e[t]=this._permissionMap.get(t),e),{});return JSON.stringify(t)},parseJson:e=>JSON.parse(e),pluginName:`SHEET_AuthzIoMockService_PLUGIN`,businesses:[n.UniverType.UNIVER_SHEET,n.UniverType.UNIVER_DOC,n.UniverType.UNIVER_SLIDE,n.UniverType.UNIVER_BOARD],onLoad:(e,t)=>{for(let e in t)this._permissionMap.set(e,t[e])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){let t=Y(8),{objectType:r,selectRangeObject:i,worksheetObject:a}=e,o=i||a,s={objectType:r,unitID:(o==null?void 0:o.unitID)||``,name:(o==null?void 0:o.name)||``,strategies:[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}],selectRangeObject:i};return this._permissionMap.set(t,s),t}async allowed(e){let{objectID:t,actions:r}=e,i=this._permissionMap.get(t);return i?r.map(e=>{let r=`${t}:${e}`;if(this._permissionOverrides.has(r))return{action:e,allowed:this._permissionOverrides.get(r)};let a=i.strategies.find(t=>t.action===e);return a?{action:e,allowed:this._getRole(a.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}}):r.map(e=>({action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}))}async batchAllowed(e){let t=await Promise.all(e.map(e=>this.allowed(e)));return e.map((e,n)=>({unitID:e.unitID,objectID:e.objectID,actions:t[n]}))}async list(e){let t=[],r=[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}];return e.objectIDs.forEach(i=>{let a=this._permissionMap.get(i),o=(a==null?void 0:a.strategies)||r,s={objectID:i,unitID:e.unitID,objectType:(a==null?void 0:a.objectType)||3,name:(a==null?void 0:a.name)||``,shareOn:!1,shareRole:n.UnitRole.Owner,shareScope:-1,scope:{read:n.ObjectScope.AllCollaborator,edit:n.ObjectScope.AllCollaborator},creator:Wv(n.UnitRole.Owner),strategies:o.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${i}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let r=o.find(t=>t.action===e);return r?{action:e,allowed:this._getRole(r.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}})};t.push(s)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:r}=e,i=this._permissionMap.get(t);i&&r&&(i.strategies=r.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,i),r.forEach(e=>{e.role===n.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===n.UnitRole.Owner||e.role===n.UnitRole.Editor)&&this.clearPermissionOverride(t,e.action)}))}setPermissionOverride(e,t,n){let r=`${e}:${t}`;this._permissionOverrides.set(r,n)}clearPermissionOverride(e,t){let n=`${e}:${t}`;this._permissionOverrides.delete(n)}clearAllOverrides(e){let t=[];this._permissionOverrides.forEach((n,r)=>{r.startsWith(`${e}:`)&&t.push(r)}),t.forEach(e=>this._permissionOverrides.delete(e))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}setCfgEnableObjInherit(e){this._cfgEnableObjInherit=e}getCfgEnableObjInherit(){return this._cfgEnableObjInherit}};qv=pa([V(0,Hv),V(1,(0,i.Inject)(Kv))],qv);let Jv=(0,i.createIdentifier)(`IAuthzIoIoService`),Yv=(0,i.createIdentifier)(`univer.confirm-service`);var Xv=class{constructor(){T(this,`confirmOptions$`,new t.Subject)}dispose(){this.confirmOptions$.complete()}open(e){throw Error(`This is not implemented in the test service!`)}confirm(e){return Promise.resolve(!0)}close(e){throw Error(`This is not implemented in the test service!`)}};let Zv=`FOCUSING_UNIT`,Qv=`FOCUSING_SHEET`,$v=`FOCUSING_DOC`,ey=`FOCUSING_SLIDE`,ty=`EDITOR_ACTIVATED`,ny=`FOCUSING_FX_BAR_EDITOR`;var ry=class extends k{constructor(...e){super(...e),T(this,`_error$`,new t.Subject),T(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let iy=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),ay=function(e){return e.SUCCUSS=`0`,e.ERROR_EXCEED_SIZE=`1`,e.ERROR_IMAGE_TYPE=`2`,e.ERROR_UPLOAD_COUNT_LIMIT=`3`,e.ERROR_IMAGE=`4`,e}({}),oy=(0,i.createIdentifier)(`core.image-io.service`),sy=(0,i.createIdentifier)(`core.url-image.service`);function cy(e=``,t=`zhCN`,n=``){return{id:e,sheetOrder:[],name:n,appVersion:Re,locale:t,styles:{},sheets:{},resources:[]}}var ly=class{constructor(e={}){T(this,`_styles`,void 0),T(this,`_cacheMap`,new Gu(1e5)),this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,t){return this._cacheMap.has(t)?this._cacheMap.get(t):this._getExistingStyleId(e)||`-1`}get(e){return typeof e==`string`?(e=String(e),this._styles[e]):e}add(e,t){let n=Y(6);return this._styles[n]=e,this._cacheMap.set(t,n),n}setValue(e){if(e==null)return;let t=JSON.stringify(e),n=this.search(e,t);return n===`-1`?this.add(e,t):n}addCustomStyle(e,t){t!=null&&(this._styles[e]=t,this._cacheMap.set(JSON.stringify(t),e))}remove(e){let t=this._styles[e];t&&(delete this._styles[e],this._cacheMap.delete(JSON.stringify(t)))}toJSON(){return this._styles}getStyleByCell(e){let t;t=e&&z.isObject(e.s)?e.s:(e==null?void 0:e.s)&&this.get(e.s);let n=e==null?void 0:e.interceptorStyle;return n?{...t,...n}:t}_generateCacheMap(){let{_styles:e,_cacheMap:t}=this;for(let n in e){let r=JSON.stringify(e[n]);t.set(r,n)}}_getExistingStyleId(e){let{_styles:t}=this;for(let n in t)if(z.diffValue(t[n],e))return n;return null}};let uy=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!Uf.equals(t,e))),dy=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Uf.equals(e.range,r.range)}),fy={t:0,b:2,l:2,r:2},py=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function my(e,t,n={}){var r,i,a,o;let s=e.length,{textRotation:c,paddingData:l,horizontalAlign:u=0,verticalAlign:d=0,wrapStrategy:f=0,cellValueType:p}=n,m=(r=l==null?void 0:l.t)==null?fy.t:r,h=(i=l==null?void 0:l.r)==null?fy.r:i,g=(a=l==null?void 0:l.b)==null?fy.b:a,_=(o=l==null?void 0:l.l)==null?fy.l:o,{vertexAngle:v,centerAngle:y}=Cy(c);return new S_({id:`d`,body:{dataStream:`${e}\r
|
|
19
|
-
`,textRuns:[{ts:t,st:0,ed:s}],paragraphs:[{startIndex:s,paragraphId:Cm(new Set),paragraphStyle:{horizontalAlign:u}}],sectionBreaks:[{sectionId:Am(new Set),startIndex:s+1}]},documentStyle:{pageSize:{width:1/0,height:1/0},documentFlavor:0,marginTop:m,marginBottom:g,marginRight:h,marginLeft:_,paragraphLineGapDefault:0,renderConfig:{horizontalAlign:u,verticalAlign:d,centerAngle:y,vertexAngle:v,wrapStrategy:f,cellValueType:p}},drawings:{},drawingsOrder:[]})}function hy(e){if(!e)return{};let{tr:t,td:n,ht:r,vt:i,tb:a,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:i,wrapStrategy:a,paddingData:o}}function gy(e){if(!e)return{};let{ff:t,fs:n,it:r,bl:i,ul:a,st:o,ol:s,cl:c}=e,l={};return t&&(l.ff=t),n&&(l.fs=n),r&&(l.it=r),i&&(l.bl=i),a&&(l.ul=a),o&&(l.st=o),s&&(l.ol=s),c&&(l.cl=c),l}function _y(e,t,n){var r;let i=e.getBody();if((r=i.customRanges)!=null&&r.some(e=>e.rangeType===0))return;let a=Z.customRange.add({ranges:[{startOffset:0,endOffset:i.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:0,body:i,properties:{url:t,refId:n}});a&&X.apply(i,a.serialize())}function vy(e){return e!=null}function yy(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}function by(e){let t=J.ff,n=J.fs;if(!e){let e=`${n}pt ${t}`;return{fontCache:e,fontString:e,fontSize:n,originFontSize:n,fontFamily:t}}let r=`italic`;(e.it===0||e.it===void 0)&&(r=`normal`);let i=`bold`;(e.bl===0||e.bl===void 0)&&(i=`normal`);let a=n;e.fs&&(a=e.fs);let o=xy(e.ff,t),{va:s}=e,c=a;if(s===2||s===3){let{sbr:e,spr:t}=Sy(o,c);c*=s===2?e:t}let l=`${r} ${i} ${c}pt ${o}`;return{fontCache:l,fontString:`${l}, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif `,fontSize:c,originFontSize:a,fontFamily:o}}function xy(e,t){return e!=null&&e.trim()?e.split(`,`).map(e=>{let t=e.trim().replace(/^['"]|['"]$/g,``);return t.includes(` `)?`"${t}"`:t}).filter(Boolean).join(`, `):t}function Sy(e,t){return py(t)}function Cy(e){let{a:t=0,v:n=0}=e||{a:0,v:0},r=0,i=t;return n===1&&(r=90,i=90),{centerAngle:r,vertexAngle:i}}function wy(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e)){let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=wy(e[r]);return n}let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r];t[i]=wy(e[i])}return t}function Ty(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:wy(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=wy(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:wy(e.custom)),t}function Ey(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:wy(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=wy(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:wy(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function Dy(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={},c=Object.keys(o);for(let e=0,t=c.length;e<t;e++){let t=c[e],n=Number(t),r=o[n];r!=null&&(s[n]=Ty(r))}t[a]=s}return t}function Oy(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={};`h`in o&&o.h!==void 0&&(s.h=o.h),`ia`in o&&o.ia!==void 0&&(s.ia=o.ia),`ah`in o&&o.ah!==void 0&&(s.ah=o.ah),`hd`in o&&o.hd!==void 0&&(s.hd=o.hd),`w`in o&&o.w!==void 0&&(s.w=o.w),`s`in o&&o.s!==void 0&&(o.s===null||typeof o.s==`string`?s.s=o.s:s.s=wy(o.s)),`custom`in o&&o.custom!==void 0&&(s.custom=o.custom===null?null:wy(o.custom)),t[a]=s}return t}function ky(e){let t=e.length,n=Array(t);for(let r=0;r<t;r++){let t=e[r];n[r]={startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType,startAbsoluteRefType:t.startAbsoluteRefType,endAbsoluteRefType:t.endAbsoluteRefType}}return n}function Ay(e){let t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:ky(e.mergeData),cellData:Dy(e.cellData),rowData:Oy(e.rowData),columnData:Oy(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle==`string`?t.defaultStyle=e.defaultStyle:t.defaultStyle=wy(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:wy(e.custom)),t}var jy=class{constructor(e,t){this._config=e,T(this,`_columnData`,{}),this._columnData=t}getColumnData(){return this._columnData}getColVisible(e){let{_columnData:t}=this,n=t[e];return n?n.hd!==1:!0}getColumnStyle(e){var t;return(t=this._columnData[e])==null?void 0:t.s}setColumnStyle(e,t){let n=this.getColumnOrCreate(e);n.s=t}getHiddenCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&e?(r=!1,n.push({rangeType:2,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:2}),n}getVisibleCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&!e?(r=!1,n.push({rangeType:2,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:2}),n}getColumnDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getColumn(i);n[r]=e==null?{w:this._config.defaultColumnWidth,hd:0}:e,r++}return n}getSize(){return El(this._columnData)}getColumnWidth(e){var t,n;return(t=(n=this._columnData[e])==null?void 0:n.w)==null?this._config.defaultColumnWidth:t}setColumnWidth(e,t){let n=this._columnData[e];t===this._config.defaultColumnWidth?n&&(delete n.w,Object.keys(n).length===0&&delete this._columnData[e]):this._columnData[e]=n?{...n,w:t}:{w:t}}getColumn(e){return this._columnData[e]}insertColumnsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._columnData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._columnData[n+r]=this._columnData[n],delete this._columnData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._columnData[r]={...t})}}removeColumn(e){delete this._columnData[e]}getColumnOrCreate(e){let{_columnData:t}=this,n=t[e];if(n)return n;let r={};return this._columnData[e]=r,r}setCustomMetadata(e,t){let n=this.getColumn(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getColumn(e))==null?void 0:t.custom}},My=class{constructor(e,t,n){this._config=e,this._viewModel=t,T(this,`_rowData`,void 0),this._rowData=n}getRowData(){return this._rowData}getRowStyle(e){var t;return(t=this._rowData[e])==null?void 0:t.s}setRowStyle(e,t){let n=this.getRowOrCreate(e);n.s=t}getRowDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getRow(i);n[r]=e==null?{h:this._config.defaultRowHeight,hd:0}:e,r++}return n}getRowHeight(e,t=1){let{_rowData:n}=this,r=this._config,i=0;for(let a=0;a<t;a++){let{ia:t,ah:o,h:s=r.defaultRowHeight}=n[a+e]||{hd:0,h:r.defaultRowHeight};i+=(t==null||t===1)&&typeof o==`number`?o:s}return i}setRowHeight(e,t){let n=this._rowData[e];if(t===this._config.defaultRowHeight)n&&(delete n.h,Object.keys(n).length===0&&delete this._rowData[e]);else{let r=Math.min(t,2e3);this._rowData[e]=n?{...n,h:r}:{h:r}}}getRow(e){return this._rowData[e]}insertRowsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._rowData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._rowData[n+r]=this._rowData[n],delete this._rowData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._rowData[r]={...t})}}removeRow(e){delete this._rowData[e]}getRowOrCreate(e){let{_rowData:t}=this,n=t[e];if(n)return n;let r={};return t[e]=r,r}getHiddenRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:1})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),n}getVisibleRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&!e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:1})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),n}getRowRawVisible(e){let t=this.getRow(e);return t?t.hd!==1:!0}getSize(){return El(this._rowData)}setCustomMetadata(e,t){let n=this.getRow(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getRow(e))==null?void 0:t.custom}};let Ny=1e3;function Py(e){let t={name:`Sheet1`,id:`sheet-01`,tabColor:``,hidden:0,rowCount:Ny,columnCount:20,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:88,defaultRowHeight:24,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:1,rowHeader:{width:46,hidden:0},columnHeader:{height:20,hidden:0},rightToLeft:0};return Object.keys(t).forEach(n=>{let r=n;e[r]===void 0&&(e[r]=t[r])}),e}var Fy=class extends k{constructor(e){super(),T(this,`_cellCache`,new Map),T(this,`_rowCache`,new Map),T(this,`_columnCache`,new Map),T(this,`_hasRow`,!1),T(this,`_hasColumn`,!1),T(this,`_hasAll`,!1),T(this,`_allIndex`,-1),T(this,`_mergeData`,void 0),T(this,`_rangeMap`,new Gu(5e4)),this._init(e.concat())}_init(e){this._mergeData=e,this._createCache(e)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(e){let t=0;for(let n of e){let{rangeType:e}=n;e===1?this._createRowCache(n,t):e===2?this._createColumnCache(n,t):e===3?this._createCellAllCache(t):this._createCellCache(n,t),t++}}rebuild(e){this._clearCache(),this._init(e.concat())}_createRowCache(e,t){let{startRow:n,endRow:r}=e;for(let e=n;e<=r;e++)this._rowCache.set(e,t),this._hasRow=!0}_createColumnCache(e,t){let{startColumn:n,endColumn:r}=e;for(let e=n;e<=r;e++)this._columnCache.set(e,t),this._hasColumn=!0}_createCellAllCache(e){this._hasAll=!0,this._allIndex=e}_createCellCache(e,t){for(let n=e.startRow;n<=e.endRow;n++){let r=this._cellCache.get(n);r==null&&(r=new Map,this._cellCache.set(n,r));for(let n=e.startColumn;n<=e.endColumn;n++)r.set(n,t)}}add(e){this._mergeData.push(e),this._clearCache(),this._createCache(this._mergeData)}remove(e,t){let n=this._getMergeDataIndex(e,t);n!==-1&&(this._mergeData.splice(n,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(e,t){let n=this._getMergeDataIndex(e,t);return n===-1?null:this._mergeData[n]}getMergeDataIndex(e,t){return this._getMergeDataIndex(e,t)}isRowContainsMergedCell(e){return this._hasAll||!z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(t=>t.startRow<=e&&e<=t.endRow)}isColumnContainsMergedCell(e){return this._hasAll||!z.isEmptyObject(this._rowCache)?!0:this._mergeData.some(t=>t.startColumn<=e&&e<=t.endColumn)}getMergedCellRange(e,t,n,r){let i=[],a=`${e}-${t}-${n}-${r}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let o=0,s=[];for(let a of this._mergeData||[])Uf.intersects(a,{startRow:e,endRow:n,startColumn:t,endColumn:r})&&(i.push({...a}),s.push(o)),o++;return this._rangeMap.set(a,s),i}_getRangeFromCache(e){let t=this._rangeMap.get(e)||[],n=[];for(let e of t)n.push({...this._mergeData[e]});return n}_getMergeDataIndex(e,t){var n;if(this._hasAll)return this._allIndex;if(this._hasRow){let t=this._rowCache.get(e);if(t!==void 0)return t}if(this._hasColumn){let e=this._columnCache.get(t);if(e!==void 0)return e}let r=(n=this._cellCache.get(e))==null?void 0:n.get(t);return r===void 0?-1:r}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}},Iy=class extends k{constructor(e){super(),this.getRawCell=e,T(this,`_cellContentInterceptor`,null),T(this,`_rowFilteredInterceptor`,null)}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,t,n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,3,n,r):this.getRawCell(e,t)}getCellValueOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,2):this.getRawCell(e,t)}getCellStyleOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,1):this.getRawCell(e,t)}getRowFiltered(e){var t,n;return(t=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(e))==null?!1:t}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._cellContentInterceptor=e,D(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._rowFilteredInterceptor=e,D(()=>this._rowFilteredInterceptor=null)}};let Ly={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};var Ry=class e{constructor(e,t,n){var r;this.unitId=e,this._styles=n,T(this,`_sheetId`,void 0),T(this,`_snapshot`,void 0),T(this,`_cellData`,void 0),T(this,`_rowManager`,void 0),T(this,`_columnManager`,void 0),T(this,`_viewModel`,void 0),T(this,`_spanModel`,void 0),T(this,`_isRowStylePrecedeColumnStyle`,!0),T(this,`_getCellHeight`,void 0),this._snapshot=Py(t);let{columnData:i,rowData:a,cellData:o}=this._snapshot;this._sheetId=(r=this._snapshot.id)==null?Y(6):r,this._cellData=new Fl(o),this._viewModel=new Iy((e,t)=>this.getCellRaw(e,t)),this._rowManager=new My(this._snapshot,this._viewModel,a),this._columnManager=new jy(this._snapshot,i),this._spanModel=new Fy(this._snapshot.mergeData)}__interceptViewModel(e){e(this._viewModel)}__registerGetCellHeight(e){return this._getCellHeight=e,D(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(e,t){return this._getCellHeight?this._getCellHeight(e,t):this.getRowHeight(e)}setMergeData(e){this._snapshot.mergeData=e,this.getSpanModel().rebuild(e)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(e){this._isRowStylePrecedeColumnStyle=e}getStyleDataByHash(e){return{...this._styles.get(e)}}setStyleData(e){return this._styles.setValue(e)}getColumnStyle(e,t=!1){return t?this._columnManager.getColumnStyle(e):this._styles.get(this._columnManager.getColumnStyle(e))}setColumnStyle(e,t){this._columnManager.setColumnStyle(e,t)}getRowStyle(e,t=!1){return t?this._rowManager.getRowStyle(e):this._styles.get(this._rowManager.getRowStyle(e))}setRowStyle(e,t){this._rowManager.setRowStyle(e,t)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){let e=this._snapshot.defaultStyle;return this._styles.get(e)}setDefaultCellStyle(e){this._snapshot.defaultStyle=e}getCellStyle(e,t){let n=this.getCell(e,t);if(n){let e=n.s;return typeof e==`string`?this._styles.get(e):e}return null}getComposedCellStyle(e,t,n){let r=this.getDefaultCellStyleInternal(),i=this.getRowStyle(e),a=this.getColumnStyle(t),o=this.getCell(e,t),s=this._styles.getStyleByCell(o);return(n==null?this._isRowStylePrecedeColumnStyle:n)?ae(r,a,i,o==null?void 0:o.themeStyle,s):ae(r,i,a,o==null?void 0:o.themeStyle,s)}getComposedCellStyleByCellData(e,t,n,r){let i=this.getDefaultCellStyleInternal(),a=this.getRowStyle(e),o=this.getColumnStyle(t),s=this._styles.getStyleByCell(n);return(r==null?this._isRowStylePrecedeColumnStyle:r)?ae(i,o,a,n==null?void 0:n.themeStyle,s):ae(i,a,o,n==null?void 0:n.themeStyle,s)}getComposedCellStyleWithoutSelf(e,t,n,r){let i=n===void 0?this.getComposedCellStyle(e,t,r):this.getComposedCellStyleByCellData(e,t,n,r),a=this.getCellRaw(e,t);if(!a||!a.s)return i;let o=typeof a.s==`string`?this._styles.get(a.s):a.s;if(!o)return i;for(let e in o)e in i&&delete i[e];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){let e=this.getCellMatrix(),t=this.getMergeData(),n=-1,r=-1,i=-1,a=-1,o=!1,s=!1;return e.forEach((t,c)=>{Object.keys(c).forEach(c=>{let l=+c,u=e.getValue(t,l),d=u!=null&&u.s?this._styles.get(u.s):null,f=(d==null?void 0:d.bd)&&(d.bd.b||d.bd.l||d.bd.r||d.bd.t||d.bd.bc_tr||d.bd.bl_tr||d.bd.ml_tr||d.bd.tl_bc||d.bd.tl_br||d.bd.tl_mr);(u&&(u.v!==null&&u.v!==void 0&&u.v!==``||u.p)||d!=null&&d.bg||f)&&(o?n=Math.min(n,t):(n=t,o=!0),r=Math.max(r,t),s?i=Math.min(i,l):(s=!0,i=l),a=Math.max(a,l))})}),t.forEach(e=>{o?n=Math.min(n,e.startRow):(n=e.startRow,o=!0),r=Math.max(r,e.endRow),s?i=Math.min(i,e.startColumn):(i=e.startColumn,o=!0),a=Math.max(a,e.endColumn)}),!o||!s?null:{startColumn:i,startRow:n,endColumn:a,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){let{_snapshot:t}=this,n=Ay(t);return new e(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(e,t){return this._spanModel.getMergedCell(e,t)}getMergedCellRange(e,t,n,r){return this._spanModel.getMergedCellRange(e,t,n,r)}isRowContainsMergedCell(e){return this._spanModel.isRowContainsMergedCell(e)}isColumnContainsMergedCell(e){return this._spanModel.isColumnContainsMergedCell(e)}getCellInfoInMergeData(e,t){let n=this.getMergedCell(e,t),r=!1,i=!1,a=e,o=t,s=e,c=t;if(n){let{startRow:l,endRow:u,startColumn:d,endColumn:f}=n;e===l&&t===d?(a=u,o=f,s=l,c=d,i=!0):e>=l&&e<=u&&t>=d&&t<=f&&(a=u,o=f,s=l,c=d,r=!0)}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}getCell(e,t){return e<0||t<0?null:this._viewModel.getCell(e,t)}getCellValueOnly(e,t){return e<0||t<0?null:this._viewModel.getCellValueOnly(e,t)}getCellStyleOnly(e,t){return e<0||t<0?null:this._viewModel.getCellStyleOnly(e,t)}getCellRaw(e,t){return this.getCellMatrix().getValue(e,t)}getCellWithFilteredInterceptors(e,t,n,r){return this._viewModel.getCell(e,t,n,r)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRangeFilterRows(e){let t=[];for(let n=e.startRow;n<=e.endRow;n++)this.getRowFiltered(n)&&t.push(n);return t}getMatrixWithMergedCells(e,t,n,r,i=`raw`){let a=this.getCellMatrix(),o=this._spanModel.getMergedCellRange(e,t,n,r),s=new Fl;return $f(e,n,t,r).forEach((e,t)=>{let n;if(i===`raw`)n=this.getCellRaw(e,t);else if(i===`intercepted`)n=this.getCell(e,t);else if(i===`both`){let i=this.getCellRaw(e,t);if(i){var r;n={...i};let a=(r=this.getCell(e,t))==null?void 0:r.v;vy(a)&&n&&(n.displayV=String(a))}}n&&s.setValue(e,t,n)}),o.forEach(e=>{let{startColumn:t,startRow:n,endColumn:r,endRow:i}=e;$f(n,i,t,r).forEach((e,o)=>{e===n&&o===t&&s.setValue(e,o,{...a.getValue(e,o),rowSpan:i-n+1,colSpan:r-t+1}),(e!==n||o!==t)&&s.realDeleteValue(e,o)})}),s}getRange(e,t,n,r){return typeof e==`object`?new pf(this,e,{getStyles:()=>this._styles}):new pf(this,{startRow:e,startColumn:t,endColumn:r||t,endRow:n||e},{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(){let{_snapshot:e}=this,{columnCount:t}=e;return t}getMaxRows(){let{_snapshot:e}=this,{rowCount:t}=e;return t}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){let{_snapshot:e}=this,{showGridlines:t}=e;return t===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){let{_snapshot:e}=this,{tabColor:t}=e;return t}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}isRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRowVisible(e){return!this.isRowFiltered(e)&&this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,t){let n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,t);return r.forEach(e=>e.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,t){let n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,t);return r.forEach(e=>e.endRow=n),r}getVisibleRows(){let e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){let e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){let{_snapshot:e}=this,{rightToLeft:t}=e;return t}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,t=!0){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this;return{[Symbol.iterator]:()=>{let e=n,s=r;return{next(){for(;;){if(s>a&&(e+=1,s=r),e>i)return{done:!0,value:void 0};let n=o.getCell(e,s),c=!n,l=o.getMergedCell(e,s);if(l){if(e!==l.startRow||s!==l.startColumn){s=l.endColumn+1;continue}if(c&&t){s=l.endColumn+1;continue}let r={row:e,col:s,value:n};return r.colSpan=l.endColumn-l.startColumn+1,r.rowSpan=l.endRow-l.startRow+1,s=l.endColumn+1,{done:!1,value:r}}if(c&&t)s+=1;else{let t={row:e,col:s,value:n};return s+=1,{done:!1,value:t}}}}}}}}iterateByColumn(e,t=!0,n=!0){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=e,s=this;return{[Symbol.iterator]:()=>{let e=r,c=i;return{next(){for(;;){if(e>a&&(c+=1,e=r),c>o)return{done:!0,value:void 0};let i=s.getMergedCell(e,c);if(i){let r=e!==i.startRow,a=r||c!==i.startColumn;if(n&&a||!n&&r){e=i.endRow+1;continue}let o=s.getCell(i.startRow,i.startColumn);if(!o&&t){e=i.endRow+1;continue}let l={row:e,col:i.startColumn,value:o};return l.colSpan=i.endColumn-i.startColumn+1,l.rowSpan=i.endRow-i.startRow+1,e=i.endRow+1,{done:!1,value:l}}let l=s.getCell(e,c);if(!l&&t)e+=1;else{let t={row:e,col:c,value:l};return e+=1,{done:!1,value:t}}}}}}}}getCellDocumentModel(e,t,n=Ly){var r;if(!e)return;let{isDeepClone:i,displayRawFormula:a,ignoreTextRotation:o}={...Ly,...n},s,c=`document`,l=hy(t),u=o?J.tr:l.textRotation||J.tr,d=l.horizontalAlign||J.ht,f=l.verticalAlign||J.vt,p=l.wrapStrategy||J.tb,m=l.paddingData||fy;if(e.f&&a)s=my(e.f.toString(),{},{verticalAlign:f}),d=J.ht;else if(e.p){let{centerAngle:t,vertexAngle:n}=Cy(u);s=this._updateConfigAndGetDocumentModel(i?z.deepClone(e.p):e.p,d,m,{horizontalAlign:d,verticalAlign:f,centerAngle:t,vertexAngle:n,wrapStrategy:p,zeroWidthParagraphBreak:1})}else if(e.v!=null){let n=gy(t);c=by(n).fontCache;let r=zy(e);e.t===4&&a&&(r=`'${r}`),s=my(r,n,{...l,textRotation:u,cellValueType:e.t})}return s&&e.linkUrl&&e.linkId&&_y(s,e.linkUrl,e.linkId),{documentModel:s,fontString:c,textRotation:u,wrapStrategy:p,verticalAlign:f,horizontalAlign:d,paddingData:m,fill:t==null||(r=t.bg)==null?void 0:r.rgb}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=0,e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new S_(e)}getBlankCellDocumentModel(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e),i=gy(r),a=this.getCellDocumentModel(e,r,{ignoreTextRotation:!0});if(a!=null)return a.documentModel==null&&(a.documentModel=my(``,i)),a;let o=`document`,s=J.tr,c=J.ht,l=J.vt,u=J.tb,d=fy;return o=by({}).fontCache,{documentModel:my(``,i),fontString:o,textRotation:s,wrapStrategy:u,verticalAlign:l,horizontalAlign:c,paddingData:d}}getCellDocumentModelWithFormula(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e);return this.getCellDocumentModel(e,r,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};function zy(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;return typeof r==`string`?e.t===3?r.toUpperCase():r.replace(/[\r\n]/g,``):typeof r==`number`?e.t===3?r?`TRUE`:`FALSE`:r.toString():typeof r==`boolean`?r?`TRUE`:`FALSE`:``}function By(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;if(r==null)return``;if(e.t===3){if(typeof r==`string`)return r.toUpperCase();if(typeof r==`number`)return r?`TRUE`:`FALSE`}return typeof r==`boolean`?r?`TRUE`:`FALSE`:String(r)}function Vy(e){if(e===null)return``;if(e!=null&&e.p){let t=e==null?void 0:e.p.body;if(t==null)return``;let n=t.dataStream;return Z.transform.getPlainText(n)}return e==null?void 0:e.v}function Hy(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}let Uy=class extends M{get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(e){return typeof e==`string`||`startRow`in e||`row`in e}constructor(e={},r){super(),this._logService=r,T(this,`type`,n.UniverType.UNIVER_SHEET),T(this,`_sheetCreated$`,new t.Subject),T(this,`sheetCreated$`,this._sheetCreated$.asObservable()),T(this,`_sheetDisposed$`,new t.Subject),T(this,`sheetDisposed$`,this._sheetDisposed$.asObservable()),T(this,`_activeSheet$`,new t.BehaviorSubject(null)),T(this,`activeSheet$`,this._activeSheet$.asObservable()),T(this,`_worksheets`,void 0),T(this,`_styles`,void 0),T(this,`_snapshot`,void 0),T(this,`_unitId`,void 0),T(this,`_count`,void 0),T(this,`_name$`,void 0),T(this,`name$`,void 0);let i=cy();z.isEmptyObject(e)?this._snapshot=i:this._snapshot=z.commonExtend(i,e);let{styles:a}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=Y(6)),this._unitId=this._snapshot.id,this._styles=new ly(a),this._count=1,this._worksheets=new Map,this._name$=new t.BehaviorSubject(e.name||``),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(e=>{this._removeSheet(e)})}save(){return z.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(e){this._name$.next(e),this._snapshot.name=e}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}addWorksheet(e,t,n){let{sheets:r,sheetOrder:i}=this._snapshot;if(r[e])return!1;r[e]=n,i.splice(t,0,e),this.ensureSheetOrderUnique();let a=new Ry(this._unitId,n,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){let e=new Set,t=[];for(let n of this._snapshot.sheetOrder)e.has(n)||(e.add(n),t.push(n));this._snapshot.sheetOrder=t,e.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(e){Object.entries(e).forEach(([e,t])=>{this._styles.addCustomStyle(e,t)})}removeStyles(e){e.forEach(e=>{this._styles.remove(e)})}getConfig(){return this._snapshot}getIndexBySheetId(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>t===e)}getActiveSheet(e){if(!this._activeSheet&&e===void 0)throw Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){let e=this._activeSheet;if(e)return e;let t=this._snapshot.sheetOrder;for(let e=0,n=t.length;e<n;e++){let n=this._worksheets.get(t[e]);if(n&&n.isSheetHidden()!==1)return this.setActiveSheet(n),n}let n=this._worksheets.get(t[0]);return this.setActiveSheet(n),n}setActiveSheet(e){this._activeSheet$.next(e)}_removeSheet(e){let t=this._worksheets.get(e);return t?(this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(t),!0):!1}removeSheet(e){let t=this._removeSheet(e);return t&&delete this._snapshot.sheets[e],t}getActiveSheetIndex(){let{sheetOrder:e}=this._snapshot;return e.findIndex(e=>this._worksheets.get(e)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){let{sheetOrder:e}=this._snapshot;return e.map(e=>this._worksheets.get(e))}getSheetsName(){let{sheetOrder:e}=this._snapshot,t=[];return e.forEach(e=>{let n=this._worksheets.get(e);n&&t.push(n.getName())}),t}getSheetIndex(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>e.getSheetId()===t)}getSheetBySheetName(e){let{sheetOrder:t}=this._snapshot,n=t.find(t=>this._worksheets.get(t).getName()===e);return this._worksheets.get(n)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){let{sheetOrder:t}=this._snapshot;return this._worksheets.get(t[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===1).map(e=>e.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden!==1).map(e=>e.getConfig().id)}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().some(t=>t.toLowerCase()===e.toLowerCase())}uniqueSheetName(e=`Sheet1`){let t=e;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}generateNewSheetName(e){let t=e+this._count;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}_parseWorksheetSnapshots(){let{_snapshot:e,_worksheets:t}=this,{sheets:n,sheetOrder:r}=e;if(z.isEmptyObject(n)){let e=Y();n[e]={id:e}}for(let e in n){let i=n[e],{name:a}=i;i.name=this.uniqueSheetName(a),i.name!==a&&this._logService.debug(`[Workbook]`,`The worksheet name ${a} is duplicated, we changed it to ${i.name}. Please fix the problem in your snapshot.`);let o=new Ry(this._unitId,i,this._styles);t.set(e,o),r.includes(e)||r.push(e)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};Uy=pa([V(1,ua)],Uy);let Wy=(0,i.createIdentifier)(`univer.current`),Gy=class extends k{constructor(e,n,r){super(),this._injector=e,this._contextService=n,this._logService=r,T(this,`_unitsByType`,new Map),T(this,`_unitCreateOptions`,new Map),T(this,`_createHandler`,void 0),T(this,`_ctorByType`,new Map),T(this,`_currentUnits`,new Map),T(this,`_currentUnits$`,new t.BehaviorSubject(this._currentUnits)),T(this,`currentUnits$`,this._currentUnits$.asObservable()),T(this,`_unitAdded$`,new t.Subject),T(this,`unitAdded$`,this._unitAdded$.asObservable()),T(this,`_unitDisposed$`,new t.Subject),T(this,`unitDisposed$`,this._unitDisposed$.asObservable()),T(this,`_focused$`,new t.BehaviorSubject(null)),T(this,`focused$`,this._focused$.asObservable())}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(e=>e==null?void 0:e.dispose()),this._currentUnits.clear(),this._unitsByType.clear(),this._unitCreateOptions.clear()}__setCreateHandler(e){this._createHandler=e}createUnit(e,t,n){return this._createHandler(e,t,this._ctorByType.get(e),n)}registerCtorForType(e,t){return this._ctorByType.set(e,t),{dispose:()=>{this._ctorByType.delete(e)}}}__getCtorByType(e){return this._ctorByType.get(e)}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe((0,t.map)(t=>{var n;return(n=t.get(e))==null?null:n}),(0,t.distinctUntilChanged)())}getCurrentUnitOfType(e){return this._currentUnits.get(e)}setCurrentUnitForType(e){let t=this._getUnitById(e);if(!t)throw Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits.get(t[1])!==t[0]&&(this._currentUnits.set(t[1],t[0]),this._currentUnits$.next(this._currentUnits))}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe((0,t.filter)(t=>t.unit.type===e))}__addUnit(e,t){var n;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${e.getUnitId()}`);let r=e.type;this._unitsByType.has(r)||this._unitsByType.set(r,[]);let i=this._unitsByType.get(r),a=e.getUnitId();if(i.findIndex(e=>e.getUnitId()===a)!==-1)throw Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${a}.`);i.push(e),t&&this._unitCreateOptions.set(a,{...t}),this._unitAdded$.next({unit:e,options:t}),((n=t==null?void 0:t.makeCurrent)==null||n)&&this.setCurrentUnitForType(e.getUnitId())}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe((0,t.filter)(t=>t.type===e))}getUnit(e,t){var n;let r=(n=this._getUnitById(e))==null?void 0:n[0];return t&&(r==null?void 0:r.type)!==t?null:r}getUnitCreateOptions(e){var t;return(t=this._unitCreateOptions.get(e))==null?null:t}getUniverSheetInstance(e){return this.getUnit(e,n.UniverType.UNIVER_SHEET)}getAllUnitsForType(e){var t;return(t=this._unitsByType.get(e))==null?[]:t}changeDoc(e,t){let r=this.getAllUnitsForType(n.UniverType.UNIVER_DOC),i=r.find(t=>t.getUnitId()===e);if(i!=null){let e=r.indexOf(i);r.splice(e,1)}this.__addUnit(t)}get focused(){var e;let t=this._focused$.getValue();return t?(e=this._getUnitById(t))==null?void 0:e[0]:null}focusUnit(e){var t;this._focused$.getValue()!==e&&(this._focused$.next(e),this.focused instanceof Uy?(this._contextService.setContextValue(Zv,!0),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(Qv,!0),this._contextService.setContextValue(ey,!1),this.setCurrentUnitForType(e)):this.focused instanceof S_?(this._contextService.setContextValue(Zv,!0),this._contextService.setContextValue($v,!0),this._contextService.setContextValue(Qv,!1),this._contextService.setContextValue(ey,!1),this.setCurrentUnitForType(e)):((t=this.focused)==null?void 0:t.type)===n.UniverType.UNIVER_SLIDE?(this._contextService.setContextValue(Zv,!0),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(Qv,!1),this._contextService.setContextValue(ey,!0),this.setCurrentUnitForType(e)):(this._contextService.setContextValue(Zv,!1),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(Qv,!1),this._contextService.setContextValue(ey,!1)))}getFocusedUnit(){return this.focused}getUnitType(e){let t=this._getUnitById(e);return t?t[1]:n.UniverType.UNRECOGNIZED}disposeUnit(e){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${e}`);let t=this._getUnitById(e);if(!t)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${e}`),!1;let[n,r]=t,i=this._unitsByType.get(r),a=i.indexOf(n);return i.splice(a,1),this._tryResetCurrentOnRemoval(e,r),this._tryResetFocusOnRemoval(e),this._unitDisposed$.next(n),this._unitCreateOptions.delete(e),n.dispose(),!0}_tryResetCurrentOnRemoval(e,t){let n=this.getCurrentUnitOfType(t);(n==null?void 0:n.getUnitId())===e&&(this._currentUnits.set(t,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(e){var t;((t=this.focused)==null?void 0:t.getUnitId())===e&&this._focused$.next(null)}_getUnitById(e){for(let[t,n]of this._unitsByType){let r=n.find(t=>t.getUnitId()===e);if(r)return[r,t]}}};Gy=pa([V(0,(0,i.Inject)(i.Injector)),V(1,sa),V(2,(0,i.Inject)(ua))],Gy);let Ky=function(e){return e[e.Starting=0]=`Starting`,e[e.Ready=1]=`Ready`,e[e.Rendered=2]=`Rendered`,e[e.Steady=3]=`Steady`,e}({}),qy={0:`Starting`,1:`Ready`,2:`Rendered`,3:`Steady`};var Jy=class extends Error{constructor(e){super(`[LifecycleService]: lifecycle stage "${qy[e]}" will never be reached!`),this.name=`LifecycleUnreachableError`}};let Yy=class extends k{constructor(e){super(),this._logService=e,T(this,`_lifecycle$`,new t.BehaviorSubject(0)),T(this,`lifecycle$`,this._lifecycle$.asObservable()),T(this,`_lock`,!1),this._reportProgress(0)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(this._lock)throw Error(`[LifecycleService]: cannot set new stage when related logic is all handled!`);if(e<this.stage)throw Error(`[LifecycleService]: lifecycle stage cannot go backward!`);e!==this.stage&&(this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(e){return(0,t.firstValueFrom)(this.lifecycle$.pipe((0,t.filter)(t=>t>=e),wa(t=>t===e),(0,t.map)(()=>void 0))).catch(t=>t.name===`EmptyError`?Promise.reject(new Jy(e)):Promise.reject(t))}subscribeWithPrevious(){return(0,t.merge)(Xy(this.stage),this._lifecycle$.pipe((0,t.skip)(1))).pipe(wa(e=>e===3))}_reportProgress(e){this._logService.debug(`[LifecycleService]`,`lifecycle progressed to "${qy[e]}".`)}};Yy=pa([V(0,ua)],Yy);function Xy(e){switch(e){case 0:return(0,t.of)(0);case 1:return(0,t.of)(0,1);case 2:return(0,t.of)(0,1,2);default:return(0,t.of)(0,1,2,3)}}let Zy=(0,i.createIdentifier)(`ILocalStorageService`);var Qy=class extends k{get _currentLocale(){return this._currentLocale$.value}constructor(){super(),T(this,`_currentLocale$`,new t.BehaviorSubject(`zhCN`)),T(this,`currentLocale$`,this._currentLocale$.asObservable()),T(this,`_direction$`,new t.BehaviorSubject(`ltr`)),T(this,`direction$`,this._direction$.asObservable()),T(this,`_locales`,null),T(this,`localeChanged$`,new t.Subject),T(this,`t`,(e,...t)=>{if(!this._locales)throw Error(`[LocaleService]: Locale not initialized`);let n=e.split(`.`),r=this.resolveKeyPath(this._locales[this._currentLocale],n);if(typeof r==`string`){let e=r;return t.forEach((t,n)=>{e=e.replace(`{${n}}`,t)}),e}else return e}),this.disposeWithMe(D(()=>{this._locales=null,this._currentLocale$.complete(),this._direction$.complete(),this.localeChanged$.complete()}))}load(e){var t;this._locales=ta((t=this._locales)==null?{}:t,e)}setLocale(e){this._currentLocale$.next(e),this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}setDirection(e){this._direction$.next(e)}getDirection(){return this._direction$.value}resolveKeyPath(e,t){let n=t.shift();if(n&&e&&n in e){let r=e[n];return t.length>0&&(typeof r==`object`||Array.isArray(r))?this.resolveKeyPath(r,t):r}return null}};let $y=class{constructor(e){this._userManagerService=e}async list(e){return{list:[{type:0,mentions:[{objectType:0,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:`PEOPLE`}],page:e.page,size:e.size,total:1}}};$y=pa([V(0,(0,i.Inject)(Kv))],$y);let eb=(0,i.createIdentifier)(`univer.service.mention-io`),tb=function(e){return e.INIT=`init`,e.FETCHING=`fetching`,e.DONE=`done`,e}({}),nb=(0,i.createIdentifier)(`univer.permission-service`);var rb=class extends k{constructor(...e){super(...e),T(this,`_permissionPointMap`,new Map),T(this,`_permissionPointUpdate$`,new t.Subject),T(this,`permissionPointUpdate$`,this._permissionPointUpdate$.asObservable()),T(this,`_showComponents`,!0)}setShowComponents(e){this._showComponents=e}getShowComponents(){return this._showComponents}deletePermissionPoint(e){let t=this._permissionPointMap.get(e);t&&(t.complete(),this._permissionPointMap.delete(e))}addPermissionPoint(e){let n=e instanceof t.BehaviorSubject,r=n?e.getValue():e;return r.id?this._permissionPointMap.get(r.id)?(console.warn(`${r.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(r.id,n?e:new t.BehaviorSubject(r)),this._permissionPointUpdate$.next(r),!0):!1}updatePermissionPoint(e,t){let n=this._permissionPointMap.get(e);if(!n)return;let r=n.getValue();r.value=t,r.status=`done`,n.next(r),this._permissionPointUpdate$.next(r)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(e){let t=this._permissionPointMap.get(e);if(t)return t.getValue()}getPermissionPoint$(e){let t=this._permissionPointMap.get(e);if(t)return t}composePermission$(e){return(0,t.combineLatest)(e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.asObservable()})).pipe((0,r.map)(e=>e))}composePermission(e){return e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.getValue()})}getAllPermissionPoint(){let e=new Map;return this._permissionPointMap.forEach((t,n)=>{e.set(n,t)}),e}};function ib(e,t){if(!t)return e;let n=[];for(let r of e){let e=t.find(([e])=>e===r[0]);if(e){if(e[1]===null)continue;n.push([r[0],e[1]])}else n.push(r)}return n}let ab=Symbol(`DependentOn`);var ob=class extends k{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};T(ob,`pluginName`,void 0),T(ob,`packageName`,Le),T(ob,`version`,Re),T(ob,`type`,n.UniverType.UNIVER_UNKNOWN);var sb=class{constructor(){T(this,`_plugins`,[])}addPlugin(e){this._plugins.push(e)}removePlugins(){let e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}};function cb(...e){return function(t){t[ab]=e}}let lb=class{constructor(e,t,r){this._injector=e,this._lifecycleService=t,this._logService=r,T(this,`_pluginRegistry`,new Map),T(this,`_pluginStore`,new sb),T(this,`_seenPlugins`,new Set),T(this,`_loadedPlugins`,new Set),T(this,`_loadedPluginTypes`,new Set([n.UniverType.UNIVER_UNKNOWN])),T(this,`_flushTimerByType`,new Map)}dispose(){this._pluginStore.removePlugins().forEach(e=>e.dispose()),this._flushTimerByType.forEach(e=>clearTimeout(e))}registerPlugin(e,t){this._assertPluginValid(e);let r={plugin:e,options:t};this._pluginRegistry.set(e.pluginName,r),this._logService.debug(`[PluginService]`,`Plugin "${e.pluginName}" registered.`);let{type:i}=e;this._loadedPluginTypes.has(i)&&(i===n.UniverType.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(i))}startPluginsForType(e){this._loadedPluginTypes.has(e)||this._loadPluginsForType(e)}_loadPluginsForType(e){let t=Array.from(this._pluginRegistry.keys()),n=[];t.forEach(t=>{let r=this._pluginRegistry.get(t);r.plugin.type===e&&n.push(r)}),this._loadFromPlugins(n),this._loadedPluginTypes.add(e)}_assertPluginValid(e){let{type:t,pluginName:r,packageName:i,version:a}=e;if(t===n.UniverType.UNRECOGNIZED)throw Error(`[PluginService]: invalid plugin type for ${e.name}. Please assign a "type" to your plugin.`);if(!r)throw Error(`[PluginService]: no plugin name for ${e.name}. Please assign a "pluginName" to your plugin.`);if(a&&a!==ob.version&&this._logService.error(`[PluginService]`,[`Plugin version mismatch.`,` plugin: "${r||e.name}"`,` package: "${i}"`,` plugin version: "${a}"`,` core version: "${ob.version}"`,` registration will continue, but please make sure all @univerjs packages use the same version.`].join(`
|
|
20
|
-
`)),this._seenPlugins.has(r))throw 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(e.pluginName)}_flushType(e){this._flushTimerByType.get(e)===void 0&&this._flushTimerByType.set(e,setTimeout(()=>{this._loadPluginsForType(e),this._flushTimerByType.delete(e)},4))}_loadFromPlugins(e){let t=[],r=new Set,i=e=>{let{plugin:a}=e,{pluginName:o}=a;if(this._loadedPlugins.has(o)||r.has(o))return;r.add(o),this._pluginRegistry.delete(o);let s=a[ab];s&&s.forEach(e=>{let t=this._pluginRegistry.get(e.pluginName);if(t)i(t);else if(!this._seenPlugins.has(e.pluginName)&&!r.has(e.pluginName)){if(a.type===n.UniverType.UNIVER_UNKNOWN&&e.type!==n.UniverType.UNIVER_UNKNOWN)throw 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 ${e.pluginName}.`);a.type!==e.type&&e.type!==n.UniverType.UNIVER_UNKNOWN&&this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which has different type.`),this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(e),i({plugin:e,options:void 0})}}),t.push(e)};e.forEach(e=>i(e));let a=t.map(e=>this._initPlugin(e.plugin,e.options));this._pluginsRunLifecycle(a)}_pluginsRunLifecycle(e){let n=this._lifecycleService.stage;if(Xy(n).subscribe(t=>this._runStage(e,t)),n!==3){let n=this._lifecycleService.lifecycle$.pipe((0,t.skip)(1)).subscribe(t=>{this._runStage(e,t),t===3&&n.unsubscribe()})}}_runStage(e,t){e.forEach(e=>{switch(t){case 0:e.onStarting();break;case 1:e.onReady();break;case 2:e.onRendered();break;case 3:e.onSteady();break}})}_initPlugin(e,t){let n=this._injector.createInstance(e,t);return this._pluginStore.addPlugin(n),this._loadedPlugins.add(e.pluginName),this._logService.debug(`[PluginService]`,`Plugin "${n.getPluginName()}" loaded.`),n}};lb=pa([V(0,(0,i.Inject)(i.Injector)),V(1,(0,i.Inject)(Yy)),V(2,ua)],lb);let ub=(0,i.createIdentifier)(`resource-loader-service`),db=class extends k{constructor(e){super(),this._logService=e,T(this,`_resourceMap`,new Map),T(this,`_register$`,new t.Subject),T(this,`register$`,this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e,t){return t?this.getResourcesByType(e,t):this.getAllResourceHooks().map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}getResourcesByType(e,t){let n=this.getAllResourceHooks(),r=[];for(let i=0;i<n.length;i++){let a=n[i];if(!a.businesses.includes(t))continue;let o=a.toJson(e);r.push({name:a.pluginName,data:o})}return r}registerPluginResource(e){let t=e.pluginName;if(this._resourceMap.has(t))throw Error(`the pluginName is registered {${t}}`);return this._resourceMap.set(t,e),this._register$.next(e),D(()=>this._resourceMap.delete(t))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,t){let n=this.getAllResourceHooks();for(let i=0;i<n.length;i++){var r;let a=n[i],o=t==null||(r=t.find(e=>e.name===a.pluginName))==null?void 0:r.data;if(o)try{let t=a.parseJson(o);a.onLoad(e,t)}catch(e){this._logService.error(`[ResourceManagerService]`,`loadResources error`,e)}}}unloadResources(e,t){let n=this.getAllResourceHooks();for(let r=0;r<n.length;r++){let i=n[r];i.businesses.includes(t)&&i.onUnLoad(e)}}dispose(){this._register$.complete(),this._resourceMap.clear()}};db=pa([V(0,ua)],db);var fb=class extends k{get darkMode(){return this._darkMode$.getValue()}constructor(){super(),T(this,`_darkMode$`,new t.BehaviorSubject(!1)),T(this,`darkMode$`,this._darkMode$.asObservable()),T(this,`_validColorCache`,new Map),T(this,`_currentTheme`,a.defaultTheme),T(this,`_currentTheme$`,new t.BehaviorSubject(this._currentTheme)),T(this,`currentTheme$`,this._currentTheme$.asObservable()),this.disposeWithMe(D(()=>{this._currentTheme=a.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}isValidThemeColor(e){if(this._validColorCache.has(e))return this._validColorCache.get(e);let t=!1,n=e.split(`.`);if(n.length===1)t=e in a.defaultTheme;else if(n.length===2){let[e,r]=n;t=e in a.defaultTheme&&r in this._currentTheme[e]}return this._validColorCache.set(e,t),t}getCurrentTheme(){return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}setDarkMode(e){this._darkMode$.next(e)}getColorFromTheme(e){return Yn(this._currentTheme,e)}};let pb=(0,i.createIdentifier)(`univer.undo-redo.service`);var mb=class{dispose(){}async dispatchToHandlers(){return!1}};let hb=`univer.command.redo`,gb=`univer.command.undo`,_b=new class extends mb{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,gb)}handler(e){let t=e.get(pb),n=t.pitchTopUndoElement();if(!n)return!1;let r=e.get(ga);return xa(n.undoMutations,r).result?(t.popUndoToRedo(),!0):!1}},vb=new class extends mb{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,hb)}handler(e){let t=e.get(pb),n=t.pitchTopRedoElement();if(!n)return!1;let r=e.get(ga);return xa(n.redoMutations,r).result?(t.popRedoToUndo(),!0):!1}},yb=class extends k{constructor(e,n,r){super(),this._univerInstanceService=e,this._commandService=n,this._contextService=r,T(this,`undoRedoStatus$`,void 0),T(this,`_undoRedoStatus$`,new t.BehaviorSubject({undos:0,redos:0})),T(this,`_undoStacks`,new Map),T(this,`_redoStacks`,new Map),T(this,`_batchingStatus`,new Map),this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(_b)),this.disposeWithMe(this._commandService.registerCommand(vb)),this.disposeWithMe(D(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(D(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){let{unitID:t}=e,n=this._getRedoStack(t,!0),r=this._getUndoStack(t,!0);if(n.length=0,this._batchingStatus.has(e.unitID)){let t=this._batchingStatus.get(e.unitID),n=this._pitchUndoElement(e.unitID);t===0||!n?(i(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(n,e)}else i(e);function i(e){r.push(e),r.length>20&&r.splice(0,1)}this._updateStatus()}clearUndoRedo(e){let t=this._getRedoStack(e);t&&(t.length=0);let n=this._getUndoStack(e);n&&(n.length=0),this._updateStatus()}pitchTopUndoElement(){let e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){let e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){let t=this._getUndoStack(e);return t!=null&&t.length?t[t.length-1]:null}_pitchRedoElement(e){let t=this._getRedoStack(e);return t!=null&&t.length?t[t.length-1]:null}popUndoToRedo(){let e=this._getUndoStackForFocused().pop();e&&(e.redoMutations.length>0&&this._getRedoStackForFocused().push(e),this._updateStatus())}popRedoToUndo(){let e=this._getRedoStackForFocused().pop();e&&(this._getUndoStackForFocused().push(e),this._updateStatus())}rollback(e,t){let n=t||this._getFocusedUnitId(),r=this._getUndoStack(n),i=r==null?void 0:r[(r==null?void 0:r.length)-1];i&&i.id===e&&(r.pop(),xa(i.undoMutations,this._commandService))}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw Error(`[LocalUndoRedoService]: cannot batching undo redo twice at the same time!`);return this._batchingStatus.set(e,0),D(()=>this._batchingStatus.delete(e))}_updateStatus(){var e,t;let n=this._getFocusedUnitId(),r=n&&((e=this._undoStacks.get(n))==null?void 0:e.length)||0,i=n&&((t=this._redoStacks.get(n))==null?void 0:t.length)||0;this._undoRedoStatus$.next({undos:r,redos:i})}_getUndoStack(e,t=!1){let n=this._undoStacks.get(e);return!n&&t&&(n=[],this._undoStacks.set(e,n)),n||null}_getRedoStack(e,t=!1){let n=this._redoStacks.get(e);return!n&&t&&(n=[],this._redoStacks.set(e,n)),n||null}_getUndoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getUndoStack(e,!0)}_getRedoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getRedoStack(e,!0)}_tryBatchingElements(e,t){e.redoMutations.push(...t.redoMutations),e.undoMutations.push(...t.undoMutations)}_getFocusedUnitId(){let e=``,t=this._contextService.getContextValue(Qv),n=this._contextService.getContextValue(ny),r=this._contextService.getContextValue(ty);if(t)if(n)e=Qu;else if(r)e=Zu;else{var i,a;e=(i=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())==null?``:i}else{var o,s;e=(o=(s=this._univerInstanceService.getFocusedUnit())==null?void 0:s.getUnitId())==null?``:o}return e}};yb=pa([V(0,Wy),V(1,ga),V(2,sa)],yb);var bb=class{constructor(e,t=1e3){this._injector=e,T(this,`_imageCacheMap`,void 0),this._imageCacheMap=new Gu(t)}_getImageCacheKey(e,t){return`${e}-${t}`}getImage(e,t,n,r){let i=this._getImageCacheKey(e,t);return this._imageCacheMap.get(i)||((async()=>{let a=new Image,o=this._injector.has(oy)?this._injector.get(oy):null,s=this._injector.has(sy)?this._injector.get(sy):null;if(e===`UUID`)try{a.src=await(o==null?void 0:o.getImage(t))||``}catch(e){console.error(e)}else if(e===`URL`)try{a.src=await(s==null?void 0:s.getImage(t))||t}catch{a.src=t}else a.src=t;a.onload=()=>{a.removeAttribute(`data-error`),n==null||n()},a.onerror=()=>{a.setAttribute(`data-error`,`true`),r==null||r()},this._imageCacheMap.set(i,a)})(),null)}};function xb(e){return!(e.length===0||e.length>31||e.startsWith(`'`)||e.endsWith(`'`)||/[:\\\/\?\*\[\]]/.test(e))}function Sb(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}let Cb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$=new Uint32Array(96);var wb=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(`Data must be an instance of ArrayBuffer or SharedArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==1)throw Error(`Got v${i} data when expected v1.`);let a=Cb[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=Cb.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=e*2,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Tb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=[];for(;s>0;){let l=$[--s],u=$[--s],d=$[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&($[s++]=d,$[s++]=f-1,$[s++]=1-l),(l===0?n>=p:r>=m)&&($[s++]=f+1,$[s++]=u,$[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=$[--s],d=$[--s],f=$[--s];if(d-f<=o){for(let n=f;n<=d;n++)kb(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];kb(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&($[s++]=f,$[s++]=p-1,$[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&($[s++]=p+1,$[s++]=d,$[s++]=1-u)}return c}};function Tb(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;Eb(e,t,o,r,i,a),Tb(e,t,n,r,o-1,1-a),Tb(e,t,n,o+1,i,1-a)}function Eb(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);Eb(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(Db(e,t,r,n),t[2*i+a]>o&&Db(e,t,r,i);s<c;){for(Db(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?Db(e,t,r,c):(c++,Db(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function Db(e,t,n,r){Ob(e,n,r),Ob(t,2*n,2*r),Ob(t,2*n+1,2*r+1)}function Ob(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function kb(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var Ab=class{constructor(e=!1){this._enableOneCellCache=e,T(this,`_tree`,new Map),T(this,`_oneCellCache`,new Map),T(this,`_kdTree`,new Map)}dispose(){this.clear()}getTree(e,t){return this._tree.has(e)||this._tree.set(e,new Map),this._tree.get(e).has(t)||this._tree.get(e).set(t,new _f),this._tree.get(e).get(t)}_getOneCellCache(e,t,n,r){return this._oneCellCache.has(e)||this._oneCellCache.set(e,new Map),this._oneCellCache.get(e).has(t)||this._oneCellCache.get(e).set(t,new Map),this._oneCellCache.get(e).get(t).has(n)||this._oneCellCache.get(e).get(t).set(n,new Map),this._oneCellCache.get(e).get(t).get(n).has(r)||this._oneCellCache.get(e).get(t).get(n).set(r,new Set),this._oneCellCache.get(e).get(t).get(n).get(r)}_removeOneCellCache(e,t,n,r,i){let a=this._oneCellCache.get(e);if(!a)return;let o=a.get(t);if(!o)return;let s=o.get(n);if(!s)return;let c=s.get(r);c&&c.delete(i)}_removeCellCacheByRange(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this._oneCellCache.get(t);if(!a)return;let o=a.get(n);if(!o)return;let{startRow:s,startColumn:c,endRow:l,endColumn:u}=r;for(let e=s;e<=l;e++){let t=o.get(e);if(t)for(let e=c;e<=u;e++){let n=t.get(e);n&&n.delete(i)}}}_insertOneCellCache(e,t,n,r,i){this._getOneCellCache(e,t,n,r).add(i)}_getRdTreeItems(e){let t=[];for(let[n,r]of e)for(let[e,i]of r)t.push({x:e,y:n,ids:i});return t}_searchByOneCellCache(e){var t;let{unitId:n,sheetId:r,range:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=i,l=(t=this._kdTree.get(n))==null?void 0:t.get(r);if(!l)return[];let{tree:u,items:d}=l,f=u.range(o,a,c,s),p=[];for(let e of f){let t=d[e];p.push(...Array.from(t.ids))}return p}openKdTree(){for(let[t,n]of this._oneCellCache){this._kdTree.has(t)||this._kdTree.set(t,new Map);for(let[r,i]of n){var e;let n=this._getRdTreeItems(i),a=new wb(n.length);(e=this._kdTree.get(t))==null||e.set(r,{tree:a,items:n});for(let e of n)a.add(e.x,e.y);a.finish()}}}closeKdTree(){for(let[t,n]of this._oneCellCache)for(let[r,i]of n){var e;(e=this._kdTree.get(t))==null||e.set(r,void 0)}}insert(e){let{unitId:t,sheetId:n,range:r,id:i}=e;if(!t||t.length===0)return;let{startRow:a,endRow:o,startColumn:s,endColumn:c}=r;if(this._enableOneCellCache&&a===o&&s===c){this._insertOneCellCache(t,n,a,s,i);return}let l=this.getTree(t,n);Number.isNaN(a)&&(a=0),Number.isNaN(s)&&(s=0),Number.isNaN(o)&&(o=1/0),Number.isNaN(c)&&(c=1/0),l.insert({minX:s,minY:a,maxX:c,maxY:o,id:i})}bulkInsert(e){for(let t of e)this.insert(t)}*searchGenerator(e){var t;let{unitId:n,sheetId:r,range:i}=e;if(this._enableOneCellCache){let t=this._searchByOneCellCache(e);for(let e of t)yield e}let a=(t=this._tree.get(n))==null?void 0:t.get(r);if(!a)return;let o=a.search({minX:i.startColumn,minY:i.startRow,maxX:i.endColumn,maxY:i.endRow});for(let e of o)yield e.id}bulkSearch(e,t){let n=new Set;for(let r of e)for(let e of this.searchGenerator(r))(t==null?void 0:t.has(e))!==!0&&n.add(e);return n}removeById(e,t){if(t){var n,r;(n=this._tree.get(e))==null||n.delete(t),(r=this._oneCellCache.get(e))==null||r.delete(t)}else this._tree.delete(e),this._oneCellCache.delete(e)}_removeRTreeItem(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this.getTree(t,n),o=a.search({minX:r.startColumn,minY:r.startRow,maxX:r.endColumn,maxY:r.endRow});for(let e=0;e<o.length;e++)o[e].id===i&&a.remove(o[e])}remove(e){let{unitId:t,sheetId:n,range:r,id:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=r;this._enableOneCellCache?a===s&&o===c?this._removeOneCellCache(t,n,r.startRow,r.startColumn,i):(this._removeCellCacheByRange(e),this._removeRTreeItem(e)):this._removeRTreeItem(e)}bulkRemove(e){for(let t of e)this.remove(t)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){let e={};return this._tree.forEach((t,n)=>{e[n]={},t.forEach((t,r)=>{e[n][r]=t.toJSON()})}),e}fromJSON(e){this._tree.clear();for(let t in e){this._tree.set(t,new Map);for(let n in e[t]){let r=new _f;r.fromJSON(e[t][n]),this._tree.get(t).set(n,r)}}}};function jb(e){return new Promise(t=>setTimeout(t,e))}function Mb(e=1){return new Promise(t=>{let n=0,r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}let Nb=class extends k{constructor(e){super(),this._localeService=e,T(this,`_fontLocale`,void 0),T(this,`_dirty`,!0),this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(e){this._dirty=e}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};Nb=pa([V(0,(0,i.Inject)(Qy))],Nb);function Pb(e={}){let t={defaultBackgroundColor:`rgba(24, 119, 242, 0.08)`,defaultStripeColor:`rgba(24, 119, 242, 0.25)`,rowGaps:{1:{size:6},3:{size:10,color:`rgba(245, 158, 11, 0.14)`},6:{size:14,color:`rgba(16, 185, 129, 0.12)`,stripeColor:`rgba(5, 150, 105, 0.35)`}},colGaps:{1:{size:5},2:{size:8,stripeColor:`rgba(59, 130, 246, 0.35)`},4:{size:12,color:`rgba(244, 63, 94, 0.12)`,stripeColor:`rgba(225, 29, 72, 0.30)`}}};return{...t,...e,rowGaps:{...t.rowGaps,...e.rowGaps},colGaps:{...t.colGaps,...e.colGaps}}}let Fb=class extends Nb{constructor(e,t,n,r,i,a){super(n),this.worksheet=e,this._styles=t,this._contextService=r,this._configService=i,this._injector=a,T(this,`_worksheetData`,void 0),T(this,`_renderRawFormula`,!1),T(this,`_cellData`,void 0),T(this,`_imageCacheMap`,void 0),T(this,`_skipAutoHeightForMergedCells`,!0),T(this,`_rowTotalHeight`,0),T(this,`_columnTotalWidth`,0),T(this,`_rowHeaderWidth`,0),T(this,`_columnHeaderHeight`,0),T(this,`_rowHeightAccumulation`,[]),T(this,`_columnWidthAccumulation`,[]),T(this,`_marginTop`,0),T(this,`_marginLeft`,0),T(this,`_gapConfig`,{}),T(this,`_scaleX`,1),T(this,`_scaleY`,1),T(this,`_scrollX`,0),T(this,`_scrollY`,0),this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new bb(this._injector),this.initConfig()}initConfig(){var e,t;this._skipAutoHeightForMergedCells=!((e=this._configService.getConfig(ed))!=null&&e),this.worksheet.setIsRowStylePrecedeColumnStyle((t=this._configService.getConfig(`isRowStylePrecedeColumnStyle`))==null?!1:t)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(e){this._columnHeaderHeight=e,this._worksheetData.columnHeader.height=e}set rowHeaderWidth(e){this._rowHeaderWidth=e,this._worksheetData.rowHeader.width=e}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(e){this._marginLeft=e}setMarginTop(e){this._marginTop=e}setScale(e,t){this._updateLayout(),this._scaleX=e,this._scaleY=t||e,this._updateLayout()}setScroll(e,t){z.isDefine(e)&&(this._scrollX=e),z.isDefine(t)&&(this._scrollY=t)}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}get gapConfig(){return this._gapConfig}setGapConfig(e){this._gapConfig=this._fillDefaultGapThemeColors(e),this.makeDirty(!0),this._updateLayout()}_fillDefaultGapThemeColors(e){var t,n;if(e.defaultBackgroundColor&&e.defaultStripeColor)return e;let{r,g:i,b:a}=new Ia(this._injector.get(fb).getColorFromTheme(`primary.500`)).toRgb();return{...e,defaultBackgroundColor:(t=e.defaultBackgroundColor)==null?`rgba(${r}, ${i}, ${a}, 0.025)`:t,defaultStripeColor:(n=e.defaultStripeColor)==null?`rgba(${r}, ${i}, ${a}, 0.08)`:n}}getRowGapSize(e){var t,n;return(t=(n=this._gapConfig.rowGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getColGapSize(e){var t,n;return(t=(n=this._gapConfig.colGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getGapSizeGetter(){if(!(!this._gapConfig.rowGaps&&!this._gapConfig.colGaps))return{row:e=>this.getRowGapSize(e),col:e=>this.getColGapSize(e)}}getRowGapAtPosition(e){let{rowGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._rowHeightAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}getColGapAtPosition(e){let{colGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._columnWidthAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}_generateRowMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){var o,s;let e=n;if(this.worksheet.getRowFiltered(t))e=0;else if(a[t]!=null){let r=a[t];if(!r)continue;let{h:i=n,ah:o,ia:s}=r;e=(s==null||s===1)&&typeof o==`number`&&o>0?o:i,r.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.rowGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,r+=e,i.push(r)}return{rowTotalHeight:r,rowHeightAccumulation:i}}_generateColumnMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){var o,s;let e=n;if(a[t]!=null){let n=a[t];if(!n)continue;n.w!=null&&(e=n.w),n.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.colGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,r+=e,i.push(r)}return{columnTotalWidth:r,columnWidthAccumulation:i}}intersectMergeRange(e,t){return!!this.worksheet.getMergedCell(e,t)}_getOverflowBound(e,t,n,r,i=1){let a=0;if(t>n){let o=this._columnWidthAccumulation.length-1;for(let s=t;s>=n;s--){let n=s;if(!Bl(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n+1>o?o:n+1;let{startX:c,endX:l}=Lb(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&n===t?a+=(l-c)/2:a+=l-c,r<a)return n}return t}for(let o=t;o<=n;o++){let n=o;if(!Bl(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n-1<0?0:n-1;let{startX:s,endX:c}=Lb(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&n===t?a+=(c-s)/2:a+=c-s,r<a)return n}return n}_updateLayout(){if(!this.dirty)return;let{rowData:e,columnData:t,defaultRowHeight:n,defaultColumnWidth:r,rowCount:i,columnCount:a,rowHeader:o,columnHeader:s}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:l}=this._generateRowMatrixCache(i,e,n),{columnTotalWidth:u,columnWidthAccumulation:d}=this._generateColumnMatrixCache(a,t,r);this._rowHeaderWidth=o.hidden===1?0:this._dynamicallyUpdateRowHeaderWidth(o),this._columnHeaderHeight=s.hidden===1?0:s.height,this._rowTotalHeight=c,this._rowHeightAccumulation=l,this._columnTotalWidth=u,this._columnWidthAccumulation=d,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(e){}_dynamicallyUpdateRowHeaderWidth(e){let t=`${this.worksheet.getRowCount()}`.length*8;return Math.max(e.width,t)}_hasUnMergedCellInRow(e,t,n){if(!this.worksheet.getMergeData())return!1;for(let r=t;r<=n;r++){let{isMerged:t,isMergedMainCell:n}=this.worksheet.getCellInfoInMergeData(e,r);if(!t&&!n)return!0}return!1}expandRangeByMerge(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this._worksheetData.mergeData;if(!o)return{startRow:n,startColumn:r,endRow:i,endColumn:a};let s=!0,c=new Fl,l=0,u=null;for(;s;){s=!1;for(let e=0;e<o.length;e++){let{startRow:t,startColumn:d,endRow:f,endColumn:p}=o[e];if(c.getValue(t,d))continue;let m={startColumn:r,startRow:n,endColumn:a,endRow:i},h={startColumn:d,startRow:t,endColumn:p,endRow:f};zf(m,h)&&(n=Math.min(n,t),r=Math.min(r,d),i=Math.max(i,f),a=Math.max(a,p),c.setValue(t,d,!0),s=!0,l++,u=h)}}return t&&l===1&&Uf.contains(u,e)?{startRow:u.startRow,startColumn:u.startColumn,endRow:u.startRow,endColumn:u.startColumn}:{startRow:n,startColumn:r,endRow:i,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(e,t){return this.worksheet.getCellInfoInMergeData(e,t)}getNoMergeCellWithCoordByIndex(e,t,n=!0){let{rowHeightAccumulation:r,columnWidthAccumulation:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:o}=this,{startY:s,endY:c,startX:l,endX:u}=Lb(e,t,r,i,void 0,this.getGapSizeGetter());return n&&(s+=o,c+=o,l+=a,u+=a),{startY:s,endY:c,startX:l,endX:u}}getRowIndexByOffsetY(e,t,n,r){let{rowHeightAccumulation:i}=this;e=zb(e,t,n,this.columnHeaderHeightAndMarginTop);let a=Ma(i,e,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var o;Math.abs(i[a]-e)<Math.abs(e-((o=i[a-1])==null?0:o))&&(a+=1)}return a}getColumnIndexByOffsetX(e,t,n,r){let i=Rb(e,t,n,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this,o=Ma(a,i,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var s;Math.abs(a[o]-i)<Math.abs(i-((s=a[o-1])==null?0:s))&&(o+=1)}return o}getCellIndexByOffset(e,t,n,r,i,a){return{row:this.getRowIndexByOffsetY(t,r,i,a),column:this.getColumnIndexByOffsetX(e,n,i,a)}}getCellByOffset(e,t,n,r,i){var a;let o=(a=this)==null?void 0:a.getCellIndexByOffset(e,t,n,r,i,{firstMatch:!0});return o?this.worksheet.getCellInfoInMergeData(o.row,o.column):null}getCellWithCoordByIndex(e,t,n=!0){var r;let{rowHeightAccumulation:i,columnWidthAccumulation:a,rowHeaderWidthAndMarginLeft:o,columnHeaderHeightAndMarginTop:s}=this,c=Lb(e,t,i,a,(r=this.worksheet)==null?void 0:r.getCellInfoInMergeData(e,t),this.getGapSizeGetter()),{isMerged:l,isMergedMainCell:u}=c,{startY:d,endY:f,startX:p,endX:m,mergeInfo:h}=c,g=o,_=s;return n===!1&&(g=0,_=0),d+=_,f+=_,p+=g,m+=g,h.startY+=_,h.endY+=_,h.startX+=g,h.endX+=g,{actualRow:e,actualColumn:t,startX:p,startY:d,endX:m,endY:f,isMerged:l,isMergedMainCell:u,mergeInfo:h}}getCellWithCoordByOffset(e,t,n,r,i,a){let{row:o,column:s}=this.getCellIndexByOffset(e,t,n,r,i,a);return this.getCellWithCoordByIndex(o,s)}getOffsetByColumn(e){let{columnWidthAccumulation:t,rowHeaderWidthAndMarginLeft:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetByRow(e){let{rowHeightAccumulation:t,columnHeaderHeightAndMarginTop:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetRelativeToRowCol(e,t){let n=Ma(this.columnWidthAccumulation,e),r=e-((this._columnWidthAccumulation[n-1]||0)+this.getColGapSize(n)),i=Ma(this.rowHeightAccumulation,t);return{row:i,column:n,columnOffset:r,rowOffset:t-((this._rowHeightAccumulation[i-1]||0)+this.getRowGapSize(i))}}getCellIndexAndOffsetByPosition(e,t){let{actualRow:n,actualColumn:r,startX:i,startY:a}=this.getCellWithCoordByOffset(e,t,this._scaleX,this._scaleY,{x:this._scrollX,y:this._scrollY});return{row:n,rowOffset:t-a,column:r,columnOffset:e-i}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=0,e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new S_(e)}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,this.worksheet=null}};Fb=pa([V(2,(0,i.Inject)(Qy)),V(3,sa),V(4,aa),V(5,(0,i.Inject)(i.Injector))],Fb);function Ib(e,t,n,r,i=0,a=0){let o=e-1,s=t-1,c=(n[o]||0)+i,l=n[e];l==null&&(l=n[n.length-1]);let u=(r[s]||0)+a,d=r[t];return d==null&&(d=r[r.length-1]),{startY:c,endY:l,startX:u,endX:d}}function Lb(e,t,n,r,i,a){var o,s;e=z.clamp(e,0,n.length-1),t=z.clamp(t,0,r.length-1);let{startY:c,endY:l,startX:u,endX:d}=Ib(e,t,n,r,(o=a==null?void 0:a.row(e))==null?0:o,(s=a==null?void 0:a.col(t))==null?0:s);if(!i)return{startY:c,endY:l,startX:u,endX:d,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:c,endY:l,startX:u,endX:d,startRow:e,startColumn:t,endRow:e,endColumn:t}};let{isMerged:f,isMergedMainCell:p,startRow:m,startColumn:h,endRow:g,endColumn:_}=i,v={startRow:m,startColumn:h,endRow:g,endColumn:_,startY:c,endY:l,startX:u,endX:d},y=n.length-1,b=r.length-1;if(f&&m!==-1&&h!==-1){var x,S;let e=(x=a==null?void 0:a.row(m))==null?0:x,t=(S=a==null?void 0:a.col(h))==null?0:S,i=(n[m-1]||0)+e,o=n[g]||n[y],s=(r[h-1]||0)+t,c=r[_]||r[b];v={...v,startY:i,endY:o,startX:s,endX:c}}else if(!f&&g!==-1&&_!==-1){let e=n[g]||n[y],t=r[_]||r[b];v={...v,startY:c,endY:e,startX:u,endX:t}}return{isMerged:f,isMergedMainCell:p,actualRow:e,actualColumn:t,startY:c,endY:l,startX:u,endX:d,mergeInfo:v}}function Rb(e,t,n,r){let{x:i}=n;return e/t+i-r}function zb(e,t,n,r){let{y:i}=n;return e=e/t+i-r,e}let Bb=[`script`,`style`,`meta`,`comment`,`link`],Vb=function(e){return e[e.INFO=0]=`INFO`,e[e.STOP=1]=`STOP`,e[e.WARNING=2]=`WARNING`,e}({}),Hb=function(e){return 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}({}),Ub=function(e){return 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}({}),Wb=function(e){return e[e.TEXT=0]=`TEXT`,e[e.ARROW=1]=`ARROW`,e[e.CUSTOM=2]=`CUSTOM`,e}({}),Gb=function(e){return e.VALID=`valid`,e.INVALID=`invalid`,e.VALIDATING=`validating`,e}({}),Kb=function(e){return 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}({}),qb=class extends k{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){let e=(e,t,n=[],r)=>{let i=n.find(t=>t.name===e.pluginName);if(i)try{let n=e.parseJson(i.data);e.onLoad(t,n)}catch{console.error(`Load ${r}{${t}} Resources{${e.pluginName}} Data Error.`)}},t=t=>{t.businesses.forEach(r=>{switch(r){case n.UniverType.UNRECOGNIZED:case n.UniverType.UNIVER_UNKNOWN:case n.UniverType.UNIVER_DOC:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_DOC).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Document`)});break;case n.UniverType.UNIVER_SLIDE:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SLIDE).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Slide`)});break;case n.UniverType.UNIVER_BOARD:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_BOARD).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Board`)});break;case n.UniverType.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SHEET).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Workbook`)});break;case n.UniverType.UNIVER_BASE:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_BASE).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Base`)});break}})};this._resourceManagerService.getAllResourceHooks().forEach(e=>t(e)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(e=>t(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SHEET).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_DOC).subscribe(e=>{let{unit:t}=e;nd(t.getUnitId())||this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_BOARD).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_BASE).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_DOC).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_DOC)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_BASE).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_BASE)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SLIDE)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_BOARD).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_BOARD)}))}saveUnit(e){let t=this._univerInstanceService.getUnit(e);if(!t)return null;let n=this._resourceManagerService.getResources(e,t.type),r=z.deepClone(t.getSnapshot());return r.resources=n,r}};qb=pa([V(0,(0,i.Inject)(Hv)),V(1,(0,i.Inject)(Wy))],qb);var Jb=class extends M{constructor(...e){super(...e),T(this,`type`,void 0),T(this,`name$`,void 0)}getUnitId(){throw Error(`Method not implemented.`)}setName(e){throw Error(`Method not implemented.`)}getSnapshot(){throw Error(`Method not implemented.`)}getRev(){throw Error(`Method not implemented.`)}incrementRev(){throw Error(`Method not implemented.`)}setRev(e){throw Error(`Method not implemented.`)}},Yb=class{get _univerInstanceService(){return this._injector.get(Wy)}get _pluginService(){return this._injector.get(lb)}constructor(e={},t){T(this,`_startedTypes`,new Set),T(this,`_injector`,void 0),T(this,`_disposingCallbacks`,new O);let n=this._injector=Xb(t,e==null?void 0:e.override),{theme:r,darkMode:i,locale:a,locales:o,direction:s,logLevel:c,logCommandExecution:l}=e;r&&this._injector.get(fb).setTheme(r),i&&this._injector.get(fb).setDarkMode(i),o&&this._injector.get(Qy).load(o),a&&this._injector.get(Qy).setLocale(a),s&&this._injector.get(Qy).setDirection(s),c&&this._injector.get(ua).setLogLevel(c),l!==void 0&&this._injector.get(aa).setConfig(ma,l),this._init(n)}__getInjector(){return this._injector}onDispose(e){let t=this._disposingCallbacks.add(D(e));return D(()=>t.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(e){this._injector.get(Qy).setLocale(e)}createUnit(e,t){return this._univerInstanceService.createUnit(e,t)}_init(e){this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SHEET,Uy),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_DOC,S_),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SLIDE,Jb);let t=e.get(Wy);t.__setCreateHandler((n,r,i,a)=>{var o;let s=!this._startedTypes.has(n);s&&(this._pluginService.startPluginsForType(n),this._startedTypes.add(n));let c=(o=t.__getCtorByType(n))==null?i:o;if(!c)throw Error(`[Univer]: No constructor registered for unit type ${n}.`);let l=e.createInstance(c,r);return t.__addUnit(l,a),s&&this._tryProgressToReady(),l})}_tryProgressToReady(){this._injector.get(Yy).stage<1&&(this._injector.get(Yy).stage=1)}registerPlugin(e,t){this._pluginService.registerPlugin(e,t)}registerPlugins(e){e.forEach(e=>{let[t,n]=e;this._pluginService.registerPlugin(t,n)})}};function Xb(e,t){let n=ib([[ry],[Qy],[fb],[Yy],[lb],[Kv],[Wy,{useClass:Gy}],[nb,{useClass:rb}],[ua,{useClass:da,lazy:!0}],[ga,{useClass:ya}],[pb,{useClass:yb,lazy:!0}],[aa,{useClass:oa}],[sa,{useClass:ca}],[Hv,{useClass:db,lazy:!0}],[ub,{useClass:qb,lazy:!0}],[Jv,{useClass:qv}],[eb,{useClass:$y,lazy:!0}]],t),r=e?e.createChild(n):new i.Injector(n);return qe(r,[[Kv],[ub]]),r}x(),e.ABCToNumber=ep,e.AUTO_HEIGHT_FOR_MERGED_CELLS=ed,e.AbsoluteRefType=oo,e.ActionIterator=Qg,e.AlignTypeH=Ld,e.AlignTypeV=Rd,e.ArrangeTypeEnum=Ud,e.AsyncInterceptorManager=Zp,e.AsyncLock=zp.default,Object.defineProperty(e,"AuthzIoLocalService",{enumerable:!0,get:function(){return qv}}),e.AutoFillSeries=se,e.BORDER_KEYS=Yd,e.BORDER_STYLE_KEYS=Jd,e.BaseDataModel=mp,e.BaseFieldType=sp,e.BaseFilterConjunction=up,e.BaseFilterOperator=lp,e.BaseSortDirection=dp,e.BaseViewType=cp,e.BaselineOffset=Me,e.BlockType=fd,e.BooleanNumber=Ne,e.BorderStyleTypes=ce,e.BorderType=le,e.BuildTextUtils=Z,e.BulletAlignment=cd,e.COLORS=Fa,e.COLOR_STYLE_KEYS=qd,e.COMMAND_LOG_EXECUTION_CONFIG_KEY=ma,e.CanceledError=Ye,e.CellModeEnum=fo,e.CellValueType=Pe,e.ColorKit=Ia,e.ColorType=ue,e.ColumnLayoutType=kd,e.ColumnResponsiveType=Ad,e.ColumnSeparatorType=gd,Object.defineProperty(e,"CommandService",{enumerable:!0,get:function(){return ya}}),e.CommandType=ha,e.CommonHideTypes=de,e.ConfigService=oa,e.ContextService=ca,e.CopyPasteType=fe,e.CustomCommandExecutionError=Je,e.CustomDecorationType=dd,e.CustomRangeType=ud,e.DEFAULT_CELL=nf,e.DEFAULT_DOC=y_,e.DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING=of,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE=0,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW=12,e.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=`__default_document_sub_component_id20231101__`,e.DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
|
|
21
|
-
`,e.DEFAULT_NUMBER_FORMAT=`General`,e.DEFAULT_RANGE=ef,e.DEFAULT_RANGE_ARRAY=$d,e.DEFAULT_SELECTION=tf,e.DEFAULT_STYLES=J,e.DEFAULT_TEXT_FORMAT=`@@@`,e.DEFAULT_TEXT_FORMAT_EXCEL=`@`,e.DEFAULT_WORKSHEET_COLUMN_COUNT=20,e.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=`DEFAULT_WORKSHEET_COLUMN_COUNT`,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=`DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT`,e.DEFAULT_WORKSHEET_COLUMN_WIDTH=88,e.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=`DEFAULT_WORKSHEET_COLUMN_WIDTH`,e.DEFAULT_WORKSHEET_ROW_COUNT=Ny,e.DEFAULT_WORKSHEET_ROW_COUNT_KEY=`DEFAULT_WORKSHEET_ROW_COUNT`,e.DEFAULT_WORKSHEET_ROW_HEIGHT=24,e.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=`DEFAULT_WORKSHEET_ROW_HEIGHT`,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=`DEFAULT_WORKSHEET_ROW_TITLE_WIDTH`,e.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=$u,e.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Qu,e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Zu,e.DOC_DRAWING_PRINTING_COMPONENT_KEY=`univer-docs-drawing-printing`,e.DOC_RANGE_TYPE=lo,e.DashStyleType=Cd,e.DataStreamTreeNodeType=Km,e.DataStreamTreeTokenType=qm,e.DataValidationErrorStyle=Vb,e.DataValidationImeMode=Hb,e.DataValidationOperator=Ub,e.DataValidationRenderMode=Wb,e.DataValidationStatus=Gb,e.DataValidationType=Kb,e.DeleteDirection=pe,e.DependentOn=cb,e.DesktopLogService=da,e.DeveloperMetadataVisibility=me,e.Dimension=he,e.Direction=ge,e.Disposable=k,e.DisposableCollection=O,e.DocStyleType=ad,e.DocumentBlockRangeType=ld,e.DocumentBlockType=id,e.DocumentDataModel=S_,e.DocumentFlavor=pd,e.DrawingTypeEnum=Wd,e.EDITOR_ACTIVATED=ty,e.EXTENSION_NAMES=cf,e.ErrorService=ry,e.EventState=zv,e.EventSubject=Bv,e.FOCUSING_COMMENT_EDITOR=`FOCUSING_COMMENT_EDITOR`,e.FOCUSING_COMMON_DRAWINGS=`FOCUSING_COMMON_DRAWINGS`,e.FOCUSING_DOC=$v,e.FOCUSING_EDITOR_BUT_HIDDEN=`FOCUSING_EDITOR_BUT_HIDDEN`,e.FOCUSING_EDITOR_INPUT_FORMULA=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_EDITOR_STANDALONE=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_FX_BAR_EDITOR=ny,e.FOCUSING_PANEL_EDITOR=`FOCUSING_PANEL_EDITOR`,e.FOCUSING_SHAPE_TEXT_EDITOR=`FOCUSING_SHAPE_TEXT_EDITOR`,e.FOCUSING_SHEET=Qv,e.FOCUSING_SLIDE=ey,e.FOCUSING_UNIT=Zv,e.FOCUSING_UNIVER_EDITOR=`FOCUSING_UNIVER_EDITOR`,e.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=`FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE`,e.FORMULA_EDITOR_ACTIVATED=`FORMULA_EDITOR_ACTIVATED`,e.FollowNumberWithType=od,e.FontItalic=Ae,e.FontStyleType=Nd,e.FontWeight=je,e.GridType=md,e.HorizontalAlign=De,e.IAuthzIoService=Jv,e.ICommandService=ga,e.IConfigService=aa,e.IConfirmService=Yv,e.IContextService=sa,e.IImageIoService=oy,e.ILocalStorageService=Zy,e.ILogService=ua,e.IMentionIOService=eb,e.IPermissionService=nb,e.IResourceLoaderService=ub,e.IResourceManagerService=Hv,e.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=`isRowStylePrecedeColumnStyle`,e.IURLImageService=sy,e.IUndoRedoService=pb,e.IUniverInstanceService=Wy,e.ImageCacheMap=bb,e.ImageSourceType=iy,e.ImageUploadStatusType=ay,Object.defineProperty(e,"Inject",{enumerable:!0,get:function(){return i.Inject}}),Object.defineProperty(e,"InjectSelf",{enumerable:!0,get:function(){return i.InjectSelf}}),Object.defineProperty(e,"Injector",{enumerable:!0,get:function(){return i.Injector}}),e.InterceptorEffectEnum=Gp,e.InterceptorManager=Jp,e.InterpolationPointType=ve,Object.defineProperty(e,"JSON1",{enumerable:!0,get:function(){return Um}}),e.JSONX=m_,e.LOCALE_META=be,e.LRUHelper=Ku,e.LRUMap=Gu,Object.defineProperty(e,"LifecycleService",{enumerable:!0,get:function(){return Yy}}),e.LifecycleStages=Ky,e.LifecycleUnreachableError=Jy,e.ListGlyphType=sd,Object.defineProperty(e,"LocalUndoRedoService",{enumerable:!0,get:function(){return yb}}),e.LocaleService=Qy,e.LocaleType=ye,e.LogLevel=la,Object.defineProperty(e,"LookUp",{enumerable:!0,get:function(){return i.LookUp}}),e.MAX_COLUMN_COUNT=Yu,e.MAX_ROW_COUNT=Ju,e.MODERN_DOCUMENT_DEFAULT_MARGIN=66.66666666666667,e.MODERN_DOCUMENT_WIDTH=df,e.MOVE_BUFFER_VALUE=2,Object.defineProperty(e,"Many",{enumerable:!0,get:function(){return i.Many}}),e.MemoryCursor=pm,Object.defineProperty(e,"MentionIOLocalService",{enumerable:!0,get:function(){return $y}}),e.MentionType=xe,e.ModernDocumentWidthMode=uf,e.NAMED_STYLE_MAP=af,e.NAMED_STYLE_SPACE_MAP=sf,e.NamedStyleType=xd,e.NilCommand=va,e.NumberUnitType=Id,e.ObjectMatrix=Fl,e.ObjectRelativeFromH=Pd,e.ObjectRelativeFromV=Fd,Object.defineProperty(e,"Optional",{enumerable:!0,get:function(){return i.Optional}}),e.PADDING_KEYS=Zd,e.PAGE_SIZE=lf,e.PAPER_TYPES=Hd,e.PARAGRAPH_ID_PREFIX=Sm,e.PRESERVE_INSERTED_PARAGRAPH_IDS=Wm,e.PRESET_LIST_TYPE=Xh,e.PageOrientType=Bd,e.PaperType=Vd,e.ParagraphElementType=vd,e.ParagraphStyleBuilder=vv,e.ParagraphStyleValue=_v,e.PermissionService=rb,e.PermissionStatus=tb,e.Plugin=ob,Object.defineProperty(e,"PluginService",{enumerable:!0,get:function(){return lb}}),e.PositionedObjectLayoutType=bd,e.PresetListType=Gh,e.ProtectionType=Se,Object.defineProperty(e,"Quantity",{enumerable:!0,get:function(){return i.Quantity}}),e.QuickListType=Wh,e.QuickListTypeMap=$h,e.RANGE_DIRECTION=co,e.RANGE_TYPE=ao,e.RBush=_f,e.RCDisposable=j,e.RESTORE_INSERTED_PARAGRAPH_IDS=fh,e.RGBA_PAREN=`rgba(`,e.RGB_PAREN=`rgb(`,e.ROTATE_BUFFER_VALUE=1,e.RTree=Ab,e.Range=pf,e.Rectangle=Uf,Object.defineProperty(e,"RediError",{enumerable:!0,get:function(){return i.RediError}}),e.RedoCommand=vb,e.RedoCommandId=hb,e.RefAlias=Qf,e.Registry=vm,e.RegistryAsMap=ym,e.RelativeDate=Ce,Object.defineProperty(e,"ResourceManagerService",{enumerable:!0,get:function(){return db}}),e.RichTextBuilder=bv,e.RichTextParagraphBuilder=xv,e.RichTextRunBuilder=Sv,e.RichTextValue=yv,e.RxDisposable=A,e.SECTION_ID_PREFIX=km,e.SHEET_EDITOR_UNITS=rf,e.STYLE_KEYS=Qd,e.SectionType=hd,Object.defineProperty(e,"Self",{enumerable:!0,get:function(){return i.Self}}),Object.defineProperty(e,"SheetSkeleton",{enumerable:!0,get:function(){return Fb}}),e.SheetTypes=we,e.SheetViewModel=Iy,Object.defineProperty(e,"Skeleton",{enumerable:!0,get:function(){return Nb}}),Object.defineProperty(e,"SkipSelf",{enumerable:!0,get:function(){return i.SkipSelf}}),e.SliceBodyType=Og,e.SpacingRule=Sd,e.Styles=ly,e.TEXT_DECORATION_KEYS=Kd,e.TEXT_ROTATION_KEYS=Xd,e.THEME_COLORS=po,e.TabStopAlignment=wd,e.TableAlignmentType=Ed,e.TableLayoutType=Dd,e.TableRowHeightRule=jd,e.TableSizeType=Td,e.TableTextWrapType=Od,e.TestConfirmService=Xv,e.TextDecoration=Ee,e.TextDecorationBuilder=gv,e.TextDirection=Te,e.TextDirectionType=_d,e.TextStyleBuilder=hv,e.TextStyleValue=mv,e.TextX=X,e.TextXActionType=Gm,e.ThemeColorType=Fe,e.ThemeColors=Ie,e.ThemeService=fb,e.Tools=z,e.UndoCommand=_b,e.UndoCommandId=gb,e.UnitModel=M,e.Univer=Yb,Object.defineProperty(e,"UniverInstanceService",{enumerable:!0,get:function(){return Gy}}),e.UniverInstanceType=n.UniverType,e.UpdateDocsAttributeType=eo,e.UserManagerService=Kv,e.VerticalAlign=Oe,e.VerticalAlignmentType=Md,Object.defineProperty(e,"WithNew",{enumerable:!0,get:function(){return i.WithNew}}),Object.defineProperty(e,"Workbook",{enumerable:!0,get:function(){return Uy}}),e.Worksheet=Ry,e.WrapStrategy=ke,e.WrapTextType=yd,e.addLinkToDocumentModel=_y,e.afterInitApply=Oa,e.afterTime=Ea,e.awaitTime=jb,e.binSearchFirstGreaterThanTarget=ja,e.binarySearchArray=Aa,e.bufferDebounceTime=Ta,e.cellToRange=Yl,e.characterSpacingControlType=zd,e.checkForSubstrings=eu,e.checkIfMove=Pa,e.checkParagraphHasBullet=Du,e.checkParagraphHasIndent=Ou,e.checkParagraphHasIndentByStyle=ku,e.cloneBodyWithFreshParagraphIds=wm,e.cloneCellData=Ty,e.cloneCellDataMatrix=Dy,e.cloneCellDataWithSpanAndDisplay=Ey,e.cloneParagraphWithId=Tm,e.cloneSectionBreakWithId=jm,e.cloneValue=wy,e.cloneWorksheetData=Ay,e.codeToBlob=Na,e.columnLabelToNumber=qu,e.composeBody=qg,e.composeInterceptors=qp,e.composeStyles=ae,e.concatMatrixArray=Al,e.containsInteriorInsertionOffset=ah,e.containsStreamIndex=ih,e.convertCellToRange=Il,e.convertObservableToBehaviorSubject=Da,e.covertCellValue=Xl,e.covertCellValues=Zl,e.createAsyncInterceptorKey=Yp,e.createDefaultBaseTableSnapshot=fp,e.createDefaultUser=Wv,e.createDocumentModelWithStyle=my,Object.defineProperty(e,"createIdentifier",{enumerable:!0,get:function(){return i.createIdentifier}}),e.createInterceptorKey=Kp,e.createInternalEditorID=td,e.createParagraphId=Cm,e.createRandomId=Zf,e.createRowColIter=$f,e.createSectionId=Am,e.createSheetGapTestConfig=Pb,e.currencySymbols=Sl,e.customNameCharacterCheck=Sb,e.dateKit=Tu,e.debounce=jt,e.dedupe=Be,e.dedupeBy=Ve,e.deepCompare=Ql,e.delayAnimationFrame=Mb,e.deleteContent=ju,e.extractPureTextFromCell=zy,Object.defineProperty(e,"forwardRef",{enumerable:!0,get:function(){return i.forwardRef}}),e.fromCallback=Ca,e.fromEventSubject=Vv,e.generateIntervalsByPoints=Pu,e.generateRandomId=Y,e.get=Yn,e.getArrayLength=El,e.getBasesEmptySnapshot=pp,e.getBlockRangeInterval=Qm,e.getBodySlice=Rg,e.getBodySliceForSplitTextXAction=Bg,e.getBodySliceForTextXAction=zg,e.getBorderStyleType=Kl,e.getCellCoordByIndexSimple=Ib,e.getCellInfoInMergeData=uo,e.getCellValueType=no,e.getCellWithCoordByIndexCore=Lb,e.getColorStyle=Vl,e.getColumnGroupRangeInterval=$m,e.getCustomBlockIdsInSelections=Q_,e.getCustomBlockInterval=th,e.getCustomBlockSlice=Lg,e.getCustomDecorationSlice=Ug,e.getCustomRangeInterval=eh,e.getCustomRangeSlice=Hg,e.getDisplayValueFromCell=By,e.getDocsEmptySnapshot=Nm,e.getDocsUpdateBody=ql,e.getEmptyCell=yy,e.getExclusiveRangeInterval=Xm,e.getInclusiveRangeInterval=Ym,e.getIntersectRange=zf,e.getNumfmtParseValueFilter=wl,e.getOriginCellValue=Vy,e.getParagraphContentStartOffset=Cg,e.getParagraphContentStartOffsets=wg,e.getParagraphFollowingBlockOffset=Tg,e.getParagraphsSlice=Fg,e.getPlainText=g_,e.getReverseDirection=_e,e.getRichTextEditPath=Zg,e.getSectionBreakSlice=Ig,e.getSectionHeaderFooterReferenceKey=Iv,e.getSheetsEmptySnapshot=cy,e.getSingleDataStreamChange=nv,e.getTableCellTokenInterval=rh,e.getTableRangeInterval=Zm,e.getTableRowTokenInterval=nh,e.getTableSlice=Mg,e.getTextRunSlice=jg,e.getTransformOffsetX=Rb,e.getTransformOffsetY=zb,e.getWorksheetUID=Hy,e.groupBy=We,e.handleStyleToString=Wl,e.hashAlgorithm=Nu,e.horizontalLineSegmentsSubtraction=Eu,e.insertMatrixArray=Ol,e.insertTextToContent=Au,e.intersectsOperationalIntervals=oh,e.invertColorByHSL=lm,e.invertColorByMatrix=fm,Object.defineProperty(e,"isAsyncDependencyItem",{enumerable:!0,get:function(){return i.isAsyncDependencyItem}}),Object.defineProperty(e,"isAsyncHook",{enumerable:!0,get:function(){return i.isAsyncHook}}),e.isBlackColor=Qa,e.isBooleanString=Vp,e.isCellCoverable=Bl,e.isCellV=io,Object.defineProperty(e,"isClassDependencyItem",{enumerable:!0,get:function(){return i.isClassDependencyItem}}),e.isCommentEditorID=rd,Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return i.isCtor}}),e.isDefaultFormat=vl,Object.defineProperty(e,"isDisposable",{enumerable:!0,get:function(){return i.isDisposable}}),e.isEmptyCell=zl,Object.defineProperty(e,"isFactoryDependencyItem",{enumerable:!0,get:function(){return i.isFactoryDependencyItem}}),e.isFormulaId=Ul,e.isFormulaString=Hl,e.isICellData=to,e.isInternalEditorID=nd,e.isNodeEnv=oe,e.isNotNullOrUndefined=vy,e.isNullCell=ro,e.isNumeric=hm,e.isPatternEqualWithoutDecimal=yl,e.isRangesEqual=uy,e.isRealNum=Mu,e.isSafeNumeric=gm,e.isSafeUrl=R,e.isSameStyleTextRun=$l,e.isTextFormat=_l,e.isUnitRangesEqual=dy,e.isValidRange=Jl,Object.defineProperty(e,"isValueDependencyItem",{enumerable:!0,get:function(){return i.isValueDependencyItem}}),e.isWhiteColor=$a,e.makeArray=Ge,e.makeCellRangeToRangeData=Rl,e.makeCellToSelection=Ll,e.makeCustomRangeStream=Jm,e.mapObjectMatrix=Tl,e.merge=ta,e.mergeIntervals=Fu,e.mergeLocales=Iu,e.mergeOverrideWithDependencies=ib,e.mergeSets=xm,e.mergeWith=na,e.mergeWorksheetSnapshotWithDefault=Py,e.mixinClass=mm,e.moveMatrixArray=Ml,e.moveRangeByOffset=Mf,e.nameCharacterCheck=xb,e.noop=Up,e.normalizeBody=Vg,e.normalizeInsertedSectionIdsForDocument=Ch,e.normalizeTextRuns=ph,e.normalizeUrl=L,e.numberToABC=tp,e.numberToListABC=rp,Object.defineProperty(e,"numfmt",{enumerable:!0,get:function(){return Wc}}),e.queryObjectMatrix=qf,e.regexp=gl,e.registerDependencies=Ke,e.remove=ze,e.repeatStringNumTimes=np,e.replaceInDocumentBody=T_,e.requestImmediateMacroTask=bm,e.resolveDocumentParagraphStyle=w_,e.resolveSectionHeaderFooterReference=Lv,e.resolveSectionHeaderFooterReferences=Rv,e.resolveWithBasePath=te,e.rotate=Ue,e.searchArray=Ma,e.searchInOrderedArray=ka,e.selectionToArray=so,e.sequence=Ze,e.sequenceAsync=Xe,e.sequenceExecute=xa,e.sequenceExecuteAsync=Sa,e.set=ia,Object.defineProperty(e,"setDependencies",{enumerable:!0,get:function(){return i.setDependencies}}),e.shallowEqual=Hp,e.shiftExclusiveRangeOnDelete=uh,e.shiftExclusiveRangeOnInsert=ch,e.shiftInclusiveRangeOnDelete=lh,e.shiftInclusiveRangeOnInsert=sh,e.skipParseTagNames=Bb,e.sliceMatrixArray=jl,e.sortRules=ip,e.sortRulesByDesc=ap,e.sortRulesFactory=op,e.spliceArray=kl,e.splitIntoGrid=Pf,e.takeAfter=wa,e.throttle=Wp,e.toDisposable=D,e.touchDependencies=qe,e.updateAttributeByDelete=$g,e.updateAttributeByInsert=e_,e.validateDocBodyStructure=Pv,e.validateDocumentStructure=Fv,e.willLoseNumericPrecision=_m});
|
|
10
|
+
`||e.dataStream[n]===void 0;return{dataStream:a?`${i}\r`:i,customBlocks:t.map((e,t)=>({startIndex:t,blockId:e.drawingId})),...a?{paragraphs:[{startIndex:i.length,paragraphId:Cm(new Set((r=e.paragraphs)==null?void 0:r.map(e=>e.paragraphId)))}]}:{}}}function nv(e,t){if(e==null||t==null)return null;let n=e.dataStream,r=t.dataStream;if(n===r)return null;let i=r.length-n.length;if(i>0){let a=iv(e,t,n,r,i);if(a)return a}else if(i<0){let a=rv(e,t,n,r,-i);if(a)return a}let a=0;for(;a<n.length&&a<r.length&&n[a]===r[a];)a++;let o=n.length,s=r.length;for(;o>a&&s>a&&n[o-1]===r[s-1];)o--,s--;return{start:a,deleteLength:o-a,insertLength:s-a}}function rv(e,t,n,r,i){for(let a of av(t,e))if(n.slice(0,a)===r.slice(0,a)&&n.slice(a+i)===r.slice(a))return{start:a,deleteLength:i,insertLength:0};return null}function iv(e,t,n,r,i){for(let a of av(e,t))if(n.slice(0,a)===r.slice(0,a)&&n.slice(a)===r.slice(a+i))return{start:a,deleteLength:0,insertLength:i};return null}function av(e,t){let n=[...ov(e.blockRanges,t.blockRanges,e=>e.blockId),...ov(e.tables,t.tables,e=>e.tableId),...ov(e.columnGroups,t.columnGroups,e=>e.columnGroupId),...ov(e.customBlocks,t.customBlocks,e=>e.blockId)];return Array.from(new Set(n)).sort((e,t)=>e-t)}function ov(e,t,n){let r=new Set((e==null?[]:e).map(n));return(t==null?[]:t).filter(e=>!r.has(n(e))).map(e=>e.startIndex)}var Z=class{};T(Z,`customRange`,{add:I_,delete:F_,copyCustomRange:A_,getCustomRangesInterestsWithSelection:k_,isIntersecting:O_}),T(Z,`customDecoration`,{add:E_,delete:D_}),T(Z,`selection`,{replace:Y_,makeSelection:dg,normalizeSelection:fg,delete:q_,replaceTextRuns:Z_,retain:J_}),T(Z,`range`,{isIntersects:pg,getParagraphsInRange:mg,getParagraphsInRanges:hg}),T(Z,`transform`,{getPlainText:g_,fromPlainText:v_,isEmptyDocument:__}),T(Z,`paragraph`,{bullet:{set:bg,switch:vg,toggleChecklist:yg,changeNestLevel:Eg},style:{set:Dg},util:{transform:_g,getParagraphsInRange:mg,getParagraphsInRanges:hg}}),T(Z,`drawing`,{add:$_});let sv=new Set(Object.values(qm).filter(e=>e!==``&&e!==` `));function cv(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];let t=new Set;for(let n=0;n<e.dataStream.length;n++)e.dataStream[n]===`\r`&&e.paragraphs.push({startIndex:n,paragraphId:Cm(t)})}if(e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),!e.sectionBreaks){e.sectionBreaks=[];let t=new Set;for(let n=0;n<e.dataStream.length;n++)e.dataStream[n]===`
|
|
11
|
+
`&&e.sectionBreaks.push({startIndex:n,sectionId:Am(t)})}return e.tables||(e.tables=[]),e}function lv(e){var t;return e.body=cv((t=e.body)==null?{dataStream:``}:t),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}function uv(e){return typeof e==`string`?{rgb:e}:e}function dv(e){let{bold:t,italic:n,fontFamily:r,fontSize:i,color:a,background:o,...s}=e,c={...s};return t!==void 0&&(c.bl=+!!t),n!==void 0&&(c.it=+!!n),r!==void 0&&(c.ff=r),i!==void 0&&(c.fs=i),a!==void 0&&(c.cl=uv(a)),o!==void 0&&(c.bg=uv(o)),c}function fv(e){return typeof e==`number`?{v:e}:e}function pv(e){if(e)return e instanceof yv?e.build():{horizontalAlign:e.align,lineSpacing:e.lineHeight,spacingRule:e.lineHeightRule,indentFirstLine:fv(e.firstLineIndent),hanging:fv(e.hangingIndent),indentStart:fv(e.indentStart),indentEnd:fv(e.indentEnd),spaceAbove:fv(e.spaceBefore),spaceBelow:fv(e.spaceAfter),direction:e.direction,wordWrap:e.wordWrap===void 0?void 0:+!!e.wordWrap,keepLines:e.keepLines===void 0?void 0:+!!e.keepLines,keepNext:e.keepNext===void 0?void 0:+!!e.keepNext}}function mv(e){var t,n;return((t=(n=e.body)==null?void 0:n.dataStream)==null?``:t).replace(/\r|\n/g,``).length>0}var hv=class e{static create(t={}){return new e(t)}constructor(e={}){T(this,`_style`,void 0),this._style=e}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===1}get bold(){return this._style.bl===1}get underline(){return this._style.ul&&_v.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&_v.create(this._style.bbl)}get strikethrough(){return this._style.st&&_v.create(this._style.st)}get overline(){return this._style.ol&&_v.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 gv.create(z.deepClone(this._style))}getValue(){return{...this._style}}},gv=class e extends hv{static create(t={}){return new e(t)}constructor(e={}){super(e)}setFontFamily(e){return this._style.ff=e,this}setFontSize(e){return this._style.fs=e,this}setItalic(e){return this._style.it=+!!e,this}setBold(e){return this._style.bl=+!!e,this}setUnderline(e){return this._style.ul=e.build(),this}setBottomBorderLine(e){return this._style.bbl=e.build(),this}setStrikethrough(e){return this._style.st=e.build(),this}setOverline(e){return this._style.ol=e.build(),this}setBackground(e){return this._style.bg=e,this}setBorder(e){return this._style.bd=e,this}setColor(e){return this._style.cl=e,this}setVerticalAlign(e){return this._style.va=e,this}copy(){return e.create(z.deepClone(this._style))}build(){return this.getValue()}},_v=class e{static create(t={s:1}){return new e(t)}constructor(e={s:1}){T(this,`_decoration`,void 0),this._decoration=e}get show(){return this._decoration.s===1}get followFontColor(){return this._decoration.c===1}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(e){return this._decoration.s=+!!e,this}setFollowFontColor(e){return this._decoration.c=+!!e,this}setColor(e){return this._decoration.cl=e,this}setLineType(e){return this._decoration.t=e,this}copy(){return e.create(z.deepClone(this._decoration))}build(){return{...this._decoration}}},vv=class e{static create(t={}){return new e(t)}constructor(e={}){T(this,`_style`,void 0),this._style=e}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===1}get keepNext(){return this._style.keepNext===1}get wordWrap(){return this._style.wordWrap===1}get widowControl(){return this._style.widowControl===1}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===1}copy(){return yv.create(z.deepClone(this._style))}getValue(){return this._style}},yv=class e extends vv{static create(t={}){return new e(t)}constructor(e={}){super(e)}setIndentFirstLine(e){return this._style.indentFirstLine=e,this}setHanging(e){return this._style.hanging=e,this}setIndentStart(e){return this._style.indentStart=e,this}setTabStops(e){return this._style.tabStops=e,this}setIndentEnd(e){return this._style.indentEnd=e,this}setTextStyle(e){return this._style.textStyle=e,this}setHeadingId(e){return this._style.headingId=e,this}setNamedStyleType(e){return this._style.namedStyleType=e,this}setHorizontalAlign(e){return this._style.horizontalAlign=e,this}setLineSpacing(e){return this._style.lineSpacing=e,this}setDirection(e){return this._style.direction=e,this}setSpacingRule(e){return this._style.spacingRule=e,this}setSnapToGrid(e){return this._style.snapToGrid=+!!e,this}setSpaceAbove(e){return this._style.spaceAbove=e,this}setSpaceBelow(e){return this._style.spaceBelow=e,this}setBorderBetween(e){return this._style.borderBetween=e,this}setBorderTop(e){return this._style.borderTop=e,this}setBorderBottom(e){return this._style.borderBottom=e,this}setBorderLeft(e){return this._style.borderLeft=e,this}setBorderRight(e){return this._style.borderRight=e,this}setKeepLines(e){return this._style.keepLines=+!!e,this}setKeepNext(e){return this._style.keepNext=+!!e,this}setWordWrap(e){return this._style.wordWrap=+!!e,this}setWidowControl(e){return this._style.widowControl=+!!e,this}setShading(e){return this._style.shading=e,this}setSuppressHyphenation(e){return this._style.suppressHyphenation=+!!e,this}copy(){return e.create(z.deepClone(this._style))}build(){return this.getValue()}},bv=class e{static create(t){return new e(t)}static createByBody(t){return new e({body:t,id:`d`,documentStyle:{}})}constructor(e){if(T(this,`_data`,void 0),!e.body)throw Error(`Invalid document data, body is required`);this._data=lv(e)}copy(){return xv.create(z.deepClone(this._data))}slice(e,t){let{body:n,...r}=this._data;return xv.create({...z.deepClone(r),body:Rg(n,e,t)})}toPlainText(){var e,t;return Z.transform.getPlainText((e=(t=this._data.body)==null?void 0:t.dataStream)==null?``:e).replaceAll(`\r`,`
|
|
12
|
+
`)}getParagraphStyle(){var e;return vv.create((e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].paragraphStyle)}getParagraphBullet(){var e;return(e=this._data.body)==null||(e=e.paragraphs)==null?void 0:e[0].bullet}getParagraphs(){var e,t;let n=(e=(t=this._data.body)==null?void 0:t.paragraphs)==null?[]:e,r=0;return n.map(e=>{let t=this.slice(r,e.startIndex);return r=e.startIndex,t})}getTextRuns(){var e,t;return((e=(t=this._data.body)==null?void 0:t.textRuns)==null?[]:e).map(e=>({...e,ts:e.ts?hv.create(e.ts):null}))}getLinks(){var e,t;return(e=(t=this._data.body)==null||(t=t.customRanges)==null?void 0:t.filter(e=>e.rangeType===0))==null?[]:e}getData(){return this._data}},xv=class e extends bv{static extend(e){Object.getOwnPropertyNames(e.prototype).forEach(t=>{if(t===`constructor`)return;let n=Object.getOwnPropertyDescriptor(e.prototype,t);n&&Object.defineProperty(this.prototype,t,n)})}static newEmptyData(){return lv({id:`d`,documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
13
|
+
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0,paragraphId:Cm(new Set)}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(t){return new e(t==null?e.newEmptyData():t)}constructor(e){super(e),T(this,`_doc`,void 0),T(this,`_trackedRanges`,new Set),this._doc=new S_(e)}getParagraphs(){var e;let t=this._data.body;if(!t)return[];let n=wg(t);return((e=t.paragraphs)==null?[]:e).map(e=>{var t;return this._createParagraphBuilder(e.paragraphId,(t=n.get(e.startIndex))==null?0:t,e.startIndex)})}getTextRuns(){return this.getParagraphs().flatMap(e=>e.getTextRuns())}_createTextRunBuilders(e){var t,n,r;let i=this._data.body;if(!i||e.startOffset>=e.endOffset)return[];let a=new Set([e.startOffset,e.endOffset]),o=(t,n)=>{let r=Math.max(t,e.startOffset),i=Math.min(n,e.endOffset);r<i&&(a.add(r),a.add(i))};for(let e of(t=i.textRuns)==null?[]:t)o(e.st,e.ed);for(let e of(n=i.customRanges)==null?[]:n)o(e.startIndex,e.endIndex+1);for(let e of(r=i.customDecorations)==null?[]:r)o(e.startIndex,e.endIndex+1);for(let t=e.startOffset;t<e.endOffset;t++)sv.has(i.dataStream[t])&&(a.add(t),a.add(t+1));let s=[...a].sort((e,t)=>e-t),c=[];for(let e=0;e<s.length-1;e++){var l;let t=s[e],n=s[e+1];if(t>=n||n-t===1&&sv.has(i.dataStream[t]))continue;let r=((l=i.textRuns)==null?[]:l).find(e=>e.st<=t&&e.ed>=n);c.push(new Cv(this,this._trackRange(t,n),r==null?void 0:r.ts,r==null?void 0:r.sId,!!r))}return c}_replaceTextRun(e,t,n,r,i){var a,o;if(t.includes(`\r`)||t.includes(`
|
|
14
|
+
`))throw RangeError(`Rich text run replacement cannot contain paragraph or section breaks.`);let s=this._doc.getBody();if(!s)throw Error(`Rich text body is not available.`);let{startOffset:c,endOffset:l}=e;if(s.dataStream.slice(c,l)===t)return;let u=Rg(s,c,l),d={dataStream:t};t&&i&&(d.textRuns=[{st:0,ed:t.length,sId:r,ts:z.deepClone(n)}]),t&&(a=u.customRanges)!=null&&a.length&&(d.customRanges=u.customRanges.map(e=>({...z.deepClone(e),startIndex:0,endIndex:t.length-1}))),t&&(o=u.customDecorations)!=null&&o.length&&(d.customDecorations=u.customDecorations.map(e=>({...z.deepClone(e),startIndex:0,endIndex:t.length-1})));let f=Z.selection.replace({doc:this._doc,selection:{startOffset:c,endOffset:l,collapsed:c===l},body:d});if(!f)throw Error(`Replace rich text run failed.`);X.apply(s,f.serialize()),this._rebaseTrackedRanges(c,l,t.length)}_createParagraphBuilder(e,t,n){return new Sv(this,e,this._trackRange(t,n))}_trackRange(e,t){let n={startOffset:e,endOffset:t};return this._trackedRanges.add(n),n}_rebaseTrackedRanges(e,t,n){let r=n-(t-e),i=n=>n<=e?n:n>=t?n+r:e,a=i=>i<=e?i:i>=t?i+r:e+n;for(let e of this._trackedRanges)e.startOffset=i(e.startOffset),e.endOffset=a(e.endOffset)}text(e){return this.insertText(e)}align(e){var t,n,r;let i=(n=(t=this._data).documentStyle)==null?t.documentStyle={}:n,a=(r=i.renderConfig)==null?i.renderConfig={}:r;if(e.horizontal!==void 0){var o,s;a.horizontalAlign=e.horizontal;for(let t of(o=(s=this._data.body)==null?void 0:s.paragraphs)==null?[]:o)t.paragraphStyle={...t.paragraphStyle,horizontalAlign:e.horizontal}}return e.vertical!==void 0&&(a.verticalAlign=e.vertical),this}columns(e){var t,n,r,i;if(!Number.isInteger(e.count)||e.count<1)throw RangeError(`Rich text column count must be a positive integer.`);let a=(n=(t=this._data).body)==null?t.body={dataStream:`\r
|
|
15
|
+
`}:n,o=(r=a.sectionBreaks)==null?a.sectionBreaks=[]:r;if(!o.length){var s,c;o.push({sectionId:Am(new Set),startIndex:Math.max(0,((s=(c=a.dataStream)==null?void 0:c.length)==null?0:s)-1)})}let l=Math.max(0,(i=e.spacing)==null?0:i),u=e.count===1?void 0:Array.from({length:e.count},(t,n)=>({width:0,paddingEnd:n===e.count-1?0:l}));for(let e of o)u?e.columnProperties=u.map(e=>({...e})):delete e.columnProperties;return this}span(e,t){return e?this.insertRichText(bv.create({id:`d`,documentStyle:{},body:{dataStream:e,textRuns:[{st:0,ed:e.length,ts:dv(t)}]}})):this}bold(e){return this.span(e,{bold:!0})}italic(e){return this.span(e,{italic:!0})}code(e){return this.span(e,{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,background:`#f3f4f6`})}listItem(e,t={}){var n,r,i,a;let o=(n=t.type)==null?`BULLET_LIST`:n,s=(r=this._data.body)==null||(r=r.paragraphs)==null?void 0:r.at(-1),c=s==null?void 0:s.bullet,l=((i=t.listId)==null?void 0:i.trim())||((c==null?void 0:c.listType)===o?c.listId:Y());(mv(this._data)||t.paragraphStyle)&&this.paragraph(t.paragraphStyle);let u=(a=this._data.body)==null||(a=a.paragraphs)==null?void 0:a.at(-1);if(u){var d;u.bullet={listId:l,listType:o,nestingLevel:Math.max(0,Math.trunc((d=t.level)==null?0:d))}}return this.text(e)}paragraph(e){var t,n,r,i;let a=pv(e);if(!mv(this._data)){if(a){var o;let e=(o=this._data.body)==null||(o=o.paragraphs)==null?void 0:o[0];e&&(e.paragraphStyle=a)}return this}let s=(t=this._data.body)==null||(t=t.paragraphs)==null?void 0:t.at(-1),c=z.deepClone(s==null?void 0:s.paragraphStyle),l=z.deepClone(s==null?void 0:s.bullet),u=Math.max(0,((n=(r=this._data.body)==null?void 0:r.dataStream.length)==null?2:n)-2);this.insertRichText(u,bv.create({id:`d`,documentStyle:{},body:{dataStream:`\r`,paragraphs:[{startIndex:0,paragraphId:Cm(new Set),paragraphStyle:c,bullet:l}]}}));let d=(i=this._data.body)==null||(i=i.paragraphs)==null?void 0:i.at(-1);return a?d&&(d.paragraphStyle=a):d&&delete d.paragraphStyle,d&&delete d.bullet,this}insertText(e,t,n){var r,i;let a=((r=(i=this._data.body)==null?void 0:i.dataStream.length)==null?2:r)-2,o,s;if(typeof e==`string`?o=e:(a=Math.min(e,a),o=t),s=typeof t==`object`?t instanceof gv?t.build():t:n instanceof gv?n.build():n,!o)return this;let c={dataStream:o,textRuns:s?[{ts:s,st:a,ed:a+o.length}]:[]},l=Z.selection.replace({doc:this._doc,selection:{startOffset:a,endOffset:a,collapsed:!0},body:c});if(!l)throw Error(`Insert text failed, please check.`);return X.apply(this._doc.getBody(),l.serialize()),this}insertRichText(e,t){var n,r;let i=((n=(r=this._data.body)==null?void 0:r.dataStream.length)==null?2:n)-2,a;typeof e==`object`?a=e instanceof bv?e.getData():e:(i=Math.min(e,i),a=t instanceof bv?t.getData():t);let o=Z.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:a.body});if(!o)throw Error(`Insert text failed, please check.`);return X.apply(this._doc.getBody(),o.serialize()),this}delete(e,t){if(t!==void 0){if(!t)return this;let n=Z.selection.delete([{startOffset:e,endOffset:e+t,collapsed:!0}],this._data.body);X.apply(this._doc.getBody(),n)}return this}setStyle(e,t,n){let r={dataStream:``,textRuns:[{ts:n instanceof gv?n.build():n,st:0,ed:t-e}]},i=Z.selection.retain([{startOffset:e,endOffset:t,collapsed:!0}],r);return X.apply(this._doc.getBody(),i),this}setLink(e,t,n){let r=Z.customRange.add({rangeType:0,rangeId:Y(),properties:{url:n},ranges:[{startOffset:e,endOffset:t,collapsed:!1}],body:this._data.body});if(!r)throw Error(`Insert text failed, please check.`);return X.apply(this._doc.getBody(),r.serialize()),this}cancelLink(e,t){if(typeof e==`string`){let t=Z.customRange.delete({rangeId:e,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);X.apply(this._doc.getBody(),t.serialize())}else this.slice(e,t).getLinks().forEach(e=>{let t=Z.customRange.delete({rangeId:e.rangeId,documentDataModel:this._doc});if(!t)throw Error(`Insert text failed, please check.`);X.apply(this._doc.getBody(),t.serialize())});return this}updateLink(e,t){var n;let r=(n=this._data.body)==null||(n=n.customRanges)==null?void 0:n.find(t=>t.rangeId===e);if(!r)throw Error(`Link not found`);return r.properties.url=t,this}insertParagraph(e,t){let n,r;if(typeof e==`object`){var i,a;n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphId:Cm(new Set),paragraphStyle:e.build()}]},r=((i=(a=this._data.body)==null?void 0:a.dataStream.length)==null?2:i)-2}else r=e,n={dataStream:`\r`,paragraphs:[{startIndex:0,paragraphId:Cm(new Set),paragraphStyle:t==null?void 0:t.build()}]};return this.insertRichText(r,bv.create({body:n,id:`d`,documentStyle:{}})),this}insertLink(t,n,r){let i=``,a=``;typeof t==`string`?(i=t,a=n):(i=n,a=r);let o=e.createByBody({dataStream:i,customRanges:[{rangeType:0,rangeId:Y(),properties:{url:a},startIndex:0,endIndex:i.length-1}]});return typeof t==`number`?this.insertRichText(t,o):this.insertRichText(o)}},Sv=class extends bv{constructor(e,t,n){super(wv(e.getData(),t,n)),this._owner=e,this._paragraphId=t,this._range=n}getId(){return this._paragraphId}getRange(){return{...this._range}}getText(){var e,t;return((e=(t=this._owner.getData().body)==null?void 0:t.dataStream)==null?``:e).slice(this._range.startOffset,this._range.endOffset)}toPlainText(){return this.getText()}getTextRuns(){return this._owner._createTextRunBuilders(this._range)}getParagraphStyle(){return vv.create(this._getParagraph().paragraphStyle)}getParagraphBullet(){return this._getParagraph().bullet}getLinks(){var e,t;return(e=(t=this.getData().body)==null||(t=t.customRanges)==null?void 0:t.filter(e=>e.rangeType===0))==null?[]:e}getBullet(){return this.getParagraphBullet()}getData(){return wv(this._owner.getData(),this._paragraphId,this._range)}copy(){return xv.create(z.deepClone(this.getData()))}_getParagraph(){var e;let t=(e=this._owner.getData().body)==null||(e=e.paragraphs)==null?void 0:e.find(e=>e.paragraphId===this._paragraphId);if(!t)throw Error(`Rich text paragraph "${this._paragraphId}" was not found.`);return t}},Cv=class{constructor(e,t,n,r,i){this._owner=e,this._range=t,this._textStyle=n,this._styleId=r,this._hasExplicitTextStyle=i,T(this,`_active`,!0)}get st(){return this._range.startOffset}get ed(){return this._range.endOffset}get sId(){return this._styleId}get ts(){return this._textStyle?hv.create(this._textStyle):null}getRange(){return{...this._range}}getText(){var e,t;return((e=(t=this._owner.getData().body)==null?void 0:t.dataStream)==null?``:e).slice(this._range.startOffset,this._range.endOffset)}getTextStyle(){return this.ts}hasTextStyle(){return this._hasExplicitTextStyle}setText(e){if(!this._active)throw Error(`Rich text run handle is no longer valid.`);return this._owner._replaceTextRun(this._range,e,this._textStyle,this._styleId,this._hasExplicitTextStyle),e||(this._active=!1),this}};function wv(e,t,n){var r;let{body:i,...a}=e;if(!i)throw Error(`Rich text body is not available.`);let o=(r=i.paragraphs)==null?void 0:r.find(e=>e.paragraphId===t);if(!o)throw Error(`Rich text paragraph "${t}" was not found.`);let s=Rg(i,n.startOffset,n.endOffset);return s.paragraphs=[{...z.deepClone(o),startIndex:n.endOffset-n.startOffset}],{...z.deepClone(a),body:s}}function Q(e,t,n,r){return{...e,code:t,index:r,message:n}}function Tv(e,t,n){e.dataStream.includes(`\r`)||t.push(Q(n,`missing-root-paragraph`,`Document body must contain at least one paragraph sentinel.`)),e.dataStream.includes(`
|
|
16
|
+
`)||t.push(Q(n,`missing-root-section-break`,`Document body must contain at least one section break sentinel.`))}function Ev(e,t,n){var r;let i=new Map;for(let o of(r=e.paragraphs)==null?[]:r)if(e.dataStream[o.startIndex]!==`\r`)t.push(Q(n,`paragraph-token-mismatch`,`Paragraph metadata must point to a paragraph sentinel.`,o.startIndex));else{var a;i.set(o.startIndex,((a=i.get(o.startIndex))==null?0:a)+1)}Ov(i,{context:n,duplicateCode:`duplicate-paragraph-metadata`,duplicateMessage:`Paragraph sentinel must have exactly one paragraph metadata entry.`},t)}function Dv(e,t,n){var r;let i=new Map,a=new Map;for(let c of(r=e.sectionBreaks)==null?[]:r){if(!c.sectionId)t.push(Q(n,`missing-section-id`,`Section break metadata must have a stable section id.`,c.startIndex));else{var o;a.set(c.sectionId,((o=a.get(c.sectionId))==null?0:o)+1)}if(e.dataStream[c.startIndex]!==`
|
|
17
|
+
`)t.push(Q(n,`section-break-token-mismatch`,`Section break metadata must point to a section break sentinel.`,c.startIndex));else{var s;i.set(c.startIndex,((s=i.get(c.startIndex))==null?0:s)+1)}}Ov(i,{context:n,duplicateCode:`duplicate-section-break-metadata`,duplicateMessage:`Section break sentinel must have exactly one section break metadata entry.`},t);for(let[e,r]of a)r>1&&t.push(Q(n,`duplicate-section-id`,`Section id "${e}" must be unique within a document segment.`))}function Ov(e,t,n){for(let[r,i]of e)i>1&&n.push(Q(t.context,t.duplicateCode,t.duplicateMessage,r))}function kv(e,t,n,r){let i=new Map,a=[],o=[];for(let s=0;s<e.length;s++)if(e[s]===t)a.push(s);else if(e[s]===n){let e=a.pop();e===void 0?o.push(s):i.set(e,r?s+1:s)}return{pairs:i,unmatchedEnds:o,unmatchedStarts:a}}function Av(e,t,n){var r;let i=kv(e.dataStream,``,``,!0).pairs,a=new Set,o,s=[...(r=e.tables)==null?[]:r].sort((e,t)=>e.startIndex-t.startIndex||e.endIndex-t.endIndex);for(let r of s)a.add(r.startIndex),(!Number.isInteger(r.startIndex)||e.dataStream[r.startIndex]!==``)&&t.push(Q(n,`table-start-token-mismatch`,`Table startIndex must point to a table start sentinel.`,r.startIndex)),(!Number.isInteger(r.endIndex)||r.endIndex<=r.startIndex||r.endIndex>e.dataStream.length||e.dataStream[r.endIndex-1]!==``||i.get(r.startIndex)!==r.endIndex)&&t.push(Q(n,`table-end-token-mismatch`,`Table endIndex must be the exclusive boundary immediately after a table end sentinel.`,r.endIndex)),o&&oh(Zm(o),Zm(r))&&t.push(Q(n,`overlapping-table`,`Table ranges must not overlap.`,r.startIndex)),o=r;for(let e of i.keys())a.has(e)||t.push(Q(n,`missing-table-metadata`,`Table token range must have a table metadata entry.`,e))}function jv(e,t,n){var r;let i=kv(e.dataStream,``,``,!1);for(let e of[...i.unmatchedStarts,...i.unmatchedEnds])t.push(Q(n,`unbalanced-block`,`Block sentinel has no matching boundary.`,e));let a=[...(r=e.blockRanges)==null?[]:r].sort((e,t)=>e.startIndex-t.startIndex||e.endIndex-t.endIndex),o=new Set,s;for(let e=0;e<a.length;e++){let r=a[e];o.add(r.startIndex),i.pairs.get(r.startIndex)!==r.endIndex&&t.push(Q(n,`block-range-token-mismatch`,`Block range must point to its matching block start and end sentinels.`,r.startIndex)),s&&oh(Qm(s),Qm(r))&&t.push(Q(n,`overlapping-block-range`,`Block ranges must not overlap or share structural sentinels.`,r.startIndex)),s=r}for(let e of i.pairs.keys())o.has(e)||t.push(Q(n,`missing-block-range-metadata`,`Block token range must have a block metadata entry.`,e))}function Mv(e,t,n){var r;let i=kv(e.dataStream,``,``,!1).pairs,a=new Set,o=[...(r=e.columnGroups)==null?[]:r].sort((e,t)=>e.startIndex-t.startIndex||e.endIndex-t.endIndex),s;for(let r of o){a.add(r.startIndex);let o=i.get(r.startIndex);if(o!==r.endIndex&&t.push(Q(n,`column-group-range-token-mismatch`,`Column group range must point to its matching start and end sentinels.`,r.startIndex)),s&&oh($m(s),$m(r))&&t.push(Q(n,`overlapping-column-group`,`Column group ranges must not overlap.`,r.startIndex)),s=r,Array.isArray(r.columns)){let i=0,a=o==null?r.endIndex:o;for(let t=r.startIndex+1;t<a;t++)e.dataStream[t]===``&&i++;i!==r.columns.length&&t.push(Q(n,`column-group-column-count-mismatch`,`Column group metadata column count must match the data stream.`,r.startIndex))}}for(let e of i.keys())a.has(e)||t.push(Q(n,`missing-column-group-metadata`,`Column group token range must have a metadata entry.`,e))}function Nv(e,t,n){var r;let i=new Map;for(let o of(r=e.customBlocks)==null?[]:r){var a;let{startIndex:r}=o;if(!Number.isInteger(r)||e.dataStream[r]!==`\b`){t.push(Q(n,`custom-block-token-mismatch`,`Custom block startIndex must point to a custom block sentinel.`,r));continue}i.set(r,((a=i.get(r))==null?0:a)+1)}Ov(i,{context:n,duplicateCode:`duplicate-custom-block-metadata`,duplicateMessage:`Custom block sentinel must have exactly one custom block metadata entry.`},t);for(let r=0;r<e.dataStream.length;r++)e.dataStream[r]===`\b`&&!i.has(r)&&t.push(Q(n,`missing-custom-block-metadata`,`Custom block sentinel must have a custom block metadata entry.`,r))}function Pv(e,t,n){let r=[],i=[],a=[],o=[],s=[];for(let c=0;c<e.dataStream.length;c++){let l=e.dataStream[c],u=i[i.length-1],d=s[s.length-1];if(l===`\r`)u&&(u.hasChild=!0),d&&(d.hasParagraph=!0);else if(l===`
|
|
18
|
+
`)u&&(u.hasChild=!0),d&&(d.hasSectionBreak=!0);else if(l===``)r.push(c);else if(l===``)i.push({startIndex:c,hasChild:!1});else if(l===``){let e=i.pop();e?e.hasChild||t.push(Q(n,`empty-column`,`Column must contain at least one paragraph or section child.`,e.startIndex)):t.push(Q(n,`unbalanced-column-group`,`Column end token has no matching column start.`,c))}else if(l===``)i.length>0||r.length===0?(t.push(Q(n,`unbalanced-column-group`,`Column group closes while a column is still open.`,c)),i.length=0):r.pop();else if(l===``)a.push(c);else if(l===`\x1B`)o.push(c);else if(l===``)s.push({startIndex:c,hasParagraph:!1,hasSectionBreak:!1});else if(l===``){let e=s.pop();e?(!e.hasParagraph||!e.hasSectionBreak)&&t.push(Q(n,`empty-table-cell`,`Table cell must contain a paragraph and section break child.`,e.startIndex)):t.push(Q(n,`unbalanced-table`,`Table cell end token has no matching start.`,c))}else l===``?s.length>0||o.length===0?(t.push(Q(n,`unbalanced-table`,`Table row closes while a cell is still open.`,c)),s.length=0):o.pop():l===``&&(s.length>0||o.length>0||a.length===0?(t.push(Q(n,`unbalanced-table`,`Table closes while a row or cell is still open.`,c)),s.length=0,o.length=0):a.pop())}(r.length>0||i.length>0)&&t.push(Q(n,`unbalanced-column-group`,`Column group or column token is not closed.`,e.dataStream.length)),(a.length>0||o.length>0||s.length>0)&&t.push(Q(n,`unbalanced-table`,`Table, row, or cell token is not closed.`,e.dataStream.length))}function Fv(e,t={segmentType:`body`}){let n=[];return Tv(e,n,t),Ev(e,n,t),Dv(e,n,t),Av(e,n,t),jv(e,n,t),Mv(e,n,t),Nv(e,n,t),Pv(e,n,t),n}function Iv(e){var t,n;let r=[];e.body&&r.push(...Fv(e.body,{segmentType:`body`}));for(let[n,i]of Object.entries((t=e.headers)==null?{}:t))r.push(...Fv(i.body,{segmentType:`header`,segmentId:n}));for(let[t,i]of Object.entries((n=e.footers)==null?{}:n))r.push(...Fv(i.body,{segmentType:`footer`,segmentId:t}));return r}function Lv(e,t){return`${t==="default"?`default`:t===`first`?`firstPage`:`evenPage`}${e===`header`?`Header`:`Footer`}Id`}function Rv(e,t,n,r){if(n<0||n>=t.length)return{linkedToPrevious:!1};let i=t[n],a=i[r];if(typeof a==`string`&&a)return{segmentId:a,linkedToPrevious:!1,sourceSectionId:i.sectionId};if(n===0){let t=e[r];return{...typeof t==`string`&&t?{segmentId:t}:{},linkedToPrevious:!1}}let o=Rv(e,t,n-1,r);return{...o.segmentId?{segmentId:o.segmentId}:{},linkedToPrevious:!0,sourceSectionId:o.sourceSectionId}}function zv(e,t,n){let r={};for(let i of[`defaultHeaderId`,`defaultFooterId`,`firstPageHeaderId`,`firstPageFooterId`,`evenPageHeaderId`,`evenPageFooterId`]){let{segmentId:a}=Rv(e,t,n,i);a&&(r[i]=a)}return r}var Bv=class{constructor(){T(this,`skipNextObservers`,!1),T(this,`lastReturnValue`,void 0),T(this,`isStopPropagation`,!1)}stopPropagation(){this.isStopPropagation=!0}},Vv=class extends t.Subject{constructor(...e){super(...e),T(this,`_sortedObservers`,[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(e){let t;t=typeof e==`function`?{next:([t,n])=>e(t,n)}:e;let n=super.subscribe(t);return this._sortedObservers.push(t),this._sortedObservers.sort((e,t)=>{var n,r;return((n=e.priority)==null?0:n)-((r=t.priority)==null?0:r)}),n.add(()=>this._sortedObservers=this._sortedObservers.filter(e=>e!==t)),n}clearObservers(){this._sortedObservers.forEach(e=>{var t;return(t=e.complete)==null?void 0:t.call(e)}),this._sortedObservers.length=0}emitEvent(e){if(!this.closed){let n=new Bv;n.lastReturnValue=e;for(let r of this._sortedObservers){var t;if(n.lastReturnValue=(t=r.next)==null?void 0:t.call(r,[e,n]),n.skipNextObservers)return{handled:!0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}throw Error(`[EventSubject]: cannot emit event on a closed subject.`)}};function Hv(e){return new t.Observable(t=>{let n=e.subscribeEvent(e=>{t.next(e)});return()=>n.unsubscribe()})}let Uv=(0,i.createIdentifier)(`core.resource-manager.service`),Wv={[n.UnitRole.Editor]:`Editor`,[n.UnitRole.Owner]:`Owner`,[n.UnitRole.Reader]:`Reader`,[n.UnitRole.UNRECOGNIZED]:`UNRECOGNIZED`},Gv=e=>e?{userID:`${Wv[e]}_${Y(8)}`,name:Wv[e],avatar:``}:{userID:``,name:``,avatar:``,anonymous:!0,canBindAnonymous:!1},Kv=(e,t)=>e.startsWith(Wv[t]);var qv=class extends k{constructor(...e){super(...e),T(this,`_model`,new Map),T(this,`_userChange$`,new t.Subject),T(this,`userChange$`,this._userChange$.asObservable()),T(this,`_currentUser$`,new t.BehaviorSubject(Gv())),T(this,`currentUser$`,this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(e){this.addUser(e),this._currentUser$.next(e)}addUser(e){this._model.set(e.userID,e),this._userChange$.next({type:`add`,user:e})}getUser(e,t){let n=this._model.get(e);if(n)return n;t&&t()}delete(e){let t=this.getUser(e);this._model.delete(e),t&&this._userChange$.next({type:`delete`,user:t})}clear(){this._model.clear(),this._userChange$.next({type:`clear`})}list(){return Array.from(this._model.values())}};let Jv=class{constructor(e,t){this._resourceManagerService=e,this._userManagerService=t,T(this,`_permissionMap`,new Map([])),T(this,`_permissionOverrides`,new Map),T(this,`_cfgEnableObjInherit`,!1),this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){let e=this._userManagerService.getCurrentUser();e&&e.userID||this._userManagerService.setCurrentUser(Gv(n.UnitRole.Owner))}_getRole(e){let t=this._userManagerService.getCurrentUser();return t?Kv(t.userID,e):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:e=>{let t=[...this._permissionMap.keys()].reduce((e,t)=>(e[t]=this._permissionMap.get(t),e),{});return JSON.stringify(t)},parseJson:e=>JSON.parse(e),pluginName:`SHEET_AuthzIoMockService_PLUGIN`,businesses:[n.UniverType.UNIVER_SHEET,n.UniverType.UNIVER_DOC,n.UniverType.UNIVER_SLIDE,n.UniverType.UNIVER_BOARD],onLoad:(e,t)=>{for(let e in t)this._permissionMap.set(e,t[e])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(e){let t=Y(8),{objectType:r,selectRangeObject:i,worksheetObject:a}=e,o=i||a,s={objectType:r,unitID:(o==null?void 0:o.unitID)||``,name:(o==null?void 0:o.name)||``,strategies:[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}],selectRangeObject:i};return this._permissionMap.set(t,s),t}async allowed(e){let{objectID:t,actions:r}=e,i=this._permissionMap.get(t);return i?r.map(e=>{let r=`${t}:${e}`;if(this._permissionOverrides.has(r))return{action:e,allowed:this._permissionOverrides.get(r)};let a=i.strategies.find(t=>t.action===e);return a?{action:e,allowed:this._getRole(a.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}}):r.map(e=>({action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}))}async batchAllowed(e){let t=await Promise.all(e.map(e=>this.allowed(e)));return e.map((e,n)=>({unitID:e.unitID,objectID:e.objectID,actions:t[n]}))}async list(e){let t=[],r=[{action:6,role:n.UnitRole.Owner},{action:16,role:n.UnitRole.Owner},{action:17,role:n.UnitRole.Owner},{action:18,role:n.UnitRole.Owner},{action:19,role:n.UnitRole.Owner},{action:33,role:n.UnitRole.Owner},{action:34,role:n.UnitRole.Owner},{action:35,role:n.UnitRole.Owner},{action:36,role:n.UnitRole.Owner},{action:37,role:n.UnitRole.Owner},{action:38,role:n.UnitRole.Owner},{action:39,role:n.UnitRole.Owner},{action:40,role:n.UnitRole.Owner}];return e.objectIDs.forEach(i=>{let a=this._permissionMap.get(i),o=(a==null?void 0:a.strategies)||r,s={objectID:i,unitID:e.unitID,objectType:(a==null?void 0:a.objectType)||3,name:(a==null?void 0:a.name)||``,shareOn:!1,shareRole:n.UnitRole.Owner,shareScope:-1,scope:{read:n.ObjectScope.AllCollaborator,edit:n.ObjectScope.AllCollaborator},creator:Gv(n.UnitRole.Owner),strategies:o.map(e=>({action:e.action,role:e.role})),actions:e.actions.map(e=>{let t=`${i}:${e}`;if(this._permissionOverrides.has(t))return{action:e,allowed:this._permissionOverrides.get(t)};let r=o.find(t=>t.action===e);return r?{action:e,allowed:this._getRole(r.role)}:{action:e,allowed:this._getRole(n.UnitRole.Owner)||this._getRole(n.UnitRole.Editor)}})};t.push(s)}),t}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(e){let{objectID:t,strategies:r}=e,i=this._permissionMap.get(t);i&&r&&(i.strategies=r.map(e=>({action:e.action,role:e.role})),this._permissionMap.set(t,i),r.forEach(e=>{e.role===n.UnitRole.Reader?this.setPermissionOverride(t,e.action,!1):(e.role===n.UnitRole.Owner||e.role===n.UnitRole.Editor)&&this.clearPermissionOverride(t,e.action)}))}setPermissionOverride(e,t,n){let r=`${e}:${t}`;this._permissionOverrides.set(r,n)}clearPermissionOverride(e,t){let n=`${e}:${t}`;this._permissionOverrides.delete(n)}clearAllOverrides(e){let t=[];this._permissionOverrides.forEach((n,r)=>{r.startsWith(`${e}:`)&&t.push(r)}),t.forEach(e=>this._permissionOverrides.delete(e))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(e){}setCfgEnableObjInherit(e){this._cfgEnableObjInherit=e}getCfgEnableObjInherit(){return this._cfgEnableObjInherit}};Jv=pa([V(0,Uv),V(1,(0,i.Inject)(qv))],Jv);let Yv=(0,i.createIdentifier)(`IAuthzIoIoService`),Xv=(0,i.createIdentifier)(`univer.confirm-service`);var Zv=class{constructor(){T(this,`confirmOptions$`,new t.Subject)}dispose(){this.confirmOptions$.complete()}open(e){throw Error(`This is not implemented in the test service!`)}confirm(e){return Promise.resolve(!0)}close(e){throw Error(`This is not implemented in the test service!`)}};let Qv=`FOCUSING_UNIT`,$v=`FOCUSING_SHEET`,ey=`FOCUSING_DOC`,ty=`FOCUSING_SLIDE`,ny=`FOCUSING_BOARD`,ry=`EDITOR_ACTIVATED`,iy=`FOCUSING_FX_BAR_EDITOR`;var ay=class extends k{constructor(...e){super(...e),T(this,`_error$`,new t.Subject),T(this,`error$`,this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}};let oy=function(e){return e.URL=`URL`,e.UUID=`UUID`,e.BASE64=`BASE64`,e}({}),sy=function(e){return e.SUCCUSS=`0`,e.ERROR_EXCEED_SIZE=`1`,e.ERROR_IMAGE_TYPE=`2`,e.ERROR_UPLOAD_COUNT_LIMIT=`3`,e.ERROR_IMAGE=`4`,e}({}),cy=(0,i.createIdentifier)(`core.image-io.service`),ly=(0,i.createIdentifier)(`core.url-image.service`);function uy(e=``,t=`zhCN`,n=``){return{id:e,sheetOrder:[],name:n,appVersion:Re,locale:t,styles:{},sheets:{},resources:[]}}var dy=class{constructor(e={}){T(this,`_styles`,void 0),T(this,`_cacheMap`,new Gu(1e5)),this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,t){return this._cacheMap.has(t)?this._cacheMap.get(t):this._getExistingStyleId(e)||`-1`}get(e){return typeof e==`string`?(e=String(e),this._styles[e]):e}add(e,t){let n=Y(6);return this._styles[n]=e,this._cacheMap.set(t,n),n}setValue(e){if(e==null)return;let t=JSON.stringify(e),n=this.search(e,t);return n===`-1`?this.add(e,t):n}addCustomStyle(e,t){t!=null&&(this._styles[e]=t,this._cacheMap.set(JSON.stringify(t),e))}remove(e){let t=this._styles[e];t&&(delete this._styles[e],this._cacheMap.delete(JSON.stringify(t)))}toJSON(){return this._styles}getStyleByCell(e){let t;t=e&&z.isObject(e.s)?e.s:(e==null?void 0:e.s)&&this.get(e.s);let n=e==null?void 0:e.interceptorStyle;return n?{...t,...n}:t}_generateCacheMap(){let{_styles:e,_cacheMap:t}=this;for(let n in e){let r=JSON.stringify(e[n]);t.set(r,n)}}_getExistingStyleId(e){let{_styles:t}=this;for(let n in t)if(z.diffValue(t[n],e))return n;return null}};let fy=(e,t)=>t.length===e.length&&!e.some(e=>t.some(t=>!Uf.equals(t,e))),py=(e,t)=>t.length===e.length&&e.every((e,n)=>{let r=t[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Uf.equals(e.range,r.range)}),my={t:0,b:2,l:2,r:2},hy=e=>({sbr:.6,sbo:e,spr:.6,spo:e});function gy(e,t,n={}){var r,i,a,o;let s=e.length,{textRotation:c,paddingData:l,horizontalAlign:u=0,verticalAlign:d=0,wrapStrategy:f=0,cellValueType:p}=n,m=(r=l==null?void 0:l.t)==null?my.t:r,h=(i=l==null?void 0:l.r)==null?my.r:i,g=(a=l==null?void 0:l.b)==null?my.b:a,_=(o=l==null?void 0:l.l)==null?my.l:o,{vertexAngle:v,centerAngle:y}=Ty(c);return new S_({id:`d`,body:{dataStream:`${e}\r
|
|
19
|
+
`,textRuns:[{ts:t,st:0,ed:s}],paragraphs:[{startIndex:s,paragraphId:Cm(new Set),paragraphStyle:{horizontalAlign:u}}],sectionBreaks:[{sectionId:Am(new Set),startIndex:s+1}]},documentStyle:{pageSize:{width:1/0,height:1/0},documentFlavor:0,marginTop:m,marginBottom:g,marginRight:h,marginLeft:_,paragraphLineGapDefault:0,renderConfig:{horizontalAlign:u,verticalAlign:d,centerAngle:y,vertexAngle:v,wrapStrategy:f,cellValueType:p}},drawings:{},drawingsOrder:[]})}function _y(e){if(!e)return{};let{tr:t,td:n,ht:r,vt:i,tb:a,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:i,wrapStrategy:a,paddingData:o}}function vy(e){if(!e)return{};let{ff:t,fs:n,it:r,bl:i,ul:a,st:o,ol:s,cl:c}=e,l={};return t&&(l.ff=t),n&&(l.fs=n),r&&(l.it=r),i&&(l.bl=i),a&&(l.ul=a),o&&(l.st=o),s&&(l.ol=s),c&&(l.cl=c),l}function yy(e,t,n){var r;let i=e.getBody();if((r=i.customRanges)!=null&&r.some(e=>e.rangeType===0))return;let a=Z.customRange.add({ranges:[{startOffset:0,endOffset:i.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:0,body:i,properties:{url:t,refId:n}});a&&X.apply(i,a.serialize())}function by(e){return e!=null}function xy(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}function Sy(e){let t=J.ff,n=J.fs;if(!e){let e=`${n}pt ${t}`;return{fontCache:e,fontString:e,fontSize:n,originFontSize:n,fontFamily:t}}let r=`italic`;(e.it===0||e.it===void 0)&&(r=`normal`);let i=`bold`;(e.bl===0||e.bl===void 0)&&(i=`normal`);let a=n;e.fs&&(a=e.fs);let o=Cy(e.ff,t),{va:s}=e,c=a;if(s===2||s===3){let{sbr:e,spr:t}=wy(o,c);c*=s===2?e:t}let l=`${r} ${i} ${c}pt ${o}`;return{fontCache:l,fontString:`${l}, "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif `,fontSize:c,originFontSize:a,fontFamily:o}}function Cy(e,t){return e!=null&&e.trim()?e.split(`,`).map(e=>{let t=e.trim().replace(/^['"]|['"]$/g,``);return t.includes(` `)?`"${t}"`:t}).filter(Boolean).join(`, `):t}function wy(e,t){return hy(t)}function Ty(e){let{a:t=0,v:n=0}=e||{a:0,v:0},r=0,i=t;return n===1&&(r=90,i=90),{centerAngle:r,vertexAngle:i}}function Ey(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e)){let t=e.length,n=Array(t);for(let r=0;r<t;r++)n[r]=Ey(e[r]);return n}let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r];t[i]=Ey(e[i])}return t}function Dy(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Ey(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Ey(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Ey(e.custom)),t}function Oy(e){if(e==null)return e;let t={};return e.p!==void 0&&(t.p=e.p===null?null:Ey(e.p)),e.s!==void 0&&(e.s===null||typeof e.s==`string`?t.s=e.s:t.s=Ey(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:Ey(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function ky(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={},c=Object.keys(o);for(let e=0,t=c.length;e<t;e++){let t=c[e],n=Number(t),r=o[n];r!=null&&(s[n]=Dy(r))}t[a]=s}return t}function Ay(e){let t={},n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){let i=n[r],a=Number(i),o=e[a];if(o===void 0)continue;let s={};`h`in o&&o.h!==void 0&&(s.h=o.h),`ia`in o&&o.ia!==void 0&&(s.ia=o.ia),`ah`in o&&o.ah!==void 0&&(s.ah=o.ah),`hd`in o&&o.hd!==void 0&&(s.hd=o.hd),`w`in o&&o.w!==void 0&&(s.w=o.w),`s`in o&&o.s!==void 0&&(o.s===null||typeof o.s==`string`?s.s=o.s:s.s=Ey(o.s)),`custom`in o&&o.custom!==void 0&&(s.custom=o.custom===null?null:Ey(o.custom)),t[a]=s}return t}function jy(e){let t=e.length,n=Array(t);for(let r=0;r<t;r++){let t=e[r];n[r]={startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType,startAbsoluteRefType:t.startAbsoluteRefType,endAbsoluteRefType:t.endAbsoluteRefType}}return n}function My(e){let t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:jy(e.mergeData),cellData:ky(e.cellData),rowData:Ay(e.rowData),columnData:Ay(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle==`string`?t.defaultStyle=e.defaultStyle:t.defaultStyle=Ey(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:Ey(e.custom)),t}var Ny=class{constructor(e,t){this._config=e,T(this,`_columnData`,{}),this._columnData=t}getColumnData(){return this._columnData}getColVisible(e){let{_columnData:t}=this,n=t[e];return n?n.hd!==1:!0}getColumnStyle(e){var t;return(t=this._columnData[e])==null?void 0:t.s}setColumnStyle(e,t){let n=this.getColumnOrCreate(e);n.s=t}getHiddenCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&e?(r=!1,n.push({rangeType:2,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:2}),n}getVisibleCols(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getColVisible(a);r&&!e?(r=!1,n.push({rangeType:2,startColumn:i,endColumn:a-1,startRow:0,endRow:0})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:t,rangeType:2}),n}getColumnDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getColumn(i);n[r]=e==null?{w:this._config.defaultColumnWidth,hd:0}:e,r++}return n}getSize(){return El(this._columnData)}getColumnWidth(e){var t,n;return(t=(n=this._columnData[e])==null?void 0:n.w)==null?this._config.defaultColumnWidth:t}setColumnWidth(e,t){let n=this._columnData[e];t===this._config.defaultColumnWidth?n&&(delete n.w,Object.keys(n).length===0&&delete this._columnData[e]):this._columnData[e]=n?{...n,w:t}:{w:t}}getColumn(e){return this._columnData[e]}insertColumnsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._columnData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._columnData[n+r]=this._columnData[n],delete this._columnData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._columnData[r]={...t})}}removeColumn(e){delete this._columnData[e]}getColumnOrCreate(e){let{_columnData:t}=this,n=t[e];if(n)return n;let r={};return this._columnData[e]=r,r}setCustomMetadata(e,t){let n=this.getColumn(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getColumn(e))==null?void 0:t.custom}},Py=class{constructor(e,t,n){this._config=e,this._viewModel=t,T(this,`_rowData`,void 0),this._rowData=n}getRowData(){return this._rowData}getRowStyle(e){var t;return(t=this._rowData[e])==null?void 0:t.s}setRowStyle(e,t){let n=this.getRowOrCreate(e);n.s=t}getRowDatas(e,t){let n={},r=0;for(let i=e;i<e+t;i++){let e=this.getRow(i);n[r]=e==null?{h:this._config.defaultRowHeight,hd:0}:e,r++}return n}getRowHeight(e,t=1){let{_rowData:n}=this,r=this._config,i=0;for(let a=0;a<t;a++){let{ia:t,ah:o,h:s=r.defaultRowHeight}=n[a+e]||{hd:0,h:r.defaultRowHeight};i+=(t==null||t===1)&&typeof o==`number`?o:s}return i}setRowHeight(e,t){let n=this._rowData[e];if(t===this._config.defaultRowHeight)n&&(delete n.h,Object.keys(n).length===0&&delete this._rowData[e]);else{let r=Math.min(t,2e3);this._rowData[e]=n?{...n,h:r}:{h:r}}}getRow(e){return this._rowData[e]}insertRowsWithData(e,t,n){let r=t-e+1,i=Object.keys(this._rowData);for(let t=i.length-1;t>=0;t--){let n=Number(i[t]);n>=e&&(this._rowData[n+r]=this._rowData[n],delete this._rowData[n])}for(let r=e;r<=t;r++){let t=n==null?void 0:n[r-e];t!=null&&Object.keys(t).length>0&&(this._rowData[r]={...t})}}removeRow(e){delete this._rowData[e]}getRowOrCreate(e){let{_rowData:t}=this,n=t[e];if(n)return n;let r={};return t[e]=r,r}getHiddenRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:1})):!r&&!e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),n}getVisibleRows(e=0,t=this.getSize()-1){let n=[],r=!1,i=-1;for(let a=e;a<=t;a++){let e=this.getRowRawVisible(a);r&&!e?(r=!1,n.push({startRow:i,endRow:a-1,startColumn:0,endColumn:0,rangeType:1})):!r&&e&&(r=!0,i=a)}return r&&n.push({startRow:i,endRow:t,startColumn:0,endColumn:0,rangeType:1}),n}getRowRawVisible(e){let t=this.getRow(e);return t?t.hd!==1:!0}getSize(){return El(this._rowData)}setCustomMetadata(e,t){let n=this.getRow(e);n&&(n.custom=t)}getCustomMetadata(e){var t;return(t=this.getRow(e))==null?void 0:t.custom}};let Fy=1e3;function Iy(e){let t={name:`Sheet1`,id:`sheet-01`,tabColor:``,hidden:0,rowCount:Fy,columnCount:20,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:88,defaultRowHeight:24,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:1,rowHeader:{width:46,hidden:0},columnHeader:{height:20,hidden:0},rightToLeft:0};return Object.keys(t).forEach(n=>{let r=n;e[r]===void 0&&(e[r]=t[r])}),e}var Ly=class extends k{constructor(e){super(),T(this,`_cellCache`,new Map),T(this,`_rowCache`,new Map),T(this,`_columnCache`,new Map),T(this,`_hasRow`,!1),T(this,`_hasColumn`,!1),T(this,`_hasAll`,!1),T(this,`_allIndex`,-1),T(this,`_mergeData`,void 0),T(this,`_rangeMap`,new Gu(5e4)),this._init(e.concat())}_init(e){this._mergeData=e,this._createCache(e)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(e){let t=0;for(let n of e){let{rangeType:e}=n;e===1?this._createRowCache(n,t):e===2?this._createColumnCache(n,t):e===3?this._createCellAllCache(t):this._createCellCache(n,t),t++}}rebuild(e){this._clearCache(),this._init(e.concat())}_createRowCache(e,t){let{startRow:n,endRow:r}=e;for(let e=n;e<=r;e++)this._rowCache.set(e,t),this._hasRow=!0}_createColumnCache(e,t){let{startColumn:n,endColumn:r}=e;for(let e=n;e<=r;e++)this._columnCache.set(e,t),this._hasColumn=!0}_createCellAllCache(e){this._hasAll=!0,this._allIndex=e}_createCellCache(e,t){for(let n=e.startRow;n<=e.endRow;n++){let r=this._cellCache.get(n);r==null&&(r=new Map,this._cellCache.set(n,r));for(let n=e.startColumn;n<=e.endColumn;n++)r.set(n,t)}}add(e){this._mergeData.push(e),this._clearCache(),this._createCache(this._mergeData)}remove(e,t){let n=this._getMergeDataIndex(e,t);n!==-1&&(this._mergeData.splice(n,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(e,t){let n=this._getMergeDataIndex(e,t);return n===-1?null:this._mergeData[n]}getMergeDataIndex(e,t){return this._getMergeDataIndex(e,t)}isRowContainsMergedCell(e){return this._hasAll||!z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(t=>t.startRow<=e&&e<=t.endRow)}isColumnContainsMergedCell(e){return this._hasAll||!z.isEmptyObject(this._rowCache)?!0:this._mergeData.some(t=>t.startColumn<=e&&e<=t.endColumn)}getMergedCellRange(e,t,n,r){let i=[],a=`${e}-${t}-${n}-${r}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let o=0,s=[];for(let a of this._mergeData||[])Uf.intersects(a,{startRow:e,endRow:n,startColumn:t,endColumn:r})&&(i.push({...a}),s.push(o)),o++;return this._rangeMap.set(a,s),i}_getRangeFromCache(e){let t=this._rangeMap.get(e)||[],n=[];for(let e of t)n.push({...this._mergeData[e]});return n}_getMergeDataIndex(e,t){var n;if(this._hasAll)return this._allIndex;if(this._hasRow){let t=this._rowCache.get(e);if(t!==void 0)return t}if(this._hasColumn){let e=this._columnCache.get(t);if(e!==void 0)return e}let r=(n=this._cellCache.get(e))==null?void 0:n.get(t);return r===void 0?-1:r}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}},Ry=class extends k{constructor(e){super(),this.getRawCell=e,T(this,`_cellContentInterceptor`,null),T(this,`_rowFilteredInterceptor`,null)}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,t,n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,3,n,r):this.getRawCell(e,t)}getCellValueOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,2):this.getRawCell(e,t)}getCellStyleOnly(e,t){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,t,1):this.getRawCell(e,t)}getRowFiltered(e){var t,n;return(t=(n=this._rowFilteredInterceptor)==null?void 0:n.getRowFiltered(e))==null?!1:t}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._cellContentInterceptor=e,D(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw Error(`[SheetViewModel]: Interceptor already registered.`);return this._rowFilteredInterceptor=e,D(()=>this._rowFilteredInterceptor=null)}};let zy={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};var By=class e{constructor(e,t,n){var r;this.unitId=e,this._styles=n,T(this,`_sheetId`,void 0),T(this,`_snapshot`,void 0),T(this,`_cellData`,void 0),T(this,`_rowManager`,void 0),T(this,`_columnManager`,void 0),T(this,`_viewModel`,void 0),T(this,`_spanModel`,void 0),T(this,`_isRowStylePrecedeColumnStyle`,!0),T(this,`_getCellHeight`,void 0),this._snapshot=Iy(t);let{columnData:i,rowData:a,cellData:o}=this._snapshot;this._sheetId=(r=this._snapshot.id)==null?Y(6):r,this._cellData=new Fl(o),this._viewModel=new Ry((e,t)=>this.getCellRaw(e,t)),this._rowManager=new Py(this._snapshot,this._viewModel,a),this._columnManager=new Ny(this._snapshot,i),this._spanModel=new Ly(this._snapshot.mergeData)}__interceptViewModel(e){e(this._viewModel)}__registerGetCellHeight(e){return this._getCellHeight=e,D(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(e,t){return this._getCellHeight?this._getCellHeight(e,t):this.getRowHeight(e)}setMergeData(e){this._snapshot.mergeData=e,this.getSpanModel().rebuild(e)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(e){this._isRowStylePrecedeColumnStyle=e}getStyleDataByHash(e){return{...this._styles.get(e)}}setStyleData(e){return this._styles.setValue(e)}getColumnStyle(e,t=!1){return t?this._columnManager.getColumnStyle(e):this._styles.get(this._columnManager.getColumnStyle(e))}setColumnStyle(e,t){this._columnManager.setColumnStyle(e,t)}getRowStyle(e,t=!1){return t?this._rowManager.getRowStyle(e):this._styles.get(this._rowManager.getRowStyle(e))}setRowStyle(e,t){this._rowManager.setRowStyle(e,t)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){let e=this._snapshot.defaultStyle;return this._styles.get(e)}setDefaultCellStyle(e){this._snapshot.defaultStyle=e}getCellStyle(e,t){let n=this.getCell(e,t);if(n){let e=n.s;return typeof e==`string`?this._styles.get(e):e}return null}getComposedCellStyle(e,t,n){let r=this.getDefaultCellStyleInternal(),i=this.getRowStyle(e),a=this.getColumnStyle(t),o=this.getCell(e,t),s=this._styles.getStyleByCell(o);return(n==null?this._isRowStylePrecedeColumnStyle:n)?ae(r,a,i,o==null?void 0:o.themeStyle,s):ae(r,i,a,o==null?void 0:o.themeStyle,s)}getComposedCellStyleByCellData(e,t,n,r){let i=this.getDefaultCellStyleInternal(),a=this.getRowStyle(e),o=this.getColumnStyle(t),s=this._styles.getStyleByCell(n);return(r==null?this._isRowStylePrecedeColumnStyle:r)?ae(i,o,a,n==null?void 0:n.themeStyle,s):ae(i,a,o,n==null?void 0:n.themeStyle,s)}getComposedCellStyleWithoutSelf(e,t,n,r){let i=n===void 0?this.getComposedCellStyle(e,t,r):this.getComposedCellStyleByCellData(e,t,n,r),a=this.getCellRaw(e,t);if(!a||!a.s)return i;let o=typeof a.s==`string`?this._styles.get(a.s):a.s;if(!o)return i;for(let e in o)e in i&&delete i[e];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){let e=this.getCellMatrix(),t=this.getMergeData(),n=-1,r=-1,i=-1,a=-1,o=!1,s=!1;return e.forEach((t,c)=>{Object.keys(c).forEach(c=>{let l=+c,u=e.getValue(t,l),d=u!=null&&u.s?this._styles.get(u.s):null,f=(d==null?void 0:d.bd)&&(d.bd.b||d.bd.l||d.bd.r||d.bd.t||d.bd.bc_tr||d.bd.bl_tr||d.bd.ml_tr||d.bd.tl_bc||d.bd.tl_br||d.bd.tl_mr);(u&&(u.v!==null&&u.v!==void 0&&u.v!==``||u.p)||d!=null&&d.bg||f)&&(o?n=Math.min(n,t):(n=t,o=!0),r=Math.max(r,t),s?i=Math.min(i,l):(s=!0,i=l),a=Math.max(a,l))})}),t.forEach(e=>{o?n=Math.min(n,e.startRow):(n=e.startRow,o=!0),r=Math.max(r,e.endRow),s?i=Math.min(i,e.startColumn):(i=e.startColumn,o=!0),a=Math.max(a,e.endColumn)}),!o||!s?null:{startColumn:i,startRow:n,endColumn:a,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){let{_snapshot:t}=this,n=My(t);return new e(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(e,t){return this._spanModel.getMergedCell(e,t)}getMergedCellRange(e,t,n,r){return this._spanModel.getMergedCellRange(e,t,n,r)}isRowContainsMergedCell(e){return this._spanModel.isRowContainsMergedCell(e)}isColumnContainsMergedCell(e){return this._spanModel.isColumnContainsMergedCell(e)}getCellInfoInMergeData(e,t){let n=this.getMergedCell(e,t),r=!1,i=!1,a=e,o=t,s=e,c=t;if(n){let{startRow:l,endRow:u,startColumn:d,endColumn:f}=n;e===l&&t===d?(a=u,o=f,s=l,c=d,i=!0):e>=l&&e<=u&&t>=d&&t<=f&&(a=u,o=f,s=l,c=d,r=!0)}return{actualRow:e,actualColumn:t,isMergedMainCell:i,isMerged:r,endRow:a,endColumn:o,startRow:s,startColumn:c}}getCell(e,t){return e<0||t<0?null:this._viewModel.getCell(e,t)}getCellValueOnly(e,t){return e<0||t<0?null:this._viewModel.getCellValueOnly(e,t)}getCellStyleOnly(e,t){return e<0||t<0?null:this._viewModel.getCellStyleOnly(e,t)}getCellRaw(e,t){return this.getCellMatrix().getValue(e,t)}getCellWithFilteredInterceptors(e,t,n,r){return this._viewModel.getCell(e,t,n,r)}getRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRangeFilterRows(e){let t=[];for(let n=e.startRow;n<=e.endRow;n++)this.getRowFiltered(n)&&t.push(n);return t}getMatrixWithMergedCells(e,t,n,r,i=`raw`){let a=this.getCellMatrix(),o=this._spanModel.getMergedCellRange(e,t,n,r),s=new Fl;return $f(e,n,t,r).forEach((e,t)=>{let n;if(i===`raw`)n=this.getCellRaw(e,t);else if(i===`intercepted`)n=this.getCell(e,t);else if(i===`both`){let i=this.getCellRaw(e,t);if(i){var r;n={...i};let a=(r=this.getCell(e,t))==null?void 0:r.v;by(a)&&n&&(n.displayV=String(a))}}n&&s.setValue(e,t,n)}),o.forEach(e=>{let{startColumn:t,startRow:n,endColumn:r,endRow:i}=e;$f(n,i,t,r).forEach((e,o)=>{e===n&&o===t&&s.setValue(e,o,{...a.getValue(e,o),rowSpan:i-n+1,colSpan:r-t+1}),(e!==n||o!==t)&&s.realDeleteValue(e,o)})}),s}getRange(e,t,n,r){return typeof e==`object`?new pf(this,e,{getStyles:()=>this._styles}):new pf(this,{startRow:e,startColumn:t,endColumn:r||t,endRow:n||e},{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(){let{_snapshot:e}=this,{columnCount:t}=e;return t}getMaxRows(){let{_snapshot:e}=this,{rowCount:t}=e;return t}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){let{_snapshot:e}=this,{showGridlines:t}=e;return t===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){let{_snapshot:e}=this,{tabColor:t}=e;return t}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this._viewModel.getRowFiltered(e)?0:this.getRowManager().getRowHeight(e)}isRowFiltered(e){return this._viewModel.getRowFiltered(e)}getRowVisible(e){return!this.isRowFiltered(e)&&this.getRowRawVisible(e)}getRowRawVisible(e){return this.getRowManager().getRowRawVisible(e)}getHiddenRows(e,t){let n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,t);return r.forEach(e=>e.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,t){let n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,t);return r.forEach(e=>e.endRow=n),r}getVisibleRows(){let e=this.getRowCount();return this._rowManager.getVisibleRows(0,e-1)}getVisibleCols(){let e=this.getColumnCount();return this._columnManager.getVisibleCols(0,e-1)}isRightToLeft(){let{_snapshot:e}=this,{rightToLeft:t}=e;return t}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}iterateByRow(e,t=!0){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this;return{[Symbol.iterator]:()=>{let e=n,s=r;return{next(){for(;;){if(s>a&&(e+=1,s=r),e>i)return{done:!0,value:void 0};let n=o.getCell(e,s),c=!n,l=o.getMergedCell(e,s);if(l){if(e!==l.startRow||s!==l.startColumn){s=l.endColumn+1;continue}if(c&&t){s=l.endColumn+1;continue}let r={row:e,col:s,value:n};return r.colSpan=l.endColumn-l.startColumn+1,r.rowSpan=l.endRow-l.startRow+1,s=l.endColumn+1,{done:!1,value:r}}if(c&&t)s+=1;else{let t={row:e,col:s,value:n};return s+=1,{done:!1,value:t}}}}}}}}iterateByColumn(e,t=!0,n=!0){let{startRow:r,startColumn:i,endRow:a,endColumn:o}=e,s=this;return{[Symbol.iterator]:()=>{let e=r,c=i;return{next(){for(;;){if(e>a&&(c+=1,e=r),c>o)return{done:!0,value:void 0};let i=s.getMergedCell(e,c);if(i){let r=e!==i.startRow,a=r||c!==i.startColumn;if(n&&a||!n&&r){e=i.endRow+1;continue}let o=s.getCell(i.startRow,i.startColumn);if(!o&&t){e=i.endRow+1;continue}let l={row:e,col:i.startColumn,value:o};return l.colSpan=i.endColumn-i.startColumn+1,l.rowSpan=i.endRow-i.startRow+1,e=i.endRow+1,{done:!1,value:l}}let l=s.getCell(e,c);if(!l&&t)e+=1;else{let t={row:e,col:c,value:l};return e+=1,{done:!1,value:t}}}}}}}}getCellDocumentModel(e,t,n=zy){var r;if(!e)return;let{isDeepClone:i,displayRawFormula:a,ignoreTextRotation:o}={...zy,...n},s,c=`document`,l=_y(t),u=o?J.tr:l.textRotation||J.tr,d=l.horizontalAlign||J.ht,f=l.verticalAlign||J.vt,p=l.wrapStrategy||J.tb,m=l.paddingData||my;if(e.f&&a)s=gy(e.f.toString(),{},{verticalAlign:f}),d=J.ht;else if(e.p){let{centerAngle:t,vertexAngle:n}=Ty(u);s=this._updateConfigAndGetDocumentModel(i?z.deepClone(e.p):e.p,d,m,{horizontalAlign:d,verticalAlign:f,centerAngle:t,vertexAngle:n,wrapStrategy:p,zeroWidthParagraphBreak:1})}else if(e.v!=null){let n=vy(t);c=Sy(n).fontCache;let r=Vy(e);e.t===4&&a&&(r=`'${r}`),s=gy(r,n,{...l,textRotation:u,cellValueType:e.t})}return s&&e.linkUrl&&e.linkId&&yy(s,e.linkUrl,e.linkId),{documentModel:s,fontString:c,textRotation:u,wrapStrategy:p,verticalAlign:f,horizontalAlign:d,paddingData:m,fill:t==null||(r=t.bg)==null?void 0:r.rgb}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=0,e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new S_(e)}getBlankCellDocumentModel(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e),i=vy(r),a=this.getCellDocumentModel(e,r,{ignoreTextRotation:!0});if(a!=null)return a.documentModel==null&&(a.documentModel=gy(``,i)),a;let o=`document`,s=J.tr,c=J.ht,l=J.vt,u=J.tb,d=my;return o=Sy({}).fontCache,{documentModel:gy(``,i),fontString:o,textRotation:s,wrapStrategy:u,verticalAlign:l,horizontalAlign:c,paddingData:d}}getCellDocumentModelWithFormula(e,t,n){let r=this.getComposedCellStyleByCellData(t,n,e);return this.getCellDocumentModel(e,r,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};function Vy(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;return typeof r==`string`?e.t===3?r.toUpperCase():r.replace(/[\r\n]/g,``):typeof r==`number`?e.t===3?r?`TRUE`:`FALSE`:r.toString():typeof r==`boolean`?r?`TRUE`:`FALSE`:``}function Hy(e){var t;if(!e)return``;let n=(t=e.p)==null||(t=t.body)==null?void 0:t.dataStream;if(n)return Z.transform.getPlainText(n);let r=e.v;if(r==null)return``;if(e.t===3){if(typeof r==`string`)return r.toUpperCase();if(typeof r==`number`)return r?`TRUE`:`FALSE`}return typeof r==`boolean`?r?`TRUE`:`FALSE`:String(r)}function Uy(e){if(e===null)return``;if(e!=null&&e.p){let t=e==null?void 0:e.p.body;if(t==null)return``;let n=t.dataStream;return Z.transform.getPlainText(n)}return e==null?void 0:e.v}function Wy(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}let Gy=class extends M{get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(e){return typeof e==`string`||`startRow`in e||`row`in e}constructor(e={},r){super(),this._logService=r,T(this,`type`,n.UniverType.UNIVER_SHEET),T(this,`_sheetCreated$`,new t.Subject),T(this,`sheetCreated$`,this._sheetCreated$.asObservable()),T(this,`_sheetDisposed$`,new t.Subject),T(this,`sheetDisposed$`,this._sheetDisposed$.asObservable()),T(this,`_activeSheet$`,new t.BehaviorSubject(null)),T(this,`activeSheet$`,this._activeSheet$.asObservable()),T(this,`_worksheets`,void 0),T(this,`_styles`,void 0),T(this,`_snapshot`,void 0),T(this,`_unitId`,void 0),T(this,`_count`,void 0),T(this,`_name$`,void 0),T(this,`name$`,void 0);let i=uy();z.isEmptyObject(e)?this._snapshot=i:this._snapshot=z.commonExtend(i,e);let{styles:a}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=Y(6)),this._unitId=this._snapshot.id,this._styles=new dy(a),this._count=1,this._worksheets=new Map,this._name$=new t.BehaviorSubject(e.name||``),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(e=>{this._removeSheet(e)})}save(){return z.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(e){this._name$.next(e),this._snapshot.name=e}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)==null?1:e}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(e){this._snapshot.rev=e}addWorksheet(e,t,n){let{sheets:r,sheetOrder:i}=this._snapshot;if(r[e])return!1;r[e]=n,i.splice(t,0,e),this.ensureSheetOrderUnique();let a=new By(this._unitId,n,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){let e=new Set,t=[];for(let n of this._snapshot.sheetOrder)e.has(n)||(e.add(n),t.push(n));this._snapshot.sheetOrder=t,e.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(e){Object.entries(e).forEach(([e,t])=>{this._styles.addCustomStyle(e,t)})}removeStyles(e){e.forEach(e=>{this._styles.remove(e)})}getConfig(){return this._snapshot}getIndexBySheetId(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>t===e)}getActiveSheet(e){if(!this._activeSheet&&e===void 0)throw Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){let e=this._activeSheet;if(e)return e;let t=this._snapshot.sheetOrder;for(let e=0,n=t.length;e<n;e++){let n=this._worksheets.get(t[e]);if(n&&n.isSheetHidden()!==1)return this.setActiveSheet(n),n}let n=this._worksheets.get(t[0]);return this.setActiveSheet(n),n}setActiveSheet(e){this._activeSheet$.next(e)}_removeSheet(e){let t=this._worksheets.get(e);return t?(this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(t),!0):!1}removeSheet(e){let t=this._removeSheet(e);return t&&delete this._snapshot.sheets[e],t}getActiveSheetIndex(){let{sheetOrder:e}=this._snapshot;return e.findIndex(e=>this._worksheets.get(e)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){let{sheetOrder:e}=this._snapshot;return e.map(e=>this._worksheets.get(e))}getSheetsName(){let{sheetOrder:e}=this._snapshot,t=[];return e.forEach(e=>{let n=this._worksheets.get(e);n&&t.push(n.getName())}),t}getSheetIndex(e){let{sheetOrder:t}=this._snapshot;return t.findIndex(t=>e.getSheetId()===t)}getSheetBySheetName(e){let{sheetOrder:t}=this._snapshot,n=t.find(t=>this._worksheets.get(t).getName()===e);return this._worksheets.get(n)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){let{sheetOrder:t}=this._snapshot;return this._worksheets.get(t[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===1).map(e=>e.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden!==1).map(e=>e.getConfig().id)}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().some(t=>t.toLowerCase()===e.toLowerCase())}uniqueSheetName(e=`Sheet1`){let t=e;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}generateNewSheetName(e){let t=e+this._count;for(;this.checkSheetName(t);)t=e+this._count,this._count++;return t}_parseWorksheetSnapshots(){let{_snapshot:e,_worksheets:t}=this,{sheets:n,sheetOrder:r}=e;if(z.isEmptyObject(n)){let e=Y();n[e]={id:e}}for(let e in n){let i=n[e],{name:a}=i;i.name=this.uniqueSheetName(a),i.name!==a&&this._logService.debug(`[Workbook]`,`The worksheet name ${a} is duplicated, we changed it to ${i.name}. Please fix the problem in your snapshot.`);let o=new By(this._unitId,i,this._styles);t.set(e,o),r.includes(e)||r.push(e)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(e){this._snapshot.custom=e}};Gy=pa([V(1,ua)],Gy);let Ky=(0,i.createIdentifier)(`univer.current`),qy=class extends k{constructor(e,n,r){super(),this._injector=e,this._contextService=n,this._logService=r,T(this,`_unitsByType`,new Map),T(this,`_unitCreateOptions`,new Map),T(this,`_createHandler`,void 0),T(this,`_ctorByType`,new Map),T(this,`_currentUnits`,new Map),T(this,`_currentUnits$`,new t.BehaviorSubject(this._currentUnits)),T(this,`currentUnits$`,this._currentUnits$.asObservable()),T(this,`_unitAdded$`,new t.Subject),T(this,`unitAdded$`,this._unitAdded$.asObservable()),T(this,`_unitDisposed$`,new t.Subject),T(this,`unitDisposed$`,this._unitDisposed$.asObservable()),T(this,`_focused$`,new t.BehaviorSubject(null)),T(this,`focused$`,this._focused$.asObservable())}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(e=>e==null?void 0:e.dispose()),this._currentUnits.clear(),this._unitsByType.clear(),this._unitCreateOptions.clear()}__setCreateHandler(e){this._createHandler=e}createUnit(e,t,n){return this._createHandler(e,t,this._ctorByType.get(e),n)}registerCtorForType(e,t){return this._ctorByType.set(e,t),{dispose:()=>{this._ctorByType.delete(e)}}}__getCtorByType(e){return this._ctorByType.get(e)}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe((0,t.map)(t=>{var n;return(n=t.get(e))==null?null:n}),(0,t.distinctUntilChanged)())}getCurrentUnitOfType(e){return this._currentUnits.get(e)}setCurrentUnitForType(e){let t=this._getUnitById(e);if(!t)throw Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits.get(t[1])!==t[0]&&(this._currentUnits.set(t[1],t[0]),this._currentUnits$.next(this._currentUnits))}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe((0,t.filter)(t=>t.unit.type===e))}__addUnit(e,t){var n;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${e.getUnitId()}`);let r=e.type;this._unitsByType.has(r)||this._unitsByType.set(r,[]);let i=this._unitsByType.get(r),a=e.getUnitId();if(i.findIndex(e=>e.getUnitId()===a)!==-1)throw Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${a}.`);i.push(e),t&&this._unitCreateOptions.set(a,{...t}),this._unitAdded$.next({unit:e,options:t}),((n=t==null?void 0:t.makeCurrent)==null||n)&&this.setCurrentUnitForType(e.getUnitId())}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe((0,t.filter)(t=>t.type===e))}getUnit(e,t){var n;let r=(n=this._getUnitById(e))==null?void 0:n[0];return t&&(r==null?void 0:r.type)!==t?null:r}getUnitCreateOptions(e){var t;return(t=this._unitCreateOptions.get(e))==null?null:t}getUniverSheetInstance(e){return this.getUnit(e,n.UniverType.UNIVER_SHEET)}getAllUnitsForType(e){var t;return(t=this._unitsByType.get(e))==null?[]:t}changeDoc(e,t){let r=this.getAllUnitsForType(n.UniverType.UNIVER_DOC),i=r.find(t=>t.getUnitId()===e);if(i!=null){let e=r.indexOf(i);r.splice(e,1)}this.__addUnit(t)}get focused(){var e;let t=this._focused$.getValue();return t?(e=this._getUnitById(t))==null?void 0:e[0]:null}focusUnit(e){var t,r;this._focused$.getValue()!==e&&(this._focused$.next(e),this.focused instanceof Gy?(this._contextService.setContextValue(Qv,!0),this._contextService.setContextValue(ey,!1),this._contextService.setContextValue($v,!0),this._contextService.setContextValue(ty,!1),this._contextService.setContextValue(ny,!1),this.setCurrentUnitForType(e)):this.focused instanceof S_?(this._contextService.setContextValue(Qv,!0),this._contextService.setContextValue(ey,!0),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(ty,!1),this._contextService.setContextValue(ny,!1),this.setCurrentUnitForType(e)):((t=this.focused)==null?void 0:t.type)===n.UniverType.UNIVER_SLIDE?(this._contextService.setContextValue(Qv,!0),this._contextService.setContextValue(ey,!1),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(ty,!0),this._contextService.setContextValue(ny,!1),this.setCurrentUnitForType(e)):((r=this.focused)==null?void 0:r.type)===n.UniverType.UNIVER_BOARD?(this._contextService.setContextValue(Qv,!0),this._contextService.setContextValue(ey,!1),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(ty,!1),this._contextService.setContextValue(ny,!0),this.setCurrentUnitForType(e)):(this._contextService.setContextValue(Qv,!1),this._contextService.setContextValue(ey,!1),this._contextService.setContextValue($v,!1),this._contextService.setContextValue(ty,!1),this._contextService.setContextValue(ny,!1)))}getFocusedUnit(){return this.focused}getUnitType(e){let t=this._getUnitById(e);return t?t[1]:n.UniverType.UNRECOGNIZED}disposeUnit(e){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${e}`);let t=this._getUnitById(e);if(!t)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${e}`),!1;let[n,r]=t,i=this._unitsByType.get(r),a=i.indexOf(n);return i.splice(a,1),this._tryResetCurrentOnRemoval(e,r),this._tryResetFocusOnRemoval(e),this._unitDisposed$.next(n),this._unitCreateOptions.delete(e),n.dispose(),!0}_tryResetCurrentOnRemoval(e,t){let n=this.getCurrentUnitOfType(t);(n==null?void 0:n.getUnitId())===e&&(this._currentUnits.set(t,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(e){var t;((t=this.focused)==null?void 0:t.getUnitId())===e&&this._focused$.next(null)}_getUnitById(e){for(let[t,n]of this._unitsByType){let r=n.find(t=>t.getUnitId()===e);if(r)return[r,t]}}};qy=pa([V(0,(0,i.Inject)(i.Injector)),V(1,sa),V(2,(0,i.Inject)(ua))],qy);let Jy=function(e){return e[e.Starting=0]=`Starting`,e[e.Ready=1]=`Ready`,e[e.Rendered=2]=`Rendered`,e[e.Steady=3]=`Steady`,e}({}),Yy={0:`Starting`,1:`Ready`,2:`Rendered`,3:`Steady`};var Xy=class extends Error{constructor(e){super(`[LifecycleService]: lifecycle stage "${Yy[e]}" will never be reached!`),this.name=`LifecycleUnreachableError`}};let Zy=class extends k{constructor(e){super(),this._logService=e,T(this,`_lifecycle$`,new t.BehaviorSubject(0)),T(this,`lifecycle$`,this._lifecycle$.asObservable()),T(this,`_lock`,!1),this._reportProgress(0)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(this._lock)throw Error(`[LifecycleService]: cannot set new stage when related logic is all handled!`);if(e<this.stage)throw Error(`[LifecycleService]: lifecycle stage cannot go backward!`);e!==this.stage&&(this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(e){return(0,t.firstValueFrom)(this.lifecycle$.pipe((0,t.filter)(t=>t>=e),wa(t=>t===e),(0,t.map)(()=>void 0))).catch(t=>t.name===`EmptyError`?Promise.reject(new Xy(e)):Promise.reject(t))}subscribeWithPrevious(){return(0,t.merge)(Qy(this.stage),this._lifecycle$.pipe((0,t.skip)(1))).pipe(wa(e=>e===3))}_reportProgress(e){this._logService.debug(`[LifecycleService]`,`lifecycle progressed to "${Yy[e]}".`)}};Zy=pa([V(0,ua)],Zy);function Qy(e){switch(e){case 0:return(0,t.of)(0);case 1:return(0,t.of)(0,1);case 2:return(0,t.of)(0,1,2);default:return(0,t.of)(0,1,2,3)}}let $y=(0,i.createIdentifier)(`ILocalStorageService`);var eb=class extends k{get _currentLocale(){return this._currentLocale$.value}constructor(){super(),T(this,`_currentLocale$`,new t.BehaviorSubject(`zhCN`)),T(this,`currentLocale$`,this._currentLocale$.asObservable()),T(this,`_direction$`,new t.BehaviorSubject(`ltr`)),T(this,`direction$`,this._direction$.asObservable()),T(this,`_locales`,null),T(this,`localeChanged$`,new t.Subject),T(this,`t`,(e,...t)=>{if(!this._locales)throw Error(`[LocaleService]: Locale not initialized`);let n=e.split(`.`),r=this.resolveKeyPath(this._locales[this._currentLocale],n);if(typeof r==`string`){let e=r;return t.forEach((t,n)=>{e=e.replace(`{${n}}`,t)}),e}else return e}),this.disposeWithMe(D(()=>{this._locales=null,this._currentLocale$.complete(),this._direction$.complete(),this.localeChanged$.complete()}))}load(e){var t;this._locales=ta((t=this._locales)==null?{}:t,e)}setLocale(e){this._currentLocale$.next(e),this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}setDirection(e){this._direction$.next(e)}getDirection(){return this._direction$.value}resolveKeyPath(e,t){let n=t.shift();if(n&&e&&n in e){let r=e[n];return t.length>0&&(typeof r==`object`||Array.isArray(r))?this.resolveKeyPath(r,t):r}return null}};let tb=class{constructor(e){this._userManagerService=e}async list(e){return{list:[{type:0,mentions:[{objectType:0,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:`PEOPLE`}],page:e.page,size:e.size,total:1}}};tb=pa([V(0,(0,i.Inject)(qv))],tb);let nb=(0,i.createIdentifier)(`univer.service.mention-io`),rb=function(e){return e.INIT=`init`,e.FETCHING=`fetching`,e.DONE=`done`,e}({}),ib=(0,i.createIdentifier)(`univer.permission-service`);var ab=class extends k{constructor(...e){super(...e),T(this,`_permissionPointMap`,new Map),T(this,`_permissionPointUpdate$`,new t.Subject),T(this,`permissionPointUpdate$`,this._permissionPointUpdate$.asObservable()),T(this,`_showComponents`,!0)}setShowComponents(e){this._showComponents=e}getShowComponents(){return this._showComponents}deletePermissionPoint(e){let t=this._permissionPointMap.get(e);t&&(t.complete(),this._permissionPointMap.delete(e))}addPermissionPoint(e){let n=e instanceof t.BehaviorSubject,r=n?e.getValue():e;return r.id?this._permissionPointMap.get(r.id)?(console.warn(`${r.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(r.id,n?e:new t.BehaviorSubject(r)),this._permissionPointUpdate$.next(r),!0):!1}updatePermissionPoint(e,t){let n=this._permissionPointMap.get(e);if(!n)return;let r=n.getValue();r.value=t,r.status=`done`,n.next(r),this._permissionPointUpdate$.next(r)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(e){let t=this._permissionPointMap.get(e);if(t)return t.getValue()}getPermissionPoint$(e){let t=this._permissionPointMap.get(e);if(t)return t}composePermission$(e){return(0,t.combineLatest)(e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.asObservable()})).pipe((0,r.map)(e=>e))}composePermission(e){return e.map(e=>{var t;let n=(t=this._permissionPointMap)==null?void 0:t.get(e);if(!n)throw Error(`[PermissionService]: ${e} permissionPoint does not exist!`);return n.getValue()})}getAllPermissionPoint(){let e=new Map;return this._permissionPointMap.forEach((t,n)=>{e.set(n,t)}),e}};function ob(e,t){if(!t)return e;let n=[];for(let r of e){let e=t.find(([e])=>e===r[0]);if(e){if(e[1]===null)continue;n.push([r[0],e[1]])}else n.push(r)}return n}let sb=Symbol(`DependentOn`);var cb=class extends k{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};T(cb,`pluginName`,void 0),T(cb,`packageName`,Le),T(cb,`version`,Re),T(cb,`type`,n.UniverType.UNIVER_UNKNOWN);var lb=class{constructor(){T(this,`_plugins`,[])}addPlugin(e){this._plugins.push(e)}removePlugins(){let e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}};function ub(...e){return function(t){t[sb]=e}}let db=class{constructor(e,t,r){this._injector=e,this._lifecycleService=t,this._logService=r,T(this,`_pluginRegistry`,new Map),T(this,`_pluginStore`,new lb),T(this,`_seenPlugins`,new Set),T(this,`_loadedPlugins`,new Set),T(this,`_loadedPluginTypes`,new Set([n.UniverType.UNIVER_UNKNOWN])),T(this,`_flushTimerByType`,new Map)}dispose(){this._pluginStore.removePlugins().forEach(e=>e.dispose()),this._flushTimerByType.forEach(e=>clearTimeout(e))}registerPlugin(e,t){this._assertPluginValid(e);let r={plugin:e,options:t};this._pluginRegistry.set(e.pluginName,r),this._logService.debug(`[PluginService]`,`Plugin "${e.pluginName}" registered.`);let{type:i}=e;this._loadedPluginTypes.has(i)&&(i===n.UniverType.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(i))}startPluginsForType(e){this._loadedPluginTypes.has(e)||this._loadPluginsForType(e)}_loadPluginsForType(e){let t=Array.from(this._pluginRegistry.keys()),n=[];t.forEach(t=>{let r=this._pluginRegistry.get(t);r.plugin.type===e&&n.push(r)}),this._loadFromPlugins(n),this._loadedPluginTypes.add(e)}_assertPluginValid(e){let{type:t,pluginName:r,packageName:i,version:a}=e;if(t===n.UniverType.UNRECOGNIZED)throw Error(`[PluginService]: invalid plugin type for ${e.name}. Please assign a "type" to your plugin.`);if(!r)throw Error(`[PluginService]: no plugin name for ${e.name}. Please assign a "pluginName" to your plugin.`);if(a&&a!==cb.version&&this._logService.error(`[PluginService]`,[`Plugin version mismatch.`,` plugin: "${r||e.name}"`,` package: "${i}"`,` plugin version: "${a}"`,` core version: "${cb.version}"`,` registration will continue, but please make sure all @univerjs packages use the same version.`].join(`
|
|
20
|
+
`)),this._seenPlugins.has(r))throw 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(e.pluginName)}_flushType(e){this._flushTimerByType.get(e)===void 0&&this._flushTimerByType.set(e,setTimeout(()=>{this._loadPluginsForType(e),this._flushTimerByType.delete(e)},4))}_loadFromPlugins(e){let t=[],r=new Set,i=e=>{let{plugin:a}=e,{pluginName:o}=a;if(this._loadedPlugins.has(o)||r.has(o))return;r.add(o),this._pluginRegistry.delete(o);let s=a[sb];s&&s.forEach(e=>{let t=this._pluginRegistry.get(e.pluginName);if(t)i(t);else if(!this._seenPlugins.has(e.pluginName)&&!r.has(e.pluginName)){if(a.type===n.UniverType.UNIVER_UNKNOWN&&e.type!==n.UniverType.UNIVER_UNKNOWN)throw 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 ${e.pluginName}.`);a.type!==e.type&&e.type!==n.UniverType.UNIVER_UNKNOWN&&this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which has different type.`),this._logService.debug(`[PluginService]`,`Plugin "${o}" depends on "${e.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(e),i({plugin:e,options:void 0})}}),t.push(e)};e.forEach(e=>i(e));let a=t.map(e=>this._initPlugin(e.plugin,e.options));this._pluginsRunLifecycle(a)}_pluginsRunLifecycle(e){let n=this._lifecycleService.stage;if(Qy(n).subscribe(t=>this._runStage(e,t)),n!==3){let n=this._lifecycleService.lifecycle$.pipe((0,t.skip)(1)).subscribe(t=>{this._runStage(e,t),t===3&&n.unsubscribe()})}}_runStage(e,t){e.forEach(e=>{switch(t){case 0:e.onStarting();break;case 1:e.onReady();break;case 2:e.onRendered();break;case 3:e.onSteady();break}})}_initPlugin(e,t){let n=this._injector.createInstance(e,t);return this._pluginStore.addPlugin(n),this._loadedPlugins.add(e.pluginName),this._logService.debug(`[PluginService]`,`Plugin "${n.getPluginName()}" loaded.`),n}};db=pa([V(0,(0,i.Inject)(i.Injector)),V(1,(0,i.Inject)(Zy)),V(2,ua)],db);let fb=class extends k{constructor(e){super(),this._localeService=e,T(this,`_currentRegion$`,void 0),T(this,`currentRegion$`,void 0),T(this,`_hasExplicitRegion`,!1),this._currentRegion$=new t.BehaviorSubject(this._localeService.getCurrentLocale()),this.currentRegion$=this._currentRegion$.asObservable(),this.disposeWithMe(this._localeService.currentLocale$.subscribe(e=>{!this._hasExplicitRegion&&e!==this._currentRegion$.value&&this._currentRegion$.next(e)})),this.disposeWithMe(D(()=>this._currentRegion$.complete()))}setRegion(e){this._hasExplicitRegion=!0,this._currentRegion$.next(e)}getCurrentRegion(){return this._currentRegion$.value}};fb=pa([V(0,(0,i.Inject)(eb))],fb);let pb=(0,i.createIdentifier)(`resource-loader-service`),mb=class extends k{constructor(e){super(),this._logService=e,T(this,`_resourceMap`,new Map),T(this,`_register$`,new t.Subject),T(this,`register$`,this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e,t){return t?this.getResourcesByType(e,t):this.getAllResourceHooks().map(t=>{let n=t.toJson(e);return{name:t.pluginName,data:n}})}getResourcesByType(e,t){let n=this.getAllResourceHooks(),r=[];for(let i=0;i<n.length;i++){let a=n[i];if(!a.businesses.includes(t))continue;let o=a.toJson(e);r.push({name:a.pluginName,data:o})}return r}registerPluginResource(e){let t=e.pluginName;if(this._resourceMap.has(t))throw Error(`the pluginName is registered {${t}}`);return this._resourceMap.set(t,e),this._register$.next(e),D(()=>this._resourceMap.delete(t))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,t){let n=this.getAllResourceHooks();for(let i=0;i<n.length;i++){var r;let a=n[i],o=t==null||(r=t.find(e=>e.name===a.pluginName))==null?void 0:r.data;if(o)try{let t=a.parseJson(o);a.onLoad(e,t)}catch(e){this._logService.error(`[ResourceManagerService]`,`loadResources error`,e)}}}unloadResources(e,t){let n=this.getAllResourceHooks();for(let r=0;r<n.length;r++){let i=n[r];i.businesses.includes(t)&&i.onUnLoad(e)}}dispose(){this._register$.complete(),this._resourceMap.clear()}};mb=pa([V(0,ua)],mb);var hb=class extends k{get darkMode(){return this._darkMode$.getValue()}constructor(){super(),T(this,`_darkMode$`,new t.BehaviorSubject(!1)),T(this,`darkMode$`,this._darkMode$.asObservable()),T(this,`_validColorCache`,new Map),T(this,`_currentTheme`,a.defaultTheme),T(this,`_currentTheme$`,new t.BehaviorSubject(this._currentTheme)),T(this,`currentTheme$`,this._currentTheme$.asObservable()),this.disposeWithMe(D(()=>{this._currentTheme=a.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}isValidThemeColor(e){if(this._validColorCache.has(e))return this._validColorCache.get(e);let t=!1,n=e.split(`.`);if(n.length===1)t=e in a.defaultTheme;else if(n.length===2){let[e,r]=n;t=e in a.defaultTheme&&r in this._currentTheme[e]}return this._validColorCache.set(e,t),t}getCurrentTheme(){return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}setDarkMode(e){this._darkMode$.next(e)}getColorFromTheme(e){return Yn(this._currentTheme,e)}};let gb=(0,i.createIdentifier)(`univer.undo-redo.service`);var _b=class{dispose(){}async dispatchToHandlers(){return!1}};let vb=`univer.command.redo`,yb=`univer.command.undo`,bb=new class extends _b{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,yb)}handler(e){let t=e.get(gb),n=t.pitchTopUndoElement();if(!n)return!1;let r=e.get(ga);return xa(n.undoMutations,r).result?(t.popUndoToRedo(),!0):!1}},xb=new class extends _b{constructor(...e){super(...e),T(this,`type`,0),T(this,`id`,vb)}handler(e){let t=e.get(gb),n=t.pitchTopRedoElement();if(!n)return!1;let r=e.get(ga);return xa(n.redoMutations,r).result?(t.popRedoToUndo(),!0):!1}},Sb=class extends k{constructor(e,n,r){super(),this._univerInstanceService=e,this._commandService=n,this._contextService=r,T(this,`undoRedoStatus$`,void 0),T(this,`_undoRedoStatus$`,new t.BehaviorSubject({undos:0,redos:0})),T(this,`_undoStacks`,new Map),T(this,`_redoStacks`,new Map),T(this,`_batchingStatus`,new Map),this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(bb)),this.disposeWithMe(this._commandService.registerCommand(xb)),this.disposeWithMe(D(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(D(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){let{unitID:t}=e,n=this._getRedoStack(t,!0),r=this._getUndoStack(t,!0);if(n.length=0,this._batchingStatus.has(e.unitID)){let t=this._batchingStatus.get(e.unitID),n=this._pitchUndoElement(e.unitID);t===0||!n?(i(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(n,e)}else i(e);function i(e){r.push(e),r.length>20&&r.splice(0,1)}this._updateStatus()}clearUndoRedo(e){let t=this._getRedoStack(e);t&&(t.length=0);let n=this._getUndoStack(e);n&&(n.length=0),this._updateStatus()}pitchTopUndoElement(){let e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){let e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){let t=this._getUndoStack(e);return t!=null&&t.length?t[t.length-1]:null}_pitchRedoElement(e){let t=this._getRedoStack(e);return t!=null&&t.length?t[t.length-1]:null}popUndoToRedo(){let e=this._getUndoStackForFocused().pop();e&&(e.redoMutations.length>0&&this._getRedoStackForFocused().push(e),this._updateStatus())}popRedoToUndo(){let e=this._getRedoStackForFocused().pop();e&&(this._getUndoStackForFocused().push(e),this._updateStatus())}rollback(e,t){let n=t||this._getFocusedUnitId(),r=this._getUndoStack(n),i=r==null?void 0:r[(r==null?void 0:r.length)-1];i&&i.id===e&&(r.pop(),xa(i.undoMutations,this._commandService))}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw Error(`[LocalUndoRedoService]: cannot batching undo redo twice at the same time!`);return this._batchingStatus.set(e,0),D(()=>this._batchingStatus.delete(e))}_updateStatus(){var e,t;let n=this._getFocusedUnitId(),r=n&&((e=this._undoStacks.get(n))==null?void 0:e.length)||0,i=n&&((t=this._redoStacks.get(n))==null?void 0:t.length)||0;this._undoRedoStatus$.next({undos:r,redos:i})}_getUndoStack(e,t=!1){let n=this._undoStacks.get(e);return!n&&t&&(n=[],this._undoStacks.set(e,n)),n||null}_getRedoStack(e,t=!1){let n=this._redoStacks.get(e);return!n&&t&&(n=[],this._redoStacks.set(e,n)),n||null}_getUndoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getUndoStack(e,!0)}_getRedoStackForFocused(){let e=this._getFocusedUnitId();if(!e)throw Error(`No focused univer instance!`);return this._getRedoStack(e,!0)}_tryBatchingElements(e,t){e.redoMutations.push(...t.redoMutations),e.undoMutations.push(...t.undoMutations)}_getFocusedUnitId(){let e=``,t=this._contextService.getContextValue($v),n=this._contextService.getContextValue(iy),r=this._contextService.getContextValue(ry);if(t)if(n)e=Qu;else if(r)e=Zu;else{var i,a;e=(i=(a=this._univerInstanceService.getFocusedUnit())==null?void 0:a.getUnitId())==null?``:i}else{var o,s;e=(o=(s=this._univerInstanceService.getFocusedUnit())==null?void 0:s.getUnitId())==null?``:o}return e}};Sb=pa([V(0,Ky),V(1,ga),V(2,sa)],Sb);var Cb=class{constructor(e,t=1e3){this._injector=e,T(this,`_imageCacheMap`,void 0),this._imageCacheMap=new Gu(t)}_getImageCacheKey(e,t){return`${e}-${t}`}getImage(e,t,n,r){let i=this._getImageCacheKey(e,t);return this._imageCacheMap.get(i)||((async()=>{let a=new Image,o=this._injector.has(cy)?this._injector.get(cy):null,s=this._injector.has(ly)?this._injector.get(ly):null;if(e===`UUID`)try{a.src=await(o==null?void 0:o.getImage(t))||``}catch(e){console.error(e)}else if(e===`URL`)try{a.src=await(s==null?void 0:s.getImage(t))||t}catch{a.src=t}else a.src=t;a.onload=()=>{a.removeAttribute(`data-error`),n==null||n()},a.onerror=()=>{a.setAttribute(`data-error`,`true`),r==null||r()},this._imageCacheMap.set(i,a)})(),null)}};function wb(e){return!(e.length===0||e.length>31||e.startsWith(`'`)||e.endsWith(`'`)||/[:\\\/\?\*\[\]]/.test(e))}function Tb(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}let Eb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$=new Uint32Array(96);var Db=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(`Data must be an instance of ArrayBuffer or SharedArrayBuffer.`);let[n,r]=new Uint8Array(t,0,2);if(n!==219)throw Error(`Data does not appear to be in a KDBush format.`);let i=r>>4;if(i!==1)throw Error(`Got v${i} data when expected v1.`);let a=Eb[r&15];if(!a)throw Error(`Unrecognized array type.`);let[o]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,o,a,void 0,t)}constructor(e,t=64,n=Float64Array,r=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=Eb.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,c=(8-s%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${n}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=e*2,this._finished=!0;else{let i=this.data=new r(8+o+s+c);this.ids=new this.IndexArrayType(i,8,e),this.coords=new n(i,8+s+c,e*2),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ob(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=[];for(;s>0;){let l=$[--s],u=$[--s],d=$[--s];if(u-d<=o){for(let o=d;o<=u;o++){let s=a[2*o],l=a[2*o+1];s>=e&&s<=n&&l>=t&&l<=r&&c.push(i[o])}continue}let f=d+u>>1,p=a[2*f],m=a[2*f+1];p>=e&&p<=n&&m>=t&&m<=r&&c.push(i[f]),(l===0?e<=p:t<=m)&&($[s++]=d,$[s++]=f-1,$[s++]=1-l),(l===0?n>=p:r>=m)&&($[s++]=f+1,$[s++]=u,$[s++]=1-l)}return c}within(e,t,n){let r=[];return this.withinInto(e,t,n,r),r}withinInto(e,t,n,r){if(!this._finished)throw Error(`Data not yet indexed - call index.finish().`);let{ids:i,coords:a,nodeSize:o}=this;$[0]=0,$[1]=i.length-1,$[2]=0;let s=3,c=0,l=n*n;for(;s>0;){let u=$[--s],d=$[--s],f=$[--s];if(d-f<=o){for(let n=f;n<=d;n++)Mb(a[2*n],a[2*n+1],e,t)<=l&&(r[c++]=i[n]);continue}let p=f+d>>1,m=a[2*p],h=a[2*p+1];Mb(m,h,e,t)<=l&&(r[c++]=i[p]),(u===0?e-n<=m:t-n<=h)&&($[s++]=f,$[s++]=p-1,$[s++]=1-u),(u===0?e+n>=m:t+n>=h)&&($[s++]=p+1,$[s++]=d,$[s++]=1-u)}return c}};function Ob(e,t,n,r,i,a){if(i-r<=n)return;let o=r+i>>1;kb(e,t,o,r,i,a),Ob(e,t,n,r,o-1,1-a),Ob(e,t,n,o+1,i,1-a)}function kb(e,t,n,r,i,a){for(;i>r;){if(i-r>600){let o=i-r+1,s=n-r+1,c=Math.log(o),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(o-l)/o)*(s-o/2<0?-1:1);kb(e,t,n,Math.max(r,Math.floor(n-s*l/o+u)),Math.min(i,Math.floor(n+(o-s)*l/o+u)),a)}let o=t[2*n+a],s=r,c=i;for(Ab(e,t,r,n),t[2*i+a]>o&&Ab(e,t,r,i);s<c;){for(Ab(e,t,s,c),s++,c--;t[2*s+a]<o;)s++;for(;t[2*c+a]>o;)c--}t[2*r+a]===o?Ab(e,t,r,c):(c++,Ab(e,t,c,i)),c<=n&&(r=c+1),n<=c&&(i=c-1)}}function Ab(e,t,n,r){jb(e,n,r),jb(t,2*n,2*r),jb(t,2*n+1,2*r+1)}function jb(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Mb(e,t,n,r){let i=e-n,a=t-r;return i*i+a*a}var Nb=class{constructor(e=!1){this._enableOneCellCache=e,T(this,`_tree`,new Map),T(this,`_oneCellCache`,new Map),T(this,`_kdTree`,new Map)}dispose(){this.clear()}getTree(e,t){return this._tree.has(e)||this._tree.set(e,new Map),this._tree.get(e).has(t)||this._tree.get(e).set(t,new _f),this._tree.get(e).get(t)}_getOneCellCache(e,t,n,r){return this._oneCellCache.has(e)||this._oneCellCache.set(e,new Map),this._oneCellCache.get(e).has(t)||this._oneCellCache.get(e).set(t,new Map),this._oneCellCache.get(e).get(t).has(n)||this._oneCellCache.get(e).get(t).set(n,new Map),this._oneCellCache.get(e).get(t).get(n).has(r)||this._oneCellCache.get(e).get(t).get(n).set(r,new Set),this._oneCellCache.get(e).get(t).get(n).get(r)}_removeOneCellCache(e,t,n,r,i){let a=this._oneCellCache.get(e);if(!a)return;let o=a.get(t);if(!o)return;let s=o.get(n);if(!s)return;let c=s.get(r);c&&c.delete(i)}_removeCellCacheByRange(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this._oneCellCache.get(t);if(!a)return;let o=a.get(n);if(!o)return;let{startRow:s,startColumn:c,endRow:l,endColumn:u}=r;for(let e=s;e<=l;e++){let t=o.get(e);if(t)for(let e=c;e<=u;e++){let n=t.get(e);n&&n.delete(i)}}}_insertOneCellCache(e,t,n,r,i){this._getOneCellCache(e,t,n,r).add(i)}_getRdTreeItems(e){let t=[];for(let[n,r]of e)for(let[e,i]of r)t.push({x:e,y:n,ids:i});return t}_searchByOneCellCache(e){var t;let{unitId:n,sheetId:r,range:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=i,l=(t=this._kdTree.get(n))==null?void 0:t.get(r);if(!l)return[];let{tree:u,items:d}=l,f=u.range(o,a,c,s),p=[];for(let e of f){let t=d[e];p.push(...Array.from(t.ids))}return p}openKdTree(){for(let[t,n]of this._oneCellCache){this._kdTree.has(t)||this._kdTree.set(t,new Map);for(let[r,i]of n){var e;let n=this._getRdTreeItems(i),a=new Db(n.length);(e=this._kdTree.get(t))==null||e.set(r,{tree:a,items:n});for(let e of n)a.add(e.x,e.y);a.finish()}}}closeKdTree(){for(let[t,n]of this._oneCellCache)for(let[r,i]of n){var e;(e=this._kdTree.get(t))==null||e.set(r,void 0)}}insert(e){let{unitId:t,sheetId:n,range:r,id:i}=e;if(!t||t.length===0)return;let{startRow:a,endRow:o,startColumn:s,endColumn:c}=r;if(this._enableOneCellCache&&a===o&&s===c){this._insertOneCellCache(t,n,a,s,i);return}let l=this.getTree(t,n);Number.isNaN(a)&&(a=0),Number.isNaN(s)&&(s=0),Number.isNaN(o)&&(o=1/0),Number.isNaN(c)&&(c=1/0),l.insert({minX:s,minY:a,maxX:c,maxY:o,id:i})}bulkInsert(e){for(let t of e)this.insert(t)}*searchGenerator(e){var t;let{unitId:n,sheetId:r,range:i}=e;if(this._enableOneCellCache){let t=this._searchByOneCellCache(e);for(let e of t)yield e}let a=(t=this._tree.get(n))==null?void 0:t.get(r);if(!a)return;let o=a.search({minX:i.startColumn,minY:i.startRow,maxX:i.endColumn,maxY:i.endRow});for(let e of o)yield e.id}bulkSearch(e,t){let n=new Set;for(let r of e)for(let e of this.searchGenerator(r))(t==null?void 0:t.has(e))!==!0&&n.add(e);return n}removeById(e,t){if(t){var n,r;(n=this._tree.get(e))==null||n.delete(t),(r=this._oneCellCache.get(e))==null||r.delete(t)}else this._tree.delete(e),this._oneCellCache.delete(e)}_removeRTreeItem(e){let{unitId:t,sheetId:n,range:r,id:i}=e,a=this.getTree(t,n),o=a.search({minX:r.startColumn,minY:r.startRow,maxX:r.endColumn,maxY:r.endRow});for(let e=0;e<o.length;e++)o[e].id===i&&a.remove(o[e])}remove(e){let{unitId:t,sheetId:n,range:r,id:i}=e,{startRow:a,startColumn:o,endRow:s,endColumn:c}=r;this._enableOneCellCache?a===s&&o===c?this._removeOneCellCache(t,n,r.startRow,r.startColumn,i):(this._removeCellCacheByRange(e),this._removeRTreeItem(e)):this._removeRTreeItem(e)}bulkRemove(e){for(let t of e)this.remove(t)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){let e={};return this._tree.forEach((t,n)=>{e[n]={},t.forEach((t,r)=>{e[n][r]=t.toJSON()})}),e}fromJSON(e){this._tree.clear();for(let t in e){this._tree.set(t,new Map);for(let n in e[t]){let r=new _f;r.fromJSON(e[t][n]),this._tree.get(t).set(n,r)}}}};function Pb(e){return new Promise(t=>setTimeout(t,e))}function Fb(e=1){return new Promise(t=>{let n=0,r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}let Ib=class extends k{constructor(e){super(),this._localeService=e,T(this,`_fontLocale`,void 0),T(this,`_dirty`,!0),this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(e){this._dirty=e}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};Ib=pa([V(0,(0,i.Inject)(eb))],Ib);function Lb(e={}){let t={defaultBackgroundColor:`rgba(24, 119, 242, 0.08)`,defaultStripeColor:`rgba(24, 119, 242, 0.25)`,rowGaps:{1:{size:6},3:{size:10,color:`rgba(245, 158, 11, 0.14)`},6:{size:14,color:`rgba(16, 185, 129, 0.12)`,stripeColor:`rgba(5, 150, 105, 0.35)`}},colGaps:{1:{size:5},2:{size:8,stripeColor:`rgba(59, 130, 246, 0.35)`},4:{size:12,color:`rgba(244, 63, 94, 0.12)`,stripeColor:`rgba(225, 29, 72, 0.30)`}}};return{...t,...e,rowGaps:{...t.rowGaps,...e.rowGaps},colGaps:{...t.colGaps,...e.colGaps}}}let Rb=class extends Ib{constructor(e,t,n,r,i,a){super(n),this.worksheet=e,this._styles=t,this._contextService=r,this._configService=i,this._injector=a,T(this,`_worksheetData`,void 0),T(this,`_renderRawFormula`,!1),T(this,`_cellData`,void 0),T(this,`_imageCacheMap`,void 0),T(this,`_skipAutoHeightForMergedCells`,!0),T(this,`_rowTotalHeight`,0),T(this,`_columnTotalWidth`,0),T(this,`_rowHeaderWidth`,0),T(this,`_columnHeaderHeight`,0),T(this,`_rowHeightAccumulation`,[]),T(this,`_columnWidthAccumulation`,[]),T(this,`_marginTop`,0),T(this,`_marginLeft`,0),T(this,`_gapConfig`,{}),T(this,`_scaleX`,1),T(this,`_scaleY`,1),T(this,`_scrollX`,0),T(this,`_scrollY`,0),this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Cb(this._injector),this.initConfig()}initConfig(){var e,t;this._skipAutoHeightForMergedCells=!((e=this._configService.getConfig(ed))!=null&&e),this.worksheet.setIsRowStylePrecedeColumnStyle((t=this._configService.getConfig(`isRowStylePrecedeColumnStyle`))==null?!1:t)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(e){this._columnHeaderHeight=e,this._worksheetData.columnHeader.height=e}set rowHeaderWidth(e){this._rowHeaderWidth=e,this._worksheetData.rowHeader.width=e}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(e){this._marginLeft=e}setMarginTop(e){this._marginTop=e}setScale(e,t){this._updateLayout(),this._scaleX=e,this._scaleY=t||e,this._updateLayout()}setScroll(e,t){z.isDefine(e)&&(this._scrollX=e),z.isDefine(t)&&(this._scrollY=t)}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}get gapConfig(){return this._gapConfig}setGapConfig(e){this._gapConfig=this._fillDefaultGapThemeColors(e),this.makeDirty(!0),this._updateLayout()}_fillDefaultGapThemeColors(e){var t,n;if(e.defaultBackgroundColor&&e.defaultStripeColor)return e;let{r,g:i,b:a}=new Ia(this._injector.get(hb).getColorFromTheme(`primary.500`)).toRgb();return{...e,defaultBackgroundColor:(t=e.defaultBackgroundColor)==null?`rgba(${r}, ${i}, ${a}, 0.025)`:t,defaultStripeColor:(n=e.defaultStripeColor)==null?`rgba(${r}, ${i}, ${a}, 0.08)`:n}}getRowGapSize(e){var t,n;return(t=(n=this._gapConfig.rowGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getColGapSize(e){var t,n;return(t=(n=this._gapConfig.colGaps)==null||(n=n[e])==null?void 0:n.size)==null?0:t}getGapSizeGetter(){if(!(!this._gapConfig.rowGaps&&!this._gapConfig.colGaps))return{row:e=>this.getRowGapSize(e),col:e=>this.getColGapSize(e)}}getRowGapAtPosition(e){let{rowGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._rowHeightAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}getColGapAtPosition(e){let{colGaps:t}=this._gapConfig;if(!t)return-1;for(let a of Object.keys(t)){var n,r,i;let o=Number(a),s=(n=(r=t[o])==null?void 0:r.size)==null?0:n;if(s<=0)continue;let c=(i=this._columnWidthAccumulation[o-1])==null?0:i,l=c+s;if(e>=c&&e<l)return o}return-1}_generateRowMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){var o,s;let e=n;if(this.worksheet.getRowFiltered(t))e=0;else if(a[t]!=null){let r=a[t];if(!r)continue;let{h:i=n,ah:o,ia:s}=r;e=(s==null||s===1)&&typeof o==`number`&&o>0?o:i,r.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.rowGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,r+=e,i.push(r)}return{rowTotalHeight:r,rowHeightAccumulation:i}}_generateColumnMatrixCache(e,t,n){let r=0,i=[],a=t;for(let t=0;t<e;t++){var o,s;let e=n;if(a[t]!=null){let n=a[t];if(!n)continue;n.w!=null&&(e=n.w),n.hd===1&&(e=0)}let c=(o=(s=this._gapConfig.colGaps)==null||(s=s[t])==null?void 0:s.size)==null?0:o;r+=c,r+=e,i.push(r)}return{columnTotalWidth:r,columnWidthAccumulation:i}}intersectMergeRange(e,t){return!!this.worksheet.getMergedCell(e,t)}_getOverflowBound(e,t,n,r,i=1){let a=0;if(t>n){let o=this._columnWidthAccumulation.length-1;for(let s=t;s>=n;s--){let n=s;if(!Bl(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n+1>o?o:n+1;let{startX:c,endX:l}=Bb(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&n===t?a+=(l-c)/2:a+=l-c,r<a)return n}return t}for(let o=t;o<=n;o++){let n=o;if(!Bl(this.worksheet.getCell(e,n))&&n!==t||this.intersectMergeRange(e,n))return n===t?n:n-1<0?0:n-1;let{startX:s,endX:c}=Bb(e,n,this.rowHeightAccumulation,this.columnWidthAccumulation,void 0,this.getGapSizeGetter());if(i===2&&n===t?a+=(c-s)/2:a+=c-s,r<a)return n}return n}_updateLayout(){if(!this.dirty)return;let{rowData:e,columnData:t,defaultRowHeight:n,defaultColumnWidth:r,rowCount:i,columnCount:a,rowHeader:o,columnHeader:s}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:l}=this._generateRowMatrixCache(i,e,n),{columnTotalWidth:u,columnWidthAccumulation:d}=this._generateColumnMatrixCache(a,t,r);this._rowHeaderWidth=o.hidden===1?0:this._dynamicallyUpdateRowHeaderWidth(o),this._columnHeaderHeight=s.hidden===1?0:s.height,this._rowTotalHeight=c,this._rowHeightAccumulation=l,this._columnTotalWidth=u,this._columnWidthAccumulation=d,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(e){}_dynamicallyUpdateRowHeaderWidth(e){let t=`${this.worksheet.getRowCount()}`.length*8;return Math.max(e.width,t)}_hasUnMergedCellInRow(e,t,n){if(!this.worksheet.getMergeData())return!1;for(let r=t;r<=n;r++){let{isMerged:t,isMergedMainCell:n}=this.worksheet.getCellInfoInMergeData(e,r);if(!t&&!n)return!0}return!1}expandRangeByMerge(e,t){let{startRow:n,startColumn:r,endRow:i,endColumn:a}=e,o=this._worksheetData.mergeData;if(!o)return{startRow:n,startColumn:r,endRow:i,endColumn:a};let s=!0,c=new Fl,l=0,u=null;for(;s;){s=!1;for(let e=0;e<o.length;e++){let{startRow:t,startColumn:d,endRow:f,endColumn:p}=o[e];if(c.getValue(t,d))continue;let m={startColumn:r,startRow:n,endColumn:a,endRow:i},h={startColumn:d,startRow:t,endColumn:p,endRow:f};zf(m,h)&&(n=Math.min(n,t),r=Math.min(r,d),i=Math.max(i,f),a=Math.max(a,p),c.setValue(t,d,!0),s=!0,l++,u=h)}}return t&&l===1&&Uf.contains(u,e)?{startRow:u.startRow,startColumn:u.startColumn,endRow:u.startRow,endColumn:u.startColumn}:{startRow:n,startColumn:r,endRow:i,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(e,t){return this.worksheet.getCellInfoInMergeData(e,t)}getNoMergeCellWithCoordByIndex(e,t,n=!0){let{rowHeightAccumulation:r,columnWidthAccumulation:i,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:o}=this,{startY:s,endY:c,startX:l,endX:u}=Bb(e,t,r,i,void 0,this.getGapSizeGetter());return n&&(s+=o,c+=o,l+=a,u+=a),{startY:s,endY:c,startX:l,endX:u}}getRowIndexByOffsetY(e,t,n,r){let{rowHeightAccumulation:i}=this;e=Hb(e,t,n,this.columnHeaderHeightAndMarginTop);let a=Ma(i,e,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var o;Math.abs(i[a]-e)<Math.abs(e-((o=i[a-1])==null?0:o))&&(a+=1)}return a}getColumnIndexByOffsetX(e,t,n,r){let i=Vb(e,t,n,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this,o=Ma(a,i,r==null?void 0:r.firstMatch);if(r!=null&&r.closeFirst){var s;Math.abs(a[o]-i)<Math.abs(i-((s=a[o-1])==null?0:s))&&(o+=1)}return o}getCellIndexByOffset(e,t,n,r,i,a){return{row:this.getRowIndexByOffsetY(t,r,i,a),column:this.getColumnIndexByOffsetX(e,n,i,a)}}getCellByOffset(e,t,n,r,i){var a;let o=(a=this)==null?void 0:a.getCellIndexByOffset(e,t,n,r,i,{firstMatch:!0});return o?this.worksheet.getCellInfoInMergeData(o.row,o.column):null}getCellWithCoordByIndex(e,t,n=!0){var r;let{rowHeightAccumulation:i,columnWidthAccumulation:a,rowHeaderWidthAndMarginLeft:o,columnHeaderHeightAndMarginTop:s}=this,c=Bb(e,t,i,a,(r=this.worksheet)==null?void 0:r.getCellInfoInMergeData(e,t),this.getGapSizeGetter()),{isMerged:l,isMergedMainCell:u}=c,{startY:d,endY:f,startX:p,endX:m,mergeInfo:h}=c,g=o,_=s;return n===!1&&(g=0,_=0),d+=_,f+=_,p+=g,m+=g,h.startY+=_,h.endY+=_,h.startX+=g,h.endX+=g,{actualRow:e,actualColumn:t,startX:p,startY:d,endX:m,endY:f,isMerged:l,isMergedMainCell:u,mergeInfo:h}}getCellWithCoordByOffset(e,t,n,r,i,a){let{row:o,column:s}=this.getCellIndexByOffset(e,t,n,r,i,a);return this.getCellWithCoordByIndex(o,s)}getOffsetByColumn(e){let{columnWidthAccumulation:t,rowHeaderWidthAndMarginLeft:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetByRow(e){let{rowHeightAccumulation:t,columnHeaderHeightAndMarginTop:n}=this,r=t.length-1,i=t[e];return i==null?e<0?n:t[r]+n:i+n}getOffsetRelativeToRowCol(e,t){let n=Ma(this.columnWidthAccumulation,e),r=e-((this._columnWidthAccumulation[n-1]||0)+this.getColGapSize(n)),i=Ma(this.rowHeightAccumulation,t);return{row:i,column:n,columnOffset:r,rowOffset:t-((this._rowHeightAccumulation[i-1]||0)+this.getRowGapSize(i))}}getCellIndexAndOffsetByPosition(e,t){let{actualRow:n,actualColumn:r,startX:i,startY:a}=this.getCellWithCoordByOffset(e,t,this._scaleX,this._scaleY,{x:this._scrollX,y:this._scrollY});return{row:n,rowOffset:t-a,column:r,columnOffset:e-i}}_updateConfigAndGetDocumentModel(e,t,n,r){var i,a,o,s,c;if(!r||!((i=e.body)!=null&&i.dataStream))return;e.documentStyle||(e.documentStyle={}),e.documentStyle.marginTop=(a=n.t)==null?0:a,e.documentStyle.marginBottom=(o=n.b)==null?2:o,e.documentStyle.marginLeft=(s=n.l)==null?2:s,e.documentStyle.marginRight=(c=n.r)==null?2:c,e.documentStyle.pageSize={width:1/0,height:1/0},e.documentStyle.documentFlavor=0,e.documentStyle.paragraphLineGapDefault=0,e.documentStyle.renderConfig={...e.documentStyle.renderConfig,...r};let l=e.body.paragraphs||[];for(let e of l)e.paragraphStyle||(e.paragraphStyle={}),e.paragraphStyle.horizontalAlign=t;return new S_(e)}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,this.worksheet=null}};Rb=pa([V(2,(0,i.Inject)(eb)),V(3,sa),V(4,aa),V(5,(0,i.Inject)(i.Injector))],Rb);function zb(e,t,n,r,i=0,a=0){let o=e-1,s=t-1,c=(n[o]||0)+i,l=n[e];l==null&&(l=n[n.length-1]);let u=(r[s]||0)+a,d=r[t];return d==null&&(d=r[r.length-1]),{startY:c,endY:l,startX:u,endX:d}}function Bb(e,t,n,r,i,a){var o,s;e=z.clamp(e,0,n.length-1),t=z.clamp(t,0,r.length-1);let{startY:c,endY:l,startX:u,endX:d}=zb(e,t,n,r,(o=a==null?void 0:a.row(e))==null?0:o,(s=a==null?void 0:a.col(t))==null?0:s);if(!i)return{startY:c,endY:l,startX:u,endX:d,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:c,endY:l,startX:u,endX:d,startRow:e,startColumn:t,endRow:e,endColumn:t}};let{isMerged:f,isMergedMainCell:p,startRow:m,startColumn:h,endRow:g,endColumn:_}=i,v={startRow:m,startColumn:h,endRow:g,endColumn:_,startY:c,endY:l,startX:u,endX:d},y=n.length-1,b=r.length-1;if(f&&m!==-1&&h!==-1){var x,S;let e=(x=a==null?void 0:a.row(m))==null?0:x,t=(S=a==null?void 0:a.col(h))==null?0:S,i=(n[m-1]||0)+e,o=n[g]||n[y],s=(r[h-1]||0)+t,c=r[_]||r[b];v={...v,startY:i,endY:o,startX:s,endX:c}}else if(!f&&g!==-1&&_!==-1){let e=n[g]||n[y],t=r[_]||r[b];v={...v,startY:c,endY:e,startX:u,endX:t}}return{isMerged:f,isMergedMainCell:p,actualRow:e,actualColumn:t,startY:c,endY:l,startX:u,endX:d,mergeInfo:v}}function Vb(e,t,n,r){let{x:i}=n;return e/t+i-r}function Hb(e,t,n,r){let{y:i}=n;return e=e/t+i-r,e}let Ub=[`script`,`style`,`meta`,`comment`,`link`],Wb=function(e){return e[e.INFO=0]=`INFO`,e[e.STOP=1]=`STOP`,e[e.WARNING=2]=`WARNING`,e}({}),Gb=function(e){return 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}({}),Kb=function(e){return 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}({}),qb=function(e){return e[e.TEXT=0]=`TEXT`,e[e.ARROW=1]=`ARROW`,e[e.CUSTOM=2]=`CUSTOM`,e}({}),Jb=function(e){return e.VALID=`valid`,e.INVALID=`invalid`,e.VALIDATING=`validating`,e}({}),Yb=function(e){return 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}({}),Xb=class extends k{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){let e=(e,t,n=[],r)=>{let i=n.find(t=>t.name===e.pluginName);if(i)try{let n=e.parseJson(i.data);e.onLoad(t,n)}catch{console.error(`Load ${r}{${t}} Resources{${e.pluginName}} Data Error.`)}},t=t=>{t.businesses.forEach(r=>{switch(r){case n.UniverType.UNRECOGNIZED:case n.UniverType.UNIVER_UNKNOWN:case n.UniverType.UNIVER_DOC:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_DOC).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Document`)});break;case n.UniverType.UNIVER_SLIDE:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SLIDE).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Slide`)});break;case n.UniverType.UNIVER_BOARD:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_BOARD).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Board`)});break;case n.UniverType.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_SHEET).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Workbook`)});break;case n.UniverType.UNIVER_BASE:this._univerInstanceService.getAllUnitsForType(n.UniverType.UNIVER_BASE).forEach(n=>{e(t,n.getUnitId(),n.getSnapshot().resources,`Base`)});break}})};this._resourceManagerService.getAllResourceHooks().forEach(e=>t(e)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(e=>t(e))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SHEET).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_DOC).subscribe(e=>{let{unit:t}=e;nd(t.getUnitId())||this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_BOARD).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(n.UniverType.UNIVER_BASE).subscribe(e=>{let{unit:t}=e;this._resourceManagerService.loadResources(t.getUnitId(),t.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SHEET).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_DOC).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_DOC)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_BASE).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_BASE)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_SLIDE).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_SLIDE)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(n.UniverType.UNIVER_BOARD).subscribe(e=>{this._resourceManagerService.unloadResources(e.getUnitId(),n.UniverType.UNIVER_BOARD)}))}saveUnit(e){let t=this._univerInstanceService.getUnit(e);if(!t)return null;let n=this._resourceManagerService.getResources(e,t.type),r=z.deepClone(t.getSnapshot());return r.resources=n,r}};Xb=pa([V(0,(0,i.Inject)(Uv)),V(1,(0,i.Inject)(Ky))],Xb);var Zb=class extends M{constructor(...e){super(...e),T(this,`type`,void 0),T(this,`name$`,void 0)}getUnitId(){throw Error(`Method not implemented.`)}setName(e){throw Error(`Method not implemented.`)}getSnapshot(){throw Error(`Method not implemented.`)}getRev(){throw Error(`Method not implemented.`)}incrementRev(){throw Error(`Method not implemented.`)}setRev(e){throw Error(`Method not implemented.`)}},Qb=class{get _univerInstanceService(){return this._injector.get(Ky)}get _pluginService(){return this._injector.get(db)}constructor(e={},t){T(this,`_startedTypes`,new Set),T(this,`_injector`,void 0),T(this,`_disposingCallbacks`,new O);let n=this._injector=$b(t,e==null?void 0:e.override),{theme:r,darkMode:i,locale:a,region:o,locales:s,direction:c,logLevel:l,logCommandExecution:u}=e;r&&this._injector.get(hb).setTheme(r),i&&this._injector.get(hb).setDarkMode(i),s&&this._injector.get(eb).load(s),a&&this._injector.get(eb).setLocale(a),o&&this._injector.get(fb).setRegion(o),c&&this._injector.get(eb).setDirection(c),l&&this._injector.get(ua).setLogLevel(l),u!==void 0&&this._injector.get(aa).setConfig(ma,u),this._init(n)}__getInjector(){return this._injector}onDispose(e){let t=this._disposingCallbacks.add(D(e));return D(()=>t.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(e){this._injector.get(eb).setLocale(e)}setRegion(e){this._injector.get(fb).setRegion(e)}createUnit(e,t){return this._univerInstanceService.createUnit(e,t)}_init(e){this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SHEET,Gy),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_DOC,S_),this._univerInstanceService.registerCtorForType(n.UniverType.UNIVER_SLIDE,Zb);let t=e.get(Ky);t.__setCreateHandler((n,r,i,a)=>{var o;let s=!this._startedTypes.has(n);s&&(this._pluginService.startPluginsForType(n),this._startedTypes.add(n));let c=(o=t.__getCtorByType(n))==null?i:o;if(!c)throw Error(`[Univer]: No constructor registered for unit type ${n}.`);let l=e.createInstance(c,r);return t.__addUnit(l,a),s&&this._tryProgressToReady(),l})}_tryProgressToReady(){this._injector.get(Zy).stage<1&&(this._injector.get(Zy).stage=1)}registerPlugin(e,t){this._pluginService.registerPlugin(e,t)}registerPlugins(e){e.forEach(e=>{let[t,n]=e;this._pluginService.registerPlugin(t,n)})}};function $b(e,t){let n=ob([[ay],[eb],[fb],[hb],[Zy],[db],[qv],[Ky,{useClass:qy}],[ib,{useClass:ab}],[ua,{useClass:da,lazy:!0}],[ga,{useClass:ya}],[gb,{useClass:Sb,lazy:!0}],[aa,{useClass:oa}],[sa,{useClass:ca}],[Uv,{useClass:mb,lazy:!0}],[pb,{useClass:Xb,lazy:!0}],[Yv,{useClass:Jv}],[nb,{useClass:tb,lazy:!0}]],t),r=e?e.createChild(n):new i.Injector(n);return qe(r,[[qv],[pb]]),r}x(),e.ABCToNumber=ep,e.AUTO_HEIGHT_FOR_MERGED_CELLS=ed,e.AbsoluteRefType=oo,e.ActionIterator=Qg,e.AlignTypeH=Ld,e.AlignTypeV=Rd,e.ArrangeTypeEnum=Ud,e.AsyncInterceptorManager=Zp,e.AsyncLock=zp.default,Object.defineProperty(e,"AuthzIoLocalService",{enumerable:!0,get:function(){return Jv}}),e.AutoFillSeries=se,e.BORDER_KEYS=Yd,e.BORDER_STYLE_KEYS=Jd,e.BaseDataModel=mp,e.BaseFieldType=sp,e.BaseFilterConjunction=up,e.BaseFilterOperator=lp,e.BaseSortDirection=dp,e.BaseViewType=cp,e.BaselineOffset=Me,e.BlockType=fd,e.BooleanNumber=Ne,e.BorderStyleTypes=ce,e.BorderType=le,e.BuildTextUtils=Z,e.BulletAlignment=cd,e.COLORS=Fa,e.COLOR_STYLE_KEYS=qd,e.COMMAND_LOG_EXECUTION_CONFIG_KEY=ma,e.CanceledError=Ye,e.CellModeEnum=fo,e.CellValueType=Pe,e.ColorKit=Ia,e.ColorType=ue,e.ColumnLayoutType=kd,e.ColumnResponsiveType=Ad,e.ColumnSeparatorType=gd,Object.defineProperty(e,"CommandService",{enumerable:!0,get:function(){return ya}}),e.CommandType=ha,e.CommonHideTypes=de,e.ConfigService=oa,e.ContextService=ca,e.CopyPasteType=fe,e.CustomCommandExecutionError=Je,e.CustomDecorationType=dd,e.CustomRangeType=ud,e.DEFAULT_CELL=nf,e.DEFAULT_DOC=y_,e.DEFAULT_DOCUMENT_PARAGRAPH_LINE_SPACING=of,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_ABOVE=0,e.DEFAULT_DOCUMENT_PARAGRAPH_SPACE_BELOW=12,e.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=`__default_document_sub_component_id20231101__`,e.DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
|
|
21
|
+
`,e.DEFAULT_NUMBER_FORMAT=`General`,e.DEFAULT_RANGE=ef,e.DEFAULT_RANGE_ARRAY=$d,e.DEFAULT_SELECTION=tf,e.DEFAULT_STYLES=J,e.DEFAULT_TEXT_FORMAT=`@@@`,e.DEFAULT_TEXT_FORMAT_EXCEL=`@`,e.DEFAULT_WORKSHEET_COLUMN_COUNT=20,e.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=`DEFAULT_WORKSHEET_COLUMN_COUNT`,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20,e.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=`DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT`,e.DEFAULT_WORKSHEET_COLUMN_WIDTH=88,e.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=`DEFAULT_WORKSHEET_COLUMN_WIDTH`,e.DEFAULT_WORKSHEET_ROW_COUNT=Fy,e.DEFAULT_WORKSHEET_ROW_COUNT_KEY=`DEFAULT_WORKSHEET_ROW_COUNT`,e.DEFAULT_WORKSHEET_ROW_HEIGHT=24,e.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=`DEFAULT_WORKSHEET_ROW_HEIGHT`,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,e.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=`DEFAULT_WORKSHEET_ROW_TITLE_WIDTH`,e.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=$u,e.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Qu,e.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Zu,e.DOC_DRAWING_PRINTING_COMPONENT_KEY=`univer-docs-drawing-printing`,e.DOC_RANGE_TYPE=lo,e.DashStyleType=Cd,e.DataStreamTreeNodeType=Km,e.DataStreamTreeTokenType=qm,e.DataValidationErrorStyle=Wb,e.DataValidationImeMode=Gb,e.DataValidationOperator=Kb,e.DataValidationRenderMode=qb,e.DataValidationStatus=Jb,e.DataValidationType=Yb,e.DeleteDirection=pe,e.DependentOn=ub,e.DesktopLogService=da,e.DeveloperMetadataVisibility=me,e.Dimension=he,e.Direction=ge,e.Disposable=k,e.DisposableCollection=O,e.DocStyleType=ad,e.DocumentBlockRangeType=ld,e.DocumentBlockType=id,e.DocumentDataModel=S_,e.DocumentFlavor=pd,e.DrawingTypeEnum=Wd,e.EDITOR_ACTIVATED=ry,e.EXTENSION_NAMES=cf,e.ErrorService=ay,e.EventState=Bv,e.EventSubject=Vv,e.FOCUSING_BOARD=ny,e.FOCUSING_COMMENT_EDITOR=`FOCUSING_COMMENT_EDITOR`,e.FOCUSING_COMMON_DRAWINGS=`FOCUSING_COMMON_DRAWINGS`,e.FOCUSING_DOC=ey,e.FOCUSING_EDITOR_BUT_HIDDEN=`FOCUSING_EDITOR_BUT_HIDDEN`,e.FOCUSING_EDITOR_INPUT_FORMULA=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_EDITOR_STANDALONE=`FOCUSING_EDITOR_INPUT_FORMULA`,e.FOCUSING_FX_BAR_EDITOR=iy,e.FOCUSING_PANEL_EDITOR=`FOCUSING_PANEL_EDITOR`,e.FOCUSING_SHAPE_TEXT_EDITOR=`FOCUSING_SHAPE_TEXT_EDITOR`,e.FOCUSING_SHEET=$v,e.FOCUSING_SLIDE=ty,e.FOCUSING_UNIT=Qv,e.FOCUSING_UNIVER_EDITOR=`FOCUSING_UNIVER_EDITOR`,e.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=`FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE`,e.FORMULA_EDITOR_ACTIVATED=`FORMULA_EDITOR_ACTIVATED`,e.FollowNumberWithType=od,e.FontItalic=Ae,e.FontStyleType=Nd,e.FontWeight=je,e.GridType=md,e.HorizontalAlign=De,e.IAuthzIoService=Yv,e.ICommandService=ga,e.IConfigService=aa,e.IConfirmService=Xv,e.IContextService=sa,e.IImageIoService=cy,e.ILocalStorageService=$y,e.ILogService=ua,e.IMentionIOService=nb,e.IPermissionService=ib,e.IResourceLoaderService=pb,e.IResourceManagerService=Uv,e.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=`isRowStylePrecedeColumnStyle`,e.IURLImageService=ly,e.IUndoRedoService=gb,e.IUniverInstanceService=Ky,e.ImageCacheMap=Cb,e.ImageSourceType=oy,e.ImageUploadStatusType=sy,Object.defineProperty(e,"Inject",{enumerable:!0,get:function(){return i.Inject}}),Object.defineProperty(e,"InjectSelf",{enumerable:!0,get:function(){return i.InjectSelf}}),Object.defineProperty(e,"Injector",{enumerable:!0,get:function(){return i.Injector}}),e.InterceptorEffectEnum=Gp,e.InterceptorManager=Jp,e.InterpolationPointType=ve,Object.defineProperty(e,"JSON1",{enumerable:!0,get:function(){return Um}}),e.JSONX=m_,e.LOCALE_META=be,e.LRUHelper=Ku,e.LRUMap=Gu,Object.defineProperty(e,"LifecycleService",{enumerable:!0,get:function(){return Zy}}),e.LifecycleStages=Jy,e.LifecycleUnreachableError=Xy,e.ListGlyphType=sd,Object.defineProperty(e,"LocalUndoRedoService",{enumerable:!0,get:function(){return Sb}}),e.LocaleService=eb,e.LocaleType=ye,e.LogLevel=la,Object.defineProperty(e,"LookUp",{enumerable:!0,get:function(){return i.LookUp}}),e.MAX_COLUMN_COUNT=Yu,e.MAX_ROW_COUNT=Ju,e.MODERN_DOCUMENT_DEFAULT_MARGIN=66.66666666666667,e.MODERN_DOCUMENT_WIDTH=df,e.MOVE_BUFFER_VALUE=2,Object.defineProperty(e,"Many",{enumerable:!0,get:function(){return i.Many}}),e.MemoryCursor=pm,Object.defineProperty(e,"MentionIOLocalService",{enumerable:!0,get:function(){return tb}}),e.MentionType=xe,e.ModernDocumentWidthMode=uf,e.NAMED_STYLE_MAP=af,e.NAMED_STYLE_SPACE_MAP=sf,e.NamedStyleType=xd,e.NilCommand=va,e.NumberUnitType=Id,e.ObjectMatrix=Fl,e.ObjectRelativeFromH=Pd,e.ObjectRelativeFromV=Fd,Object.defineProperty(e,"Optional",{enumerable:!0,get:function(){return i.Optional}}),e.PADDING_KEYS=Zd,e.PAGE_SIZE=lf,e.PAPER_TYPES=Hd,e.PARAGRAPH_ID_PREFIX=Sm,e.PRESERVE_INSERTED_PARAGRAPH_IDS=Wm,e.PRESET_LIST_TYPE=Xh,e.PageOrientType=Bd,e.PaperType=Vd,e.ParagraphElementType=vd,e.ParagraphStyleBuilder=yv,e.ParagraphStyleValue=vv,e.PermissionService=ab,e.PermissionStatus=rb,e.Plugin=cb,Object.defineProperty(e,"PluginService",{enumerable:!0,get:function(){return db}}),e.PositionedObjectLayoutType=bd,e.PresetListType=Gh,e.ProtectionType=Se,Object.defineProperty(e,"Quantity",{enumerable:!0,get:function(){return i.Quantity}}),e.QuickListType=Wh,e.QuickListTypeMap=$h,e.RANGE_DIRECTION=co,e.RANGE_TYPE=ao,e.RBush=_f,e.RCDisposable=j,e.RESTORE_INSERTED_PARAGRAPH_IDS=fh,e.RGBA_PAREN=`rgba(`,e.RGB_PAREN=`rgb(`,e.ROTATE_BUFFER_VALUE=1,e.RTree=Nb,e.Range=pf,e.Rectangle=Uf,Object.defineProperty(e,"RediError",{enumerable:!0,get:function(){return i.RediError}}),e.RedoCommand=xb,e.RedoCommandId=vb,e.RefAlias=Qf,Object.defineProperty(e,"RegionService",{enumerable:!0,get:function(){return fb}}),e.Registry=vm,e.RegistryAsMap=ym,e.RelativeDate=Ce,Object.defineProperty(e,"ResourceManagerService",{enumerable:!0,get:function(){return mb}}),e.RichTextBuilder=xv,e.RichTextParagraphBuilder=Sv,e.RichTextRunBuilder=Cv,e.RichTextValue=bv,e.RxDisposable=A,e.SECTION_ID_PREFIX=km,e.SHEET_EDITOR_UNITS=rf,e.STYLE_KEYS=Qd,e.SectionType=hd,Object.defineProperty(e,"Self",{enumerable:!0,get:function(){return i.Self}}),Object.defineProperty(e,"SheetSkeleton",{enumerable:!0,get:function(){return Rb}}),e.SheetTypes=we,e.SheetViewModel=Ry,Object.defineProperty(e,"Skeleton",{enumerable:!0,get:function(){return Ib}}),Object.defineProperty(e,"SkipSelf",{enumerable:!0,get:function(){return i.SkipSelf}}),e.SliceBodyType=Og,e.SpacingRule=Sd,e.Styles=dy,e.TEXT_DECORATION_KEYS=Kd,e.TEXT_ROTATION_KEYS=Xd,e.THEME_COLORS=po,e.TabStopAlignment=wd,e.TableAlignmentType=Ed,e.TableLayoutType=Dd,e.TableRowHeightRule=jd,e.TableSizeType=Td,e.TableTextWrapType=Od,e.TestConfirmService=Zv,e.TextDecoration=Ee,e.TextDecorationBuilder=_v,e.TextDirection=Te,e.TextDirectionType=_d,e.TextStyleBuilder=gv,e.TextStyleValue=hv,e.TextX=X,e.TextXActionType=Gm,e.ThemeColorType=Fe,e.ThemeColors=Ie,e.ThemeService=hb,e.Tools=z,e.UndoCommand=bb,e.UndoCommandId=yb,e.UnitModel=M,e.Univer=Qb,Object.defineProperty(e,"UniverInstanceService",{enumerable:!0,get:function(){return qy}}),e.UniverInstanceType=n.UniverType,e.UpdateDocsAttributeType=eo,e.UserManagerService=qv,e.VerticalAlign=Oe,e.VerticalAlignmentType=Md,Object.defineProperty(e,"WithNew",{enumerable:!0,get:function(){return i.WithNew}}),Object.defineProperty(e,"Workbook",{enumerable:!0,get:function(){return Gy}}),e.Worksheet=By,e.WrapStrategy=ke,e.WrapTextType=yd,e.addLinkToDocumentModel=yy,e.afterInitApply=Oa,e.afterTime=Ea,e.awaitTime=Pb,e.binSearchFirstGreaterThanTarget=ja,e.binarySearchArray=Aa,e.bufferDebounceTime=Ta,e.cellToRange=Yl,e.characterSpacingControlType=zd,e.checkForSubstrings=eu,e.checkIfMove=Pa,e.checkParagraphHasBullet=Du,e.checkParagraphHasIndent=Ou,e.checkParagraphHasIndentByStyle=ku,e.cloneBodyWithFreshParagraphIds=wm,e.cloneCellData=Dy,e.cloneCellDataMatrix=ky,e.cloneCellDataWithSpanAndDisplay=Oy,e.cloneParagraphWithId=Tm,e.cloneSectionBreakWithId=jm,e.cloneValue=Ey,e.cloneWorksheetData=My,e.codeToBlob=Na,e.columnLabelToNumber=qu,e.composeBody=qg,e.composeInterceptors=qp,e.composeStyles=ae,e.concatMatrixArray=Al,e.containsInteriorInsertionOffset=ah,e.containsStreamIndex=ih,e.convertCellToRange=Il,e.convertObservableToBehaviorSubject=Da,e.covertCellValue=Xl,e.covertCellValues=Zl,e.createAsyncInterceptorKey=Yp,e.createDefaultBaseTableSnapshot=fp,e.createDefaultUser=Gv,e.createDocumentModelWithStyle=gy,Object.defineProperty(e,"createIdentifier",{enumerable:!0,get:function(){return i.createIdentifier}}),e.createInterceptorKey=Kp,e.createInternalEditorID=td,e.createParagraphId=Cm,e.createRandomId=Zf,e.createRowColIter=$f,e.createSectionId=Am,e.createSheetGapTestConfig=Lb,e.currencySymbols=Sl,e.customNameCharacterCheck=Tb,e.dateKit=Tu,e.debounce=jt,e.dedupe=Be,e.dedupeBy=Ve,e.deepCompare=Ql,e.delayAnimationFrame=Fb,e.deleteContent=ju,e.extractPureTextFromCell=Vy,Object.defineProperty(e,"forwardRef",{enumerable:!0,get:function(){return i.forwardRef}}),e.fromCallback=Ca,e.fromEventSubject=Hv,e.generateIntervalsByPoints=Pu,e.generateRandomId=Y,e.get=Yn,e.getArrayLength=El,e.getBasesEmptySnapshot=pp,e.getBlockRangeInterval=Qm,e.getBodySlice=Rg,e.getBodySliceForSplitTextXAction=Bg,e.getBodySliceForTextXAction=zg,e.getBorderStyleType=Kl,e.getCellCoordByIndexSimple=zb,e.getCellInfoInMergeData=uo,e.getCellValueType=no,e.getCellWithCoordByIndexCore=Bb,e.getColorStyle=Vl,e.getColumnGroupRangeInterval=$m,e.getCustomBlockIdsInSelections=Q_,e.getCustomBlockInterval=th,e.getCustomBlockSlice=Lg,e.getCustomDecorationSlice=Ug,e.getCustomRangeInterval=eh,e.getCustomRangeSlice=Hg,e.getDisplayValueFromCell=Hy,e.getDocsEmptySnapshot=Nm,e.getDocsUpdateBody=ql,e.getEmptyCell=xy,e.getExclusiveRangeInterval=Xm,e.getInclusiveRangeInterval=Ym,e.getIntersectRange=zf,e.getNumfmtParseValueFilter=wl,e.getOriginCellValue=Uy,e.getParagraphContentStartOffset=Cg,e.getParagraphContentStartOffsets=wg,e.getParagraphFollowingBlockOffset=Tg,e.getParagraphsSlice=Fg,e.getPlainText=g_,e.getReverseDirection=_e,e.getRichTextEditPath=Zg,e.getSectionBreakSlice=Ig,e.getSectionHeaderFooterReferenceKey=Lv,e.getSheetsEmptySnapshot=uy,e.getSingleDataStreamChange=nv,e.getTableCellTokenInterval=rh,e.getTableRangeInterval=Zm,e.getTableRowTokenInterval=nh,e.getTableSlice=Mg,e.getTextRunSlice=jg,e.getTransformOffsetX=Vb,e.getTransformOffsetY=Hb,e.getWorksheetUID=Wy,e.groupBy=We,e.handleStyleToString=Wl,e.hashAlgorithm=Nu,e.horizontalLineSegmentsSubtraction=Eu,e.insertMatrixArray=Ol,e.insertTextToContent=Au,e.intersectsOperationalIntervals=oh,e.invertColorByHSL=lm,e.invertColorByMatrix=fm,Object.defineProperty(e,"isAsyncDependencyItem",{enumerable:!0,get:function(){return i.isAsyncDependencyItem}}),Object.defineProperty(e,"isAsyncHook",{enumerable:!0,get:function(){return i.isAsyncHook}}),e.isBlackColor=Qa,e.isBooleanString=Vp,e.isCellCoverable=Bl,e.isCellV=io,Object.defineProperty(e,"isClassDependencyItem",{enumerable:!0,get:function(){return i.isClassDependencyItem}}),e.isCommentEditorID=rd,Object.defineProperty(e,"isCtor",{enumerable:!0,get:function(){return i.isCtor}}),e.isDefaultFormat=vl,Object.defineProperty(e,"isDisposable",{enumerable:!0,get:function(){return i.isDisposable}}),e.isEmptyCell=zl,Object.defineProperty(e,"isFactoryDependencyItem",{enumerable:!0,get:function(){return i.isFactoryDependencyItem}}),e.isFormulaId=Ul,e.isFormulaString=Hl,e.isICellData=to,e.isInternalEditorID=nd,e.isNodeEnv=oe,e.isNotNullOrUndefined=by,e.isNullCell=ro,e.isNumeric=hm,e.isPatternEqualWithoutDecimal=yl,e.isRangesEqual=fy,e.isRealNum=Mu,e.isSafeNumeric=gm,e.isSafeUrl=R,e.isSameStyleTextRun=$l,e.isTextFormat=_l,e.isUnitRangesEqual=py,e.isValidRange=Jl,Object.defineProperty(e,"isValueDependencyItem",{enumerable:!0,get:function(){return i.isValueDependencyItem}}),e.isWhiteColor=$a,e.makeArray=Ge,e.makeCellRangeToRangeData=Rl,e.makeCellToSelection=Ll,e.makeCustomRangeStream=Jm,e.mapObjectMatrix=Tl,e.merge=ta,e.mergeIntervals=Fu,e.mergeLocales=Iu,e.mergeOverrideWithDependencies=ob,e.mergeSets=xm,e.mergeWith=na,e.mergeWorksheetSnapshotWithDefault=Iy,e.mixinClass=mm,e.moveMatrixArray=Ml,e.moveRangeByOffset=Mf,e.nameCharacterCheck=wb,e.noop=Up,e.normalizeBody=Vg,e.normalizeInsertedSectionIdsForDocument=Ch,e.normalizeTextRuns=ph,e.normalizeUrl=L,e.numberToABC=tp,e.numberToListABC=rp,Object.defineProperty(e,"numfmt",{enumerable:!0,get:function(){return Wc}}),e.queryObjectMatrix=qf,e.regexp=gl,e.registerDependencies=Ke,e.remove=ze,e.repeatStringNumTimes=np,e.replaceInDocumentBody=T_,e.requestImmediateMacroTask=bm,e.resolveDocumentParagraphStyle=w_,e.resolveSectionHeaderFooterReference=Rv,e.resolveSectionHeaderFooterReferences=zv,e.resolveWithBasePath=te,e.rotate=Ue,e.searchArray=Ma,e.searchInOrderedArray=ka,e.selectionToArray=so,e.sequence=Ze,e.sequenceAsync=Xe,e.sequenceExecute=xa,e.sequenceExecuteAsync=Sa,e.set=ia,Object.defineProperty(e,"setDependencies",{enumerable:!0,get:function(){return i.setDependencies}}),e.shallowEqual=Hp,e.shiftExclusiveRangeOnDelete=uh,e.shiftExclusiveRangeOnInsert=ch,e.shiftInclusiveRangeOnDelete=lh,e.shiftInclusiveRangeOnInsert=sh,e.skipParseTagNames=Ub,e.sliceMatrixArray=jl,e.sortRules=ip,e.sortRulesByDesc=ap,e.sortRulesFactory=op,e.spliceArray=kl,e.splitIntoGrid=Pf,e.takeAfter=wa,e.throttle=Wp,e.toDisposable=D,e.touchDependencies=qe,e.updateAttributeByDelete=$g,e.updateAttributeByInsert=e_,e.validateDocBodyStructure=Fv,e.validateDocumentStructure=Iv,e.willLoseNumericPrecision=_m});
|