@univerjs/core 0.6.7 → 0.6.8
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 +8 -10
- package/lib/es/index.js +3644 -3592
- package/lib/facade.js +1428 -0
- package/lib/index.js +18092 -0
- package/lib/types/docs/data-model/document-data-model.d.ts +1 -0
- package/lib/types/docs/data-model/preset-list-type.d.ts +3 -1
- package/lib/types/docs/data-model/text-x/build-utils/index.d.ts +11 -1
- package/lib/types/docs/data-model/text-x/build-utils/paragraph.d.ts +13 -1
- package/lib/types/docs/data-model/text-x/build-utils/selection.d.ts +4 -0
- package/lib/types/shared/lifecycle.d.ts +1 -1
- package/lib/types/shared/tools.d.ts +1 -0
- package/lib/types/sheets/worksheet.d.ts +9 -8
- package/lib/types/types/const/const.d.ts +4 -0
- package/lib/types/types/interfaces/i-document-data.d.ts +3 -4
- package/lib/umd/index.js +8 -10
- package/package.json +2 -2
package/lib/cjs/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
"use strict";var qu=Object.defineProperty;var Ju=(e,t,n)=>t in e?qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>Ju(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("rxjs"),wr=require("rxjs/operators"),je=require("@wendellhu/redi");function Zu(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const fr=typeof global<"u"?global:typeof self<"u"?self:window;function Qu(){const t=new Map;let n=0;typeof fr.requestIdleCallback!="function"&&(fr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof fr.cancelIdleCallback!="function"&&(fr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function ec(){Qu()}function er(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function tc(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function nc(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function rc(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function sc(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function ic(e){return Array.isArray(e)?e:[e]}function oc(e,t){t.forEach(n=>e.add(n))}function Uo(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class vs extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class ac extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function ko(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function Po(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function Oi(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wi(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function bi(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function zn(e){return typeof e=="function"}function lc(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var os=lc(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
|
|
2
|
-
`+n.map(function(r,s){return s+1+") "+r.toString()}).join(`
|
|
3
|
-
`):"",this.name="UnsubscriptionError",this.errors=n}});function yi(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var uc=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=Oi(o),l=a.next();!l.done;l=a.next()){var u=l.value;u.remove(this)}}catch(R){t={error:R}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else o.remove(this);var c=this.initialTeardown;if(zn(c))try{c()}catch(R){i=R instanceof os?R.errors:[R]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var d=Oi(h),f=d.next();!f.done;f=d.next()){var E=f.value;try{Ai(E)}catch(R){i=i!=null?i:[],R instanceof os?i=bi(bi([],wi(i)),wi(R.errors)):i.push(R)}}}catch(R){r={error:R}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(i)throw new os(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ai(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&yi(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&yi(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();function cc(e){return e instanceof uc||e&&"closed"in e&&zn(e.remove)&&zn(e.add)&&zn(e.unsubscribe)}function Ai(e){zn(e)?e():e.unsubscribe()}function nt(e){let t=!1;return e?cc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:nt(()=>{})}function hc(e){return nt(()=>{e.unsubscribe()})}class Gr{constructor(){C(this,"_disposables",new Set)}add(t){const n=nt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class rt{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Gr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class dc extends rt{constructor(){super(...arguments);C(this,"dispose$",new we.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class fc extends rt{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const yn=je.createIdentifier("univer.context-service");class Fo extends rt{constructor(){super(...arguments);C(this,"_contextChanged$",new we.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new we.Observable(r=>{const s=this._contextChanged$.pipe(we.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var $o=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))($o||{});const vt=je.createIdentifier("univer.log");class Bo extends rt{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=gc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function gc(...e){return e.map(t=>JSON.stringify(t)).join("")}var mc=Object.getOwnPropertyDescriptor,_c=(e,t,n,r)=>{for(var s=r>1?void 0:r?mc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ti=(e,t)=>(n,r)=>t(n,r,e),tr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(tr||{});const nr=je.createIdentifier("anywhere.command-service");class pc{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),nt(()=>{this._commands.delete(t.id),this._commandTypes.delete(t.id)})}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Ho={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends rt{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new pc,this._registerCommand(Ho)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),nt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),nt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof vs)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=nc(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof vs)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),nt(()=>er(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(n)}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{const o=new Gr;s=new Ec(n.id),o.add(this._commandRegistry.registerCommand(s)),o.add(nt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return nt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=_c([Ti(0,je.Inject(je.Injector)),Ti(1,vt)],exports.CommandService);class Ec{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(vt),s=t.get(yn),i=t.get(je.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),nt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Kr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return Po(r)}function Cc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return ko(r)}function jo(e){return new we.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Os(e){return function(n){return new we.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Rc(e=0){return t=>{let n=[];return t.pipe(we.tap(r=>n.push(r)),we.debounceTime(e),we.map(()=>n),we.tap(()=>n=[]))}}function Ic(e){const t=new we.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(we.take(1))}const Sc=e=>new Promise(t=>{we.merge(jo(e.onCommandExecuted.bind(e)).pipe(wr.filter(([n])=>n.type===tr.MUTATION)),we.timer(300)).pipe(wr.debounceTime(16),wr.first()).subscribe(()=>{t()})});function Wo(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 vc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Yo(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function kn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=Wo(e,t):r=Yo(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Oc(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const Pn=2,zo=1;function wc(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,f=u,E=i,R=s;return Math.abs(a-n)>Pn||Math.abs(l-r)>Pn||Math.abs(d-E)>Pn||Math.abs(f-R)>Pn||Math.abs(h-o)>zo}var Vo=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Vo||{}),Xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(Xe||{}),Go=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Go||{}),pt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(pt||{}),Ko=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Ko||{}),Xo=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Xo||{}),qo=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(qo||{}),Jo=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Jo||{}),Zo=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Zo||{}),Qo=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Qo||{});function bc(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var ea=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(ea||{}),rr=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(rr||{}),Pr=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Pr||{}),ta=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(ta||{}),na=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(na||{}),ra=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(ra||{}),sa=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(sa||{}),ia=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(ia||{}),oa=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(oa||{}),aa=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(aa||{}),Kn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Kn||{}),la=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(la||{}),Ot=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(Ot||{}),tn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(tn||{}),on=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(on||{}),Fr=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(Fr||{}),$r=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))($r||{}),xt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(xt||{}),Ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Ie||{}),Vt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Vt||{}),dt=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(dt||{}),Xr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Xr||{});const yc="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Ac=e=>crypto.getRandomValues(new Uint8Array(e)),Tc=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Nc=(e,t=21)=>Tc(e,t|0,Ac),Mc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=yc[n[e]&63];return t};const ua=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"]),Dc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function Lc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Dc.test(e)){if(ca(e))return!0;try{const r=new URL(ha(e)).hostname.split(".").pop();if(r&&ua.has(r))return!0}catch{return!1}}return!1}function ca(e){return/^[a-zA-Z]+:\/\//.test(e)}function xc(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function ha(e){return ca(e)?e:xc(e)?`mailto://${e}`:`https://${e}`}const Uc=/^-ms-/,kc=/-([a-z])/g,Ht=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function Ks(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Pc(e,t):re.isObject(e)?Fc(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Pc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!Ks(s,i))return!1}return!0}function Fc(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!Ks(i,o))return!1}return!0}class re{static stringAt(t){let n="",r=t;for(;r>=Ht.length;)r/=Ht.length,r-=1,n+=Ht[r%Ht.length];const s=t%Ht.length;return n+=Ht[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Ht.length**i+Ht.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return Ut(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return Ks(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Lc(t)}static normalizeUrl(t){return ha(t)}static topLevelDomainCombiningString(){return[...ua].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Uc,"ms-").replace(kc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function Ut(e=21,t){return t?Nc(t,e)():Mc(e)}function ws(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const $c=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function br(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(bs(r,{...a,ed:Math.min(u,n)}))):o.push(bs(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function Bc(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${br(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=br(e,o,r.length)),i}else return br(e,0,e.dataStream.length)}function bs(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:f,va:E}=s;let R=e.slice(n,r);const w=[];return a===Ie.TRUE&&(R=`<i>${R}</i>`),E===xt.SUPERSCRIPT?R=`<sup>${R}</sup>`:E===xt.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(u==null?void 0:u.s)===Ie.TRUE&&(R=`<u>${R}</u>`),(c==null?void 0:c.s)===Ie.TRUE&&(R=`<s>${R}</s>`),l===Ie.TRUE&&(R=`<strong>${R}</strong>`),i&&w.push(`font-family: ${i}`),f&&w.push(`color: ${f.rgb}`),o&&w.push(`font-size: ${o}pt`),h&&w.push("text-decoration: overline"),d&&w.push(`background: ${d.rgb}`),w.length?`<span style="${w.join("; ")};">${R}</span>`:R}const da={[Xr.OFFICE]:{[dt.ACCENT1]:"#4472C4",[dt.ACCENT2]:"#ED7D31",[dt.ACCENT3]:"#A5A5A5",[dt.ACCENT4]:"#70AD47",[dt.ACCENT5]:"#5B9BD5",[dt.ACCENT6]:"#70AD47",[dt.DARK1]:"#000000",[dt.DARK2]:"#44546A",[dt.LIGHT1]:"#FFFFFF",[dt.LIGHT2]:"#E7E6E6",[dt.HYPERLINK]:"#0563C1",[dt.FOLLOWED_HYPERLINK]:"#954F72"}};class qr{constructor(){C(this,"_themeValue",dt.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=pt.UNSUPPORTED,this._themeColors=Xr.OFFICE,this._themeTint=0}asRgbColor(){return new Br(this._rgbValue,this)}asThemeColor(){return new Hr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case pt.THEME:return this.asThemeColor();case pt.RGB:return this.asRgbColor();case pt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=pt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=pt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=pt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=pt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class an{constructor(t){C(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new qr().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new an(this._builder)}equals(t){return!1}}class fa{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new qr;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const _t=class _t extends an{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(_t.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(_t.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return an.rgbColorToHexValue(this)}getRed(){let n=this._red+_t.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+_t.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+_t.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return pt.RGB}clone(){return new _t(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof _t?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(_t,"RGB_COLOR_AMT",0),C(_t,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(_t,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Br=_t;const Wt=class Wt extends an{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=da[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Wt._cacheThemeColor.has(this._themeColors)){if(s=Wt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Wt._cacheThemeColor.set(this._themeColors,s);const i=new fa(an.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Wt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Wt?n._themeColorType===this._themeColorType:!1}getColorType(){return pt.THEME}getThemeColorType(){return this._themeColorType}};C(Wt,"_cacheThemeColor",new Map);let Hr=Wt;const Hc="rgb(",jc="rgba(",ys={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class St{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof St){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=ga(t);if(n==null){this._setNullColor();return}this._color=n;const r=Gc(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new St(t).toRgb(),i=new St(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new St(l)}static getContrastRatio(t,n){const r=new St(t).getLuminance(),s=new St(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[gr(Math.round(n).toString(16)),gr(Math.round(r).toString(16)),gr(Math.round(s).toString(16)),gr(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return Jc(this.toRgb())}toHsl(){return qc(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new St(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new St(n)}setAlpha(t){return new St({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=as(t),n=as(n),r=as(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const gr=e=>e.length===1?`0${e}`:e,as=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),ga=e=>{if(Qc(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ys[t]){const n=ys[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Wc(t);if(t.startsWith("rgb"))return Yc(t);if(t.startsWith("hsl"))return zc(t);if(t.startsWith("hsv"))return Vc(t)},Wc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},Yc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},zc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Vc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Gc=e=>{const t=ga(e);if(t!=null)return"r"in t?t:"l"in t?Kc(t):Xc(t)},ls=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),Kc=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=ls(u,l,t+1/3),i=ls(u,l,t),o=ls(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},Xc=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],f={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},qc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},Jc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},Zc=e=>e==null,Qc=e=>!Zc(e)&&typeof e=="object";function eh(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function th(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var ke=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(ke||{});function nh(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 rh(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Vt.STRING;if(typeof e.v=="number")return Vt.NUMBER;if(typeof e.v=="boolean")return Vt.BOOLEAN}function sh(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function ih(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),tt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(tt||{});function oh(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var ma=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(ma||{}),_a=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(_a||{});function ah(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=n[u];if(e===c&&t===d){i=h,o=f,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=f){i=h,o=f,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var pn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(pn||{});function pa(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,f=n;if(r&&i){const{startRow:E,startColumn:R,endRow:w,endColumn:L,startY:J,endY:z,startX:de,endX:N}=i;c=E,h=R,d=w,f=L,o=J,a=z,l=de,u=N}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:u}}const lh=pa;function uh(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function Ea(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function As(e){return Ea(e)&&(e==null?void 0:e.coverable)!==!1}function Tt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new qr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function ch(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function hh(e){return re.isString(e)&&e.length>0}function dh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Tt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Tt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,f,E,R,w,L;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${mr((a=e.bd)==null?void 0:a.b.s)} ${(l=Tt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${mr((c=e.bd)==null?void 0:c.t.s)} ${(h=Tt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${mr((f=e.bd)==null?void 0:f.r.s)} ${(E=Tt(e.bd.r.cl))!=null?E:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${mr((w=e.bd)==null?void 0:w.l.s)} ${(L=Tt(e.bd.l.cl))!=null?L:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Tt(e.cl)}; `)}],["va",()=>{e.va===xt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===xt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Kn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Kn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===Ot.LEFT?n+="text-align: left; ":e.ht===Ot.RIGHT?n+="text-align: right; ":e.ht===Ot.CENTER?n+="text-align: center; ":e.ht===Ot.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===tn.BOTTOM?n+="vertical-align: bottom; ":e.vt===tn.TOP?n+="vertical-align: top; ":e.vt===tn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===on.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===on.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,f,E,R,w,L;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(f=e.pd)==null?void 0:f.r}pt`;(E=e.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=e.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(w=e.pd)!=null&&w.l&&(n+=`padding-left: ${l}; `),(L=e.pd)!=null&&L.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function mr(e){let t="";return e===Xe.NONE?t="none":e===Xe.THIN?t="0.5pt solid":e===Xe.HAIR?t="0.5pt double":e===Xe.DOTTED?t="0.5pt dotted":e===Xe.DASHED||e===Xe.DASH_DOT?t="0.5pt dashed":e===Xe.DASH_DOT_DOT?t="0.5pt dotted":e===Xe.DOUBLE?t="0.5pt double":e===Xe.MEDIUM?t="1pt solid":e===Xe.MEDIUM_DASHED||e===Xe.MEDIUM_DASH_DOT?t="1pt dashed":e===Xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===Xe.SLANT_DASH_DOT?t="0.5pt dashed":e===Xe.THICK&&(t="1.5pt solid"),t}function fh(e){let t=0;if(e=e.trim(),e==="none")t=Xe.NONE;else if(e==="0.5pt solid")t=Xe.THIN;else if(e==="0.5pt double")t=Xe.HAIR;else if(e==="0.5pt dotted")t=Xe.DOTTED;else if(e==="0.5pt dashed")t=Xe.DASHED;else if(e==="1pt solid")t=Xe.MEDIUM;else if(e==="1pt dashed")t=Xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=Xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=Xe.THICK;else if(!e.includes("none"))t=Xe.THIN;else return Xe.NONE;return t}function gh(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function mh(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function _h(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Xs(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>Xs(e[n],t[n])):e===t:!1}function Ca(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Xs(n,r)}function ph(e,t){return t.some(n=>e.indexOf(n)>-1)}function Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yr={exports:{}},Eh=yr.exports,Ni;function Ch(){return Ni||(Ni=1,function(e,t){(function(n,r){e.exports=r()})(Eh,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",f="year",E="date",R="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,L=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,J={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(M){var b=["th","st","nd","rd"],O=M%100;return"["+M+(b[(O-20)%10]||b[O]||b[0])+"]"}},z=function(M,b,O){var P=String(M);return!P||P.length>=b?M:""+Array(b+1-P.length).join(O)+M},de={s:z,z:function(M){var b=-M.utcOffset(),O=Math.abs(b),P=Math.floor(O/60),$=O%60;return(b<=0?"+":"-")+z(P,2,"0")+":"+z($,2,"0")},m:function M(b,O){if(b.date()<O.date())return-M(O,b);var P=12*(O.year()-b.year())+(O.month()-b.month()),$=b.clone().add(P,h),V=O-$<0,se=b.clone().add(P+(V?-1:1),h);return+(-(P+(O-$)/(V?$-se:se-$))||0)},a:function(M){return M<0?Math.ceil(M)||0:Math.floor(M)},p:function(M){return{M:h,y:f,w:c,d:u,D:E,h:l,m:a,s:o,ms:i,Q:d}[M]||String(M||"").toLowerCase().replace(/s$/,"")},u:function(M){return M===void 0}},N="en",A={};A[N]=J;var j="$isDayjsObject",Z=function(M){return M instanceof H||!(!M||!M[j])},fe=function M(b,O,P){var $;if(!b)return N;if(typeof b=="string"){var V=b.toLowerCase();A[V]&&($=V),O&&(A[V]=O,$=V);var se=b.split("-");if(!$&&se.length>1)return M(se[0])}else{var he=b.name;A[he]=b,$=he}return!P&&$&&(N=$),$||!P&&N},ae=function(M,b){if(Z(M))return M.clone();var O=typeof b=="object"?b:{};return O.date=M,O.args=arguments,new H(O)},_=de;_.l=fe,_.i=Z,_.w=function(M,b){return ae(M,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var H=function(){function M(O){this.$L=fe(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[j]=!0}var b=M.prototype;return b.parse=function(O){this.$d=function(P){var $=P.date,V=P.utc;if($===null)return new Date(NaN);if(_.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var se=$.match(w);if(se){var he=se[2]-1||0,ge=(se[7]||"0").substring(0,3);return V?new Date(Date.UTC(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)):new Date(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)}}return new Date($)}(O),this.init()},b.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},b.$utils=function(){return _},b.isValid=function(){return this.$d.toString()!==R},b.isSame=function(O,P){var $=ae(O);return this.startOf(P)<=$&&$<=this.endOf(P)},b.isAfter=function(O,P){return ae(O)<this.startOf(P)},b.isBefore=function(O,P){return this.endOf(P)<ae(O)},b.$g=function(O,P,$){return _.u(O)?this[P]:this.set($,O)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(O,P){var $=this,V=!!_.u(P)||P,se=_.p(O),he=function(Y,W){var le=_.w($.$u?Date.UTC($.$y,W,Y):new Date($.$y,W,Y),$);return V?le:le.endOf(u)},ge=function(Y,W){return _.w($.toDate()[Y].apply($.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(W)),$)},Te=this.$W,ye=this.$M,S=this.$D,F="set"+(this.$u?"UTC":"");switch(se){case f:return V?he(1,0):he(31,11);case h:return V?he(1,ye):he(0,ye+1);case c:var G=this.$locale().weekStart||0,X=(Te<G?Te+7:Te)-G;return he(V?S-X:S+(6-X),ye);case u:case E:return ge(F+"Hours",0);case l:return ge(F+"Minutes",1);case a:return ge(F+"Seconds",2);case o:return ge(F+"Milliseconds",3);default:return this.clone()}},b.endOf=function(O){return this.startOf(O,!1)},b.$set=function(O,P){var $,V=_.p(O),se="set"+(this.$u?"UTC":""),he=($={},$[u]=se+"Date",$[E]=se+"Date",$[h]=se+"Month",$[f]=se+"FullYear",$[l]=se+"Hours",$[a]=se+"Minutes",$[o]=se+"Seconds",$[i]=se+"Milliseconds",$)[V],ge=V===u?this.$D+(P-this.$W):P;if(V===h||V===f){var Te=this.clone().set(E,1);Te.$d[he](ge),Te.init(),this.$d=Te.set(E,Math.min(this.$D,Te.daysInMonth())).$d}else he&&this.$d[he](ge);return this.init(),this},b.set=function(O,P){return this.clone().$set(O,P)},b.get=function(O){return this[_.p(O)]()},b.add=function(O,P){var $,V=this;O=Number(O);var se=_.p(P),he=function(ye){var S=ae(V);return _.w(S.date(S.date()+Math.round(ye*O)),V)};if(se===h)return this.set(h,this.$M+O);if(se===f)return this.set(f,this.$y+O);if(se===u)return he(1);if(se===c)return he(7);var ge=($={},$[a]=r,$[l]=s,$[o]=n,$)[se]||1,Te=this.$d.getTime()+O*ge;return _.w(Te,this)},b.subtract=function(O,P){return this.add(-1*O,P)},b.format=function(O){var P=this,$=this.$locale();if(!this.isValid())return $.invalidDate||R;var V=O||"YYYY-MM-DDTHH:mm:ssZ",se=_.z(this),he=this.$H,ge=this.$m,Te=this.$M,ye=$.weekdays,S=$.months,F=$.meridiem,G=function(W,le,oe,B){return W&&(W[le]||W(P,V))||oe[le].slice(0,B)},X=function(W){return _.s(he%12||12,W,"0")},Y=F||function(W,le,oe){var B=W<12?"AM":"PM";return oe?B.toLowerCase():B};return V.replace(L,function(W,le){return le||function(oe){switch(oe){case"YY":return String(P.$y).slice(-2);case"YYYY":return _.s(P.$y,4,"0");case"M":return Te+1;case"MM":return _.s(Te+1,2,"0");case"MMM":return G($.monthsShort,Te,S,3);case"MMMM":return G(S,Te);case"D":return P.$D;case"DD":return _.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return G($.weekdaysMin,P.$W,ye,2);case"ddd":return G($.weekdaysShort,P.$W,ye,3);case"dddd":return ye[P.$W];case"H":return String(he);case"HH":return _.s(he,2,"0");case"h":return X(1);case"hh":return X(2);case"a":return Y(he,ge,!0);case"A":return Y(he,ge,!1);case"m":return String(ge);case"mm":return _.s(ge,2,"0");case"s":return String(P.$s);case"ss":return _.s(P.$s,2,"0");case"SSS":return _.s(P.$ms,3,"0");case"Z":return se}return null}(W)||se.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(O,P,$){var V,se=this,he=_.p(P),ge=ae(O),Te=(ge.utcOffset()-this.utcOffset())*r,ye=this-ge,S=function(){return _.m(se,ge)};switch(he){case f:V=S()/12;break;case h:V=S();break;case d:V=S()/3;break;case c:V=(ye-Te)/6048e5;break;case u:V=(ye-Te)/864e5;break;case l:V=ye/s;break;case a:V=ye/r;break;case o:V=ye/n;break;default:V=ye}return $?V:_.a(V)},b.daysInMonth=function(){return this.endOf(h).$D},b.$locale=function(){return A[this.$L]},b.locale=function(O,P){if(!O)return this.$L;var $=this.clone(),V=fe(O,P,!0);return V&&($.$L=V),$},b.clone=function(){return _.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},M}(),v=H.prototype;return ae.prototype=v,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",f],["$D",E]].forEach(function(M){v[M[1]]=function(b){return this.$g(b,M[0],M[1])}}),ae.extend=function(M,b){return M.$i||(M(b,H,ae),M.$i=!0),ae},ae.locale=fe,ae.isDayjs=Z,ae.unix=function(M){return ae(1e3*M)},ae.en=A[N],ae.Ls=A,ae.p={},ae})}(yr)),yr.exports}var Rh=Ch();const Pt=Ct(Rh);var Ar={exports:{}},Ih=Ar.exports,Mi;function Sh(){return Mi||(Mi=1,function(e,t){(function(n,r){e.exports=r()})(Ih,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(Ar)),Ar.exports}var vh=Sh();const Oh=Ct(vh);var Tr={exports:{}},wh=Tr.exports,Di;function bh(){return Di||(Di=1,function(e,t){(function(n,r){e.exports=r()})(wh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(w){return(w=+w)+(w>68?1900:2e3)},c=function(w){return function(L){this[w]=+L}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(L){if(!L||L==="Z")return 0;var J=L.match(/([+-]|\d\d)/g),z=60*J[1]+(+J[2]||0);return z===0?0:J[0]==="+"?-z:z}(w)}],d=function(w){var L=l[w];return L&&(L.indexOf?L:L.s.concat(L.f))},f=function(w,L){var J,z=l.meridiem;if(z){for(var de=1;de<=24;de+=1)if(w.indexOf(z(de,0,L))>-1){J=de>12;break}}else J=w===(L?"pm":"PM");return J},E={A:[a,function(w){this.afternoon=f(w,!1)}],a:[a,function(w){this.afternoon=f(w,!0)}],Q:[s,function(w){this.month=3*(w-1)+1}],S:[s,function(w){this.milliseconds=100*+w}],SS:[i,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(w){var L=l.ordinal,J=w.match(/\d+/);if(this.day=J[0],L)for(var z=1;z<=31;z+=1)L(z).replace(/\[|\]/g,"")===w&&(this.day=z)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(w){var L=d("months"),J=(d("monthsShort")||L.map(function(z){return z.slice(0,3)})).indexOf(w)+1;if(J<1)throw new Error;this.month=J%12||J}],MMMM:[a,function(w){var L=d("months").indexOf(w)+1;if(L<1)throw new Error;this.month=L%12||L}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(w){this.year=u(w)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function R(w){var L,J;L=w,J=l&&l.formats;for(var z=(w=L.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(ae,_,H){var v=H&&H.toUpperCase();return _||J[H]||n[H]||J[v].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(M,b,O){return b||O.slice(1)})})).match(r),de=z.length,N=0;N<de;N+=1){var A=z[N],j=E[A],Z=j&&j[0],fe=j&&j[1];z[N]=fe?{regex:Z,parser:fe}:A.replace(/^\[|\]$/g,"")}return function(ae){for(var _={},H=0,v=0;H<de;H+=1){var M=z[H];if(typeof M=="string")v+=M.length;else{var b=M.regex,O=M.parser,P=ae.slice(v),$=b.exec(P)[0];O.call(_,$),ae=ae.replace($,"")}}return function(V){var se=V.afternoon;if(se!==void 0){var he=V.hours;se?he<12&&(V.hours+=12):he===12&&(V.hours=0),delete V.afternoon}}(_),_}}return function(w,L,J){J.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(u=w.parseTwoDigitYear);var z=L.prototype,de=z.parse;z.parse=function(N){var A=N.date,j=N.utc,Z=N.args;this.$u=j;var fe=Z[1];if(typeof fe=="string"){var ae=Z[2]===!0,_=Z[3]===!0,H=ae||_,v=Z[2];_&&(v=Z[2]),l=this.$locale(),!ae&&v&&(l=J.Ls[v]),this.$d=function(P,$,V,se){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*P);var he=R($)(P),ge=he.year,Te=he.month,ye=he.day,S=he.hours,F=he.minutes,G=he.seconds,X=he.milliseconds,Y=he.zone,W=he.week,le=new Date,oe=ye||(ge||Te?1:le.getDate()),B=ge||le.getFullYear(),te=0;ge&&!Te||(te=Te>0?Te-1:le.getMonth());var ie,me=S||0,be=F||0,De=G||0,K=X||0;return Y?new Date(Date.UTC(B,te,oe,me,be,De,K+60*Y.offset*1e3)):V?new Date(Date.UTC(B,te,oe,me,be,De,K)):(ie=new Date(B,te,oe,me,be,De,K),W&&(ie=se(ie).week(W).toDate()),ie)}catch{return new Date("")}}(A,fe,j,J),this.init(),v&&v!==!0&&(this.$L=this.locale(v).$L),H&&A!=this.format(fe)&&(this.$d=new Date("")),l={}}else if(fe instanceof Array)for(var M=fe.length,b=1;b<=M;b+=1){Z[1]=fe[b-1];var O=J.apply(this,Z);if(O.isValid()){this.$d=O.$d,this.$L=O.$L,this.init();break}b===M&&(this.$d=new Date(""))}else de.call(this,N)}}})}(Tr)),Tr.exports}var yh=bh();const Ah=Ct(yh);var Nr={exports:{}},Th=Nr.exports,Li;function Nh(){return Li||(Li=1,function(e,t){(function(n,r){e.exports=r()})(Th,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,E,R){var w=h.name?h:h.$locale(),L=o(w[d]),J=o(w[f]),z=L||J.map(function(N){return N.slice(0,E)});if(!R)return z;var de=w.weekStart;return z.map(function(N,A){return z[(A+(de||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(E,R,w){return R||w.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Nr)),Nr.exports}var Mh=Nh();const Dh=Ct(Mh);var Mr={exports:{}},Lh=Mr.exports,xi;function xh(){return xi||(xi=1,function(e,t){(function(n,r){e.exports=r()})(Lh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,E,R){var w=R&&R.toUpperCase();return E||d[R]||n[R]||d[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(L,J,z){return J||z.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Mr)),Mr.exports}var Uh=xh();const kh=Ct(Uh);var Dr={exports:{}},Ph=Dr.exports,Ui;function Fh(){return Ui||(Ui=1,function(e,t){(function(n,r){e.exports=r()})(Ph,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(R){var w={date:R,utc:!0,args:arguments};return new o(w)},l.utc=function(R){var w=a(this.toDate(),{locale:this.$L,utc:!0});return R?w.add(this.utcOffset(),n):w},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(R){R.utc&&(this.$u=!0),this.$utils().u(R.$offset)||(this.$offset=R.$offset),u.call(this,R)};var c=l.init;l.init=function(){if(this.$u){var R=this.$d;this.$y=R.getUTCFullYear(),this.$M=R.getUTCMonth(),this.$D=R.getUTCDate(),this.$W=R.getUTCDay(),this.$H=R.getUTCHours(),this.$m=R.getUTCMinutes(),this.$s=R.getUTCSeconds(),this.$ms=R.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(R,w){var L=this.$utils().u;if(L(R))return this.$u?0:L(this.$offset)?h.call(this):this.$offset;if(typeof R=="string"&&(R=function(N){N===void 0&&(N="");var A=N.match(r);if(!A)return null;var j=(""+A[0]).match(s)||["-",0,0],Z=j[0],fe=60*+j[1]+ +j[2];return fe===0?0:Z==="+"?fe:-fe}(R),R===null))return this;var J=Math.abs(R)<=16?60*R:R,z=this;if(w)return z.$offset=J,z.$u=R===0,z;if(R!==0){var de=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(z=this.local().add(J+de,n)).$offset=J,z.$x.$localOffset=de}else z=this.utc();return z};var d=l.format;l.format=function(R){var w=R||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,w)},l.valueOf=function(){var R=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*R},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(R){return R==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var E=l.diff;l.diff=function(R,w,L){if(R&&this.$u===R.$u)return E.call(this,R,w,L);var J=this.local(),z=a(R).local();return E.call(J,z,w,L)}}})}(Dr)),Dr.exports}var $h=Fh();const Bh=Ct($h);var Lr={exports:{}},Hh=Lr.exports,ki;function jh(){return ki||(ki=1,function(e,t){(function(n,r){e.exports=r()})(Hh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(Lr)),Lr.exports}var Wh=jh();const Yh=Ct(Wh);var xr={exports:{}},zh=xr.exports,Pi;function Vh(){return Pi||(Pi=1,function(e,t){(function(n,r){e.exports=r()})(zh,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(xr)),xr.exports}var Gh=Vh();const Kh=Ct(Gh);var Ur={exports:{}},Xh=Ur.exports,Fi;function qh(){return Fi||(Fi=1,function(e,t){(function(n,r){e.exports=r()})(Xh,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(Ur)),Ur.exports}var Jh=qh();const Zh=Ct(Jh);Pt.extend(Ah);Pt.extend(Oh);Pt.extend(Yh);Pt.extend(Dh);Pt.extend(Kh);Pt.extend(Zh);Pt.extend(Bh);Pt.extend(kh);function Jr(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function Qh(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function ed(e){if(e==null)return!1;const t=e.paragraphStyle;return Ra(t)}function Ra(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 Ia(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Sa(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function td(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function nd(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ke=Symbol("newer"),st=Symbol("older");class rd{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.key}):{done:!0,value:void 0}}}class sd{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.value}):{done:!0,value:void 0}}}class id{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Lo,xo;xo=Ke,Lo=st;class $i{constructor(t,n){C(this,"key");C(this,"value");C(this,xo);C(this,Lo);this.key=t,this.value=n,this[Ke]=void 0,this[st]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Xn{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(Fn.hasLength(t,1)){if(Fn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Fn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Fn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),nt(()=>er(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ke]&&(t===this.oldest&&(this.oldest=t[Ke]),t[Ke][st]=t[st]),t[st]&&(t[st][Ke]=t[Ke]),t[Ke]=void 0,t[st]=this.newest,this.newest&&(this.newest[Ke]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new $i(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ke]=o,o[st]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new $i(t,n)),this.newest?(this.newest[Ke]=r,r[st]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ke]?(this.oldest=this.oldest[Ke],this.oldest[st]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ke]=t[st]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ke]&&n[st]?(n[st][Ke]=n[Ke],n[Ke][st]=n[st]):n[Ke]?(n[Ke][st]=void 0,this.oldest=n[Ke]):n[st]?(n[st][Ke]=void 0,this.newest=n[st]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new rd(this.oldest)}values(){return new sd(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new id(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ke]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ke];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ke],n&&(t+=" < ");return t}}class Fn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var kr={exports:{}},od=kr.exports,Bi;function ad(){return Bi||(Bi=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:od,function(){return function(){var n={d:function(p,g){for(var m in g)n.o(g,m)&&!n.o(p,m)&&Object.defineProperty(p,m,{enumerable:!0,get:g[m]})},o:function(p,g){return Object.prototype.hasOwnProperty.call(p,g)}},r={};n.d(r,{default:function(){return ct}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(p){const g=i.exec(p);if(!g)throw new SyntaxError("Malformed locale: ".concat(p));return{lang:g[1]+(g[2]?"_"+g[2]:""),language:g[1],territory:g[2]||"",codeset:g[3]||"",modifier:g[4]||""}}function u(p){if(typeof p=="number")return s[65535&p]||null;const g=parseInt(p,16);return isFinite(g)&&s[65535&g]?s[65535&g]||null:i.test(p)?p:null}function c(p){const g=u(p);let m=null;if(g){const y=l(g);m=o[y.lang]||o[y.language]||null}return m}function h(p){return Object.assign({},a,p)}function d(p,g){const m=typeof g=="object"?g:l(g);return o[m.lang]=h(p),m.language===m.lang||o[m.language]||(o[m.language]=h(p)),o[m.lang]}const f=h({group:","});function E(p,g){if(typeof p!="number")return p;if(p<0)return-E(-p,g);if(g){const m=10**(g||0)||1;return E(p*m,0)/m}return Math.round(p)}f.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function R(p,g,m){const y=p<0?-1:1,T=10**(g||2),U=10**(m||2);let x,k,I=Math.abs(p),Q=0,pe=0,q=0,_e=1;if((p=I)%1==0)k=[p*y,1];else if(p<1e-19)k=[y,1e19];else if(p>1e19)k=[1e19*y,1];else{do if(I=1/(I-Math.floor(I)),x=_e,_e=_e*Math.floor(I)+Q,Q=x,pe=q,q=Math.floor(p*_e+.5),q>=T||_e>=U)return[y*pe,Q];while(Math.abs(p-q/_e)>=1e-10&&I!==Math.floor(I));k=[y*q,_e]}return k}const w={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},L=Object.assign({},w);function J(p){if(p===null&&(p=w),p){for(const g in p)if(g in w){const m=p[g];L[g]=m==null?w[g]:m}}return{...L}}const z={"#":"",0:"0","?":" "},de={"@":"text","-":"minus","+":"plus"},N=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],A=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+A.join("")+"]");function Z(p,g,m){return g[m+"_max"]=p.length,g[m+"_min"]=p.replace(/#/g,"").length,g}const fe={};function ae(p){if(!(p in fe)){const g=[],m=p.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,y=>"?".repeat(y.length));for(let y=0;y<m.length;y++){const T=m.charAt(y);g[y]=T in z?z[T]:T}fe[p]=g.join("")}return fe[p]}function _(p,g){typeof p=="string"&&(p={type:"string",value:p=p.replace(/ /g,z["?"])}),g.push(p)}function H(p){const g=[],m={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:g};let y=p+"",T="int",U=!1,x=null;const k=[];let I,Q,pe=!1;for(;y&&!U;){if(I=/^General/i.exec(y))m.general=!0,_({type:"general"},g);else if(T==="int"&&(I=/^[#?0]+(?:,[#?0]+)*/.exec(y))||T==="den"&&(I=/^[#?\d]+/.exec(y))||(I=/^[#?0]+/.exec(y)))m[T+"_pattern"].push(I[0]),x={type:T,num:I[0]},_(x,g);else if((I=/^\//.exec(y))&&m[T+"_pattern"].length){if(!x)throw new SyntaxError("Missing a numerator in pattern ".concat(p));m.fractions=!0,m.num_pattern.push(m[T+"_pattern"].pop()),x.type="num",T="den",_({type:"div"},g)}else if(I=/^,+/.exec(y)){const D=y.charAt(1)in z;Q.slice(-1)in z&&(I[0].length>1||!D)?m.scale=.001**I[0].length:m.dec_fractions||_(I[0],g)}else{if(I=/^;/.exec(y)){U=!0;break}if(I=/^[@+-]/.exec(y))I[0]==="@"&&(m.text=!0),_({type:de[I[0]]},g);else if(I=/^(?:\[(h+|m+|s+)\])/i.exec(y)){const D=I[1].toLowerCase(),ee=D[0],Ce={type:"",size:0,date:1,raw:I[0],pad:D.length};ee==="h"?(Ce.size=16,Ce.type="hour-elap"):ee==="m"?(Ce.size=32,Ce.type="min-elap"):(Ce.size=64,Ce.type="sec-elap"),m.date=m.date|Ce.size,k.push(Ce),_(Ce,g)}else if(I=/^(?:B2)/i.exec(y))pe||(m.date_system=6);else if(I=/^(?:B1)/i.exec(y))pe||(m.date_system=1);else if(I=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(y)){const D={type:"",size:0,date:1,raw:I[0]},ee=I[0].toLowerCase(),Ce=ee[0];if(ee==="y"||ee==="yy")D.size=2,D.type="year-short";else if(Ce==="y"||Ce==="e")D.size=2,D.type="year";else if(ee==="b"||ee==="bb")D.size=2,D.type="b-year-short";else if(Ce==="b")D.size=2,D.type="b-year";else if(ee==="d"||ee==="dd")D.size=8,D.type="day",D.pad=/dd/.test(ee);else if(ee==="ddd")D.size=8,D.type="weekday-short";else if(Ce==="d")D.size=8,D.type="weekday";else if(Ce==="h")D.size=16,D.type="hour",D.pad=/hh/i.test(ee);else if(Ce==="m"){ee.length===3?(D.size=4,D.type="monthname-short"):ee.length===5?(D.size=4,D.type="monthname-single"):ee.length>=4&&(D.size=4,D.type="monthname");const Ae=k[k.length-1];!D.type&&Ae&&!Ae.used&&80&Ae.size&&(Ae.used=!0,D.size=32,D.type="min",D.pad=/mm/.test(ee)),D.type||(D.size=4,D.type="month",D.pad=/mm/.test(ee),D.indeterminate=!0)}else if(Ce==="s"){D.size=64,D.type="sec",D.pad=/ss/.test(ee);const Ae=k[k.length-1];Ae&&32&Ae.size?D.used=!0:Ae&&Ae.indeterminate&&(delete Ae.indeterminate,Ae.size=32,Ae.type="min",D.used=!0)}m.date=m.date|D.size,m.date_eval=!0,k.push(D),_(D,g)}else if(I=/^(?:AM\/PM|am\/pm|A\/P)/.exec(y))m.clock=12,m.date=16|m.date,m.date_eval=!0,_({type:"am",short:I[0]==="A/P"},g);else if(m.date&&(I=/^\.0{1,3}/i.exec(y))){const D=I[0].length-1,ee=[64,128,256,512][D];m.date=m.date|ee,m.date_eval=!0,m.sec_decimals=Math.max(m.sec_decimals,D),_({type:"subsec",size:ee,decimals:D,date:1,raw:I[0]},g)}else if((I=/^\\(.)/.exec(y))||(I=/^"([^"]*?)"/.exec(y)))_(I[1],g);else if(I=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(y))m.condition=[I[1],parseFloat(I[2],10)];else if(I=/^\[\$([^\]]+)\]/.exec(y)){const D=I[1].split("-"),ee=D.length<2?"":D[D.length-1],Ce=D[0];Ce&&_(Ce,g);const Ae=u(ee);Ae&&(m.locale=Ae);const Ue=parseInt(ee,16);isFinite(Ue)&&16711680&Ue&&(Ue>>16&255)===6&&(m.date_system=6),pe=!0}else if(I=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(y))m.color=I[2]?N[parseInt(I[2],10)]||"#000":I[1].toLowerCase();else if(!(I=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(y))){if(I=/^%/.exec(y))m.scale=100,m.percent=!0,_("%",g);else if(I=/^_(\\.|.)/.exec(y))_(" ",g);else if(I=/^\./.exec(y))_({type:"point",value:I[0]},g),m.dec_fractions=!0,T="frac";else if(I=/^[Ee]([+-]?|(?=[0#?]))/.exec(y))m.exponential=!0,m.exp_plus=I[1]==="+",T="man",_({type:"exp",plus:I[1]==="+"},g);else if(!(I=/^\*(\\.|.)/.exec(y))){if(I=/^[BENn[]/.exec(y))throw new SyntaxError("Unexpected char ".concat(y.charAt(0)," in pattern ").concat(p));y[0]==="("&&(m.parens=!0),I=[y[0]],_(I[0],g)}}}Q=I[0],y=y.slice(I?I[0].length:1)}if(m.pattern=p.slice(0,p.length-y.length),/^((?:\[[^\]]+\])+)(;|$)/.test(m.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(m.pattern)&&_({type:"text"},g),m.fractions&&m.dec_fractions||m.fractions&&m.exponential)throw new SyntaxError("Invalid pattern: ".concat(m.pattern));const q=m.int_pattern.join("");if(m.grouping=q.indexOf(",")>=0,m.grouping){const D=q.split(","),ee=D.length;ee===2?(m.group_pri=D[1].length,m.group_sec=m.group_pri):ee>2&&(m.group_pri=D[ee-1].length,m.group_sec=D[ee-2].length)}else m.group_pri=0,m.group_sec=0;Z(q.replace(/[,]/g,""),m,"int"),Z(m.frac_pattern.join(""),m,"frac"),Z(m.man_pattern.join(""),m,"man");let _e=m.num_pattern.join(""),Oe=m.den_pattern.join("");const ue=/\?/.test(Oe)||/\?/.test(_e);return Oe=Oe.replace(/\d/g,ue?"?":"#"),ue&&(Oe=Oe.replace(/#$/g,"?")),Z(_e,m,"num"),Z(Oe,m,"den"),ue&&(_e=_e.replace(/#$/g,"?")),m.int_padding=ae(m.int_pattern.join("")),m.man_padding=ae(m.man_pattern.join("")),m.num_padding=ae(_e),m.den_padding=ae(Oe),m.den_pattern.length&&(m.denominator=parseInt(m.den_pattern.join("").replace(/\D/g,""),10)),m.integer=!!m.int_pattern.join("").length,m.fractions&&g.forEach((D,ee)=>{const Ce=g[ee+1];D.type==="string"&&Ce&&(Ce.type==="num"?D.rule="num+int":Ce.type==="div"?D.rule="num":Ce.type==="den"&&(D.rule="den"))}),m}const v=p=>{const g=p.condition;g&&g[1]<0&&(g[0]==="<"||g[0]==="<="||g[0]==="=")||p.tokens.unshift({type:"minus",volatile:!0})};function M(p){const g=[];let m,y=!1,T=null,U=p,x=0,k=!1,I=0,Q=0;do{if(k=H(U),(k.date||k.general)&&(k.int_pattern.length||k.frac_pattern.length||k.scale!==1||k.text))throw new Error("Illegal format");if(k.condition&&(Q++,y=!0),k.text){if(T)throw new Error("Unexpected partition");T=k}k.locale&&(m=u(k.locale)),g.push(k),x=U.charAt(k.pattern.length)===";"?1:0,U=U.slice(k.pattern.length+x),I++}while(x&&I<4&&Q<3);if(x)throw new Error("Unexpected partition");if(Q>2)throw new Error("Unexpected condition");const pe=g[3];if(pe&&(pe.int_pattern.length||pe.frac_pattern.length||pe.date))throw new Error("Unexpected partition");if(y){const q=g.length;if(q===1&&(g[1]=H("General"),g[1].generated=!0),q<3){const _e=g[0],Oe=g[1];if(v(_e),Oe.condition)v(Oe);else{const ue=_e.condition;(ue[0]==="="||ue[1]>=0&&(ue[0]===">"||ue[0]===">="))&&Oe.tokens.unshift({type:"minus",volatile:!0})}}else g.forEach(v)}else{if(g.length<4&&T)for(let q=0,_e=g.length;q<_e;q++)g[q]===T&&g.splice(q,1);if(g.length<1&&T&&(g[0]=H("General"),g[0].generated=!0),g.length<2){const q=H(g[0].pattern);q.tokens.unshift({type:"minus",volatile:!0}),q.generated=!0,g.push(q)}if(g.length<3){const q=H(g[0].pattern);q.generated=!0,g.push(q)}if(g.length<4)if(T)g.push(T);else{const q=H("@");q.generated=!0,g.push(q)}g[0].condition=[">",0],g[1].condition=["<",0],g[2].condition=null}return{pattern:p,partitions:g,locale:m}}const b=Math.floor;function O(p){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&p>=0){if(p===0)return[1900,1,0];if(p===60)return[1900,2,29];if(p<60)return[1900,p<32?1:2,(p-1)%31+1]}let m=p+68569+2415019;const y=b(4*m/146097);m-=b((146097*y+3)/4);const T=b(4e3*(m+1)/1461001);m=m-b(1461*T/4)+31;const U=b(80*m/2447),x=m-b(2447*U/80);m=b(U/11);const k=U+2-12*m;return[0|100*(y-49)+T+m,0|k,0|x]}function P(p){return O(p+1462)}function $(p){if(p===60)throw new Error("#VALUE!");if(p<=1)return[1317,8,29];if(p<60)return[1317,p<32?9:10,1+(p-2)%30];const g=10631/30,m=.1335;let y=p+466935;const T=b(y/10631);y-=10631*T;const U=b((y-m)/g);y-=b(U*g+m);const x=b((y+28.5001)/29.5);return x===13?[30*T+U,12,30]:[30*T+U,x,y-b(29.5001*x-29)]}function V(p){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const y=b(p);return g===6?$(y):g===-1?P(y):O(y,m)}const se=Math.floor,he=86400;function ge(p,g){let m=null;if(Array.isArray(p)){const[y,T,U,x,k,I]=p;m=Date.UTC(y,T==null?0:T-1,U!=null?U:1,x||0,k||0,I||0)}else if(p instanceof Date&&(m=1*p,!g||!g.ignoreTimezone)){const y=new Date;y.setUTCFullYear(p.getFullYear(),p.getMonth(),p.getDate()),y.setUTCHours(p.getHours(),p.getMinutes(),p.getSeconds(),p.getMilliseconds()),m=1*y}if(m!=null&&isFinite(m)){const y=m/864e5;return y-(y<=-25509?-25568:-25569)}return p}function Te(p,g){let m=0|p;const y=he*(p-m);let T=se(y);y-T>.9999&&(T+=1,T===he&&(T=0,m+=1));const U=T<0?he+T:T,[x,k,I]=V(p,0,g&&g.leap1900),Q=se(U/60/60)%60,pe=se(U/60)%60,q=se(U)%60;if(g&&g.nativeDate){const _e=new Date(0);return _e.setUTCFullYear(x,k-1,I),_e.setUTCHours(Q,pe,q),_e}return[x,k,I,Q,pe,q]}function ye(p){return!!(p[0]&&p[0].percent||p[1]&&p[1].percent||p[2]&&p[2].percent||p[3]&&p[3].percent)}function S(p){return!!(p[0]&&p[0].date||p[1]&&p[1].date||p[2]&&p[2].date||p[3]&&p[3].date)}function F(p){const[g,m,y,T]=p;return!(g&&!g.generated||m&&!m.generated||y&&!y.generated||!T||!T.text||T.generated)}const G={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},X=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],Y={total:1,sign:0,period:0,int:1,frac:0},W=(p,g)=>p.replace(/\./,g.decimal);function le(p,g,m,y){const T=0|m;if(typeof m=="string")p.push(m);else if(m===T)p.push(Math.abs(T));else{const U=Math.abs(m);let x=U?Math.floor(Math.log10(U)):0,k=x<0?U*10**-x:U/10**x;k===10&&(k=1,x++);const I=function(pe){let q=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const _e=Math.abs(pe);if(!_e)return Y;const Oe=q&&pe<0?1:0,ue=Math.floor(_e),D=Math.floor(Math.log10(_e)+1);let ee=0,Ce=0;if(ue!==_e){ee=1;const Ae=String(E(D<0?_e*10**-D:_e/10**D,15));let Ue=Ae.length,Pe=!0,We=0;for(;We<=Ae.length;){if(Ae[We]==="."){Ue--;break}Ae[We]==="0"&&Pe?Ue--:Pe=!1,We++}Ce=Ue-D,Ce<0&&(Ce=0,ee=0)}return{total:Oe+Math.max(D,1)+ee+Ce,digits:Math.max(D,0)+Ce,sign:Oe,period:ee,int:Math.max(D,1),frac:Ce}}(U),Q=()=>{const pe=Math.abs(x);let q;q=k===1?k:E(k,5),p.push(W(q+"",y),y.exponent,x<0?y.negative:y.positive,pe<10?"0":"",pe)};if(x>=-4&&x<=-1){const pe=U.toPrecision(10+x).replace(/\.?0+$/,"");p.push(W(pe,y))}else if(x===10){const pe=U.toFixed(10).slice(0,12).replace(/\.$/,"");p.push(W(pe,y))}else if(Math.abs(x)<=9)if(I.total<=11){const pe=E(U,9).toFixed(I.frac);p.push(W(pe,y))}else x===9?p.push(Math.floor(U)):x>=0&&x<9?p.push(E(U,9-x)):Q();else I.total>=12?Q():Math.floor(U)===U?p.push(Math.floor(U)):p.push(W(E(U,9).toFixed(I.frac),y))}return p}const oe=86400,B={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},te=function(p){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const m=Math.floor(Math.log10(p));return g>1?Math.floor(m/g)*g:m};function ie(p,g,m,y){let T="",U="",x="",k="",I="",Q=0,pe=0|p,q=0,_e=0,Oe=1,ue=0,D=0,ee=0,Ce=0,Ae=0,Ue=0;const Pe=y||f;if(!g.text&&isFinite(g.scale)&&g.scale!==1&&(p=function(Se){if(Se===0)return Se;const Me=Math.ceil(Math.log10(Se<0?-Se:Se)),ne=10**(16-Math.floor(Me));return Math.round(Se*ne)/ne}(p*g.scale)),g.exponential){let Se=Math.abs(p);if(Se){const Me=10**-te(Se,g.int_max),ne=E(Se*Me,g.frac_max)/Me;Q=te(ne,g.int_max)}Se/=10**Q,p=p<0?-Se:Se,T+=Math.abs(Q)}if(g.integer){const Se=Math.abs(E(p,g.fractions?1:g.frac_max));I+=Se<1?"":Math.floor(Se)}if(g.grouping){let Se="",Me=I.length;for(Me>g.group_pri&&(Me-=g.group_pri,Se=Pe.group+I.slice(Me,Me+g.group_pri)+Se);Me>g.group_sec;)Me-=g.group_sec,Se=Pe.group+I.slice(Me,Me+g.group_sec)+Se;I=Me?I.slice(0,Me)+Se:Se}g.dec_fractions&&(k=String(E(p,g.frac_max)).split(".")[1]||"");let We=!1;if(g.fractions){const Se=Math.abs(g.integer?p%1:p);if(Se)if(We=!0,isFinite(g.denominator))x+=g.denominator,U+=E(Se*g.denominator),U==="0"&&(U="",x="",We=!1,I||(I="0"));else{const Me=R(Se,g.integer?g.num_max:1/0,g.den_max);U+=Me[0],x+=Me[1],g.integer&&U==="0"&&(I||(I="0"),U="",x="",We=!1)}}if(g.date){pe=Math.trunc(p);const Se=oe*(p-pe);if(q=Math.floor(Se),Ue=Se-q,Math.abs(Ue)<1e-6?Ue=0:Ue>.9999&&(Ue=0,q+=1,q===oe&&(q=0,pe+=1)),Ue){const Me=512&g.date||256&g.date||128&g.date;(Me===512&&Ue>.9995||Me===256&&Ue>.995||Me===128&&Ue>.95||!Me&&Ue>=.5)&&(q++,Ue=0)}if(pe||g.date_system){const Me=V(p,g.date_system,m.leap1900);_e=Me[0],Oe=Me[1],ue=Me[2]}if(q){const Me=q<0?oe+q:q;Ae=Math.floor(Me)%60,Ce=Math.floor(Me/60)%60,ee=Math.floor(Me/60/60)%60}if(D=(6+pe)%7,g.date_eval&&(ht=p,ft=pe+q/oe,m.dateSpanLarge?ht<-694324||ft>=35830291:ht<0||ft>=2958466)){if(m.dateErrorThrows)throw new Error("Date out of bounds");return m.dateErrorNumber?le(p<0?[Pe.negative]:[],0,p,Pe).join(""):m.overflow}}var ht,ft;if(g.int_padding&&(I=g.int_padding.length===1?I||g.int_padding:g.int_padding.substring(0,g.int_padding.length-I.length)+I),g.num_padding&&(U=g.num_padding.length===1?U||g.num_padding:g.num_padding.substring(0,g.num_padding.length-U.length)+U),g.den_padding&&(x=g.den_padding.length===1?x||g.den_padding:x+g.den_padding.slice(x.length)),g.man_padding){const Se=g.exp_plus?"+":"";T=g.man_padding.length===1?(Q<0?"-":Se)+(T||g.man_padding):(Q<0?"-":Se)+g.man_padding.slice(0,g.man_padding.length-T.length)+T}const Ee=[];let Qe=0;const ve={int:0,frac:0,man:0,num:0,den:0};for(let Se=0,Me=g.tokens.length;Se<Me;Se++){const ne=g.tokens[Se],at=ne.num?ne.num.length:0;if(ne.type==="string")ne.rule?ne.rule==="num"?We?Ee.push(ne.value):(g.num_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,z["?"])):ne.rule==="num+int"?We&&I?Ee.push(ne.value):g.den_min>0&&(I||g.num_min)&&Ee.push(ne.value.replace(/./g,z["?"])):ne.rule==="den"&&(We?Ee.push(ne.value):(g.den_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,z["?"]))):Ee.push(ne.value);else if(ne.type==="error")Ee.push(m.invalid);else if(ne.type==="point")Ee.push(g.date?ne.value:Pe.decimal);else if(ne.type==="general")le(Ee,0,p,Pe);else if(ne.type==="exp")Ee.push(Pe.exponent);else if(ne.type==="minus")ne.volatile&&g.date||ne.volatile&&(p>=0||typeof p!="number")||(ne.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(p<0&&I&&I!=="0"||k)&&Ee.push(Pe.negative):Ee.push(Pe.negative));else if(ne.type==="plus")Ee.push(Pe.positive);else if(ne.type==="text")Ee.push(p);else if(ne.type==="div")We?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(z["?"]):Ee.push(z["#"]);else if(ne.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const Be=Qe?g.int_pattern.join("").length-ve.int:1/0,At=Qe===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+ne.num.length);Ee.push(I.substring(I.length-Be,I.length-At)),Qe++,ve.int+=ne.num.length}else if(ne.type==="frac"){const Be=ve.frac;for(let At=0;At<at;At++)Ee.push(k[At+Be]||z[ne.num[At]]);ve.frac+=at}else if(ne.type in B)g[ne.type+"_pattern"].length===1?(ne.type==="int"&&Ee.push(I),ne.type==="frac"&&Ee.push(k),ne.type==="man"&&Ee.push(T),ne.type==="num"&&Ee.push(U),ne.type==="den"&&Ee.push(x)):(Ee.push(B[ne.type].slice(ve[ne.type],ve[ne.type]+at)),ve[ne.type]+=at);else if(ne.type==="year")_e<0&&Ee.push(Pe.negative),Ee.push(String(Math.abs(_e)).padStart(4,"0"));else if(ne.type==="year-short"){const Be=_e%100;Ee.push(Be<10?"0":"",Be)}else if(ne.type==="month")Ee.push(ne.pad&&Oe<10?"0":"",Oe);else if(ne.type==="monthname-single")g.date_system===6?Ee.push(Pe.mmmm6[Oe-1].charAt(0)):Ee.push(Pe.mmmm[Oe-1].charAt(0));else if(ne.type==="monthname-short")g.date_system===6?Ee.push(Pe.mmm6[Oe-1]):Ee.push(Pe.mmm[Oe-1]);else if(ne.type==="monthname")g.date_system===6?Ee.push(Pe.mmmm6[Oe-1]):Ee.push(Pe.mmmm[Oe-1]);else if(ne.type==="weekday-short")Ee.push(Pe.ddd[D]);else if(ne.type==="weekday")Ee.push(Pe.dddd[D]);else if(ne.type==="day")Ee.push(ne.pad&&ue<10?"0":"",ue);else if(ne.type==="hour"){const Be=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(ne.pad&&Be<10?"0":"",Be)}else if(ne.type==="min")Ee.push(ne.pad&&Ce<10?"0":"",Ce);else if(ne.type==="sec")Ee.push(ne.pad&&Ae<10?"0":"",Ae);else if(ne.type==="subsec"){Ee.push(Pe.decimal);const Be=Ue.toFixed(g.sec_decimals);Ee.push(Be.slice(2,2+ne.decimals))}else if(ne.type==="am"){const Be=ee<12?0:1;ne.short&&!y?Ee.push("AP"[Be]):Ee.push(Pe.ampm[Be])}else if(ne.type==="hour-elap"){p<0&&Ee.push(Pe.negative);const Be=24*pe+Math.floor(Math.abs(q)/3600);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="min-elap"){p<0&&Ee.push(Pe.negative);const Be=1440*pe+Math.floor(Math.abs(q)/60);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="sec-elap"){p<0&&Ee.push(Pe.negative);const Be=pe*oe+Math.abs(q);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="b-year")Ee.push(_e+543);else if(ne.type==="b-year-short"){const Be=(_e+543)%100;Ee.push(Be<10?"0":"",Be)}}return m.nbsp?Ee.join(""):Ee.join("").replace(/\u00a0/g," ")}function me(p,g){for(let m=0;m<3;m++){const y=g[m];if(y){let T;if(y.condition){const U=y.condition[0],x=y.condition[1];U==="="?T=p===x:U===">"?T=p>x:U==="<"?T=p<x:U===">="?T=p>=x:U==="<="?T=p<=x:U==="<>"&&(T=p!==x)}else T=!0;if(T)return y}}}const be=H("@"),De="black",K={};function Re(p,g){if(p){const m=p[0];g[m]=g[m]||{},Re(p.slice(1),g[m])}else g.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(p=>{Re(p,K),Re(p+" x",K),Re(p+" l",K),Re(p+" l x",K),Re("l "+p,K),Re("l "+p+" x",K),Re(p+" D",K),Re(p+" D x",K),Re("D "+p,K),Re("D "+p+" x",K)});const ze={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},He={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},xe={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},qe=new Date().getUTCFullYear();function mt(p){const g=new RegExp("^([\\s+%"+A.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+A.join("")+")]*)$").exec(p);if(g){const[,m,y,T,U,x]=g;let k=1,I="",Q=!1,pe=!1,q=!1,_e=!1,Oe=!1,ue=null,D=!1,ee=parseFloat(y.replace(/,/g,""));if(!isFinite(ee))return null;for(let Ae=0;Ae<m.length;Ae++){const Ue=m[Ae];if(Ue==="-"){if(Q||pe)return null;Q=!0,k=-1}else if(j.test(Ue)){if(Oe)return null;Oe=!0,ue=Ue}else if(Ue==="("){if(pe||Q)return null;pe=!0,k=-1}else if(Ue==="%"){if(_e)return null;_e=!0}}for(let Ae=0;Ae<x.length;Ae++){const Ue=x[Ae];if(j.test(Ue)){if(Oe)return null;Oe=!0,ue=Ue,D=!0}else if(Ue===")"){if(q||!pe)return null;q=!0}else if(Ue==="%"){if(_e)return null;_e=!0}}if(U){if(_e||Oe)return null;I="0.00E+00"}else if(_e){if(Oe)return null;I=T.includes(".")?"0.00%":"0%",ee*=.01}else if(Oe){const Ae=T.includes(".")?"#,##0.00":"#,##0";I=D?Ae+ue:ue+Ae}else T.includes(",")&&(I=T.includes(".")?"#,##0.00":"#,##0");const Ce={v:ee*k};return I&&(Ce.z=I),Ce}}const Ve=(p,g,m)=>{const y=m.path||"",T=Object.keys(g);for(let U=0;U<T.length;U++){let x;const k=T[U];if(g[k]){if(k==="$"||k==="€")p||(x=m);else if(k==="-"){const I=/^(\s*([./-]|,\s)\s*|\s+)/.exec(p);if(I){const Q=I[1]==="-"||I[1]==="/"||I[1]==="."?I[1]:" ";if(!m.sep||m.sep===Q){const pe=I[0].replace(/\s+/g," ");x=Ve(p.slice(I[0].length),g[k],{...m,sep:Q,path:y+pe})}}}else if(k===" "){const I=/^[,.]?\s+/.exec(p);if(I){const Q=I[0].replace(/\s+/g," ");x=Ve(p.slice(I[0].length),g[k],{...m,path:y+Q})}}else if(k==="j"||k==="d"){const I=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(p);I&&(x=Ve(p.slice(I[0].length),g[k],{...m,day:I[0],path:y+k}))}else if(k==="n"||k==="m"){const I=/^(0?[1-9]|1[012])\b/.exec(p);I&&(x=Ve(p.slice(I[0].length),g[k],{...m,month:+I[0],_mon:I[0],path:y+k}))}else if(k==="F"||k==="M"){const I=/^([a-z]{3,9})\b/i.exec(p),Q=I&&(k==="F"?He:ze)[I[0].toLowerCase()];Q&&(x=Ve(p.slice(I[0].length),g[k],{...m,month:Q,_mon:I[0],path:y+k}))}else if(k==="l"||k==="D"){const I=/^([a-z]{3,9})\b/i.exec(p);(I&&xe[I[0].toLowerCase()])===k&&(x=Ve(p.slice(I[0].length),g[k],{...m,path:y+k}))}else if(k==="y"){const I=/^\d\d\b/.exec(p);if(I){const Q=+I[0]>=30?+I[0]+1900:+I[0]+2e3;x=Ve(p.slice(I[0].length),g[k],{...m,year:Q,path:y+k})}}else if(k==="Y"){const I=/^\d\d\d\d\b/.exec(p);I&&(x=Ve(p.slice(I[0].length),g[k],{...m,year:+I[0],path:y+k}))}else{if(k!=="x")throw new Error('Unknown date token "'.concat(k,'"'));{const I=Ge(p);I&&(x=Ve("",g[k],{...m,time:I.v,tf:I.z,path:y+k}))}}if(x)return x}}};function et(p,g){const m=Ve(p.trim(),K,{path:""});if(m){var y;if(m.sep==="."&&m.path.length===3)return null;const T=+((y=m.year)!==null&&y!==void 0?y:qe);if(m.day||(m.day=1),!function(k,I,Q){if(Q<1||I<1||I>12)return!1;if(I===2){if(Q>(k%4==0&&k%100!=0||k%400==0||k===1900?29:28))return!1}else if((I===4||I===6||I===9||I===11)&&Q>30||(I===1||I===3||I===5||I===7||I===8||I===10||I===12)&&Q>31)return!1;return!0}(T,m.month,m.day))return null;let U=-1/0;if(T<1900)return null;T<=1900&&m.month<=2?U=25568:T<1e4&&(U=25569);const x=Date.UTC(T,m.month-1,m.day)/864e5+U+(m.time||0);if(x>=0&&x<=2958465){const k=m._mon[0]==="0"||m.day[0]==="0"||m._mon.length===2&&m.day.length===2,I=m.path.replace(/[jdlDnmMFyYx-]/g,Q=>Q==="j"||Q==="d"?k?"dd":"d":Q==="D"?"ddd":Q==="l"?"dddd":Q==="n"||Q==="m"?k?"mm":"m":Q==="M"?"mmm":Q==="F"?"mmmm":Q==="y"?"yy":Q==="x"?m.tf||"":Q==="Y"?"yyyy":Q);return g&&g.nativeDate?{v:Te(x,g),z:I}:{v:x,z:I}}}return null}function Ge(p){const g=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(p);if(g){const[,m,y,T,U,x]=g;if(U&&!T||!x&&!y&&!T)return null;let k=1*(m||0);if(x){if(k>=13)return null;x[0]!=="p"&&x[0]!=="P"||(k+=12)}return{v:(60*k*60+60*(1*(y||0))+1*(T||0)+1*(U||0))/86400,z:(m.length===2?"hh":"h")+":mm"+(T?":ss":"")+(x?" AM/PM":"")}}return null}function ut(p){return/^\s*true\s*$/i.test(p)?{v:!0}:/^\s*false\s*$/i.test(p)?{v:!1}:null}const ot={};function Dt(p,g){const{pattern:m,partitions:y,locale:T}=p,U=I=>{const Q=Object.assign({},J(),g,I);return T&&(Q.locale=T),Q},x=(I,Q)=>{const pe=U(Q);return function(q,_e,Oe){const ue=c(Oe.locale),D=_e[3]?_e[3]:be;if(typeof q=="boolean"&&(q=q?"TRUE":"FALSE"),q==null)return"";if(typeof q!="number")return ie(q,D,Oe,ue);if(!isFinite(q)){const Ce=ue||f;return isNaN(q)?Ce.nan:(q<0?Ce.negative:"")+Ce.infinity}const ee=me(q,_e);return ee?ie(q,ee,Oe,ue):Oe.overflow}(ge(I,pe),y,pe)};x.color=(I,Q)=>function(pe,q){if(typeof pe!="number"||!isFinite(pe))return(q[3]?q[3].color:be.color)||De;const _e=me(pe,q);return _e&&_e.color||De}(ge(I,U(Q)),y);const k=function(I){var Q;let pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[q,_e]=I,Oe=q.frac_max,ue={type:"general",isDate:S(I),isText:F(I),isPercent:ye(I),maxDecimals:q.general?9:Oe,scale:(Q=q.scale)!==null&&Q!==void 0?Q:1,color:0,parentheses:0,grouped:q.grouping?1:0,_partitions:I},D=!ue.isDate&&!ue.isText&&!q.error&&q.tokens.some(Pe=>Pe.type==="string"&&(pe?Pe.value===pe:j.test(Pe.value)));let ee="G",Ce=Oe>=0?Math.min(15,Oe):"",Ae="",Ue="";if(_e&&_e.color&&(Ue="-",ue.color=1),q.parens&&(Ae="()",ue.parentheses=1),D)ee="C",ue.type="currency";else if(q.error)ue.type="error",ue.maxDecimals=0;else if(ue.isDate){let Pe=0,We=0,ht="";q.tokens.forEach(Ee=>{const Qe=Ee.type;/^(b-)?year/.test(Qe)?(ht+="Y",We++):Qe.startsWith("month")?(ht+="M",We++):/^(week)?day/.test(Qe)?(ht+="D",We++):Qe!=="hour"&&Qe!=="min"&&Qe!=="sec"&&Qe!=="am"||(ht+=Qe[0],Pe++)}),ue.type="date",We&&Pe?ue.type="datetime":!We&&Pe&&(ue.type="time");const ft=X.find(Ee=>ht.startsWith(Ee[0]));ee=ft?"D":"G",Ce=ft?ft[1]:""}else ue.isText?(ee="G",ue.type="text",Ce="",ue.maxDecimals=0):q.general?(ee="G",ue.type="general",Ce=""):q.fractions?(ee="G",ue.type="fraction",Ce=""):q.exponential?(ee="S",ue.type="scientific"):ue.isPercent?(ee="P",ue.type="percent"):q.grouping?(ee=",",ue.type="grouped"):(q.int_max||Oe)&&(ee="F",ue.type="number");return ue.code=ee+Ce+Ue+Ae,ue.level=G[ue.type],Object.freeze(ue)}(y,(g||{}).currency)||new SyntaxError;return x.info=k,x.dateInfo=function(I){const[Q]=I;return{year:!!(2&Q.date),month:!!(4&Q.date),day:!!(8&Q.date),hours:!!(16&Q.date),minutes:!!(32&Q.date),seconds:!!(64&Q.date),clockType:Q.clock===12?12:24}}(y),x.isPercent=()=>!!k.isPercent,x.isDate=()=>!!k.isDate,x.isText=()=>!!k.isText,x.pattern=m,p.error&&(x.error=p.error),x.options=U,x.locale=T||g&&g.locale||"",Object.freeze(x)}function Fe(p,g){p||(p="General");let m=null;return ot[p]?m=ot[p]:(m=Object.assign({},J(),g).throws?M(p):function(y){try{return M(y)}catch(T){const U={tokens:[{type:"error"}],error:T.message};return{pattern:y,partitions:[U,U,U,U],error:T.message,locale:null}}}(p),m.error||(ot[p]=m)),Dt(m,g)}Fe.isDate=p=>Fe(p,{throws:!1}).isDate(),Fe.isPercent=p=>Fe(p,{throws:!1}).isPercent(),Fe.isText=p=>Fe(p,{throws:!1}).isText(),Fe.getInfo=(p,g)=>Fe(p,{...g,throws:!1}).info,Fe.getDateInfo=(p,g)=>Fe(p,{...g,throws:!1}).dateInfo,Fe.dateToSerial=ge,Fe.dateFromSerial=Te,Fe.options=J,Fe.dec2frac=R,Fe.round=E,Fe.codeToLocale=s,Fe.parseLocale=l,Fe.getLocale=c,Fe.addLocale=(p,g)=>{const m=l(g);return delete ot[m.lang],delete ot[m.language],d(p,m)},Fe.format=function(p,g,m){let y=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const T=m&&typeof m=="object"?m:{locale:m,throws:!y};return Fe(p,T)(ge(g,T),T)},Fe.is_date=Fe.isDate,Fe.parseNumber=mt,Fe.parseDate=et,Fe.parseTime=Ge,Fe.parseBool=ut,Fe.parseValue=function(p,g){var m,y,T;return(m=(y=(T=mt(p))!==null&&T!==void 0?T:et(p,g))!==null&&y!==void 0?y:Ge(p))!==null&&m!==void 0?m:ut(p)};var ct=Fe;return r=r.default}()})}(kr)),kr.exports}var us,Hi;function ld(){return Hi||(Hi=1,us=ad()),us}var ud=ld();const cd=Ct(ud),hd=cd;function Gt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Ts(e,t,n){const r=Gt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Ns(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function dd(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function fd(e,t,n){const r=n;if(Gt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Ms(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?gd(e,t,n,r):md(e,t,n,r)}function gd(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function md(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class wt{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new wt({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Ms(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Ms(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ts(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ts(r,void 0,i)})}removeRows(t,n){Ns(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Ns(t,n,s)})}getFragment(t,n,r,s){const i=new wt;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new wt;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Gt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Gt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new wt;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=Gt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const sr="__INTERNAL_EDITOR__",qs=`${sr}DOCS_NORMAL`,Js=`${sr}DOCS_FORMULA_BAR`,va=`${sr}ZEN_EDITOR`,Oa=`\r
|
|
4
|
-
`,
|
|
5
|
-
`)===r?Ie.TRUE:Ie.FALSE}const Gn=class Gn{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new wt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new wt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||lt.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Gn(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||lt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?_r("ul",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?_r("st",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?_r("it",t.body)===Ie.TRUE?Fr.ITALIC:Fr.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?_r("bl",t.body)===Ie.TRUE?$r.BOLD:$r.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===on.WRAP?Ie.TRUE:Ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Gn.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||lt[t]}))}};C(Gn,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let vn=Gn;function Na(e,t,n=0,r=e.length-1,s=Sd){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),f=Math.max(n,Math.floor(t-u*h/l+d)),E=Math.min(r,Math.floor(t+(l-u)*h/l+d));Na(e,t,f,E,s)}const i=e[t];let o=n,a=r;for(Mn(e,n,t),s(e[r],i)>0&&Mn(e,n,r);o<a;){for(Mn(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Mn(e,n,a):(a++,Mn(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Mn(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Sd(e,t){return e<t?-1:e>t?1:0}class jr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!Er(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;Er(t,l)&&(n.leaf?r.push(a):hs(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Er(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(Er(t,o)){if(n.leaf||hs(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=gn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=vd(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&hs(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=gn(t.slice(n,r+1)),hn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=gn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));ji(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);ji(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return hn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=cs(u),h=bd(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),Bn(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=gn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,hn(r,this.toBBox),hn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=gn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,hn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=$n(t,0,a,this.toBBox),u=$n(t,a,r,this.toBBox),c=yd(l,u),h=cs(l)+cs(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Od,i=t.leaf?this.compareMinY:wd,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=$n(t,0,n,i),a=$n(t,r-n,r,i);let l=pr(o)+pr(a);for(let u=n;u<r-n;u++){const c=t.children[u];Bn(o,t.leaf?i(c):c),l+=pr(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];Bn(a,t.leaf?i(c):c),l+=pr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)Bn(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():hn(t[n],this.toBBox)}}function vd(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 hn(e,t){$n(e,0,e.children.length,t,e)}function $n(e,t,n,r,s){s||(s=gn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];Bn(s,e.leaf?r(o):o)}return s}function Bn(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 Od(e,t){return e.minX-t.minX}function wd(e,t){return e.minY-t.minY}function cs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function pr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function bd(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 yd(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function hs(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Er(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function gn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function ji(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;Na(e,o,t,n,s),i.push(t,o,o,n)}}function Ad(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||tt.NONE,o=s.endAbsoluteRefType||tt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===tt.ALL&&o===tt.ALL)return s;const l=Wi(s.startRow,n,s.startColumn,t,a),u=Wi(s.endRow,n,s.endColumn,t,a);return r||i===tt.NONE&&o===tt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===tt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===tt.COLUMN?s={...s,startRow:l.row}:i===tt.ROW&&(s={...s,startColumn:l.column}),o===tt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===tt.COLUMN?s={...s,endRow:u.row}:o===tt.ROW&&(s={...s,endColumn:u.column}),s)}function Wi(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Zs(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function Td(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function Nd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function Md(e){const t=Zs(e),n=Td(t);return Nd(n)}function Dd(e,t){const n=[];return e.forEach(r=>{n.push(...Xt.subtract(r,t))}),Xt.mergeRanges(n)}function Ma(e,t){const n=Yi(e.startRow,e.endRow,t.startRow,t.endRow),r=Yi(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Ld(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Yi(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function Ld(e,t,n,r,s,i){const o=e!==void 0?e:zi(n,r,s,i),a=t!==void 0?t:zi(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function zi(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const Lt=class Lt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),f=Math.abs(o-a)+Math.abs(c-h),E=Math.abs(s+i-l-u),R=Math.abs(s-i)+Math.abs(l-u);return d<=f&&E<=R}static doAnyRangesIntersect(t,n){const r=new jr;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,f,E;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?E=s:E=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:E,startColumn:h,endColumn:f,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Lt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=Lt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return Md(t)}static splitIntoGrid(t){return Zs(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Dd(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(Lt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(Lt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[tt.ROW,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[tt.ROW,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[tt.COLUMN,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[tt.COLUMN,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(Lt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(Lt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(Lt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Xt=Lt;function xd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=Ud(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Ud(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function kd(e,t){vn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Pd(e,t){const n=e.toFullArray(),r=[];for(;;){const s=xd(n,t);if(!s)break;r.push(s),kd(n,s)}return r}class Fd{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Ds(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function $d(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Wr=65,Da=90,Bd=97;function Hd(e){const t=Da-Wr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Wr)+n,e=Math.floor(e/t)-1;return n}function La(e,t){let n="";for(;t>0;)n+=e,t--;return n}function jd(e,t=!1){const n=Da-Wr+1;let r=Bd;t&&(r=Wr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return La(s,i)}function Wd(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Yd(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function ir(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var xa=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(xa||{}),Ua=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Ua||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),or=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(or||{}),qt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(qt||{}),nn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(nn||{}),ka=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(ka||{}),Qs=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(Qs||{}),Pa=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Pa||{}),Fa=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Fa||{}),$a=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))($a||{}),Ba=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Ba||{}),Ha=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Ha||{}),ja=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(ja||{}),Wa=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(Wa||{}),Ya=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e[e.HEADING_6=9]="HEADING_6",e))(Ya||{}),za=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(za||{}),Va=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Va||{}),Ga=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Ga||{}),Ka=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Ka||{}),Xa=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Xa||{}),qa=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(qa||{}),Ja=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Ja||{}),Za=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Za||{}),Qa=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Qa||{}),En=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(En||{}),el=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(el||{}),tl=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(tl||{}),nl=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(nl||{}),rl=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(rl||{}),sl=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(sl||{}),il=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(il||{}),ol=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(ol||{}),al=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(al||{}),ll=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(ll||{}),ei=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(ei||{}),ul=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(ul||{}),cl=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(cl||{}),hl=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(hl||{}),jt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
6
|
-
`,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(jt||{});function zd(e){return`${e}`}const Vd=[jt.TABLE_START,jt.TABLE_ROW_START,jt.TABLE_CELL_START,jt.TABLE_CELL_END,jt.TABLE_ROW_END,jt.TABLE_END],Zr=e=>{const t=e.endsWith(`\r
|
|
7
|
-
`)?e.slice(0,-2):e;return Vd.reduce((n,r)=>n.replaceAll(r,""),t)},Gd=e=>e?Zr(e).replaceAll("\r","")==="":!0,Kd=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=Ut(),d=`${c}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:qt.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var dl=typeof global=="object"&&global&&global.Object===Object&&global,Xd=typeof self=="object"&&self&&self.Object===Object&&self,un=dl||Xd||Function("return this")(),On=un.Symbol,fl=Object.prototype,qd=fl.hasOwnProperty,Jd=fl.toString,Dn=On?On.toStringTag:void 0;function Zd(e){var t=qd.call(e,Dn),n=e[Dn];try{e[Dn]=void 0;var r=!0}catch{}var s=Jd.call(e);return r&&(t?e[Dn]=n:delete e[Dn]),s}var Qd=Object.prototype,ef=Qd.toString;function tf(e){return ef.call(e)}var nf="[object Null]",rf="[object Undefined]",Vi=On?On.toStringTag:void 0;function ar(e){return e==null?e===void 0?rf:nf:Vi&&Vi in Object(e)?Zd(e):tf(e)}function An(e){return e!=null&&typeof e=="object"}var sf="[object Symbol]";function Qr(e){return typeof e=="symbol"||An(e)&&ar(e)==sf}function of(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var wn=Array.isArray,Gi=On?On.prototype:void 0,Ki=Gi?Gi.toString:void 0;function gl(e){if(typeof e=="string")return e;if(wn(e))return of(e,gl)+"";if(Qr(e))return Ki?Ki.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var af=/\s/;function lf(e){for(var t=e.length;t--&&af.test(e.charAt(t)););return t}var uf=/^\s+/;function cf(e){return e&&e.slice(0,lf(e)+1).replace(uf,"")}function Et(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Xi=NaN,hf=/^[-+]0x[0-9a-f]+$/i,df=/^0b[01]+$/i,ff=/^0o[0-7]+$/i,gf=parseInt;function qi(e){if(typeof e=="number")return e;if(Qr(e))return Xi;if(Et(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Et(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=cf(e);var n=df.test(e);return n||ff.test(e)?gf(e.slice(2),n?2:8):hf.test(e)?Xi:+e}function ml(e){return e}var mf="[object AsyncFunction]",_f="[object Function]",pf="[object GeneratorFunction]",Ef="[object Proxy]";function ti(e){if(!Et(e))return!1;var t=ar(e);return t==_f||t==pf||t==mf||t==Ef}var ds=un["__core-js_shared__"],Ji=function(){var e=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Cf(e){return!!Ji&&Ji in e}var Rf=Function.prototype,If=Rf.toString;function Sf(e){if(e!=null){try{return If.call(e)}catch{}try{return e+""}catch{}}return""}var vf=/[\\^$.*+?()[\]{}|]/g,Of=/^\[object .+?Constructor\]$/,wf=Function.prototype,bf=Object.prototype,yf=wf.toString,Af=bf.hasOwnProperty,Tf=RegExp("^"+yf.call(Af).replace(vf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Nf(e){if(!Et(e)||Cf(e))return!1;var t=ti(e)?Tf:Of;return t.test(Sf(e))}function Mf(e,t){return e==null?void 0:e[t]}function ni(e,t){var n=Mf(e,t);return Nf(n)?n:void 0}var Zi=Object.create,Df=function(){function e(){}return function(t){if(!Et(t))return{};if(Zi)return Zi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Lf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function xf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Uf=800,kf=16,Pf=Date.now;function Ff(e){var t=0,n=0;return function(){var r=Pf(),s=kf-(r-n);if(n=r,s>0){if(++t>=Uf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function $f(e){return function(){return e}}var Yr=function(){try{var e=ni(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Bf=Yr?function(e,t){return Yr(e,"toString",{configurable:!0,enumerable:!1,value:$f(t),writable:!0})}:ml,Hf=Ff(Bf),jf=9007199254740991,Wf=/^(?:0|[1-9]\d*)$/;function ri(e,t){var n=typeof e;return t=t==null?jf:t,!!t&&(n=="number"||n!="symbol"&&Wf.test(e))&&e>-1&&e%1==0&&e<t}function si(e,t,n){t=="__proto__"&&Yr?Yr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function es(e,t){return e===t||e!==e&&t!==t}var Yf=Object.prototype,zf=Yf.hasOwnProperty;function _l(e,t,n){var r=e[t];(!(zf.call(e,t)&&es(r,n))||n===void 0&&!(t in e))&&si(e,t,n)}function Vf(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?si(n,a,l):_l(n,a,l)}return n}var Qi=Math.max;function Gf(e,t,n){return t=Qi(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Qi(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Lf(e,this,a)}}function Kf(e,t){return Hf(Gf(e,t,ml),e+"")}var Xf=9007199254740991;function pl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Xf}function ii(e){return e!=null&&pl(e.length)&&!ti(e)}function qf(e,t,n){if(!Et(n))return!1;var r=typeof t;return(r=="number"?ii(n)&&ri(t,n.length):r=="string"&&t in n)?es(n[t],e):!1}function El(e){return Kf(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&qf(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var Jf=Object.prototype;function Cl(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Jf;return e===n}function Zf(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Qf="[object Arguments]";function eo(e){return An(e)&&ar(e)==Qf}var Rl=Object.prototype,eg=Rl.hasOwnProperty,tg=Rl.propertyIsEnumerable,Ls=eo(function(){return arguments}())?eo:function(e){return An(e)&&eg.call(e,"callee")&&!tg.call(e,"callee")};function ng(){return!1}var Il=typeof exports=="object"&&exports&&!exports.nodeType&&exports,to=Il&&typeof module=="object"&&module&&!module.nodeType&&module,rg=to&&to.exports===Il,no=rg?un.Buffer:void 0,sg=no?no.isBuffer:void 0,Sl=sg||ng,ig="[object Arguments]",og="[object Array]",ag="[object Boolean]",lg="[object Date]",ug="[object Error]",cg="[object Function]",hg="[object Map]",dg="[object Number]",fg="[object Object]",gg="[object RegExp]",mg="[object Set]",_g="[object String]",pg="[object WeakMap]",Eg="[object ArrayBuffer]",Cg="[object DataView]",Rg="[object Float32Array]",Ig="[object Float64Array]",Sg="[object Int8Array]",vg="[object Int16Array]",Og="[object Int32Array]",wg="[object Uint8Array]",bg="[object Uint8ClampedArray]",yg="[object Uint16Array]",Ag="[object Uint32Array]",Ze={};Ze[Rg]=Ze[Ig]=Ze[Sg]=Ze[vg]=Ze[Og]=Ze[wg]=Ze[bg]=Ze[yg]=Ze[Ag]=!0;Ze[ig]=Ze[og]=Ze[Eg]=Ze[ag]=Ze[Cg]=Ze[lg]=Ze[ug]=Ze[cg]=Ze[hg]=Ze[dg]=Ze[fg]=Ze[gg]=Ze[mg]=Ze[_g]=Ze[pg]=!1;function Tg(e){return An(e)&&pl(e.length)&&!!Ze[ar(e)]}function Ng(e){return function(t){return e(t)}}var vl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vn=vl&&typeof module=="object"&&module&&!module.nodeType&&module,Mg=Vn&&Vn.exports===vl,fs=Mg&&dl.process,ro=function(){try{var e=Vn&&Vn.require&&Vn.require("util").types;return e||fs&&fs.binding&&fs.binding("util")}catch{}}(),so=ro&&ro.isTypedArray,Ol=so?Ng(so):Tg;function Dg(e,t){var n=wn(e),r=!n&&Ls(e),s=!n&&!r&&Sl(e),i=!n&&!r&&!s&&Ol(e),o=n||r||s||i,a=o?Zf(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ri(u,l))||a.push(u);return a}function Lg(e,t){return function(n){return e(t(n))}}function xg(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Ug=Object.prototype,kg=Ug.hasOwnProperty;function Pg(e){if(!Et(e))return xg(e);var t=Cl(e),n=[];for(var r in e)r=="constructor"&&(t||!kg.call(e,r))||n.push(r);return n}function wl(e){return ii(e)?Dg(e):Pg(e)}var Fg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$g=/^\w*$/;function Bg(e,t){if(wn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Qr(e)?!0:$g.test(e)||!Fg.test(e)||t!=null&&e in Object(t)}var qn=ni(Object,"create");function Hg(){this.__data__=qn?qn(null):{},this.size=0}function jg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Wg="__lodash_hash_undefined__",Yg=Object.prototype,zg=Yg.hasOwnProperty;function Vg(e){var t=this.__data__;if(qn){var n=t[e];return n===Wg?void 0:n}return zg.call(t,e)?t[e]:void 0}var Gg=Object.prototype,Kg=Gg.hasOwnProperty;function Xg(e){var t=this.__data__;return qn?t[e]!==void 0:Kg.call(t,e)}var qg="__lodash_hash_undefined__";function Jg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=qn&&t===void 0?qg:t,this}function ln(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])}}ln.prototype.clear=Hg;ln.prototype.delete=jg;ln.prototype.get=Vg;ln.prototype.has=Xg;ln.prototype.set=Jg;function Zg(){this.__data__=[],this.size=0}function ts(e,t){for(var n=e.length;n--;)if(es(e[n][0],t))return n;return-1}var Qg=Array.prototype,em=Qg.splice;function tm(e){var t=this.__data__,n=ts(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():em.call(t,n,1),--this.size,!0}function nm(e){var t=this.__data__,n=ts(t,e);return n<0?void 0:t[n][1]}function rm(e){return ts(this.__data__,e)>-1}function sm(e,t){var n=this.__data__,r=ts(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Ft(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ft.prototype.clear=Zg;Ft.prototype.delete=tm;Ft.prototype.get=nm;Ft.prototype.has=rm;Ft.prototype.set=sm;var bl=ni(un,"Map");function im(){this.size=0,this.__data__={hash:new ln,map:new(bl||Ft),string:new ln}}function om(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function ns(e,t){var n=e.__data__;return om(t)?n[typeof t=="string"?"string":"hash"]:n.map}function am(e){var t=ns(this,e).delete(e);return this.size-=t?1:0,t}function lm(e){return ns(this,e).get(e)}function um(e){return ns(this,e).has(e)}function cm(e,t){var n=ns(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Jt(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])}}Jt.prototype.clear=im;Jt.prototype.delete=am;Jt.prototype.get=lm;Jt.prototype.has=um;Jt.prototype.set=cm;var hm="Expected a function";function oi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(hm);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(oi.Cache||Jt),n}oi.Cache=Jt;var dm=500;function fm(e){var t=oi(e,function(r){return n.size===dm&&n.clear(),r}),n=t.cache;return t}var gm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mm=/\\(\\)?/g,_m=fm(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(gm,function(n,r,s,i){t.push(s?i.replace(mm,"$1"):r||n)}),t});function pm(e){return e==null?"":gl(e)}function yl(e,t){return wn(e)?e:Bg(e,t)?[e]:_m(pm(e))}function Al(e){if(typeof e=="string"||Qr(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Em(e,t){t=yl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Al(t[n++])];return n&&n==r?e:void 0}function Cm(e,t,n){var r=e==null?void 0:Em(e,t);return r===void 0?n:r}var Tl=Lg(Object.getPrototypeOf,Object),Rm="[object Object]",Im=Function.prototype,Sm=Object.prototype,Nl=Im.toString,vm=Sm.hasOwnProperty,Om=Nl.call(Object);function wm(e){if(!An(e)||ar(e)!=Rm)return!1;var t=Tl(e);if(t===null)return!0;var n=vm.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Nl.call(n)==Om}function bm(){this.__data__=new Ft,this.size=0}function ym(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Am(e){return this.__data__.get(e)}function Tm(e){return this.__data__.has(e)}var Nm=200;function Mm(e,t){var n=this.__data__;if(n instanceof Ft){var r=n.__data__;if(!bl||r.length<Nm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Jt(r)}return n.set(e,t),this.size=n.size,this}function Tn(e){var t=this.__data__=new Ft(e);this.size=t.size}Tn.prototype.clear=bm;Tn.prototype.delete=ym;Tn.prototype.get=Am;Tn.prototype.has=Tm;Tn.prototype.set=Mm;var Ml=typeof exports=="object"&&exports&&!exports.nodeType&&exports,io=Ml&&typeof module=="object"&&module&&!module.nodeType&&module,Dm=io&&io.exports===Ml,oo=Dm?un.Buffer:void 0;oo&&oo.allocUnsafe;function Lm(e,t){return e.slice()}var ao=un.Uint8Array;function xm(e){var t=new e.constructor(e.byteLength);return new ao(t).set(new ao(e)),t}function Um(e,t){var n=xm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function km(e){return typeof e.constructor=="function"&&!Cl(e)?Df(Tl(e)):{}}function Pm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Fm=Pm(),gs=function(){return un.Date.now()},$m="Expected a function",Bm=Math.max,Hm=Math.min;function jm(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError($m);t=qi(t)||0,Et(n)&&(c=!!n.leading,h="maxWait"in n,i=h?Bm(qi(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(A){var j=r,Z=s;return r=s=void 0,u=A,o=e.apply(Z,j),o}function E(A){return u=A,a=setTimeout(L,t),c?f(A):o}function R(A){var j=A-l,Z=A-u,fe=t-j;return h?Hm(fe,i-Z):fe}function w(A){var j=A-l,Z=A-u;return l===void 0||j>=t||j<0||h&&Z>=i}function L(){var A=gs();if(w(A))return J(A);a=setTimeout(L,R(A))}function J(A){return a=void 0,d&&r?f(A):(r=s=void 0,o)}function z(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function de(){return a===void 0?o:J(gs())}function N(){var A=gs(),j=w(A);if(r=arguments,s=this,l=A,j){if(a===void 0)return E(l);if(h)return clearTimeout(a),a=setTimeout(L,t),f(l)}return a===void 0&&(a=setTimeout(L,t)),o}return N.cancel=z,N.flush=de,N}function xs(e,t,n){(n!==void 0&&!es(e[t],n)||n===void 0&&!(t in e))&&si(e,t,n)}function Wm(e){return An(e)&&ii(e)}function Us(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Ym(e){return Vf(e,wl(e))}function zm(e,t,n,r,s,i,o){var a=Us(e,n),l=Us(t,n),u=o.get(l);if(u){xs(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=wn(l),f=!d&&Sl(l),E=!d&&!f&&Ol(l);c=l,d||f||E?wn(a)?c=a:Wm(a)?c=xf(a):f?(h=!1,c=Lm(l)):E?(h=!1,c=Um(l)):c=[]:wm(l)||Ls(l)?(c=a,Ls(a)?c=Ym(a):(!Et(a)||ti(a))&&(c=km(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),xs(e,n,c)}function ai(e,t,n,r,s){e!==t&&Fm(t,function(i,o){if(s||(s=new Tn),Et(i))zm(e,t,o,n,ai,r,s);else{var a=r?r(Us(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),xs(e,o,a)}},wl)}var Vm=El(function(e,t,n,r){ai(e,t,n,r)}),li=El(function(e,t,n){ai(e,t,n)});function Gm(e,t,n,r){if(!Et(e))return e;t=yl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Al(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=Et(c)?c:ri(t[s+1])?[]:{})}_l(a,l,u),a=a[l]}return e}function Km(e,t,n){return e==null?e:Gm(e,t,n)}var ms,lo;function Xm(){if(lo)return ms;lo=1;var e=-1,t=1,n=0;function r(_,H,v,M,b){if(_===H)return _?[[n,_]]:[];if(v!=null){var O=fe(_,H,v);if(O)return O}var P=a(_,H),$=_.substring(0,P);_=_.substring(P),H=H.substring(P),P=u(_,H);var V=_.substring(_.length-P);_=_.substring(0,_.length-P),H=H.substring(0,H.length-P);var se=s(_,H);return $&&se.unshift([n,$]),V&&se.push([n,V]),J(se,b),M&&h(se),se}function s(_,H){var v;if(!_)return[[t,H]];if(!H)return[[e,_]];var M=_.length>H.length?_:H,b=_.length>H.length?H:_,O=M.indexOf(b);if(O!==-1)return v=[[t,M.substring(0,O)],[n,b],[t,M.substring(O+b.length)]],_.length>H.length&&(v[0][0]=v[2][0]=e),v;if(b.length===1)return[[e,_],[t,H]];var P=c(_,H);if(P){var $=P[0],V=P[1],se=P[2],he=P[3],ge=P[4],Te=r($,se),ye=r(V,he);return Te.concat([[n,ge]],ye)}return i(_,H)}function i(_,H){for(var v=_.length,M=H.length,b=Math.ceil((v+M)/2),O=b,P=2*b,$=new Array(P),V=new Array(P),se=0;se<P;se++)$[se]=-1,V[se]=-1;$[O+1]=0,V[O+1]=0;for(var he=v-M,ge=he%2!==0,Te=0,ye=0,S=0,F=0,G=0;G<b;G++){for(var X=-G+Te;X<=G-ye;X+=2){var Y=O+X,W;X===-G||X!==G&&$[Y-1]<$[Y+1]?W=$[Y+1]:W=$[Y-1]+1;for(var le=W-X;W<v&&le<M&&_.charAt(W)===H.charAt(le);)W++,le++;if($[Y]=W,W>v)ye+=2;else if(le>M)Te+=2;else if(ge){var oe=O+he-X;if(oe>=0&&oe<P&&V[oe]!==-1){var B=v-V[oe];if(W>=B)return o(_,H,W,le)}}}for(var te=-G+S;te<=G-F;te+=2){var oe=O+te,B;te===-G||te!==G&&V[oe-1]<V[oe+1]?B=V[oe+1]:B=V[oe-1]+1;for(var ie=B-te;B<v&&ie<M&&_.charAt(v-B-1)===H.charAt(M-ie-1);)B++,ie++;if(V[oe]=B,B>v)F+=2;else if(ie>M)S+=2;else if(!ge){var Y=O+he-te;if(Y>=0&&Y<P&&$[Y]!==-1){var W=$[Y],le=O+W-Y;if(B=v-B,W>=B)return o(_,H,W,le)}}}}return[[e,_],[t,H]]}function o(_,H,v,M){var b=_.substring(0,v),O=H.substring(0,M),P=_.substring(v),$=H.substring(M),V=r(b,O),se=r(P,$);return V.concat(se)}function a(_,H){if(!_||!H||_.charAt(0)!==H.charAt(0))return 0;for(var v=0,M=Math.min(_.length,H.length),b=M,O=0;v<b;)_.substring(O,b)==H.substring(O,b)?(v=b,O=v):M=b,b=Math.floor((M-v)/2+v);return z(_.charCodeAt(b-1))&&b--,b}function l(_,H){var v=_.length,M=H.length;if(v==0||M==0)return 0;v>M?_=_.substring(v-M):v<M&&(H=H.substring(0,v));var b=Math.min(v,M);if(_==H)return b;for(var O=0,P=1;;){var $=_.substring(b-P),V=H.indexOf($);if(V==-1)return O;P+=V,(V==0||_.substring(b-P)==H.substring(0,P))&&(O=P,P++)}}function u(_,H){if(!_||!H||_.slice(-1)!==H.slice(-1))return 0;for(var v=0,M=Math.min(_.length,H.length),b=M,O=0;v<b;)_.substring(_.length-b,_.length-O)==H.substring(H.length-b,H.length-O)?(v=b,O=v):M=b,b=Math.floor((M-v)/2+v);return de(_.charCodeAt(_.length-b))&&b--,b}function c(_,H){var v=_.length>H.length?_:H,M=_.length>H.length?H:_;if(v.length<4||M.length*2<v.length)return null;function b(ye,S,F){for(var G=ye.substring(F,F+Math.floor(ye.length/4)),X=-1,Y="",W,le,oe,B;(X=S.indexOf(G,X+1))!==-1;){var te=a(ye.substring(F),S.substring(X)),ie=u(ye.substring(0,F),S.substring(0,X));Y.length<ie+te&&(Y=S.substring(X-ie,X)+S.substring(X,X+te),W=ye.substring(0,F-ie),le=ye.substring(F+te),oe=S.substring(0,X-ie),B=S.substring(X+te))}return Y.length*2>=ye.length?[W,le,oe,B,Y]:null}var O=b(v,M,Math.ceil(v.length/4)),P=b(v,M,Math.ceil(v.length/2)),$;if(!O&&!P)return null;P?O?$=O[4].length>P[4].length?O:P:$=P:$=O;var V,se,he,ge;_.length>H.length?(V=$[0],se=$[1],he=$[2],ge=$[3]):(he=$[0],ge=$[1],V=$[2],se=$[3]);var Te=$[4];return[V,se,he,ge,Te]}function h(_){for(var H=!1,v=[],M=0,b=null,O=0,P=0,$=0,V=0,se=0;O<_.length;)_[O][0]==n?(v[M++]=O,P=V,$=se,V=0,se=0,b=_[O][1]):(_[O][0]==t?V+=_[O][1].length:se+=_[O][1].length,b&&b.length<=Math.max(P,$)&&b.length<=Math.max(V,se)&&(_.splice(v[M-1],0,[e,b]),_[v[M-1]+1][0]=t,M--,M--,O=M>0?v[M-1]:-1,P=0,$=0,V=0,se=0,b=null,H=!0)),O++;for(H&&J(_),L(_),O=1;O<_.length;){if(_[O-1][0]==e&&_[O][0]==t){var he=_[O-1][1],ge=_[O][1],Te=l(he,ge),ye=l(ge,he);Te>=ye?(Te>=he.length/2||Te>=ge.length/2)&&(_.splice(O,0,[n,ge.substring(0,Te)]),_[O-1][1]=he.substring(0,he.length-Te),_[O+1][1]=ge.substring(Te),O++):(ye>=he.length/2||ye>=ge.length/2)&&(_.splice(O,0,[n,he.substring(0,ye)]),_[O-1][0]=t,_[O-1][1]=ge.substring(0,ge.length-ye),_[O+1][0]=e,_[O+1][1]=he.substring(ye),O++),O++}O++}}var d=/[^a-zA-Z0-9]/,f=/\s/,E=/[\r\n]/,R=/\n\r?\n$/,w=/^\r?\n\r?\n/;function L(_){function H(ye,S){if(!ye||!S)return 6;var F=ye.charAt(ye.length-1),G=S.charAt(0),X=F.match(d),Y=G.match(d),W=X&&F.match(f),le=Y&&G.match(f),oe=W&&F.match(E),B=le&&G.match(E),te=oe&&ye.match(R),ie=B&&S.match(w);return te||ie?5:oe||B?4:X&&!W&&le?3:W||le?2:X||Y?1:0}for(var v=1;v<_.length-1;){if(_[v-1][0]==n&&_[v+1][0]==n){var M=_[v-1][1],b=_[v][1],O=_[v+1][1],P=u(M,b);if(P){var $=b.substring(b.length-P);M=M.substring(0,M.length-P),b=$+b.substring(0,b.length-P),O=$+O}for(var V=M,se=b,he=O,ge=H(M,b)+H(b,O);b.charAt(0)===O.charAt(0);){M+=b.charAt(0),b=b.substring(1)+O.charAt(0),O=O.substring(1);var Te=H(M,b)+H(b,O);Te>=ge&&(ge=Te,V=M,se=b,he=O)}_[v-1][1]!=V&&(V?_[v-1][1]=V:(_.splice(v-1,1),v--),_[v][1]=se,he?_[v+1][1]=he:(_.splice(v+1,1),v--))}v++}}function J(_,H){_.push([n,""]);for(var v=0,M=0,b=0,O="",P="",$;v<_.length;){if(v<_.length-1&&!_[v][1]){_.splice(v,1);continue}switch(_[v][0]){case t:b++,P+=_[v][1],v++;break;case e:M++,O+=_[v][1],v++;break;case n:var V=v-b-M-1;if(H){if(V>=0&&A(_[V][1])){var se=_[V][1].slice(-1);if(_[V][1]=_[V][1].slice(0,-1),O=se+O,P=se+P,!_[V][1]){_.splice(V,1),v--;var he=V-1;_[he]&&_[he][0]===t&&(b++,P=_[he][1]+P,he--),_[he]&&_[he][0]===e&&(M++,O=_[he][1]+O,he--),V=he}}if(N(_[v][1])){var se=_[v][1].charAt(0);_[v][1]=_[v][1].slice(1),O+=se,P+=se}}if(v<_.length-1&&!_[v][1]){_.splice(v,1);break}if(O.length>0||P.length>0){O.length>0&&P.length>0&&($=a(P,O),$!==0&&(V>=0?_[V][1]+=P.substring(0,$):(_.splice(0,0,[n,P.substring(0,$)]),v++),P=P.substring($),O=O.substring($)),$=u(P,O),$!==0&&(_[v][1]=P.substring(P.length-$)+_[v][1],P=P.substring(0,P.length-$),O=O.substring(0,O.length-$)));var ge=b+M;O.length===0&&P.length===0?(_.splice(v-ge,ge),v=v-ge):O.length===0?(_.splice(v-ge,ge,[t,P]),v=v-ge+1):P.length===0?(_.splice(v-ge,ge,[e,O]),v=v-ge+1):(_.splice(v-ge,ge,[e,O],[t,P]),v=v-ge+2)}v!==0&&_[v-1][0]===n?(_[v-1][1]+=_[v][1],_.splice(v,1)):v++,b=0,M=0,O="",P="";break}}_[_.length-1][1]===""&&_.pop();var Te=!1;for(v=1;v<_.length-1;)_[v-1][0]===n&&_[v+1][0]===n&&(_[v][1].substring(_[v][1].length-_[v-1][1].length)===_[v-1][1]?(_[v][1]=_[v-1][1]+_[v][1].substring(0,_[v][1].length-_[v-1][1].length),_[v+1][1]=_[v-1][1]+_[v+1][1],_.splice(v-1,1),Te=!0):_[v][1].substring(0,_[v+1][1].length)==_[v+1][1]&&(_[v-1][1]+=_[v+1][1],_[v][1]=_[v][1].substring(_[v+1][1].length)+_[v+1][1],_.splice(v+1,1),Te=!0)),v++;Te&&J(_,H)}function z(_){return _>=55296&&_<=56319}function de(_){return _>=56320&&_<=57343}function N(_){return de(_.charCodeAt(0))}function A(_){return z(_.charCodeAt(_.length-1))}function j(_){for(var H=[],v=0;v<_.length;v++)_[v][1].length>0&&H.push(_[v]);return H}function Z(_,H,v,M){return A(_)||N(M)?null:j([[n,_],[e,H],[t,v],[n,M]])}function fe(_,H,v){var M=typeof v=="number"?{index:v,length:0}:v.oldRange,b=typeof v=="number"?null:v.newRange,O=_.length,P=H.length;if(M.length===0&&(b===null||b.length===0)){var $=M.index,V=_.slice(0,$),se=_.slice($),he=b?b.index:null;e:{var ge=$+P-O;if(he!==null&&he!==ge||ge<0||ge>P)break e;var Te=H.slice(0,ge),ye=H.slice(ge);if(ye!==se)break e;var S=Math.min($,ge),F=V.slice(0,S),G=Te.slice(0,S);if(F!==G)break e;var X=V.slice(S),Y=Te.slice(S);return Z(F,X,Y,se)}e:{if(he!==null&&he!==$)break e;var W=$,Te=H.slice(0,W),ye=H.slice(W);if(Te!==V)break e;var le=Math.min(O-W,P-W),oe=se.slice(se.length-le),B=ye.slice(ye.length-le);if(oe!==B)break e;var X=se.slice(0,se.length-le),Y=ye.slice(0,ye.length-le);return Z(V,X,Y,oe)}}if(M.length>0&&b&&b.length===0)e:{var F=_.slice(0,M.index),oe=_.slice(M.index+M.length),S=F.length,le=oe.length;if(P<S+le)break e;var G=H.slice(0,S),B=H.slice(P-le);if(F!==G||oe!==B)break e;var X=_.slice(S,O-le),Y=H.slice(S,P-le);return Z(F,X,Y,oe)}return null}function ae(_,H,v,M){return r(_,H,v,M,!0)}return ae.INSERT=t,ae.DELETE=e,ae.EQUAL=n,ms=ae,ms}var qm=Xm();const ui=Ct(qm),Jm=new Set(["true","false"]);function Zm(e){return Jm.has(e.toLowerCase())}function Dl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var $e=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))($e||{}),Nt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Nt||{}),ks=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ks||{});class rs extends rt{}function Qm(e=re.generateRandomId(6),t=rr.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
8
|
-
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:Qs.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Ie.TRUE,doNotHyphenateCaps:Ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Ie.FALSE,useFirstPageHeaderFooter:Ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var Qt={},Ln={},Cr={},uo;function e_(){if(uo)return Cr;uo=1,Object.defineProperty(Cr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Cr.default=n,Cr}var Rr={},co;function t_(){if(co)return Rr;co=1,Object.defineProperty(Rr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Rr.default=e,Rr}var _s={},ho;function Ll(){return ho||(ho=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const f=d;h.write(f,c[f])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,E=this.idx;for(;E>=0;)h.unshift(d[E]),E===0?(E=this.indexes[f*2],d=this.parents[f--]):E-=n(d[E-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,E){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=E.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const E of this)h&&h.descend(E),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,E)=>{f.p!=null&&d(f.p,E)})}eachDrop(h,d){this.traverse(h,(f,E)=>{f.d!=null&&d(f.d,E)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const E=this.container.splice(f,this.container.length-f);this.container.push(E),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const E=[d];this.container.splice(f,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,E=this.parents.length;let R=0;for(let w=0;w<h.length;w++){const L=h[w];typeof L=="string"||typeof L=="number"?(R++,this.descend(L)):Array.isArray(L)?this.mergeTree(L,d):typeof L=="object"&&d(L,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===E?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let f,E;E=f=c?c.descendFirst():!1;function R(w){let L;for(;E;){const J=L=c.getKey();if(w!=null){let z=!1;if(h&&typeof J=="number"&&(L=h(J,c.getComponent()),L<0&&(L=~L,z=!0)),r(L,w))return null;if(L===w&&!z)return c}d&&typeof L=="number"&&d(L,c.getComponent()),E=c.nextSibling()}return null}return R.end=()=>{f&&c.ascend()},R}e.advancer=l;function u(c,h,d){let f,E,R,w;for(f=E=c&&c.descendFirst(),R=w=h&&h.descendFirst();f||R;){let L=f?c.getKey():null,J=R?h.getKey():null;L!==null&&J!==null&&(r(J,L)?J=null:L!==J&&(L=null)),d(L==null?J:L,L!=null?c:null,J!=null?h:null),L!=null&&f&&(f=c.nextSibling()),J!=null&&R&&(R=h.nextSibling())}E&&c.ascend(),w&&h.ascend()}e.eachChildOf=u}(_s)),_s}var ps={},fo;function xl(){return fo||(fo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(ps)),ps}var It={},en={},go;function ci(){return go||(go=1,Object.defineProperty(en,"__esModule",{value:!0}),en.uniToStrPos=en.strPosToUni=void 0,en.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},en.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),en}var Es={},mo;function Ps(){return mo||(mo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=ci(),n=N=>{if(!Array.isArray(N))throw Error("Op must be an array of components");let A=null;for(let j=0;j<N.length;j++){const Z=N[j];switch(typeof Z){case"object":if(typeof Z.d!="number"&&typeof Z.d!="string")throw Error("Delete must be number or string");if(e.dlen(Z.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Z.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Z>0))throw Error("Skip components must be >0");if(typeof A=="number")throw Error("Adjacent skip components should be combined");break}A=Z}if(typeof A=="number")throw Error("Op has a trailing skip")};function r(N,A){let j=0,Z=0;for(let fe=0;fe<N.length;fe++){const ae=N[fe];switch(A(ae,j,Z),typeof ae){case"object":j+=e.dlen(ae.d);break;case"string":Z+=t.strPosToUni(ae);break;case"number":j+=ae,Z+=ae;break}}}e.eachOp=r;function s(N,A){const j=[],Z=a(j);return r(N,(fe,ae,_)=>{Z(A(fe,ae,_))}),h(j)}const i=N=>N,o=N=>s(N,i);e.dlen=N=>typeof N=="number"?N:t.strPosToUni(N);const a=N=>A=>{if(!(!A||A.d===0||A.d===""))if(N.length===0)N.push(A);else if(typeof A==typeof N[N.length-1])if(typeof A=="object"){const j=N[N.length-1];j.d=typeof j.d=="string"&&typeof A.d=="string"?j.d+A.d:e.dlen(j.d)+e.dlen(A.d)}else N[N.length-1]+=A;else N.push(A)},l=N=>typeof N=="number"?N:typeof N=="string"?t.strPosToUni(N):typeof N.d=="number"?N.d:t.strPosToUni(N.d);e.uniSlice=(N,A,j)=>{const Z=t.uniToStrPos(N,A),fe=j==null?1/0:t.uniToStrPos(N,j);return N.slice(Z,fe)};const u=(N,A,j)=>typeof N=="number"?j==null?N-A:Math.min(N,j)-A:e.uniSlice(N,A,j),c=N=>{let A=0,j=0;return{take:(ae,_)=>{if(A===N.length)return ae===-1?null:ae;const H=N[A];let v;if(typeof H=="number")return ae===-1||H-j<=ae?(v=H-j,++A,j=0,v):(j+=ae,ae);if(typeof H=="string"){if(ae===-1||_==="i"||t.strPosToUni(H.slice(j))<=ae)return v=H.slice(j),++A,j=0,v;{const M=j+t.uniToStrPos(H.slice(j),ae);return v=H.slice(j,M),j=M,v}}else{if(ae===-1||_==="d"||e.dlen(H.d)-j<=ae)return v={d:u(H.d,j)},++A,j=0,v;{let M=u(H.d,j,j+ae);return j+=ae,{d:M}}}},peek:()=>N[A]}},h=N=>(N.length>0&&typeof N[N.length-1]=="number"&&N.pop(),N);function d(N,A,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(N),n(A);const Z=[],fe=a(Z),{take:ae,peek:_}=c(N);for(let v=0;v<A.length;v++){const M=A[v];let b,O;switch(typeof M){case"number":for(b=M;b>0;)O=ae(b,"i"),fe(O),typeof O!="string"&&(b-=l(O));break;case"string":j==="left"&&typeof _()=="string"&&fe(ae(-1)),fe(t.strPosToUni(M));break;case"object":for(b=e.dlen(M.d);b>0;)switch(O=ae(b,"i"),typeof O){case"number":b-=O;break;case"string":fe(O);break;case"object":b-=e.dlen(O.d)}break}}let H;for(;H=ae(-1);)fe(H);return h(Z)}function f(N,A){n(N),n(A);const j=[],Z=a(j),{take:fe}=c(N);for(let _=0;_<A.length;_++){const H=A[_];let v,M;switch(typeof H){case"number":for(v=H;v>0;)M=fe(v,"d"),Z(M),typeof M!="object"&&(v-=l(M));break;case"string":Z(H);break;case"object":v=e.dlen(H.d);let b=0;for(;b<v;)switch(M=fe(v-b,"d"),typeof M){case"number":Z({d:u(H.d,b,b+M)}),b+=M;break;case"string":b+=t.strPosToUni(M);break;case"object":Z(M)}break}}let ae;for(;ae=fe(-1);)Z(ae);return h(j)}const E=(N,A)=>{let j=0;for(let Z=0;Z<A.length&&N>j;Z++){const fe=A[Z];switch(typeof fe){case"number":{j+=fe;break}case"string":const ae=t.strPosToUni(fe);j+=ae,N+=ae;break;case"object":N-=Math.min(e.dlen(fe.d),N-j);break}}return N},R=(N,A)=>typeof N=="number"?E(N,A):N.map(j=>E(j,A));function w(N,A,j){return s(N,(Z,fe)=>typeof Z=="object"&&typeof Z.d=="number"?{d:j.slice(A,fe,fe+Z.d)}:Z)}function L(N){return s(N,A=>{switch(typeof A){case"object":if(typeof A.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return A.d;case"string":return{d:A};case"number":return A}})}function J(N){return s(N,A=>typeof A=="object"&&typeof A.d=="string"?{d:t.strPosToUni(A.d)}:A)}function z(N){let A=!0;return r(N,j=>{typeof j=="object"&&typeof j.d=="number"&&(A=!1)}),A}function de(N){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(A=""){if(typeof A!="string")throw Error("Initial data must be a string");return N.create(A)},apply(A,j){n(j);const Z=N.builder(A);for(let fe=0;fe<j.length;fe++){const ae=j[fe];switch(typeof ae){case"number":Z.skip(ae);break;case"string":Z.append(ae);break;case"object":Z.del(e.dlen(ae.d));break}}return Z.build()},transform:d,compose:f,transformPosition:E,transformSelection:R,isInvertible:z,makeInvertible(A,j){return w(A,j,N)},stripInvertible:J,invert:L,invertWithDoc(A,j){return L(w(A,j,N))},isNoop:A=>A.length===0}}e.default=de}(Es)),Es}var Ir={},_o;function n_(){if(_o)return Ir;_o=1,Object.defineProperty(Ir,"__esModule",{value:!0});const e=Ps(),t=ci();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return Ir.default=n,n.provides={text:!0},Ir}var po;function r_(){return po||(po=1,function(e){var t=It&&It.__createBinding||(Object.create?function(d,f,E,R){R===void 0&&(R=E),Object.defineProperty(d,R,{enumerable:!0,get:function(){return f[E]}})}:function(d,f,E,R){R===void 0&&(R=E),d[R]=f[E]}),n=It&&It.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=It&&It.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var E in d)Object.hasOwnProperty.call(d,E)&&t(f,d,E);return n(f,d),f},s=It&&It.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=ci(),o=r(Ps()),a=s(n_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(E){let R=i.uniToStrPos(d,E);if(R>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,R)),d=d.slice(R)},append(E){f.push(E)},del(E){d=d.slice(i.uniToStrPos(d,E))},build(){return f.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=Ps();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(It)),It}var Eo;function s_(){return Eo||(Eo=1,function(e){var t=Ln&&Ln.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(e_()),r=t(t_()),s=Ll(),i=xl();function o(S,F){if(!S)throw new Error(F)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:S=>S,isNoop:S=>S==null,setDebug(S){},registerSubtype:L,checkValidOp:fe,normalize:ae,apply:_,transformPosition:H,compose:v,tryTransform:V,transform:he,makeInvertible:O,invert:M,invertWithDoc:P,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(S,F,G)=>ye(()=>!0,S,F,G),typeAllowingConflictsPred:S=>Object.assign(Object.assign({},e.type),{transform:(F,G,X)=>ye(S,F,G,X)})};const a=S=>S?S.getComponent():null;function l(S){return S&&typeof S=="object"&&!Array.isArray(S)}const u=S=>Array.isArray(S)?S.slice():S!==null&&typeof S=="object"?Object.assign({},S):S,c=S=>S&&(S.p!=null||S.r!==void 0),h=S=>S&&(S.d!=null||S.i!==void 0);function d(S,F){return o(S!=null),typeof F=="number"?(o(Array.isArray(S),"Invalid key - child is not an array"),(S=S.slice()).splice(F,1)):(o(l(S),"Invalid key - child is not an object"),delete(S=Object.assign({},S))[F]),S}function f(S,F,G){return typeof F=="number"?(o(S!=null,"Container is missing for key"),o(Array.isArray(S),"Cannot use numerical key for object container"),o(S.length>=F,"Cannot insert into out of bounds index"),S.splice(F,0,G)):(o(l(S),"Cannot insert into missing item"),o(S[F]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),S[F]=G),G}e.removeOp=(S,F=!0)=>s.writeCursor().writeAtPath(S,"r",F).get(),e.moveOp=(S,F)=>s.writeCursor().writeMove(S,F).get(),e.insertOp=(S,F)=>s.writeCursor().writeAtPath(S,"i",F).get(),e.replaceOp=(S,F,G)=>s.writeCursor().at(S,X=>{X.write("r",F),X.write("i",G)}).get(),e.editOp=(S,F,G,X=!1)=>s.writeCursor().at(S,Y=>A(Y,F,G,X)).get();const E=(S,F)=>S!=null&&(typeof F=="number"?Array.isArray(S):typeof S=="object"),R=(S,F)=>E(S,F)?S[F]:void 0,w={};function L(S){let F=S.type?S.type:S;F.name&&(w[F.name]=F),F.uri&&(w[F.uri]=F)}const J=S=>{const F=w[S];if(F)return F;throw Error("Missing type: "+S)};L(r_());const z=(S,F)=>S+F;L({name:"number",apply:z,compose:z,invert:S=>-S,transform:S=>S});const de=S=>S==null?null:S.et?J(S.et):S.es?w["text-unicode"]:S.ena!=null?w.number:null,N=S=>S.es?S.es:S.ena!=null?S.ena:S.e,A=(S,F,G,X=!1)=>{const[Y,W]=typeof F=="string"?[J(F),F]:[F,F.name];!X&&Y.isNoop&&Y.isNoop(G)||(W==="number"?S.write("ena",G):W==="text-unicode"?S.write("es",G):(S.write("et",W),S.write("e",G)))};function j(S){o(typeof S=="number"),o(S>=0),o(S===(0|S))}function Z(S){typeof S=="number"?j(S):o(typeof S=="string")}function fe(S){if(S===null)return;const F=new Set,G=new Set,X=W=>{let le=!0,oe=!1;for(let B in W){const te=W[B];if(le=!1,o(B==="p"||B==="r"||B==="d"||B==="i"||B==="e"||B==="es"||B==="ena"||B==="et","Invalid component item '"+B+"'"),B==="p")j(te),o(!F.has(te)),F.add(te),o(W.r===void 0);else if(B==="d")j(te),o(!G.has(te)),G.add(te),o(W.i===void 0);else if(B==="e"||B==="es"||B==="ena"){o(!oe),oe=!0;const ie=de(W);o(ie,"Missing type in edit"),ie.checkValidOp&&ie.checkValidOp(N(W))}}o(!le)},Y=(W,le,oe)=>{if(!Array.isArray(W))throw Error("Op must be null or a list");if(W.length===0)throw Error("Empty descent");le||Z(W[0]);let B=1,te=0,ie=0;for(let me=0;me<W.length;me++){const be=W[me];if(o(be!=null),Array.isArray(be)){const De=Y(be,!1);if(te){const K=typeof ie,Re=typeof De;K===Re?o(ie<De,"descent keys are not in order"):o(K==="number"&&Re==="string")}ie=De,te++,B=3}else typeof be=="object"?(o(B===1,`Prev not scalar - instead ${B}`),X(be),B=2):(o(B!==3),Z(be),o(s.isValidPathItem(be),"Invalid path key"),B=1)}return o(te!==1,"Operation makes multiple descents. Remove some []"),o(B===2||B===3),W[0]};Y(S,!0),o(F.size===G.size,"Mismatched picks and drops in op");for(let W=0;W<F.size;W++)o(F.has(W)),o(G.has(W))}function ae(S){let F=0,G=[];const X=s.writeCursor();return X.mergeTree(S,(Y,W)=>{const le=de(Y);if(le){const B=N(Y);A(W,le,le.normalize?le.normalize(B):B)}for(const B of["r","p","i","d"])if(Y[B]!==void 0){const te=B==="p"||B==="d"?(oe=Y[B],G[oe]==null&&(G[oe]=F++),G[oe]):Y[B];W.write(B,te)}var oe}),X.get()}function _(S,F){if(fe(F),F===null)return S;const G=[];return function X(Y,W){let le=Y,oe=0,B={root:Y},te=0,ie=B,me="root";function be(){for(;te<oe;te++){let De=W[te];typeof De!="object"&&(o(E(ie,me)),ie=ie[me]=u(ie[me]),me=De)}}for(;oe<W.length;oe++){const De=W[oe];if(Array.isArray(De)){const K=X(le,De);K!==le&&K!==void 0&&(be(),le=ie[me]=K)}else if(typeof De=="object"){De.d!=null?(be(),le=f(ie,me,G[De.d])):De.i!==void 0&&(be(),le=f(ie,me,De.i));const K=de(De);if(K)be(),le=ie[me]=K.apply(le,N(De));else if(De.e!==void 0)throw Error("Subtype "+De.et+" undefined")}else le=R(le,De)}return B.root}(S=function X(Y,W){const le=[];let oe=0;for(;oe<W.length;oe++){const me=W[oe];if(Array.isArray(me))break;typeof me!="object"&&(le.push(Y),Y=R(Y,me))}for(let me=W.length-1;me>=oe;me--)Y=X(Y,W[me]);for(--oe;oe>=0;oe--){const me=W[oe];if(typeof me!="object"){const be=le.pop();Y=Y===R(be,me)?be:Y===void 0?d(be,me):(te=me,ie=Y,(B=u(B=be))[te]=ie,B)}else c(me)&&(o(Y!==void 0,"Cannot pick up or remove undefined"),me.p!=null&&(G[me.p]=Y),Y=void 0)}var B,te,ie;return Y}(S,F),F)}function H(S,F){S=S.slice(),fe(F);const G=s.readCursor(F);let X,Y,W=!1;const le=[];for(let B=0;;B++){const te=S[B],ie=G.getComponent();if(ie&&(ie.r!==void 0?W=!0:ie.p!=null&&(W=!1,X=ie.p,Y=B)),B>=S.length)break;let me=0;const be=s.advancer(G,void 0,(K,Re)=>{c(Re)&&me++});le.unshift(be);const De=be(te);if(typeof te=="number"&&(S[B]-=me),!De)break}if(le.forEach(B=>B.end()),W)return null;const oe=()=>{let B=0;if(X!=null){const te=G.getPath();B=te.length,S=te.concat(S.slice(Y))}for(;B<S.length;B++){const te=S[B],ie=a(G),me=de(ie);if(me){const K=N(ie);me.transformPosition&&(S[B]=me.transformPosition(S[B],K));break}let be=0;const De=s.advancer(G,(K,Re)=>h(Re)?~(K-be):K-be,(K,Re)=>{h(Re)&&be++})(te);if(typeof te=="number"&&(S[B]+=be),!De)break}};return X!=null?G.eachDrop(null,B=>{B===X&&oe()}):oe(),S}function v(S,F){if(fe(S),fe(F),S==null)return F;if(F==null)return S;let G=0;const X=s.readCursor(S),Y=s.readCursor(F),W=s.writeCursor(),le=[],oe=[],B=[],te=[],ie=[],me=[],be=new Set;X.traverse(null,K=>{K.p!=null&&(B[K.p]=X.clone())}),Y.traverse(null,K=>{K.d!=null&&(te[K.d]=Y.clone())});const De=s.writeCursor();return function K(Re,ze,He,xe,qe,mt,Ve,et){o(ze||He);const Ge=a(ze),ut=a(He),ot=!!ut&&ut.r!==void 0,Dt=!!Ge&&Ge.i!==void 0,Fe=Ge?Ge.d:null,ct=ut?ut.p:null,p=(mt||ot)&&ct==null;if(ct!=null)xe=te[ct],Ve=oe[ct]=new s.WriteCursor;else if(ut&&ut.r!==void 0)xe=null;else{const D=a(xe);D&&D.d!=null&&(xe=null)}const g=a(xe);if(Fe!=null)if(Re=B[Fe],et=le[Fe]=new s.WriteCursor,p)mt&&!ot&&et.write("r",!0);else{const D=ie[Fe]=G++;Ve.write("d",D)}else if(Ge&&Ge.i!==void 0)Re=null;else{const D=a(Re);D&&D.p!=null&&(Re=null)}let m;Dt?(o(qe===void 0),m=Ge.i):m=qe;const y=(ct==null?!Dt||mt||ot:m===void 0)?null:Ve.getComponent();if(ct!=null){if(!(qe!==void 0||Dt)){const D=Fe!=null?ie[Fe]:G++;me[ct]=D,et.write("p",D)}}else ot&&(Dt||qe!==void 0||(ut.r,et.write("r",ut.r)));const T=p?null:de(Ge),U=de(g);if((T||U)&&(T&&T.name,U&&U.name),T&&U){o(T===U);const D=N(Ge),ee=N(g),Ce=T.compose(D,ee);A(Ve,T,Ce),be.add(g)}else T?A(Ve,T,N(Ge)):U&&(A(Ve,U,N(g)),be.add(g));const x=typeof m=="object"&&m!=null;let k=!1,I=0,Q=0,pe=0,q=0,_e=0;const Oe=s.advancer(xe,(D,ee)=>h(ee)?q-D-1:D-q,(D,ee)=>{h(ee)&&q++}),ue=s.advancer(Re,(D,ee)=>c(ee)?I-D-1:D-I,(D,ee)=>{c(ee)&&I++});if(s.eachChildOf(ze,He,(D,ee,Ce)=>{let Ae,Ue,Pe=D,We=D,ht=D;if(typeof D=="number"){let Me=D+pe;Ue=Oe(Me),We=Me+q;let ne=D+Q;Ae=ue(ne),h(a(Ue))&&(Ae=null),Pe=ne+I,ht=D+_e,o(Pe>=0,"p1PickKey is negative"),o(We>=0,"p2DropKey is negative");const at=h(a(ee)),Be=c(a(Ce));(at||Be&&!p)&&_e--,at&&Q--,Be&&pe--}else Ae=ue(D),Ue=Oe(D);et.descend(Pe),Ve.descend(We);const ft=x&&!h(a(ee))?m[ht]:void 0,Ee=K(Ae,ee,Ce,Ue,ft,p,Ve,et);var Qe,ve,Se;x&&!p?ft!==Ee&&(k||(m=Array.isArray(m)?m.slice():Object.assign({},m),k=!0),Qe=m,Se=Ee,typeof(ve=ht)=="number"?(o(Array.isArray(Qe)),o(ve<Qe.length)):(o(!Array.isArray(Qe)),o(Qe[ve]!==void 0)),Se===void 0?typeof ve=="number"?Qe.splice(ve,1):delete Qe[ve]:Qe[ve]=Se):o(Ee===void 0),Ve.ascend(),et.ascend()}),ue.end(),Oe.end(),y!=null)y.i=m;else if(!mt&&!ot&&ct==null)return m}(X,X.clone(),Y,Y.clone(),void 0,!1,W,De),W.reset(),W.mergeTree(De.get()),W.reset(),W.get(),le.map(K=>K.get()),oe.map(K=>K.get()),X.traverse(W,(K,Re)=>{const ze=K.p;if(ze!=null){const He=ie[ze];He!=null&&Re.write("p",He);const xe=le[ze];xe&&xe.get(),xe&&Re.mergeTree(xe.get())}else K.r!==void 0&&Re.write("r",K.r)}),W.reset(),W.get(),Y.traverse(W,(K,Re)=>{const ze=K.d;if(ze!=null){const xe=me[ze];xe!=null&&Re.write("d",xe);const qe=oe[ze];qe&&Re.mergeTree(qe.get())}else K.i!==void 0&&Re.write("i",K.i);const He=de(K);He&&!be.has(K)&&A(Re,He,N(K))}),W.get()}function M(S){if(S==null)return null;const F=new s.ReadCursor(S),G=new s.WriteCursor;let X;const Y=[],W=[];return function le(oe,B,te){const ie=oe.getComponent();let me,be=!1;if(ie){ie.p!=null&&(B.write("d",ie.p),Y[ie.p]=oe.clone()),ie.r!==void 0&&B.write("i",ie.r),ie.d!=null&&(B.write("p",ie.d),te=void 0),ie.i!==void 0&&(te=me=ie.i);const K=de(ie);K&&(te===void 0?(X||(X=new Set),X.add(ie)):(N(ie),te=K.apply(te,N(ie)),be=!0))}let De=0;for(const K of oe){B.descend(K);const Re=typeof K=="number"?K-De:K,ze=R(te,Re);h(oe.getComponent())&&De++;const He=le(oe,B,ze);if(te!==void 0&&He!==void 0){if(be||(be=!0,te=u(te)),!E(te,Re))throw Error("Cannot modify child - invalid operation");te[Re]=He}B.ascend()}if(me===void 0)return be?te:void 0;B.write("r",te)}(F,G,void 0),X&&(G.reset(),function le(oe,B,te){const ie=B.getComponent();if(ie){const K=ie.d;if(K!=null&&(oe=Y[K],te=W[K]=s.writeCursor()),X.has(ie)){const Re=de(ie);if(!Re.invert)throw Error(`Cannot invert subtype ${Re.name}`);A(te,Re,Re.invert(N(ie)))}}let me=0,be=0;const De=s.advancer(oe,(K,Re)=>c(Re)?me-K-1:K-me,(K,Re)=>{c(Re)&&me++});for(const K of B)if(typeof K=="number"){const Re=K-be,ze=De(Re),He=Re+me;te.descend(He),le(ze,B,te),h(B.getComponent())&&be++,te.ascend()}else te.descend(K),le(De(K),B,te),te.ascend();De.end()}(F.clone(),F,G),W.length&&(G.reset(),F.traverse(G,(le,oe)=>{const B=le.p;if(B!=null){const te=W[B];te&&te.get(),te&&oe.mergeTree(te.get())}}))),G.get()}const b=(S,F)=>S.some(G=>typeof G=="object"&&(Array.isArray(G)?b(G,F):F(G)));function O(S,F){if(S==null||!b(S,B=>{var te;return B.r!==void 0||((te=de(B))===null||te===void 0?void 0:te.makeInvertible)!=null}))return S;const G=new s.ReadCursor(S),X=new s.WriteCursor;let Y=!1;const W=[],le=[],oe=(B,te,ie)=>{const me=B.getComponent();let be=!1;if(me){me.d!=null&&te.write("d",me.d),me.i!==void 0&&te.write("i",me.i);const K=me.p;if(K!=null&&(W[K]=B.clone(),o(ie!==void 0,"Operation picks up at an invalid key"),le[K]=ie,te.write("p",me.p)),me.r!==void 0&&ie===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Re=de(me);Re&&(Re.makeInvertible?Y=!0:A(te,Re,N(me),!0))}let De=0;for(const K of B){te.descend(K);const Re=typeof K=="number"?K-De:K,ze=R(ie,Re),He=oe(B,te,ze);ze!==He&&(be||(be=!0,ie=u(ie)),He===void 0?(ie=d(ie,Re),typeof K=="number"&&De++):ie[Re]=He),te.ascend()}return me&&(me.r!==void 0?(te.write("r",r.default(ie)),ie=void 0):me.p!=null&&(ie=void 0)),ie};return oe(G,X,F),X.get(),Y&&(X.reset(),function B(te,ie,me,be,De){const K=ie.getComponent();if(K){K.i!==void 0?(be=K.i,De=!0):K.d!=null&&(be=le[K.d],te=W[K.d],De=!1,K.d);let xe=de(K);if(xe&&xe.makeInvertible){const qe=N(K);A(me,xe,xe.makeInvertible(qe,be),!0)}}let Re=0,ze=0;const He=s.advancer(te,(xe,qe)=>c(qe)?Re-xe-1:xe-Re,(xe,qe)=>{c(qe)&&Re++});for(const xe of ie)if(typeof xe=="number"){const qe=xe-ze,mt=He(qe),Ve=qe+Re,et=R(be,De?qe:Ve);me.descend(xe),B(mt,ie,me,et,De),h(ie.getComponent())&&ze++,me.ascend()}else{const qe=R(be,xe);me.descend(xe),B(He(xe),ie,me,qe,De),me.ascend()}He.end()}(G.clone(),G,X,F,!1)),X.get()}function P(S,F){return M(O(S,F))}const $=S=>{if(S==null)return null;const F=S.slice();for(let G=0;G<S.length;G++){const X=F[G];Array.isArray(X)&&(F[G]=$(X))}return F};function V(S,F,G){o(G==="left"||G==="right","Direction must be left or right");const X=G==="left"?0:1;if(F==null)return{ok:!0,result:S};fe(S),fe(F);let Y=null;const W=[],le=[],oe=[],B=[],te=[],ie=[],me=[],be=[],De=[],K=[],Re=[],ze=[],He=[],xe=[],qe=[];let mt=0;const Ve=s.readCursor(S),et=s.readCursor(F),Ge=s.writeCursor();if(function g(m,y=null,T){const U=a(y);U&&(U.r!==void 0?T=y.clone():U.p!=null&&(T=null,ie[U.p]=m.clone()));const x=m.getComponent();let k;x&&(k=x.p)!=null&&(te[k]=y?y.clone():null,oe[k]=m.clone(),T&&(K[k]=!0,De[k]=T),U&&U.p!=null&&(xe[k]=U.p));const I=s.advancer(y);for(const Q of m)g(m,I(Q),T);I.end()}(et,Ve,null),function g(m,y,T,U,x){const k=T.getComponent();let I,Q=!1;k&&((I=k.d)!=null?(B[I]=T.clone(),U!=null&&(qe[U]==null&&(qe[U]=[]),qe[U].push(I)),K[I],m=te[I]||null,y=oe[I]||null,K[I]?(x&&(Re[I]=!0),x=De[I]||null):!x||X!==1&&xe[I]!=null||Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.moveOp(y.getPath(),T.getPath())}),Q=!0):k.i!==void 0&&(m=y=null,Q=!0,x&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.insertOp(T.getPath(),k.i)})));const pe=a(m);pe&&(pe.r!==void 0?x=m.clone():pe.p!=null&&(pe.p,U=pe.p,x=null));const q=de(k);q&&x&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.editOp(T.getPath(),q,N(k),!0)});let _e=0,Oe=0;const ue=s.advancer(y,(ee,Ce)=>c(Ce)?_e-ee-1:ee-_e,(ee,Ce)=>{c(Ce)&&_e++}),D=s.advancer(m);for(const ee of T)if(typeof ee=="number"){const Ce=ee-Oe,Ae=ue(Ce);Oe+=+g(D(Ce+_e),Ae,T,U,x)}else{const Ce=ue(ee);g(D(ee),Ce,T,U,x)}return ue.end(),D.end(),Q}(Ve,et,et.clone(),null,null),B.map(g=>g&&g.get()),Y)return{ok:!1,conflict:Y};Re.map(g=>!!g);const ut=[];let ot=null;(function g(m,y,T,U,x){let k=!1;const I=a(y);if(c(I)){const ue=I.p;ue!=null?(T=B[ue],U=ze[ue]=s.writeCursor(),k=!0,x=null):(T=null,x=y.clone())}else h(a(T))&&(T=null);const Q=m.getComponent();if(Q){const ue=Q.p;ue!=null?(x&&(be[ue]=x),ut[ue]=x||X===1&&k?null:U.getComponent(),W[ue]=m.clone(),T&&(me[ue]=T.clone())):Q.r!==void 0&&(x||U.write("r",!0),(x||k)&&(ot==null&&(ot=new Set),ot.add(Q)))}let pe=0,q=0;const _e=s.advancer(y,void 0,(ue,D)=>{c(D)&&pe++}),Oe=s.advancer(T,(ue,D)=>h(D)?~(ue-q):ue-q,(ue,D)=>{h(D)&&q++});if(m)for(const ue of m)if(typeof ue=="string"){const D=_e(ue),ee=Oe(ue);U.descend(ue),g(m,D,ee,U,x),U.ascend()}else{const D=_e(ue),ee=ue-pe,Ce=c(a(D))?null:Oe(ee),Ae=ee+q;o(Ae>=0),U.descend(Ae),g(m,D,Ce,U,x),U.ascend()}_e.end(),Oe.end()})(Ve,et,et.clone(),Ge,null),Ge.reset();let Dt=[];if(function g(m,y,T,U,x,k){o(y);const I=y.getComponent();let Q=a(U),pe=!1;const q=(ve,Se,Me)=>ve?e.moveOp(ve.getPath(),Se.getPath()):e.insertOp(Se.getPath(),Me.i);if(h(I)){const ve=I.d;ve!=null&&(le[ve]=y.clone());const Se=ve!=null?ut[ve]:null;let Me=!1;if(I.i!==void 0||ve!=null&&Se){let ne;Q&&(Q.i!==void 0||(ne=Q.d)!=null&&!K[ne])&&(Me=ne!=null?ve!=null&&ve===xe[ne]:n.default(Q.i,I.i),Me||ne!=null&&X!==1&&xe[ne]!=null||Y==null&&(Y={type:i.ConflictType.DROP_COLLISION,op1:q(ve!=null?W[ve]:null,y,I),op2:q(ne!=null?oe[ne]:null,U,Q)})),Me||(k?Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:q(ve!=null?W[ve]:null,y,I),op2:e.removeOp(k.getPath())}):(ve!=null?(Dt[mt]=ve,x.write("d",Se.p=mt++)):x.write("i",r.default(I.i)),pe=!0))}else if(ve!=null&&!Se){const ne=be[ve];ne&&(k=ne.clone())}ve!=null?(m=W[ve],T=ie[ve],U=me[ve]):I.i!==void 0&&(m=T=null,Me||(U=null))}else c(a(m))&&(m=T=U=null);const _e=a(m),Oe=a(T);if(c(Oe)){const ve=Oe.p;Oe.r!==void 0&&(!_e||_e.r===void 0)||K[ve]?(U=null,k=T.clone()):ve!=null&&(U=B[ve],X!==1&&xe[ve]!=null||((x=He[ve])||(x=He[ve]=s.writeCursor()),x.reset(),k=null))}else!h(I)&&h(Q)&&(U=null);Q=U!=null?U.getComponent():null;const ue=de(I);if(ue){const ve=N(I);if(k)Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(y.getPath(),ue,ve,!0),op2:e.removeOp(k.getPath())});else{const Se=de(Q);let Me;if(Se){if(ue!==Se)throw Error("Transforming incompatible types");const ne=N(Q);Me=ue.transform(ve,ne,G)}else Me=r.default(ve);A(x,ue,Me)}}let D=0,ee=0,Ce=0,Ae=0,Ue=0,Pe=0,We=m!=null&&m.descendFirst(),ht=We;const ft=s.advancer(T,void 0,(ve,Se)=>{c(Se)&&Ce++});let Ee=U!=null&&U.descendFirst(),Qe=Ee;for(const ve of y)if(typeof ve=="number"){let Se;const Me=h(y.getComponent()),ne=ve-ee;{let $t;for(;We&&typeof($t=m.getKey())=="number";){$t+=D;const Rt=m.getComponent(),cn=c(Rt);if($t>ne||$t===ne&&(!cn||X===0&&Me))break;if(cn){D--;const Zt=Rt.p;xe.includes(Zt),Rt.d,a(He[Rt.d]),c(a(He[Rt.d])),(Rt.r===void 0||ot&&ot.has(Rt))&&(Zt==null||!ut[Zt]||X!==1&&xe.includes(Zt))||Ue--}We=m.nextSibling()}Se=We&&$t===ne?m:null}const at=ne-D;let Be=ft(at);const At=at-Ce;let dr=null;{let $t,Rt;for(;Ee&&typeof($t=U.getKey())=="number";){Rt=$t-Ae;const cn=U.getComponent(),Zt=h(cn);if(Rt>At)break;if(Rt===At){if(!Zt){dr=U;break}{if(X===0&&Me){dr=U;break}const Bt=Be&&c(Be.getComponent());if(X===0&&Bt)break}}if(Zt){const Bt=cn.d;K[Bt],xe[Bt],cn.i===void 0&&(K[Bt]||xe[Bt]!=null&&X!==1)?(K[Bt]||xe[Bt]!=null&&X===0)&&(Ae++,Pe--):Ae++}Ee=U.nextSibling()}}const vi=At+Ae+Ue+Pe;o(vi>=0,"trying to descend to a negative index"),x.descend(vi),Me&&(Se=Be=dr=null,ee++),g(Se,y,Be,dr,x,k)&&Pe++,x.ascend()}else{let Se;for(;We&&(Se=m.getKey(),typeof Se!="string"||!(Se>ve||Se===ve));)We=m.nextSibling();const Me=We&&Se===ve?m:null,ne=ft(ve);let at;for(;Ee&&(at=U.getKey(),typeof at!="string"||!(at>ve||at===ve));)Ee=U.nextSibling();const Be=Ee&&at===ve?U:null;x.descend(ve),g(Me,y,ne,Be,x,k),x.ascend()}return ft.end(),ht&&m.ascend(),Qe&&U.ascend(),pe}(Ve,Ve.clone(),et,et.clone(),Ge,null),Y)return{ok:!1,conflict:Y};Ge.reset();const Fe=(g,m,y)=>g.traverse(m,(T,U)=>{T.d!=null&&y(T.d,g,U)});(K.length||ze.length)&&(Fe(et,Ge,(g,m,y)=>{K[g]&&!Re[g]&&y.write("r",!0),ze[g]&&y.mergeTree(ze[g].get())}),Ge.reset());const ct=[],p=[];if((He.length||K.length)&&!Y){const g=s.readCursor($(Ge.get()));if(Fe(g,null,(m,y)=>{ct[m]=y.clone()}),He.forEach(m=>{m&&Fe(s.readCursor(m.get()),null,(y,T)=>{ct[y]=T.clone()})}),function m(y,T,U,x,k,I){const Q=a(T);if(Q&&c(Q))if(Q.p!=null){const D=Q.p;ct[D].getPath(),U=ct[D],x=p[D]=s.writeCursor()}else Q.r!==void 0&&(U=null);else h(a(U))&&(U=null);const pe=y.getComponent();if(pe){let D;if((D=pe.d)!=null){const ee=He[D];ee&&(ee.get(),x.mergeTree(ee.get()),U=s.readCursor(ee.get()))}}let q=0,_e=0;const Oe=s.advancer(T,void 0,(D,ee)=>{c(ee)&&q--}),ue=s.advancer(U,(D,ee)=>h(ee)?-(D-_e)-1:D-_e,(D,ee)=>{h(ee)&&_e++});for(const D of y)if(typeof D=="number"){const ee=Oe(D),Ce=D+q,Ae=ue(Ce),Ue=Ce+_e;x.descend(Ue),m(y,ee,Ae,x),x.ascend()}else x.descend(D),m(y,Oe(D),ue(D),x),x.ascend();Oe.end(),ue.end()}(et,g,g.clone(),Ge),Ge.reset(),Y)return{ok:!1,conflict:Y};if(Ge.get(),p.length){const m=p.map(T=>T?T.get():null),y=s.readCursor($(Ge.get()));if(Fe(y,Ge,(T,U,x)=>{const k=m[T];k&&(x.mergeTree(k),m[T]=null)}),m.find(T=>T)){const T=s.writeCursor(),U=s.writeCursor();let x=0,k=0;m.forEach(I=>{I!=null&&Fe(s.readCursor(I),null,Q=>{const pe=Dt[Q];T.writeMove(W[pe].getPath(),le[pe].getPath(),x++);const q=qe[pe];q&&q.forEach(_e=>{K[_e]||X!==1&&xe[_e]!=null||U.writeMove(oe[_e].getPath(),B[_e].getPath(),k++)})})}),Y={type:i.ConflictType.BLACKHOLE,op1:T.get(),op2:U.get()}}}}return Y?{ok:!1,conflict:Y}:{ok:!0,result:Ge.get()}}const se=S=>{const F=new Error("Transform detected write conflict");throw F.conflict=S,F.type=F.name="writeConflict",F};function he(S,F,G){const X=V(S,F,G);if(X.ok)return X.result;se(X.conflict)}const ge=S=>{const F=s.writeCursor();return s.readCursor(S).traverse(F,(G,X)=>{(h(G)||de(G))&&X.write("r",!0)}),F.get()},Te=(S,F)=>{const{type:G,op1:X,op2:Y}=S;switch(G){case i.ConflictType.DROP_COLLISION:return F==="left"?[null,ge(Y)]:[ge(X),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let W=!1;return s.readCursor(X).traverse(null,le=>{le.r!==void 0&&(W=!0)}),W?[null,ge(Y)]:[ge(X),null];case i.ConflictType.BLACKHOLE:return[ge(X),ge(Y)];default:throw Error("Unrecognised conflict: "+G)}};function ye(S,F,G,X){let Y=null;for(;;){const W=V(F,G,X);if(W.ok)return v(Y,W.result);{const{conflict:le}=W;S(le)||se(le);const[oe,B]=Te(le,X);F=v(ae(F),oe),G=v(ae(G),B),Y=v(Y,B)}}}}(Ln)),Ln}var Co;function i_(){return Co||(Co=1,function(e){var t=Qt&&Qt.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=Qt&&Qt.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(s_(),e);var r=Ll();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=xl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(Qt)),Qt}var gt=i_();const o_=Ct(gt),a_=Zu({__proto__:null,default:o_},[gt]);var ce=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(ce||{});function lr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Ca(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Ul(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const E={...h,ed:r};i.push(E),l.length&&i.push(...l);const R={...h,st:r+n,ed:f+n};i.push(R)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=lr(i)}function kl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(ir("startIndex"))}}function Pl(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ir("startIndex"))}}function Fl(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ir("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function $l(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(ir("startIndex"))}}const Bl="$",Ro=e=>e.split(Bl)[0];function hi(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Ro(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Ro(i.rangeId),i.rangeId===n.rangeId&&Dl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Bl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Fs(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Hl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function $s(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function l_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Fs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=hi(s)}function u_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;$s(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Hl(s)}function jl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Wl(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function Yl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function zl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Vl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Jr(h,d,s,i);if(f.length===0||(c.startIndex=f[0],c.endIndex=f[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function c_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Jr(h,d,s,i);if(f.length===0)continue;c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=hi(a)}return o}function h_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const E=Jr(d,f,i,o);if(E.length===0)continue;h.startIndex=E[0],h.endIndex=E[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Gl=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e))(Gl||{}),Mt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Mt||{});const Sr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},dn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),fn=e=>e.map((t,n)=>({...t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Io=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:or.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),ur={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:dn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:dn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:dn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:dn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:dn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:dn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:fn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:fn([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:fn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:fn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:fn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:fn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Io("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Io("☑",{st:{s:Ie.TRUE}})}},vr=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(ur.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},d_={ORDER_LIST_QUICK_2:vr(Sr["a)"]),ORDER_LIST_QUICK_3:vr(Sr["a."]),ORDER_LIST_QUICK_4:vr(Sr["i."]),ORDER_LIST_QUICK_6:vr(Sr["I."])};Object.assign(ur,d_);const f_={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5"};function g_(e,t,n,r,s){const i=m_(e,t,n,r,s),o=__(e,t,n,r,s),a=p_(e,t,n,r,s),l=E_(e,t,n,r,s),u=C_(e,t,n,r,s),c=R_(e,t,n,r),h=I_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function m_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=jl(e,n,r);if(s!==ke.REPLACE){const l=Kl(o,a,s);t.textRuns=l}return Ul(e,t,n,r),a}function Kl(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:E,ts:R}=e[o],{st:w,ed:L,ts:J,sId:z}=t[a];let de;if(n===ke.COVER?de={...J,...R}:de={...R},E<w)u()||r.push(e[o]),o++;else if(L<f)u()||r.push(t[a]),a++;else{const N={st:Math.min(f,w),ed:Math.max(f,w),ts:f<w?{...R}:{...J},sId:f<w?void 0:z};N.ed>N.st&&r.push(N),r.push({st:Math.max(f,w),ed:Math.min(E,L),ts:de,sId:z}),E<L?(o++,t[a].st=E,t[a].st===t[a].ed&&a++):(a++,e[o].st=L,e[o].st===e[o].ed&&o++);const A={st:Math.min(E,L),ed:Math.max(E,L),ts:E<L?{...J}:{...R},sId:E<L?z:void 0};l=A.ed>A.st?A:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),lr(r)}function __(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Wl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let f=[];for(const E of a){const{startIndex:R,paragraphStyle:w,bullet:L}=E;let J,z;if(s===ke.COVER?(J={...w,...h},z={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...L,...d}):(J={...h,...w},z={listId:"",listType:Mt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...L}),c===R){f.push({startIndex:c,paragraphStyle:J,bullet:z});break}}l.push(...f),f=[]}t.paragraphs=l}return kl(e,t,n,r),a}function p_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Yl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===ke.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Pl(e,t,n,r),a}function E_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=zl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===ke.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return Fl(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function C_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Vl(e,n,r);if(s!==ke.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const f of a){const{startIndex:E,endIndex:R}=f;if(E>=c&&R<=h){s===ke.COVER?d.push({...f,...u}):d.push({...u,...f});break}}l.push(...d),d=[]}t.tables=l}return $l(e,t,n,r),a}function R_(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Fs(e.customRanges,r),Fs(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=hi(l),c):[]}function I_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),$s(e.customDecorations,r),$s(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===ke.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===nn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=Hl(o),i}var di=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(di||{});function zr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return lr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function Xl(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function ql(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function S_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Jl(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function bt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=zr(e,t,n,r);const a=Xl(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=ql(e,t,n),s===1){const u=Ql(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=Zl(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Jl(e,t,n),o}function v_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Zl(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Ql(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function O_(e,t,n){return e==null||t==null?e!=null?e:t:Kl(e,t,n)}function w_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===ke.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function b_(e,t,n){return t.length===0||e.length===0||n===ke.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Bs(e,t,n=ke.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=O_(l,s,n),r.customRanges=w_(c,o,n);const d=b_(h,a,n);d.length&&(r.customDecorations=d);const f=[];let E=0,R=0;for(;E<i.length&&R<u.length;){const w=i[E],L=u[R],{startIndex:J}=w,{startIndex:z}=L;J===z?(f.push(re.deepMerge(w,L)),E++,R++):J<z?(f.push(re.deepClone(w)),E++):(f.push(re.deepClone(L)),R++)}return E<i.length&&f.push(...i.slice(E)),R<u.length&&f.push(...u.slice(R)),f.length&&(r.paragraphs=f),r}function y_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class mn{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===ce.DELETE||n.t===ce.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:bt(n.body,r,r+t,!1)})}else return{t:ce.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:ce.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class Nn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function eu(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=jl(e,t,n),a=Wl(e,t,n),l=Yl(e,t,n),u=zl(e,t,n),c=Vl(e,t,n),h=c_(e,t,n),d=h_(e,t,n);let f="";return r&&(e.dataStream=Sa(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function tu(e,t,n,r){e.dataStream=Ia(e.dataStream,r,t.dataStream),Ul(e,t,n,r),kl(e,t,n,r),Pl(e,t,n,r),Fl(e,t,n,r),$l(e,t,n,r),l_(e,t,n,r),u_(e,t,n,r)}function A_(e,t,n,r,s=ke.COVER){return g_(e,t,n,r,s)}function T_(e,t,n){return t<=0?{dataStream:""}:eu(e,t,n)}function N_(e,t,n,r){n!==0&&tu(e,t,n,r)}function M_(e,t){const n=new Nn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case ce.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&A_(e,o,a,n.cursor,i),n.moveCursor(a);break}case ce.INSERT:{const{body:i,len:o}=s;N_(e,i,o,n.cursor),n.moveCursor(o);break}case ce.DELETE:{const{len:i}=s;T_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function D_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:R,ed:w,ts:L}=t[l],{st:J,ed:z,ts:de,sId:N}=e[u];let A={};if(s===0)A={...L},n===ke.COVER&&r===ke.REPLACE&&de&&(A=Object.assign({},de,A));else if(A={...L},n===ke.REPLACE){if(r===ke.REPLACE)A={...de};else if(L&&de){const j=Object.keys(L);for(const Z of j)de[Z]&&delete A[Z]}}else if(r===ke.REPLACE){if(de){const j=Object.keys(de);for(const Z of j)de[Z]!==void 0&&(A[Z]=de[Z])}}else if(de){const j=Object.keys(de);for(const Z of j)A[Z]!==void 0&&delete A[Z]}if(w<J)h()||i.push(t[l]),l++;else if(z<R)h()||i.push(e[u]),u++;else{const j={st:Math.min(R,J),ed:Math.max(R,J),ts:R<J?{...L}:{...de}};j.ed>j.st&&i.push(),i.push({st:Math.max(R,J),ed:Math.min(w,z),ts:A,sId:N}),w<z?(l++,e[u].st=w,e[u].st===e[u].ed&&u++):(u++,t[l].st=z,t[l].st===t[l].ed&&l++);const Z={st:Math.min(w,z),ed:Math.max(w,z),ts:w<z?{...de}:{...L},sId:w<z?N:void 0};c=Z.ed>Z.st?Z:null}}h();const d=i[i.length-1],f=t[o-1],E=e[a-1];return d.ed!==Math.max(f.ed,E.ed)&&(f.ed>E.ed?i.push(f):i.push(E)),lr(i,!0)}function L_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===ke.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===ke.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function So(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===ke.REPLACE)if(r===ke.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===ke.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===ke.REPLACE&&r===ke.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===ke.REPLACE||r===ke.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function x_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===nn.DELETED||i===nn.DELETED)&&(o=!0,n.push({...r,type:nn.DELETED}));break}o||n.push(r)}return n}function U_(e,t,n=!1){const{body:r,coverType:s=ke.COVER}=e,{body:i,coverType:o=ke.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:E=[],customRanges:R,customDecorations:w}=i,L=D_(u,f,s,o,n?1:0);L&&(a.textRuns=L);const J=L_(h,R,s,o,n?1:0);J&&(a.customRanges=J);const z=x_(d,w);z&&(a.customDecorations=z);const de=[];let N=0,A=0;for(;N<c.length&&A<E.length;){const j=c[N],Z=E[A],{startIndex:fe}=j,{startIndex:ae}=Z;if(fe===ae){let _={startIndex:fe};n?_=So(j,Z,s,o,1):_=So(j,Z,s,o,0),de.push(_),N++,A++}else fe<ae?N++:(de.push(re.deepClone(Z)),A++)}return A<E.length&&de.push(...E.slice(A)),de.length&&(a.paragraphs=de),{coverType:l,body:a}}function vo(e){return Object.keys(e).length===1}const In=class In{constructor(){C(this,"_actions",[])}static apply(t,n){return M_(t,n)}static compose(t,n){const r=new mn(t),s=new mn(n),i=new In;for(;r.hasNext()||s.hasNext();)if(s.peekType()===ce.INSERT)i.push(s.next());else if(r.peekType()===ce.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===ce.INSERT&&l.t===ce.RETAIN)l.body==null?i.push(a):i.push({...a,body:Bs(a.body,l.body,l.coverType)});else if(a.t===ce.RETAIN&&l.t===ce.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===ke.REPLACE||l.coverType===ke.REPLACE?ke.REPLACE:ke.COVER;i.push({...a,t:ce.RETAIN,coverType:u,body:Bs(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===ce.RETAIN&&l.t===ce.DELETE?i.push(l):a.t===ce.INSERT&&(l.t,ce.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new mn(t),i=new mn(n),o=new In;for(;s.hasNext()||i.hasNext();)if(s.peekType()===ce.INSERT&&(r==="left"||i.peekType()!==ce.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===ce.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===ce.DELETE)continue;if(u.t===ce.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=U_(l,u,r==="left");o.push({...u,t:ce.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new mn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===ce.DELETE){n-=Math.min(o,n-i);continue}else a===ce.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===ce.INSERT)n.push({t:ce.DELETE,len:r.len,body:r.body});else if(r.t===ce.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:ce.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:ce.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:ke.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===ce.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=bt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===ce.RETAIN&&i.body!=null){const o=bt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==ce.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:ce.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:ce.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:ce.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===ce.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===ce.DELETE&&s.t===ce.DELETE)return r.len+=s.len,this;if(r.t===ce.DELETE&&s.t===ce.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===ce.RETAIN&&s.t===ce.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===ce.INSERT&&vo(r.body)&&s.t===ce.INSERT&&vo(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===ce.RETAIN&&y_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(In,"id","text-x"),C(In,"uri","https://github.com/dream-num/univer#text-x");let Ye=In;Object.defineProperty(Ye,"name",{value:"text-x"});const Sn=class Sn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ye.id||(this._subTypes.set(t.name,t),gt.type.registerSubtype(t))}static apply(t,n){if(!gt.type.isNoop(n))return gt.type.apply(t,n)}static compose(t,n){return gt.type.compose(t,n)}static transform(t,n,r){return gt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ye.name?Ye.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return gt.type.invertWithDoc(t,n)}static isNoop(t){return gt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Sn),this._instance}removeOp(t,n){return gt.removeOp(t,n)}moveOp(t,n){return gt.moveOp(t,n)}insertOp(t,n){return gt.insertOp(t,n)}replaceOp(t,n,r){return gt.replaceOp(t,n,r)}editOp(t,n=["body"]){return gt.editOp(n,Ye.name,t)}};C(Sn,"uri","https://github.com/dream-num/univer#json-x"),C(Sn,"_subTypes",new Map),C(Sn,"_instance",null);let kt=Sn;kt.registerSubtype(Ye);const fi={id:"default_doc",documentStyle:{}};class k_ extends rs{constructor(n){var r;super();C(this,"type",$e.UNIVER_DOC);C(this,"_name$",new we.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...fi,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...ur,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}}class yt extends k_{constructor(n){var s,i;super(re.isEmptyObject(n)?Qm():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new we.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...fi,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!kt.isNoop(n))return this.snapshot=kt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=di.copy){const i=this.getBody();if(i!=null)return bt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new yt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new yt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Zr((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function P_(e){const{ranges:t,id:n,type:r}=e,s=new Ye;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:ce.RETAIN,len:l-i}),s.push({t:ce.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function F_(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ye,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:ce.RETAIN,len:a}),o.push({t:ce.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:nn.DELETED}]}}),o}function nu(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function $_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):nu(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function B_(e){return{...re.deepClone(e),rangeId:Ut()}}function H_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function ru(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function j_(e,t){var i,o,a,l,u;const n=ru(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function W_(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(E=>E.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ye,u=a-o+1;l.push({t:ce.RETAIN,len:o}),l.push({t:ce.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:ce.INSERT,body:s,len:s.dataStream.length});const c=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function Y_(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ye;let u=!1;return t.forEach(c=>{var z,de,N;const h=j_(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,E=(z=o.customRanges)!=null?z:[],R=(A,j,Z)=>{var v,M,b,O;const fe=ru(A,j,E,r),ae=Math.min((M=(v=fe[0])==null?void 0:v.startIndex)!=null?M:1/0,A),_=Math.max((O=(b=fe[fe.length-1])==null?void 0:b.endIndex)!=null?O:-1/0,j),H={rangeId:Z?`${n}$${Z}`:n,rangeType:r,startIndex:0,endIndex:_-ae,wholeEntity:s,properties:{...i}};l.push({t:ce.RETAIN,len:ae-a}),l.push({t:ce.RETAIN,len:_-ae+1,body:{dataStream:"",customRanges:[H]},coverType:ke.COVER}),a=_+1},w=((de=o.paragraphs)!=null?de:[]).filter(A=>A.startIndex<f&&A.startIndex>d),L=((N=o.customBlocks)!=null?N:[]).filter(A=>A.startIndex<f&&A.startIndex>d);H_([d,f-1],[...w.map(A=>A.startIndex),...L.map(A=>A.startIndex)]).forEach(([A,j],Z)=>R(A,j,Z)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function su(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:ce.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:ce.DELETE,len:h-l}),l=h)}),r&&i.push({t:ce.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:ce.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:ke.REPLACE}))}return i}function z_(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:ce.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:ce.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const V_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=ui(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const E={t:ce.RETAIN,body:{...bt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,E}case 1:{const E={t:ce.INSERT,body:bt(n,l,l+f.length),len:f.length};return l+=f.length,E}default:return{t:ce.DELETE,len:f.length}}}),c=new Ye;return c.push({t:ce.RETAIN,len:t.startOffset}),c.push(...u),c};function G_(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const K_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:bt(i,t.startOffset,t.endOffset),a=ui(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const E=zr(n,l,l+f.length,!1),R=zr(o,l,l+f.length,!1),w={t:ce.RETAIN,body:G_(E,R)?void 0:{textRuns:E,dataStream:""},len:f.length};return l+=f.length,w}case 1:{const E={t:ce.INSERT,body:bt(n,l,l+f.length),len:f.length};return l+=f.length,E}default:return{t:ce.DELETE,len:f.length}}});if(u.every(d=>d.t===ce.RETAIN&&!d.body))return!1;const c=new Ye;return c.push({t:ce.RETAIN,len:t.startOffset}),c.push(...u),c};function X_(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function q_(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const J_=e=>{var R,w,L,J;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ye,l=kt.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(w=(R=n.getSnapshot().drawingsOrder)==null?void 0:R.length)!=null?w:0;let d=0;if(s)i>0&&a.push({t:ce.RETAIN,len:i});else{const z=su([t],c,0,null,!1);a.push(...z);const de=X_(c,[t]),N=(L=n.getDrawings())!=null?L:{},A=(J=n.getDrawingsOrder())!=null?J:[],j=de.sort((Z,fe)=>A.indexOf(Z)>A.indexOf(fe)?-1:A.indexOf(Z)<A.indexOf(fe)?1:0);if(j.length>0)for(const Z of j){const fe=N[Z],ae=A.indexOf(Z);if(fe==null||ae<0)continue;const _=l.removeOp(["drawings",Z],fe),H=l.removeOp(["drawingsOrder",ae],Z);u.push(_),u.push(H),d++}}a.push({t:ce.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((z,de)=>({startIndex:de,blockId:z.drawingId}))},len:r.length});const f=q_(n,o),E=l.editOp(a.serialize(),f);u.push(E);for(const z of r){const{drawingId:de}=z,N=l.insertOp(["drawings",de],z),A=l.insertOp(["drawingsOrder",h-d],de);u.push(N),u.push(A)}return u.reduce((z,de)=>kt.compose(z,de),null)},Z_=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(E=>{var R;return((R=E.bullet)==null?void 0:R.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const E=i.indexOf(t[0]),R=i[E-1],w=i[E+1];R&&R.bullet&&R.bullet.listType.indexOf(s)===0?(l=R.bullet.listId,s!==Mt.CHECK_LIST&&(s=R.bullet.listType)):w&&w.bullet&&w.bullet.listType.indexOf(s)===0&&(l=w.bullet.listId,s!==Mt.CHECK_LIST&&(s=w.bullet.listType))}const u=new Nn;u.reset();const c=new Ye;for(const E of t){const{startIndex:R,paragraphStyle:w={},bullet:L}=E;c.push({t:ce.RETAIN,len:R-u.cursor}),c.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:w,startIndex:0}:{startIndex:0,paragraphStyle:{...w},bullet:{nestingLevel:(f=L==null?void 0:L.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:ke.REPLACE}),u.moveCursorTo(R+1)}return c},Q_=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Mt.CHECK_LIST)===-1)return!1;const o=new Nn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Mt.CHECK_LIST?Mt.CHECK_LIST_CHECKED:Mt.CHECK_LIST;return a.push({t:ce.RETAIN,len:l-o.cursor}),a.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:ke.REPLACE}),o.moveCursorTo(l+1),a},ep=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new Nn;l.reset();const u=new Ye;for(const d of t){const{startIndex:f,paragraphStyle:E={},bullet:R}=d;u.push({t:ce.RETAIN,len:f-l.cursor}),u.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:E,bullet:{nestingLevel:(h=R==null?void 0:R.nestingLevel)!=null?h:0,textStyle:(R==null?void 0:R.listType)===n?R.textStyle:{fs:20},listType:n,listId:a}}]},coverType:ke.REPLACE}),l.moveCursorTo(f+1)}return u};function tp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const np=e=>{var c,h,d;const{paragraphs:t,segmentId:n,document:r,type:s}=e,i=new Nn;i.reset();const o=new Ye,a=(c=r.getSnapshot().lists)!=null?c:{},l=(d=(h=r.getBody())==null?void 0:h.tables)!=null?d:[],u={...ur,...a};for(const f of t){const{startIndex:E,paragraphStyle:R={},bullet:w}=f,L=tp(f,l);if(o.push({t:ce.RETAIN,len:E-i.cursor}),w){const J=w.listType;let z=u[J].nestingLevel.length-1;L&&(z=Math.min(z,2)),o.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...R},bullet:{...w,nestingLevel:Math.max(Math.min(w.nestingLevel+s,z),0)}}]},coverType:ke.REPLACE})}else o.push({t:ce.RETAIN,len:1});i.moveCursorTo(E+1)}return o};function rp(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function sp(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function ip(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}class it{}C(it,"customRange",{add:Y_,delete:W_,copyCustomRange:B_,getCustomRangesInterestsWithSelection:$_,isIntersecting:nu}),C(it,"customDecoration",{add:P_,delete:F_}),C(it,"selection",{replace:V_,makeSelection:rp,normalizeSelection:sp,delete:su,replaceTextRuns:K_,retain:z_}),C(it,"range",{isIntersects:ip}),C(it,"transform",{getPlainText:Zr,fromPlainText:Kd,isEmptyDocument:Gd}),C(it,"paragraph",{bullet:{set:ep,switch:Z_,toggleChecklist:Q_,changeNestLevel:np}}),C(it,"drawing",{add:J_});function op(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function iu(e){var t;return e.body=op((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class cr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new cr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Ie.TRUE}get bold(){return this._style.bl===Ie.TRUE}get underline(){return this._style.ul&&Yt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Yt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Yt.create(this._style.st)}get overline(){return this._style.ol&&Yt.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return Kt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Kt extends cr{static create(t={}){return new Kt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Kt.create(re.deepClone(this._style))}build(){return this.getValue()}}class Yt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Yt(t)}get show(){return this._decoration.s===Ie.TRUE}get followFontColor(){return this._decoration.c===Ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return Yt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class hr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new hr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===Ie.TRUE}get keepNext(){return this._style.keepNext===Ie.TRUE}get wordWrap(){return this._style.wordWrap===Ie.TRUE}get widowControl(){return this._style.widowControl===Ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Ie.TRUE}copy(){return Jn.create(re.deepClone(this._style))}getValue(){return this._style}}class Jn extends hr{static create(t={}){return new Jn(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return Jn.create(re.deepClone(this._style))}build(){return this.getValue()}}class zt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=iu(t)}static create(t){return new zt(t)}static createByBody(t){return new zt({body:t,id:"d",documentStyle:{}})}copy(){return rn.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return rn.create({...re.deepClone(s),body:bt(r,t,n)})}toPlainText(){var t,n;return it.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
9
|
-
`)}getParagraphStyle(){var t,n;return hr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?cr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===qt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class rn extends zt{constructor(n){super(n);C(this,"_doc");this._doc=new yt(n)}static newEmptyData(){return iu({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
10
|
-
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new rn(n!=null?n:rn.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Kt?r.build():r:a=s instanceof Kt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=it.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof zt?n.getData():n:(s=Math.min(n,s),i=r instanceof zt?r.getData():r);const o=it.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=it.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ye.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Kt?s.build():s,st:0,ed:r-n}]},o=it.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ye.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=it.customRange.add({rangeType:qt.HYPERLINK,rangeId:Ut(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=it.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=it.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,zt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=rn.createByBody({dataStream:i,customRanges:[{rangeType:qt.HYPERLINK,rangeId:Ut(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function ap(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var Cn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(Cn||{});function lp(e){return`sheet_interceptor_${e}`}const ou=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class up{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),ou(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>er(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function cp(e){return`sheet_async_interceptor_${e}`}const hp=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class dp{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),hp(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>er(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function fp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function au(e){return/^-?\d+(\.\d+)?$/.test(e)}function gp(e){return au(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class gi{constructor(){C(this,"_data",[])}static create(){return new gi}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class mi{constructor(){C(this,"_data",new Map)}static create(){return new mi}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function mp(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function _p(e,t){return t.forEach(n=>e.add(n)),e}function pp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new yt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=kt.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const E=d.customRanges[0];f.customRanges=[{...E,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,f)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const Ep="__default_document_sub_component_id20231101__";class lu{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class Cp extends we.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new lu;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function Rp(e){return new we.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const ss=je.createIdentifier("core.resource-manager.service"),Hs={[Nt.Editor]:"Editor",[Nt.Owner]:"Owner",[Nt.Reader]:"Reader",[Nt.UNRECOGNIZED]:"UNRECOGNIZED"},Vr=e=>e?{userID:`${Hs[e]}_${re.generateRandomId(8)}`,name:Hs[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},Ip=(e,t)=>e.startsWith(Hs[t]);class Zn{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new we.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new we.BehaviorSubject(Vr()));C(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var Sp=Object.getOwnPropertyDescriptor,vp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Sp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Oo=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Vr(Nt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?Ip(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[$e.UNIVER_SHEET,$e.UNIVER_DOC,$e.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return Ut(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Nt.Owner,shareScope:-1,scope:{read:ks.AllCollaborator,edit:ks.AllCollaborator},creator:Vr(Nt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Nt.Owner)||this._getRole(Nt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=vp([Oo(0,ss),Oo(1,je.Inject(Zn))],exports.AuthzIoLocalService);const uu=je.createIdentifier("IAuthzIoIoService");var Op=Object.getOwnPropertyDescriptor,wp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Op(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},bp=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Pr.PERSON,mentions:[{objectType:Pr.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=wp([bp(0,je.Inject(Zn))],exports.MentionIOLocalService);const cu=je.createIdentifier("univer.service.mention-io"),_i=je.createIdentifier("univer.config-service");class hu{constructor(){C(this,"_configChanged$",new we.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=li(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new we.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(we.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const Hn="FOCUSING_UNIT",Rn="FOCUSING_SHEET",jn="FOCUSING_DOC",Wn="FOCUSING_SLIDE",yp="FOCUSING_EDITOR_BUT_HIDDEN",du="EDITOR_ACTIVATED",Ap="FOCUSING_EDITOR_INPUT_FORMULA",fu="FOCUSING_FX_BAR_EDITOR",Tp="FOCUSING_UNIVER_EDITOR",Np="FOCUSING_EDITOR_INPUT_FORMULA",Mp="FOCUSING_PANEL_EDITOR",Dp="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Lp="FOCUSING_COMMON_DRAWINGS",xp="FORMULA_EDITOR_ACTIVATED";class gu extends rt{constructor(){super(...arguments);C(this,"_error$",new we.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const Up="0.6.7",kp={version:Up};function Pp(e="",t=rr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:kp.version,locale:t,styles:{},sheets:{},resources:[]}}class mu{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new Xn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const Fp=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Xt.equals(r,n))),$p=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Xt.equals(n.range,s.range)}),js={t:0,b:2,l:2,r:2},Bp=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),wo=90;function Yn(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=Ot.UNSPECIFIED,verticalAlign:a=tn.UNSPECIFIED,wrapStrategy:l=on.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:f}=i||js,{vertexAngle:E,centerAngle:R}=Eu(s),w={id:"d",body:{dataStream:`${e}${Oa}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:R,vertexAngle:E,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new yt(w)}function Hp(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function bo(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function _u(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===qt.HYPERLINK))return;const s=it.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:qt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function pu(e){return e!=null}const jp='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function yo(e){const t=lt.ff,n=lt.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=En.ITALIC;(e.it===0||e.it===void 0)&&(r=En.NORMAL);let s=En.BOLD;(e.bl===0||e.bl===void 0)&&(s=En.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===xt.SUBSCRIPT||a===xt.SUPERSCRIPT){const h=Wp(o,l),{sbr:d,spr:f}=h;l*=a===xt.SUBSCRIPT?d:f}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${jp} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function Wp(e,t){return Bp(t)}function Eu(e){const{a:t=0,v:n=Ie.FALSE}=e||{a:0,v:Ie.FALSE};let r=0,s=t;return n===Ie.TRUE&&(r=wo,s=wo),{centerAngle:r,vertexAngle:s}}class Yp{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==Ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Gt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Ie.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class zp{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:Ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===Ie.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Ie.TRUE:!0}getSize(){return Gt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const Vp="DEFAULT_WORKSHEET_ROW_COUNT",Cu=1e3,Gp="DEFAULT_WORKSHEET_COLUMN_COUNT",Ru=20,Kp="DEFAULT_WORKSHEET_ROW_HEIGHT",Iu=24,Xp="DEFAULT_WORKSHEET_COLUMN_WIDTH",Su=88,qp="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",vu=46,Jp="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ou=20;function wu(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Ie.FALSE,rowCount:Cu,columnCount:Ru,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Su,defaultRowHeight:Iu,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Ie.TRUE,rowHeader:{width:vu,hidden:Ie.FALSE},columnHeader:{height:Ou,hidden:Ie.FALSE},rightToLeft:Ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class Zp extends rt{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new Xn(5e4));C(this,"_skeletonCache",new Xn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Xt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:f,endColumn:E}=a[c];for(let R=n;R<=s;R++){let w=!1;for(let L=r;L<=i;L++)if(R>=h&&R<=d&&L>=f&&L<=E){o.push({startRow:h,endRow:d,startColumn:f,endColumn:E}),u.push(c),w=!0;break}if(w)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class bu extends rt{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Cn.Value|Cn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Cn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Cn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,nt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,nt(()=>this._rowFilteredInterceptor=null)}}const Ao={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Qn{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=wu(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new wt(o),this._viewModel=new bu((l,u)=>this.getCellRaw(l,u)),this._rowManager=new zp(this._snapshot,this._viewModel,i),this._columnManager=new Yp(this._snapshot,s),this._spanModel=new Zp(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}mixinDefaultStyleToCellRaw(t,n,r,s){const i=this.getColumnStyle(n),o=this.getRowStyle(t),a=this.getDefaultCellStyleInternal();if(a||i||o){let l=r==null?void 0:r.s;typeof l=="string"&&(l=this._styles.get(l));const u=s?ws(a,i,o,l):ws(a,o,i,l);r||(r={}),r.s=u}}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,f=t.getValue(u,d),E=f!=null&&f.s?this._styles.get(f.s):null,R=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(f&&(f.v||f.p)||E!=null&&E.bg||R)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new Qn(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=r;t===c&&n===d?(o=h,a=f,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=pn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new wt;return Ds(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===pn.Raw)h=this.getCellRaw(u,c);else if(i===pn.Intercepted)h=this.getCell(u,c);else if(i===pn.Both){const f=this.getCellRaw(u,c);if(f){h={...f};const E=(d=this.getCell(u,c))==null?void 0:d.v;pu(E)&&h&&(h.displayV=String(E))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:f}=u;Ds(h,f,c,d).forEach((E,R)=>{E===h&&R===c&&l.setValue(E,R,{...o.getValue(E,R),rowSpan:f-h+1,colSpan:d-c+1}),(E!==h||R!==c)&&l.realDeleteValue(E,R)})}),l}getRange(t,n,r,s){return typeof t=="object"?new vn(this,t,{getStyles:()=>this._styles}):new vn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const E={row:l,col:u,value:c};return E.colSpan=d.endColumn-d.startColumn+1,E.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:E}}if(h&&n)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const E=u!==h.startRow,R=E||c!==h.startColumn;if(r&&R||!r&&E){u=h.endRow+1;continue}const w=l.getCell(h.startRow,h.startColumn);if(!w&&n){u=h.endRow+1;continue}const J={row:u,col:h.startColumn,value:w};return J.colSpan=h.endColumn-h.startColumn+1,J.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:J}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const E={row:u,col:c,value:d};return u+=1,{done:!1,value:E}}}}}}}}_getCellDocumentModel(t,n=Ao){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Ao,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=Hp(o),c=i?lt.tr:u.textRotation||lt.tr;let h=u.horizontalAlign||lt.ht;const d=u.verticalAlign||lt.vt,f=u.wrapStrategy||lt.tb,E=u.paddingData||js;if(t.f&&s)a=Yn(t.f.toString(),{},{verticalAlign:d}),h=lt.ht;else if(t.p){const{centerAngle:w,vertexAngle:L}=Eu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,E,{horizontalAlign:h,verticalAlign:d,centerAngle:w,vertexAngle:L,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const w=bo(o);l=yo(w).fontCache;let L=yu(t);t.t===Vt.FORCE_STRING&&s&&(L=`'${L}`),a=Yn(L,w,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&_u(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:E,fill:(R=o==null?void 0:o.bg)==null?void 0:R.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new yt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=bo(r);if(n!=null)return n.documentModel==null&&(n.documentModel=Yn("",s)),n;const i="";let o="document";const a=lt.tr,l=lt.ht,u=lt.vt,c=lt.tb,h=js;return o=yo({}).fontCache,{documentModel:Yn(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function yu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return it.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Vt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Vt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function Qp(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return it.transform.getPlainText(n)}return e==null?void 0:e.v}var eE=Object.getOwnPropertyDescriptor,tE=(e,t,n,r)=>{for(var s=r>1?void 0:r?eE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},nE=(e,t)=>(n,r)=>t(n,r,e);function rE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends rs{constructor(n={},r){super();C(this,"type",$e.UNIVER_SHEET);C(this,"_sheetCreated$",new we.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new we.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new we.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=Pp();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new mu(i),this._count=1,this._worksheets=new Map,this._name$=new we.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new Qn(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==Ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===Ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new Qn(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=tE([nE(1,vt)],exports.Workbook);class pi extends rs{constructor(n){var r;super();C(this,"type",$e.UNIVER_SLIDE);C(this,"_activePage$",new we.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...Aa,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new we.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:Ut(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=Ut(6);return{id:n,pageType:ei.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var sE=Object.getOwnPropertyDescriptor,iE=(e,t,n,r)=>{for(var s=r>1?void 0:r?sE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},To=(e,t)=>(n,r)=>t(n,r,e);const bn=je.createIdentifier("univer.current");exports.UniverInstanceService=class extends rt{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new we.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new we.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new we.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new we.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(we.map(r=>{var s;return(s=r.get(n))!=null?s:null}),we.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(we.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(we.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType($e.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,$e.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,$e.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType($e.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Hn,!0),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Rn,!0),this._contextService.setContextValue(Wn,!1),this.setCurrentUnitForType(n)):this.focused instanceof yt?(this._contextService.setContextValue(Hn,!0),this._contextService.setContextValue(jn,!0),this._contextService.setContextValue(Rn,!1),this._contextService.setContextValue(Wn,!1),this.setCurrentUnitForType(n)):this.focused instanceof pi?(this._contextService.setContextValue(Hn,!0),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Rn,!1),this._contextService.setContextValue(Wn,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Hn,!1),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Rn,!1),this._contextService.setContextValue(Wn,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:$e.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=iE([To(0,je.Inject(je.Injector)),To(1,yn)],exports.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const oE={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var aE=Object.getOwnPropertyDescriptor,lE=(e,t,n,r)=>{for(var s=r>1?void 0:r?aE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},uE=(e,t)=>(n,r)=>t(n,r,e);exports.LifecycleService=class extends rt{constructor(n){super();C(this,"_lifecycle$",new we.BehaviorSubject(Je.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return we.firstValueFrom(this.lifecycle$.pipe(we.filter(r=>r>=n),Os(r=>r===n),we.map(()=>{})))}subscribeWithPrevious(){return we.merge(Au(this.stage),this._lifecycle$.pipe(we.skip(1))).pipe(Os(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${oE[n]}".`)}};exports.LifecycleService=lE([uE(0,vt)],exports.LifecycleService);function Au(e){switch(e){case Je.Starting:return we.of(Je.Starting);case Je.Ready:return we.of(Je.Starting,Je.Ready);case Je.Rendered:return we.of(Je.Starting,Je.Ready,Je.Rendered);default:return we.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const cE=je.createIdentifier("ILocalStorageService");class sn extends rt{constructor(){super();C(this,"_currentLocale$",new we.BehaviorSubject(rr.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new we.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(nt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=li((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var Ei=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(Ei||{});const Tu=je.createIdentifier("univer.permission-service");class Nu extends rt{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new we.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof we.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new we.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=Ei.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return we.combineLatest(r).pipe(wr.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var hE=Object.getOwnPropertyDescriptor,dE=(e,t,n,r)=>{for(var s=r>1?void 0:r?hE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Cs=(e,t)=>(n,r)=>t(n,r,e);const fE=4,Mu=Symbol("DependentOn");class Ws extends rt{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(Ws,"pluginName"),C(Ws,"type",$e.UNIVER_UNKNOWN);class gE{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function mE(...e){return function(t){t[Mu]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new gE);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([$e.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===$e.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===$e.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},fE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[Mu];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===$e.UNIVER_UNKNOWN&&c.type!==$e.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==$e.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Au(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(we.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=dE([Cs(0,je.Inject(je.Injector)),Cs(1,je.Inject(exports.LifecycleService)),Cs(2,vt)],exports.PluginService);function Du(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Ys=je.createIdentifier("resource-loader-service");class Lu extends rt{constructor(){super(...arguments);C(this,"_resourceMap",new Map);C(this,"_register$",new we.Subject);C(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),nt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Ci extends rt{constructor(){super();C(this,"_currentTheme");C(this,"_currentTheme$",new we.BehaviorSubject({}));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(nt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}var _E=Object.getOwnPropertyDescriptor,pE=(e,t,n,r)=>{for(var s=r>1?void 0:r?_E(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Rs=(e,t)=>(n,r)=>t(n,r,e);const is=je.createIdentifier("univer.undo-redo.service"),EE=20;class xu{dispose(){}async dispatchToHandlers(){return!1}}const Uu="univer.command.redo",ku="univer.command.undo",Pu=new class extends xu{constructor(){super(...arguments);C(this,"type",tr.COMMAND);C(this,"id",ku)}handler(t){const n=t.get(is),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(nr);return Kr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Fu=new class extends xu{constructor(){super(...arguments);C(this,"type",tr.COMMAND);C(this,"id",Uu)}handler(t){const n=t.get(is),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(nr);return Kr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends rt{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new we.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Pu)),this.disposeWithMe(this._commandService.registerCommand(Fu)),this.disposeWithMe(nt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(nt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>EE&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Kr(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),nt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(Rn),s=this._contextService.getContextValue(fu),i=this._contextService.getContextValue(du);return r?s?n=Js:i?n=qs:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}};exports.LocalUndoRedoService=pE([Rs(0,bn),Rs(1,nr),Rs(2,yn)],exports.LocalUndoRedoService);function CE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function RE(e){return new Promise(t=>setTimeout(t,e))}function IE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var Ri=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Ri||{}),$u=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))($u||{});const zs=je.createIdentifier("core.image-io.service");class Bu{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Xn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(zs)?this._injector.get(zs):null;if(t===Ri.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const SE=["script","style","meta","comment","link"];var Hu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Hu||{}),ju=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(ju||{}),Wu=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(Wu||{}),Yu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Yu||{}),zu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(zu||{}),Vu=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Vu||{}),vE=Object.getOwnPropertyDescriptor,OE=(e,t,n,r)=>{for(var s=r>1?void 0:r?vE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},wE=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends rt{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=OE([wE(0,je.Inject(sn))],exports.Skeleton);var bE=Object.getOwnPropertyDescriptor,yE=(e,t,n,r)=>{for(var s=r>1?void 0:r?bE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Or=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_isRowStylePrecedeColumnStyle",!1);C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Bu(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(ba))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(wa))!=null?r:!1}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:f}=c;(f==null||f===Ie.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=Ot.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!As(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:f}=_n(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Ot.CENTER&&c===r?a+=(f-d)/2:a+=f-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!As(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=_n(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Ot.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==Ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==Ie.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new wt;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:f,endColumn:E}=a[c];if(u.getValue(h,d))continue;Ma({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:E,endRow:f})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,f),o=Math.max(o,E),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=_n(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=_n(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Ku(n,r,s,this.columnHeaderHeightAndMarginTop);let a=kn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Gu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=kn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=_n(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:f,startX:E,endX:R,mergeInfo:w}=u,L=a,J=l;return s===!1&&(L=0,J=0),d+=J,f+=J,E+=L,R+=L,w.startY+=J,w.endY+=J,w.startX+=L,w.endX+=L,{actualRow:n,actualColumn:r,startX:E,startY:d,endX:R,endY:f,isMerged:c,isMergedMainCell:h,mergeInfo:w}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=kn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=kn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new yt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}};exports.SheetSkeleton=yE([Or(2,je.Inject(sn)),Or(3,yn),Or(4,_i),Or(5,je.Inject(je.Injector))],exports.SheetSkeleton);function Ii(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function AE(e,t,n,r){return Ii(e,t,n,r)}function _n(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=Ii(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:f,endColumn:E}=s;let R={startRow:h,startColumn:d,endRow:f,endColumn:E,startY:i,endY:o,startX:a,endX:l};const w=n.length-1,L=r.length-1;if(u&&h!==-1&&d!==-1){const J=n[h-1]||0,z=n[f]||n[w],de=r[d-1]||0,N=r[E]||r[L];R={...R,startY:J,endY:z,startX:de,endX:N}}else if(!u&&f!==-1&&E!==-1){const J=n[f]||n[w],z=r[E]||r[L];R={...R,startY:i,endY:J,startX:a,endX:z}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:R}}function Gu(e,t,n,r){const{x:s}=n;return e/t+s-r}function Ku(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const No=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Is=1,xn=8;class Si{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Is)throw new Error(`Got v${s} data when expected v${Is}.`);const i=No[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Si(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=No.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,xn,t),this.coords=new this.ArrayType(this.data,xn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(xn+o+a+l),this.ids=new this.IndexArrayType(this.data,xn,t),this.coords=new this.ArrayType(this.data,xn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Is<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let w=d;w<=h;w++){const L=o[2*w],J=o[2*w+1];L>=t&&L<=r&&J>=n&&J<=s&&u.push(i[w])}continue}const f=d+h>>1,E=o[2*f],R=o[2*f+1];E>=t&&E<=r&&R>=n&&R<=s&&u.push(i[f]),(c===0?t<=E:n<=R)&&(l.push(d),l.push(f-1),l.push(1-c)),(c===0?r>=E:s>=R)&&(l.push(f+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let w=d;w<=h;w++)Mo(i[2*w],i[2*w+1],t,n)<=u&&l.push(s[w]);continue}const f=d+h>>1,E=i[2*f],R=i[2*f+1];Mo(E,R,t,n)<=u&&l.push(s[f]),(c===0?t-r<=E:n-r<=R)&&(a.push(d),a.push(f-1),a.push(1-c)),(c===0?t+r>=E:n+r>=R)&&(a.push(f+1),a.push(h),a.push(1-c))}return l}}function Vs(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;Xu(e,t,o,r,s,i),Vs(e,t,n,r,o-1,1-i),Vs(e,t,n,o+1,s,1-i)}function Xu(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),E=Math.max(r,Math.floor(n-c*d/u+f)),R=Math.min(s,Math.floor(n+(u-c)*d/u+f));Xu(e,t,n,E,R,i)}const o=t[2*n+i];let a=r,l=s;for(Un(e,t,r,n),t[2*s+i]>o&&Un(e,t,r,s);a<l;){for(Un(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Un(e,t,r,l):(l++,Un(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Un(e,t,n,r){Ss(e,n,r),Ss(t,2*n,2*r),Ss(t,2*n+1,2*r+1)}function Ss(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Mo(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class TE{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new jr),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const f=a.get(d);if(f)for(let E=u;E<=h;E++){const R=f.get(E);R&&R.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var E;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(E=this._kdTree.get(n))==null?void 0:E.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),f=[];for(const R of d){const w=h[R];f.push(...Array.from(w.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new Si(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new jr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var NE=Object.getOwnPropertyDescriptor,ME=(e,t,n,r)=>{for(var s=r>1?void 0:r?NE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Do=(e,t)=>(n,r)=>t(n,r,e);let Gs=class extends rt{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case $e.UNRECOGNIZED:case $e.UNIVER_UNKNOWN:case $e.UNIVER_SLIDE:case $e.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType($e.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case $e.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType($e.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();ya(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Gs=ME([Do(0,je.Inject(ss)),Do(1,je.Inject(bn))],Gs);class DE{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Gr);const r=this._injector=LE(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(Ci).setTheme(s),o&&this._injector.get(sn).load(o),i&&this._injector.get(sn).setLocale(i),a&&this._injector.get(vt).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(bn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(nt(t));return nt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(sn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(vt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(vt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(vt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType($e.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType($e.UNIVER_DOC,yt),this._univerInstanceService.registerCtorForType($e.UNIVER_SLIDE,pi);const n=t.get(bn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Je.Ready&&(this._injector.get(exports.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function LE(e,t){const n=Du([[gu],[sn],[Ci],[exports.LifecycleService],[exports.PluginService],[Zn],[bn,{useClass:exports.UniverInstanceService}],[Tu,{useClass:Nu}],[vt,{useClass:Bo,lazy:!0}],[nr,{useClass:exports.CommandService}],[is,{useClass:exports.LocalUndoRedoService,lazy:!0}],[_i,{useClass:hu}],[yn,{useClass:Fo}],[ss,{useClass:Lu,lazy:!0}],[Ys,{useClass:Gs,lazy:!0}],[uu,{useClass:exports.AuthzIoLocalService}],[cu,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new je.Injector(n);return Uo(r,[[Zn],[Ys]]),r}ec();exports.ABCToNumber=$d;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=ba;exports.AbsoluteRefType=tt;exports.ActionIterator=mn;exports.AlignTypeH=rl;exports.AlignTypeV=sl;exports.ArrangeTypeEnum=al;exports.ArrowsAndMarkersShapes=ra;exports.AsyncInterceptorManager=dp;exports.AutoFillSeries=Vo;exports.BaselineOffset=xt;exports.BasicShapes=na;exports.BlockType=ka;exports.BooleanNumber=Ie;exports.BorderStyleTypes=Xe;exports.BorderType=Go;exports.BuildTextUtils=it;exports.BulletAlignment=or;exports.COLORS=ys;exports.CanceledError=ac;exports.CellModeEnum=pn;exports.CellValueType=Vt;exports.Color=an;exports.ColorBuilder=qr;exports.ColorKit=St;exports.ColorType=pt;exports.ColumnSeparatorType=$a;exports.CommandType=tr;exports.CommonHideTypes=Ko;exports.ConfigService=hu;exports.ContextService=Fo;exports.CopyPasteType=Xo;exports.CustomCommandExecutionError=vs;exports.CustomDecorationType=nn;exports.CustomRangeType=qt;exports.DEFAULT_CELL=Rd;exports.DEFAULT_DOC=fi;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Ep;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Oa;exports.DEFAULT_RANGE=Ed;exports.DEFAULT_RANGE_ARRAY=pd;exports.DEFAULT_SELECTION=Cd;exports.DEFAULT_SLIDE=Aa;exports.DEFAULT_STYLES=lt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Ru;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Gp;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ou;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=Jp;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Su;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=Xp;exports.DEFAULT_WORKSHEET_ROW_COUNT=Cu;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Vp;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Iu;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=Kp;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=vu;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=qp;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Js;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=qs;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=va;exports.DOC_RANGE_TYPE=_a;exports.DashStyleType=Va;exports.DataStreamTreeNodeType=hl;exports.DataStreamTreeTokenType=jt;exports.DataValidationErrorStyle=Hu;exports.DataValidationImeMode=ju;exports.DataValidationOperator=Wu;exports.DataValidationRenderMode=Yu;exports.DataValidationStatus=zu;exports.DataValidationType=Vu;exports.DeleteDirection=qo;exports.DependentOn=mE;exports.DesktopLogService=Bo;exports.DeveloperMetadataVisibility=Jo;exports.Dimension=Zo;exports.Direction=Qo;exports.Disposable=rt;exports.DisposableCollection=Gr;exports.DocStyleType=xa;exports.DocumentDataModel=yt;exports.DocumentFlavor=Qs;exports.DrawingTypeEnum=ll;exports.EDITOR_ACTIVATED=du;exports.EXTENSION_NAMES=Ta;exports.ErrorService=gu;exports.EventState=lu;exports.EventSubject=Cp;exports.FOCUSING_COMMON_DRAWINGS=Lp;exports.FOCUSING_DOC=jn;exports.FOCUSING_EDITOR_BUT_HIDDEN=yp;exports.FOCUSING_EDITOR_INPUT_FORMULA=Ap;exports.FOCUSING_EDITOR_STANDALONE=Np;exports.FOCUSING_FX_BAR_EDITOR=fu;exports.FOCUSING_PANEL_EDITOR=Mp;exports.FOCUSING_SHEET=Rn;exports.FOCUSING_SLIDE=Wn;exports.FOCUSING_UNIT=Hn;exports.FOCUSING_UNIVER_EDITOR=Tp;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Dp;exports.FORMULA_EDITOR_ACTIVATED=xp;exports.FollowNumberWithType=Ua;exports.FontItalic=Fr;exports.FontStyleType=En;exports.FontWeight=$r;exports.GridType=Pa;exports.HLSColor=fa;exports.HorizontalAlign=Ot;exports.IAuthzIoService=uu;exports.ICommandService=nr;exports.IConfigService=_i;exports.IContextService=yn;exports.IImageIoService=zs;exports.ILocalStorageService=cE;exports.ILogService=vt;exports.IMentionIOService=cu;exports.IPermissionService=Tu;exports.IResourceLoaderService=Ys;exports.IResourceManagerService=ss;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=wa;exports.IUndoRedoService=is;exports.IUniverInstanceService=bn;exports.ImageCacheMap=Bu;exports.ImageSourceType=Ri;exports.ImageUploadStatusType=$u;exports.InterceptorEffectEnum=Cn;exports.InterceptorManager=up;exports.InterpolationPointType=ea;exports.JSON1=a_;exports.JSONX=kt;exports.LRUHelper=Fn;exports.LRUMap=Xn;exports.LifecycleStages=Je;exports.ListGlyphType=Ne;exports.LocaleService=sn;exports.LocaleType=rr;exports.LogLevel=$o;exports.MOVE_BUFFER_VALUE=Pn;exports.MemoryCursor=Nn;exports.MentionType=Pr;exports.NamedStyleType=Ya;exports.NilCommand=Ho;exports.NumberUnitType=nl;exports.ObjectMatrix=wt;exports.ObjectRelativeFromH=el;exports.ObjectRelativeFromV=tl;exports.OtherShapes=sa;exports.PRESET_LIST_TYPE=ur;exports.PageElementType=ul;exports.PageOrientType=ol;exports.PageType=ei;exports.ParagraphElementType=Ha;exports.ParagraphStyleBuilder=Jn;exports.ParagraphStyleValue=hr;exports.PermissionService=Nu;exports.PermissionStatus=Ei;exports.Plugin=Ws;exports.PositionedObjectLayoutType=Wa;exports.PresetListType=Mt;exports.ProtectionType=ta;exports.QuickListType=Gl;exports.QuickListTypeMap=f_;exports.RANGE_DIRECTION=ma;exports.RANGE_TYPE=Le;exports.RBush=jr;exports.RCDisposable=fc;exports.RGBA_PAREN=jc;exports.RGB_PAREN=Hc;exports.ROTATE_BUFFER_VALUE=zo;exports.RTree=TE;exports.Range=vn;exports.Rectangle=Xt;exports.RedoCommand=Fu;exports.RedoCommandId=Uu;exports.RefAlias=Fd;exports.Registry=gi;exports.RegistryAsMap=mi;exports.RelativeDate=oa;exports.RelativeSlideLink=cl;exports.ResourceManagerService=Lu;exports.RgbColor=Br;exports.RichTextBuilder=rn;exports.RichTextValue=zt;exports.RxDisposable=dc;exports.SHEET_EDITOR_UNITS=Id;exports.SectionType=Fa;exports.SheetTypes=aa;exports.SheetViewModel=bu;exports.SliceBodyType=di;exports.SlideDataModel=pi;exports.SpacingRule=za;exports.SpecialShapes=ia;exports.Styles=mu;exports.THEME_COLORS=da;exports.TabStopAlignment=Ga;exports.TableAlignmentType=Xa;exports.TableLayoutType=qa;exports.TableRowHeightRule=Za;exports.TableSizeType=Ka;exports.TableTextWrapType=Ja;exports.TextDecoration=la;exports.TextDecorationBuilder=Yt;exports.TextDirection=Kn;exports.TextDirectionType=Ba;exports.TextStyleBuilder=Kt;exports.TextStyleValue=cr;exports.TextX=Ye;exports.TextXActionType=ce;exports.ThemeColor=Hr;exports.ThemeColorType=dt;exports.ThemeColors=Xr;exports.ThemeService=Ci;exports.Tools=re;exports.UndoCommand=Pu;exports.UndoCommandId=ku;exports.UnitModel=rs;exports.Univer=DE;exports.UniverInstanceType=$e;exports.UpdateDocsAttributeType=ke;exports.UserManagerService=Zn;exports.VerticalAlign=tn;exports.VerticalAlignmentType=Qa;exports.Worksheet=Qn;exports.WrapStrategy=on;exports.WrapTextType=ja;exports.addLinkToDocumentModel=_u;exports.afterInitApply=Sc;exports.afterTime=Ic;exports.awaitTime=RE;exports.binSearchFirstGreaterThanTarget=Yo;exports.binarySearchArray=vc;exports.bufferDebounceTime=Rc;exports.cellToRange=_h;exports.characterSpacingControlType=il;exports.checkForSubstrings=ph;exports.checkIfMove=wc;exports.checkParagraphHasBullet=Qh;exports.checkParagraphHasIndent=ed;exports.checkParagraphHasIndentByStyle=Ra;exports.codeToBlob=Oc;exports.composeBody=Bs;exports.composeInterceptors=ou;exports.composeStyles=ws;exports.concatMatrixArray=dd;exports.convertBodyToHtml=Bc;exports.convertCellToRange=pa;exports.covertTextRunToHtml=bs;exports.createAsyncInterceptorKey=cp;exports.createDefaultUser=Vr;exports.createDocumentModelWithStyle=Yn;exports.createInterceptorKey=lp;exports.createInternalEditorID=_d;exports.createRowColIter=Ds;exports.dayjs=Pt;exports.debounce=jm;exports.dedupe=tc;exports.deepCompare=Xs;exports.delayAnimationFrame=IE;exports.deleteContent=Sa;exports.extractPureTextFromCell=yu;exports.fromCallback=jo;exports.fromEventSubject=Rp;exports.fromObservable=hc;exports.generateRandomId=Ut;exports.get=Cm;exports.getArrayLength=Gt;exports.getBodySlice=bt;exports.getBodySliceHtml=br;exports.getBorderStyleType=fh;exports.getCellCoordByIndexSimple=Ii;exports.getCellInfoInMergeData=ah;exports.getCellPositionByIndexSimple=AE;exports.getCellValueType=rh;exports.getCellWithCoordByIndexCore=_n;exports.getColorStyle=Tt;exports.getCustomBlockSlice=Jl;exports.getCustomDecorationSlice=Ql;exports.getCustomRangeSlice=Zl;exports.getDocsUpdateBody=gh;exports.getIntersectRange=Ma;exports.getOriginCellValue=Qp;exports.getParagraphsSlice=ql;exports.getPlainText=Zr;exports.getReverseDirection=bc;exports.getSectionBreakSlice=S_;exports.getTableSlice=Xl;exports.getTextRunSlice=zr;exports.getTransformOffsetX=Gu;exports.getTransformOffsetY=Ku;exports.getWorksheetUID=rE;exports.groupBy=sc;exports.handleStyleToString=dh;exports.hashAlgorithm=nd;exports.horizontalLineSegmentsSubtraction=Jr;exports.insertMatrixArray=Ts;exports.insertTextToContent=Ia;exports.isBlackColor=eh;exports.isBooleanString=Zm;exports.isCellCoverable=As;exports.isCellV=ih;exports.isEmptyCell=Ea;exports.isFormulaId=hh;exports.isFormulaString=ch;exports.isICellData=nh;exports.isInternalEditorID=ya;exports.isNodeEnv=$c;exports.isNotNullOrUndefined=pu;exports.isNullCell=sh;exports.isNumeric=au;exports.isRangesEqual=Fp;exports.isRealNum=td;exports.isSafeNumeric=gp;exports.isSameStyleTextRun=Ca;exports.isUnitRangesEqual=$p;exports.isValidRange=mh;exports.isWhiteColor=th;exports.makeArray=ic;exports.makeCellRangeToRangeData=uh;exports.makeCellToSelection=lh;exports.makeCustomRangeStream=zd;exports.merge=li;exports.mergeOverrideWithDependencies=Du;exports.mergeSets=_p;exports.mergeWith=Vm;exports.mergeWorksheetSnapshotWithDefault=wu;exports.mixinClass=fp;exports.moveMatrixArray=Ms;exports.moveRangeByOffset=Ad;exports.nameCharacterCheck=CE;exports.normalizeBody=v_;exports.normalizeTextRuns=lr;exports.numberToABC=Hd;exports.numberToListABC=jd;exports.numfmt=hd;exports.queryObjectMatrix=Pd;exports.registerDependencies=oc;exports.remove=er;exports.repeatStringNumTimes=La;exports.replaceInDocumentBody=pp;exports.requestImmediateMacroTask=mp;exports.rotate=rc;exports.searchArray=kn;exports.searchInOrderedArray=Wo;exports.selectionToArray=oh;exports.sequence=Po;exports.sequenceAsync=ko;exports.sequenceExecute=Kr;exports.sequenceExecuteAsync=Cc;exports.set=Km;exports.shallowEqual=Dl;exports.skipParseTagNames=SE;exports.sliceMatrixArray=fd;exports.sortRules=Wd;exports.sortRulesByDesc=Yd;exports.sortRulesFactory=ir;exports.spliceArray=Ns;exports.splitIntoGrid=Zs;exports.takeAfter=Os;exports.textDiff=ui;exports.throttle=ap;exports.toDisposable=nt;exports.touchDependencies=Uo;exports.updateAttributeByDelete=eu;exports.updateAttributeByInsert=tu;Object.keys(je).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>je[e]})});
|
|
1
|
+
"use strict";var Gu=Object.defineProperty;var Vu=(e,t,n)=>t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>Vu(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("rxjs"),br=require("rxjs/operators"),je=require("@wendellhu/redi");function Ku(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const gr=typeof global<"u"?global:typeof self<"u"?self:window;function Xu(){const t=new Map;let n=0;typeof gr.requestIdleCallback!="function"&&(gr.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const u=Math.max(0,50-(Date.now()-i));s({didTimeout:u===0,timeRemaining(){return u}})},1);return t.set(o,a),o}),typeof gr.cancelIdleCallback!="function"&&(gr.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function qu(){Xu()}function tr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function Ju(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Zu(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function Qu(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function ec(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function tc(e){return Array.isArray(e)?e:[e]}function nc(e,t){t.forEach(n=>e.add(n))}function Do(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}class vs extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class rc extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Lo(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function xo(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function sc(e){return e instanceof we.Subscription||e instanceof we.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function nt(e){let t=!1;return e?sc(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:nt(()=>{})}function ic(e){return nt(()=>{e.unsubscribe()})}class Kr{constructor(){C(this,"_disposables",new Set)}add(t){const n=nt(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class st{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Kr)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class oc extends st{constructor(){super(...arguments);C(this,"dispose$",new we.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class ac extends st{constructor(n){super();C(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}const Nn=je.createIdentifier("univer.context-service");class Uo extends st{constructor(){super(...arguments);C(this,"_contextChanged$",new we.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new we.Observable(r=>{const s=this._contextChanged$.pipe(we.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var ko=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(ko||{});const Ot=je.createIdentifier("univer.log");class Po extends st{constructor(){super(...arguments);C(this,"_logLevel",3);C(this,"_deduction",new Set)}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=lc(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function lc(...e){return e.map(t=>JSON.stringify(t)).join("")}var uc=Object.getOwnPropertyDescriptor,cc=(e,t,n,r)=>{for(var s=r>1?void 0:r?uc(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},bi=(e,t)=>(n,r)=>t(n,r,e),nr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(nr||{});const rr=je.createIdentifier("anywhere.command-service");class hc{constructor(){C(this,"_commands",new Map);C(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),nt(()=>{this._commands.delete(t.id),this._commandTypes.delete(t.id)})}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Fo={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends st{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new hc,this._registerCommand(Fo)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),nt(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),nt(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(c=>c(a,s));const u=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(c=>c(a,s)),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof vs)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const h=Zu(this._commandExecutionStack,d=>d.type===0);h&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=h.id)}const u=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(h=>h(l,s));const c=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(h=>h(l,s)),u.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof vs)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),nt(()=>tr(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(n)}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{const o=new Kr;s=new dc(n.id),o.add(this._commandRegistry.registerCommand(s)),o.add(nt(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return nt(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=cc([bi(0,je.Inject(je.Injector)),bi(1,Ot)],exports.CommandService);class dc{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(Ot),s=t.get(Nn),i=t.get(je.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),nt(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Xr(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return xo(r)}function fc(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Lo(r)}function $o(e){return new we.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Os(e){return function(n){return new we.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function gc(e=0){return t=>{let n=[];return t.pipe(we.tap(r=>n.push(r)),we.debounceTime(e),we.map(()=>n),we.tap(()=>n=[]))}}function mc(e){const t=new we.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(we.take(1))}const _c=e=>new Promise(t=>{we.merge($o(e.onCommandExecuted.bind(e)).pipe(br.filter(([n])=>n.type===nr.MUTATION)),we.timer(300)).pipe(br.debounceTime(16),br.first()).subscribe(()=>{t()})});function Bo(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 pc(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Ho(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function Fn(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=Bo(e,t):r=Ho(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Ec(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const $n=2,jo=1;function Cc(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:u=0,width:c=0,angle:h=0}=e,d=c,f=u,E=i,R=s;return Math.abs(a-n)>$n||Math.abs(l-r)>$n||Math.abs(d-E)>$n||Math.abs(f-R)>$n||Math.abs(h-o)>jo}var Wo=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Wo||{}),Xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(Xe||{}),Yo=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Yo||{}),Et=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(Et||{}),zo=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(zo||{}),Go=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Go||{}),Vo=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Vo||{}),Ko=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Ko||{}),Xo=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Xo||{}),qo=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(qo||{});function Rc(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Jo=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(Jo||{}),sr=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e))(sr||{}),Fr=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(Fr||{}),Zo=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(Zo||{}),Qo=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(Qo||{}),ea=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(ea||{}),ta=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(ta||{}),na=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(na||{}),ra=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(ra||{}),sa=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(sa||{}),Xn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Xn||{}),ia=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(ia||{}),wt=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(wt||{}),nn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(nn||{}),an=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(an||{}),$r=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))($r||{}),Br=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Br||{}),Ut=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Ut||{}),Ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Ie||{}),Vt=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(Vt||{}),ft=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ft||{}),qr=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(qr||{});const Ic="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Sc=e=>crypto.getRandomValues(new Uint8Array(e)),vc=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},Oc=(e,t=21)=>vc(e,t|0,Sc),wc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ic[n[e]&63];return t};const oa=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"]),bc=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function yc(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(bc.test(e)){if(aa(e))return!0;try{const r=new URL(la(e)).hostname.split(".").pop();if(r&&oa.has(r))return!0}catch{return!1}}return!1}function aa(e){return/^[a-zA-Z]+:\/\//.test(e)}function Ac(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function la(e){return aa(e)?e:Ac(e)?`mailto://${e}`:`https://${e}`}const Tc=/^-ms-/,Nc=/-([a-z])/g,jt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function qs(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Mc(e,t):re.isObject(e)?Dc(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Mc(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!qs(s,i))return!1}return!0}function Dc(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!qs(i,o))return!1}return!0}class re{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=jt.length;)r/=jt.length,r-=1,n+=jt[r%jt.length];const s=t%jt.length;return n+=jt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=jt.length**i+jt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const c=Number.parseFloat(RegExp.$1);return c===7?"IE7":c===8?"IE8":c===9?"IE9":c===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return kt(t,n)}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,u)=>{var c,h;if(re.isArray(l)){const d=(c=a[u])!=null?c:[];a[u]=d,r(l,d);return}if(re.isObject(l)){const d=(h=a[u])!=null?h:{};a[u]=d,s(l,d);return}a[u]=l})}function s(o,a){Object.keys(o).forEach(l=>{var c,h;const u=o[l];if(re.isObject(u)){const d=(c=a[l])!=null?c:{};a[l]=d,s(u,d);return}if(re.isArray(u)){const d=(h=a[l])!=null?h:[];a[l]=d,r(u,d);return}a[l]=u})}function i(o){Object.keys(o).forEach(a=>{var u,c;const l=o[a];if(re.isArray(l)){const h=(u=t[a])!=null?u:[];t[a]=h,r(l,h);return}if(re.isObject(l)){const h=(c=t[a])!=null?c:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return qs(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return yc(t)}static normalizeUrl(t){return la(t)}static topLevelDomainCombiningString(){return[...oa].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Tc,"ms-").replace(Nc,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-z_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function kt(e=21,t){return t?Oc(t,e)():wc(e)}function ws(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const Lc=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function yr(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(t,n,l,u)&&(l>i?(o.push(r.slice(i,l)),o.push(bs(r,{...a,ed:Math.min(u,n)}))):o.push(bs(r,{...a,st:i,ed:Math.min(u,n)}))),i=Math.max(t,Math.min(u,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function xc(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:u={}}=a,{spaceAbove:c,spaceBelow:h,lineSpacing:d}=u,f=[];c!=null&&(typeof c=="number"?f.push(`margin-top: ${c}px`):f.push(`margin-top: ${c.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${yr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=yr(e,o,r.length)),i}else return yr(e,0,e.dataStream.length)}function bs(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:u,st:c,ol:h,bg:d,cl:f,va:E}=s;let R=e.slice(n,r);const w=[];return a===Ie.TRUE&&(R=`<i>${R}</i>`),E===Ut.SUPERSCRIPT?R=`<sup>${R}</sup>`:E===Ut.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(u==null?void 0:u.s)===Ie.TRUE&&(R=`<u>${R}</u>`),(c==null?void 0:c.s)===Ie.TRUE&&(R=`<s>${R}</s>`),l===Ie.TRUE&&(R=`<strong>${R}</strong>`),i&&w.push(`font-family: ${i}`),f&&w.push(`color: ${f.rgb}`),o&&w.push(`font-size: ${o}pt`),h&&w.push("text-decoration: overline"),d&&w.push(`background: ${d.rgb}`),w.length?`<span style="${w.join("; ")};">${R}</span>`:R}const ua={[qr.OFFICE]:{[ft.ACCENT1]:"#4472C4",[ft.ACCENT2]:"#ED7D31",[ft.ACCENT3]:"#A5A5A5",[ft.ACCENT4]:"#70AD47",[ft.ACCENT5]:"#5B9BD5",[ft.ACCENT6]:"#70AD47",[ft.DARK1]:"#000000",[ft.DARK2]:"#44546A",[ft.LIGHT1]:"#FFFFFF",[ft.LIGHT2]:"#E7E6E6",[ft.HYPERLINK]:"#0563C1",[ft.FOLLOWED_HYPERLINK]:"#954F72"}};class Jr{constructor(){C(this,"_themeValue",ft.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=Et.UNSUPPORTED,this._themeColors=qr.OFFICE,this._themeTint=0}asRgbColor(){return new Hr(this._rgbValue,this)}asThemeColor(){return new jr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Et.THEME:return this.asThemeColor();case Et.RGB:return this.asRgbColor();case Et.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=Et.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Et.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Et.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Et.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class ln{constructor(t){C(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new Jr().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new ln(this._builder)}equals(t){return!1}}class ca{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new Jr;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,u=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(u*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const pt=class pt extends ln{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(pt.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(pt.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return ln.rgbColorToHexValue(this)}getRed(){let n=this._red+pt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+pt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+pt.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return Et.RGB}clone(){return new pt(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof pt?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(pt,"RGB_COLOR_AMT",0),C(pt,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(pt,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Hr=pt;const Yt=class Yt extends ln{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=ua[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Yt._cacheThemeColor.has(this._themeColors)){if(s=Yt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Yt._cacheThemeColor.set(this._themeColors,s);const i=new ca(ln.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Yt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Yt?n._themeColorType===this._themeColorType:!1}getColorType(){return Et.THEME}getThemeColorType(){return this._themeColorType}};C(Yt,"_cacheThemeColor",new Map);let jr=Yt;const Uc="rgb(",kc="rgba(",ys={aliceBlue:[240,248,255],antiqueWhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blancheAlmond:[255,235,205],blue:[0,0,255],blueViolet:[138,43,226],brown:[165,42,42],burlyWood:[222,184,135],cadetBlue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornFlowerBlue:[100,149,237],cornSilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkCyan:[0,139,139],darkGoldenrod:[184,132,11],darkGray:[169,169,169],darkGreen:[0,100,0],darkGrey:[169,169,169],darkKhaki:[189,183,107],darkMagenta:[139,0,139],darkOliveGreen:[85,107,47],darkOrange:[255,140,0],darkOrchid:[153,50,204],darkRed:[139,0,0],darkSalmon:[233,150,122],darkSeaGreen:[143,188,143],darkSlateBlue:[72,61,139],darkSlateGray:[47,79,79],darkSlateGrey:[47,79,79],darkTurquoise:[0,206,209],darkViolet:[148,0,211],deepPink:[255,20,147],deepSkyBlue:[0,191,255],dimGray:[105,105,105],dimGrey:[105,105,105],dodgerBlue:[30,144,255],firebrick:[178,34,34],floralWhite:[255,255,240],forestGreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostWhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenYellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotPink:[255,105,180],indianRed:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderBlush:[255,240,245],lawnGreen:[124,252,0],lemonChiffon:[255,250,205],lightblue:[173,216,230],lightCoral:[240,128,128],lightCyan:[224,255,255],lightGoldenrodYellow:[250,250,210],lightGray:[211,211,211],lightGreen:[144,238,144],lightGrey:[211,211,211],lightPink:[255,182,193],lightSalmon:[255,160,122],lightSeaGreen:[32,178,170],lightSkyBlue:[135,206,250],lightSlateGray:[119,136,153],lightSlateGrey:[119,136,153],lightSteelBlue:[176,196,222],lightYellow:[255,255,224],lime:[0,255,0],limeGreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumAquamarine:[102,205,170],mediumBlue:[0,0,205],mediumOrchid:[186,85,211],mediumPurple:[147,112,219],mediumSeaGreen:[60,179,113],mediumSlateBlue:[123,104,238],mediumSpringGreen:[0,250,154],mediumTurquoise:[72,209,204],mediumVioletRed:[199,21,133],midBightBlue:[25,25,112],mintCream:[245,255,250],mistyRose:[255,228,225],moccasin:[255,228,181],navajoWhite:[255,222,173],navy:[0,0,128],oldLace:[253,245,230],olive:[128,128,0],oliveDrab:[107,142,35],orange:[255,165,0],orangeRed:[255,69,0],orchid:[218,112,214],paleGoldenrod:[238,232,170],paleGreen:[152,251,152],paleTurquoise:[175,238,238],paleVioletRed:[219,112,147],papayaWhip:[255,239,213],peachPuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderBlue:[176,224,230],purple:[128,0,128],rebeccaPurple:[102,51,153],red:[255,0,0],rosyBrown:[188,143,143],royalBlue:[65,105,225],saddleBrown:[139,69,19],salmon:[250,128,114],sandyBrown:[244,164,96],seaGreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyBlue:[135,206,235],slateBlue:[106,90,205],slateGray:[119,128,144],slateGrey:[119,128,144],snow:[255,255,250],springGreen:[0,255,127],steelBlue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whiteSmoke:[245,245,245],yellow:[255,255,0],yellowGreen:[154,205,5]};class vt{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof vt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=ha(t);if(n==null){this._setNullColor();return}this._color=n;const r=Hc(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var u,c;r=Math.min(1,Math.max(0,r));const s=new vt(t).toRgb(),i=new vt(n).toRgb(),o=(u=s.a)!=null?u:1,a=(c=i.a)!=null?c:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new vt(l)}static getContrastRatio(t,n){const r=new vt(t).getLuminance(),s=new vt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[mr(Math.round(n).toString(16)),mr(Math.round(r).toString(16)),mr(Math.round(s).toString(16)),mr(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return zc(this.toRgb())}toHsl(){return Yc(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new vt(n)}setAlpha(t){return new vt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=as(t),n=as(n),r=as(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const mr=e=>e.length===1?`0${e}`:e,as=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),ha=e=>{if(Vc(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim();if(ys[t]){const n=ys[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return Pc(t);if(t.startsWith("rgb"))return Fc(t);if(t.startsWith("hsl"))return $c(t);if(t.startsWith("hsv"))return Bc(t)},Pc=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},Fc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},$c=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Bc=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},Hc=e=>{const t=ha(e);if(t!=null)return"r"in t?t:"l"in t?jc(t):Wc(t)},ls=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),jc=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,u=2*r-l;s=ls(u,l,t+1/3),i=ls(u,l,t),o=ls(u,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},Wc=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),u=s%6,c=[r,a,o,o,l,r][u],h=[l,r,r,a,o,o][u],d=[o,o,l,r,r,a][u],f={r:c*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},Yc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const c=s-i;switch(l=o>.5?c/(2-s-i):c/(s+i),s){case t:a=(n-r)/c+(n<r?6:0);break;case n:a=(r-t)/c+2;break;default:a=(t-n)/c+4;break}a/=6}const u={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(u.a=e.a),u},zc=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,u=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const c={h:Math.round(o*360),s:Math.round(u*100),v:Math.round(a*100)};return e.a!==void 0&&(c.a=e.a),c},Gc=e=>e==null,Vc=e=>!Gc(e)&&typeof e=="object";function Kc(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function Xc(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}var xe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(xe||{});function qc(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 Jc(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return Vt.STRING;if(typeof e.v=="number")return Vt.NUMBER;if(typeof e.v=="boolean")return Vt.BOOLEAN}function Zc(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function Qc(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var Le=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Le||{}),tt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(tt||{});function eh(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var da=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(da||{}),fa=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(fa||{});function th(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let u=0;u<n.length;u++){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=n[u];if(e===c&&t===d){i=h,o=f,a=c,l=d,s=!0;break}if(e>=c&&e<=h&&t>=d&&t<=f){i=h,o=f,a=c,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Rn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Rn||{});function ga(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:u}=e,c=t,h=n,d=t,f=n;if(r&&i){const{startRow:E,startColumn:R,endRow:w,endColumn:T,startY:z,endY:G,startX:de,endX:M}=i;c=E,h=R,d=w,f=T,o=z,a=G,l=de,u=M}return s&&(o=i.startY,a=i.endY,l=i.startX,u=i.endX,d=i.endRow,f=i.endColumn),{startRow:c,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:u}}const nh=ga;function rh(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let u=t,c=n,h=t,d=n;return(r||s)&&(u=i,c=o,h=a,d=l),{startRow:u,startColumn:c,endRow:h,endColumn:d}}function ma(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function As(e){return ma(e)&&(e==null?void 0:e.coverable)!==!1}function Nt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new Jr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function sh(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function ih(e){return re.isString(e)&&e.length>0}function oh(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Nt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Nt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Nt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Nt(e.bg)}; `)}],["bd",()=>{var o,a,l,u,c,h,d,f,E,R,w,T;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${_r((a=e.bd)==null?void 0:a.b.s)} ${(l=Nt(e.bd.b.cl))!=null?l:""}; `),(u=e.bd)!=null&&u.t&&(n+=`border-top: ${_r((c=e.bd)==null?void 0:c.t.s)} ${(h=Nt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${_r((f=e.bd)==null?void 0:f.r.s)} ${(E=Nt(e.bd.r.cl))!=null?E:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${_r((w=e.bd)==null?void 0:w.l.s)} ${(T=Nt(e.bd.l.cl))!=null?T:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Nt(e.cl)}; `)}],["va",()=>{e.va===Ut.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Ut.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Xn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Xn.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===wt.LEFT?n+="text-align: left; ":e.ht===wt.RIGHT?n+="text-align: right; ":e.ht===wt.CENTER?n+="text-align: center; ":e.ht===wt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===nn.BOTTOM?n+="vertical-align: bottom; ":e.vt===nn.TOP?n+="vertical-align: top; ":e.vt===nn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===an.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===an.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var c,h,d,f,E,R,w,T;const o=`${(c=e.pd)==null?void 0:c.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,u=`${(f=e.pd)==null?void 0:f.r}pt`;(E=e.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=e.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(w=e.pd)!=null&&w.l&&(n+=`padding-left: ${l}; `),(T=e.pd)!=null&&T.r&&(n+=`padding-right: ${u}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function _r(e){let t="";return e===Xe.NONE?t="none":e===Xe.THIN?t="0.5pt solid":e===Xe.HAIR?t="0.5pt double":e===Xe.DOTTED?t="0.5pt dotted":e===Xe.DASHED||e===Xe.DASH_DOT?t="0.5pt dashed":e===Xe.DASH_DOT_DOT?t="0.5pt dotted":e===Xe.DOUBLE?t="0.5pt double":e===Xe.MEDIUM?t="1pt solid":e===Xe.MEDIUM_DASHED||e===Xe.MEDIUM_DASH_DOT?t="1pt dashed":e===Xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===Xe.SLANT_DASH_DOT?t="0.5pt dashed":e===Xe.THICK&&(t="1.5pt solid"),t}function ah(e){let t=0;if(e=e.trim(),e==="none")t=Xe.NONE;else if(e==="0.5pt solid")t=Xe.THIN;else if(e==="0.5pt double")t=Xe.HAIR;else if(e==="0.5pt dotted")t=Xe.DOTTED;else if(e==="0.5pt dashed")t=Xe.DASHED;else if(e==="1pt solid")t=Xe.MEDIUM;else if(e==="1pt dashed")t=Xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=Xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=Xe.THICK;else if(!e.includes("none"))t=Xe.THIN;else return Xe.NONE;return t}function lh(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function uh(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===Le.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===Le.ROW||o!==Le.ROW&&o!==Le.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function ch(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Js(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>Js(e[n],t[n])):e===t:!1}function _a(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Js(n,r)}function hh(e,t){return t.some(n=>e.indexOf(n)>-1)}function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ar={exports:{}},dh=Ar.exports,yi;function fh(){return yi||(yi=1,function(e,t){(function(n,r){e.exports=r()})(dh,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",u="day",c="week",h="month",d="quarter",f="year",E="date",R="Invalid Date",w=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,z={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(D){var b=["th","st","nd","rd"],O=D%100;return"["+D+(b[(O-20)%10]||b[O]||b[0])+"]"}},G=function(D,b,O){var P=String(D);return!P||P.length>=b?D:""+Array(b+1-P.length).join(O)+D},de={s:G,z:function(D){var b=-D.utcOffset(),O=Math.abs(b),P=Math.floor(O/60),$=O%60;return(b<=0?"+":"-")+G(P,2,"0")+":"+G($,2,"0")},m:function D(b,O){if(b.date()<O.date())return-D(O,b);var P=12*(O.year()-b.year())+(O.month()-b.month()),$=b.clone().add(P,h),V=O-$<0,se=b.clone().add(P+(V?-1:1),h);return+(-(P+(O-$)/(V?$-se:se-$))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:h,y:f,w:c,d:u,D:E,h:l,m:a,s:o,ms:i,Q:d}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},M="en",A={};A[M]=z;var j="$isDayjsObject",Z=function(D){return D instanceof H||!(!D||!D[j])},fe=function D(b,O,P){var $;if(!b)return M;if(typeof b=="string"){var V=b.toLowerCase();A[V]&&($=V),O&&(A[V]=O,$=V);var se=b.split("-");if(!$&&se.length>1)return D(se[0])}else{var he=b.name;A[he]=b,$=he}return!P&&$&&(M=$),$||!P&&M},ae=function(D,b){if(Z(D))return D.clone();var O=typeof b=="object"?b:{};return O.date=D,O.args=arguments,new H(O)},_=de;_.l=fe,_.i=Z,_.w=function(D,b){return ae(D,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var H=function(){function D(O){this.$L=fe(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[j]=!0}var b=D.prototype;return b.parse=function(O){this.$d=function(P){var $=P.date,V=P.utc;if($===null)return new Date(NaN);if(_.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var se=$.match(w);if(se){var he=se[2]-1||0,ge=(se[7]||"0").substring(0,3);return V?new Date(Date.UTC(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)):new Date(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)}}return new Date($)}(O),this.init()},b.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},b.$utils=function(){return _},b.isValid=function(){return this.$d.toString()!==R},b.isSame=function(O,P){var $=ae(O);return this.startOf(P)<=$&&$<=this.endOf(P)},b.isAfter=function(O,P){return ae(O)<this.startOf(P)},b.isBefore=function(O,P){return this.endOf(P)<ae(O)},b.$g=function(O,P,$){return _.u(O)?this[P]:this.set($,O)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(O,P){var $=this,V=!!_.u(P)||P,se=_.p(O),he=function(Y,W){var le=_.w($.$u?Date.UTC($.$y,W,Y):new Date($.$y,W,Y),$);return V?le:le.endOf(u)},ge=function(Y,W){return _.w($.toDate()[Y].apply($.toDate("s"),(V?[0,0,0,0]:[23,59,59,999]).slice(W)),$)},Te=this.$W,ye=this.$M,S=this.$D,F="set"+(this.$u?"UTC":"");switch(se){case f:return V?he(1,0):he(31,11);case h:return V?he(1,ye):he(0,ye+1);case c:var K=this.$locale().weekStart||0,q=(Te<K?Te+7:Te)-K;return he(V?S-q:S+(6-q),ye);case u:case E:return ge(F+"Hours",0);case l:return ge(F+"Minutes",1);case a:return ge(F+"Seconds",2);case o:return ge(F+"Milliseconds",3);default:return this.clone()}},b.endOf=function(O){return this.startOf(O,!1)},b.$set=function(O,P){var $,V=_.p(O),se="set"+(this.$u?"UTC":""),he=($={},$[u]=se+"Date",$[E]=se+"Date",$[h]=se+"Month",$[f]=se+"FullYear",$[l]=se+"Hours",$[a]=se+"Minutes",$[o]=se+"Seconds",$[i]=se+"Milliseconds",$)[V],ge=V===u?this.$D+(P-this.$W):P;if(V===h||V===f){var Te=this.clone().set(E,1);Te.$d[he](ge),Te.init(),this.$d=Te.set(E,Math.min(this.$D,Te.daysInMonth())).$d}else he&&this.$d[he](ge);return this.init(),this},b.set=function(O,P){return this.clone().$set(O,P)},b.get=function(O){return this[_.p(O)]()},b.add=function(O,P){var $,V=this;O=Number(O);var se=_.p(P),he=function(ye){var S=ae(V);return _.w(S.date(S.date()+Math.round(ye*O)),V)};if(se===h)return this.set(h,this.$M+O);if(se===f)return this.set(f,this.$y+O);if(se===u)return he(1);if(se===c)return he(7);var ge=($={},$[a]=r,$[l]=s,$[o]=n,$)[se]||1,Te=this.$d.getTime()+O*ge;return _.w(Te,this)},b.subtract=function(O,P){return this.add(-1*O,P)},b.format=function(O){var P=this,$=this.$locale();if(!this.isValid())return $.invalidDate||R;var V=O||"YYYY-MM-DDTHH:mm:ssZ",se=_.z(this),he=this.$H,ge=this.$m,Te=this.$M,ye=$.weekdays,S=$.months,F=$.meridiem,K=function(W,le,oe,B){return W&&(W[le]||W(P,V))||oe[le].slice(0,B)},q=function(W){return _.s(he%12||12,W,"0")},Y=F||function(W,le,oe){var B=W<12?"AM":"PM";return oe?B.toLowerCase():B};return V.replace(T,function(W,le){return le||function(oe){switch(oe){case"YY":return String(P.$y).slice(-2);case"YYYY":return _.s(P.$y,4,"0");case"M":return Te+1;case"MM":return _.s(Te+1,2,"0");case"MMM":return K($.monthsShort,Te,S,3);case"MMMM":return K(S,Te);case"D":return P.$D;case"DD":return _.s(P.$D,2,"0");case"d":return String(P.$W);case"dd":return K($.weekdaysMin,P.$W,ye,2);case"ddd":return K($.weekdaysShort,P.$W,ye,3);case"dddd":return ye[P.$W];case"H":return String(he);case"HH":return _.s(he,2,"0");case"h":return q(1);case"hh":return q(2);case"a":return Y(he,ge,!0);case"A":return Y(he,ge,!1);case"m":return String(ge);case"mm":return _.s(ge,2,"0");case"s":return String(P.$s);case"ss":return _.s(P.$s,2,"0");case"SSS":return _.s(P.$ms,3,"0");case"Z":return se}return null}(W)||se.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(O,P,$){var V,se=this,he=_.p(P),ge=ae(O),Te=(ge.utcOffset()-this.utcOffset())*r,ye=this-ge,S=function(){return _.m(se,ge)};switch(he){case f:V=S()/12;break;case h:V=S();break;case d:V=S()/3;break;case c:V=(ye-Te)/6048e5;break;case u:V=(ye-Te)/864e5;break;case l:V=ye/s;break;case a:V=ye/r;break;case o:V=ye/n;break;default:V=ye}return $?V:_.a(V)},b.daysInMonth=function(){return this.endOf(h).$D},b.$locale=function(){return A[this.$L]},b.locale=function(O,P){if(!O)return this.$L;var $=this.clone(),V=fe(O,P,!0);return V&&($.$L=V),$},b.clone=function(){return _.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},D}(),v=H.prototype;return ae.prototype=v,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",u],["$M",h],["$y",f],["$D",E]].forEach(function(D){v[D[1]]=function(b){return this.$g(b,D[0],D[1])}}),ae.extend=function(D,b){return D.$i||(D(b,H,ae),D.$i=!0),ae},ae.locale=fe,ae.isDayjs=Z,ae.unix=function(D){return ae(1e3*D)},ae.en=A[M],ae.Ls=A,ae.p={},ae})}(Ar)),Ar.exports}var gh=fh();const Ft=Rt(gh);var Tr={exports:{}},mh=Tr.exports,Ai;function _h(){return Ai||(Ai=1,function(e,t){(function(n,r){e.exports=r()})(mh,function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var u=this.$utils(),c=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return u.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return u.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return u.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}});return i.bind(this)(c)}}})}(Tr)),Tr.exports}var ph=_h();const Eh=Rt(ph);var Nr={exports:{}},Ch=Nr.exports,Ti;function Rh(){return Ti||(Ti=1,function(e,t){(function(n,r){e.exports=r()})(Ch,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},u=function(w){return(w=+w)+(w>68?1900:2e3)},c=function(w){return function(T){this[w]=+T}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(w){(this.zone||(this.zone={})).offset=function(T){if(!T||T==="Z")return 0;var z=T.match(/([+-]|\d\d)/g),G=60*z[1]+(+z[2]||0);return G===0?0:z[0]==="+"?-G:G}(w)}],d=function(w){var T=l[w];return T&&(T.indexOf?T:T.s.concat(T.f))},f=function(w,T){var z,G=l.meridiem;if(G){for(var de=1;de<=24;de+=1)if(w.indexOf(G(de,0,T))>-1){z=de>12;break}}else z=w===(T?"pm":"PM");return z},E={A:[a,function(w){this.afternoon=f(w,!1)}],a:[a,function(w){this.afternoon=f(w,!0)}],Q:[s,function(w){this.month=3*(w-1)+1}],S:[s,function(w){this.milliseconds=100*+w}],SS:[i,function(w){this.milliseconds=10*+w}],SSS:[/\d{3}/,function(w){this.milliseconds=+w}],s:[o,c("seconds")],ss:[o,c("seconds")],m:[o,c("minutes")],mm:[o,c("minutes")],H:[o,c("hours")],h:[o,c("hours")],HH:[o,c("hours")],hh:[o,c("hours")],D:[o,c("day")],DD:[i,c("day")],Do:[a,function(w){var T=l.ordinal,z=w.match(/\d+/);if(this.day=z[0],T)for(var G=1;G<=31;G+=1)T(G).replace(/\[|\]/g,"")===w&&(this.day=G)}],w:[o,c("week")],ww:[i,c("week")],M:[o,c("month")],MM:[i,c("month")],MMM:[a,function(w){var T=d("months"),z=(d("monthsShort")||T.map(function(G){return G.slice(0,3)})).indexOf(w)+1;if(z<1)throw new Error;this.month=z%12||z}],MMMM:[a,function(w){var T=d("months").indexOf(w)+1;if(T<1)throw new Error;this.month=T%12||T}],Y:[/[+-]?\d+/,c("year")],YY:[i,function(w){this.year=u(w)}],YYYY:[/\d{4}/,c("year")],Z:h,ZZ:h};function R(w){var T,z;T=w,z=l&&l.formats;for(var G=(w=T.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(ae,_,H){var v=H&&H.toUpperCase();return _||z[H]||n[H]||z[v].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,b,O){return b||O.slice(1)})})).match(r),de=G.length,M=0;M<de;M+=1){var A=G[M],j=E[A],Z=j&&j[0],fe=j&&j[1];G[M]=fe?{regex:Z,parser:fe}:A.replace(/^\[|\]$/g,"")}return function(ae){for(var _={},H=0,v=0;H<de;H+=1){var D=G[H];if(typeof D=="string")v+=D.length;else{var b=D.regex,O=D.parser,P=ae.slice(v),$=b.exec(P)[0];O.call(_,$),ae=ae.replace($,"")}}return function(V){var se=V.afternoon;if(se!==void 0){var he=V.hours;se?he<12&&(V.hours+=12):he===12&&(V.hours=0),delete V.afternoon}}(_),_}}return function(w,T,z){z.p.customParseFormat=!0,w&&w.parseTwoDigitYear&&(u=w.parseTwoDigitYear);var G=T.prototype,de=G.parse;G.parse=function(M){var A=M.date,j=M.utc,Z=M.args;this.$u=j;var fe=Z[1];if(typeof fe=="string"){var ae=Z[2]===!0,_=Z[3]===!0,H=ae||_,v=Z[2];_&&(v=Z[2]),l=this.$locale(),!ae&&v&&(l=z.Ls[v]),this.$d=function(P,$,V,se){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*P);var he=R($)(P),ge=he.year,Te=he.month,ye=he.day,S=he.hours,F=he.minutes,K=he.seconds,q=he.milliseconds,Y=he.zone,W=he.week,le=new Date,oe=ye||(ge||Te?1:le.getDate()),B=ge||le.getFullYear(),te=0;ge&&!Te||(te=Te>0?Te-1:le.getMonth());var ie,me=S||0,be=F||0,De=K||0,X=q||0;return Y?new Date(Date.UTC(B,te,oe,me,be,De,X+60*Y.offset*1e3)):V?new Date(Date.UTC(B,te,oe,me,be,De,X)):(ie=new Date(B,te,oe,me,be,De,X),W&&(ie=se(ie).week(W).toDate()),ie)}catch{return new Date("")}}(A,fe,j,z),this.init(),v&&v!==!0&&(this.$L=this.locale(v).$L),H&&A!=this.format(fe)&&(this.$d=new Date("")),l={}}else if(fe instanceof Array)for(var D=fe.length,b=1;b<=D;b+=1){Z[1]=fe[b-1];var O=z.apply(this,Z);if(O.isValid()){this.$d=O.$d,this.$L=O.$L,this.init();break}b===D&&(this.$d=new Date(""))}else de.call(this,M)}}})}(Nr)),Nr.exports}var Ih=Rh();const Sh=Rt(Ih);var Mr={exports:{}},vh=Mr.exports,Ni;function Oh(){return Ni||(Ni=1,function(e,t){(function(n,r){e.exports=r()})(vh,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,E,R){var w=h.name?h:h.$locale(),T=o(w[d]),z=o(w[f]),G=T||z.map(function(M){return M.slice(0,E)});if(!R)return G;var de=w.weekStart;return G.map(function(M,A){return G[(A+(de||0))%7]})},l=function(){return s.Ls[s.locale()]},u=function(h,d){return h.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(E,R,w){return R||w.slice(1)})}(h.formats[d.toUpperCase()])},c=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return u(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return c.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return u(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}})}(Mr)),Mr.exports}var wh=Oh();const bh=Rt(wh);var Dr={exports:{}},yh=Dr.exports,Mi;function Ah(){return Mi||(Mi=1,function(e,t){(function(n,r){e.exports=r()})(yh,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var u=this.$locale().formats,c=function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,E,R){var w=R&&R.toUpperCase();return E||d[R]||n[R]||d[w].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,z,G){return z||G.slice(1)})})}(l,u===void 0?{}:u);return a.call(this,c)}}})}(Dr)),Dr.exports}var Th=Ah();const Nh=Rt(Th);var Lr={exports:{}},Mh=Lr.exports,Di;function Dh(){return Di||(Di=1,function(e,t){(function(n,r){e.exports=r()})(Mh,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(R){var w={date:R,utc:!0,args:arguments};return new o(w)},l.utc=function(R){var w=a(this.toDate(),{locale:this.$L,utc:!0});return R?w.add(this.utcOffset(),n):w},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var u=l.parse;l.parse=function(R){R.utc&&(this.$u=!0),this.$utils().u(R.$offset)||(this.$offset=R.$offset),u.call(this,R)};var c=l.init;l.init=function(){if(this.$u){var R=this.$d;this.$y=R.getUTCFullYear(),this.$M=R.getUTCMonth(),this.$D=R.getUTCDate(),this.$W=R.getUTCDay(),this.$H=R.getUTCHours(),this.$m=R.getUTCMinutes(),this.$s=R.getUTCSeconds(),this.$ms=R.getUTCMilliseconds()}else c.call(this)};var h=l.utcOffset;l.utcOffset=function(R,w){var T=this.$utils().u;if(T(R))return this.$u?0:T(this.$offset)?h.call(this):this.$offset;if(typeof R=="string"&&(R=function(M){M===void 0&&(M="");var A=M.match(r);if(!A)return null;var j=(""+A[0]).match(s)||["-",0,0],Z=j[0],fe=60*+j[1]+ +j[2];return fe===0?0:Z==="+"?fe:-fe}(R),R===null))return this;var z=Math.abs(R)<=16?60*R:R,G=this;if(w)return G.$offset=z,G.$u=R===0,G;if(R!==0){var de=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(G=this.local().add(z+de,n)).$offset=z,G.$x.$localOffset=de}else G=this.utc();return G};var d=l.format;l.format=function(R){var w=R||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,w)},l.valueOf=function(){var R=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*R},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(R){return R==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var E=l.diff;l.diff=function(R,w,T){if(R&&this.$u===R.$u)return E.call(this,R,w,T);var z=this.local(),G=a(R).local();return E.call(z,G,w,T)}}})}(Lr)),Lr.exports}var Lh=Dh();const xh=Rt(Lh);var xr={exports:{}},Uh=xr.exports,Li;function kh(){return Li||(Li=1,function(e,t){(function(n,r){e.exports=r()})(Uh,function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}})}(xr)),xr.exports}var Ph=kh();const Fh=Rt(Ph);var Ur={exports:{}},$h=Ur.exports,xi;function Bh(){return xi||(xi=1,function(e,t){(function(n,r){e.exports=r()})($h,function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var u=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var c=o(this).startOf(r).add(1,r).date(u),h=o(this).endOf(n);if(c.isBefore(h))return 1}var d=o(this).startOf(r).date(u).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(Ur)),Ur.exports}var Hh=Bh();const jh=Rt(Hh);var kr={exports:{}},Wh=kr.exports,Ui;function Yh(){return Ui||(Ui=1,function(e,t){(function(n,r){e.exports=r()})(Wh,function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}})}(kr)),kr.exports}var zh=Yh();const Gh=Rt(zh);Ft.extend(Sh);Ft.extend(Eh);Ft.extend(Fh);Ft.extend(bh);Ft.extend(jh);Ft.extend(Gh);Ft.extend(xh);Ft.extend(Nh);function Zr(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function Vh(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function Kh(e){if(e==null)return!1;const t=e.paragraphStyle;return pa(t)}function pa(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 Ea(e,t,n){return e.slice(0,t)+n+e.slice(t)}function Ca(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function Xh(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function qh(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ke=Symbol("newer"),it=Symbol("older");class Jh{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.key}):{done:!0,value:void 0}}}class Zh{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:t.value}):{done:!0,value:void 0}}}class Qh{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ke],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var No,Mo;Mo=Ke,No=it;class ki{constructor(t,n){C(this,"key");C(this,"value");C(this,Mo);C(this,No);this.key=t,this.value=n,this[Ke]=void 0,this[it]=void 0}toJSON(){return{key:this.key,value:this.value}}}class qn{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(Bn.hasLength(t,1)){if(Bn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Bn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Bn.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),nt(()=>tr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Ke]&&(t===this.oldest&&(this.oldest=t[Ke]),t[Ke][it]=t[it]),t[it]&&(t[it][Ke]=t[Ke]),t[Ke]=void 0,t[it]=this.newest,this.newest&&(this.newest[Ke]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new ki(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ke]=o,o[it]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new ki(t,n)),this.newest?(this.newest[Ke]=r,r[it]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Ke]?(this.oldest=this.oldest[Ke],this.oldest[it]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ke]=t[it]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Ke]&&n[it]?(n[it][Ke]=n[Ke],n[Ke][it]=n[it]):n[Ke]?(n[Ke][it]=void 0,this.oldest=n[Ke]):n[it]?(n[it][Ke]=void 0,this.newest=n[it]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Jh(this.oldest)}values(){return new Zh(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Qh(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Ke]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Ke];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ke],n&&(t+=" < ");return t}}class Bn{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}var Pr={exports:{}},ed=Pr.exports,Pi;function td(){return Pi||(Pi=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:ed,function(){return function(){var n={d:function(p,g){for(var m in g)n.o(g,m)&&!n.o(p,m)&&Object.defineProperty(p,m,{enumerable:!0,get:g[m]})},o:function(p,g){return Object.prototype.hasOwnProperty.call(p,g)}},r={};n.d(r,{default:function(){return ht}});var s={1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(p){const g=i.exec(p);if(!g)throw new SyntaxError("Malformed locale: ".concat(p));return{lang:g[1]+(g[2]?"_"+g[2]:""),language:g[1],territory:g[2]||"",codeset:g[3]||"",modifier:g[4]||""}}function u(p){if(typeof p=="number")return s[65535&p]||null;const g=parseInt(p,16);return isFinite(g)&&s[65535&g]?s[65535&g]||null:i.test(p)?p:null}function c(p){const g=u(p);let m=null;if(g){const y=l(g);m=o[y.lang]||o[y.language]||null}return m}function h(p){return Object.assign({},a,p)}function d(p,g){const m=typeof g=="object"?g:l(g);return o[m.lang]=h(p),m.language===m.lang||o[m.language]||(o[m.language]=h(p)),o[m.lang]}const f=h({group:","});function E(p,g){if(typeof p!="number")return p;if(p<0)return-E(-p,g);if(g){const m=10**(g||0)||1;return E(p*m,0)/m}return Math.round(p)}f.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function R(p,g,m){const y=p<0?-1:1,N=10**(g||2),U=10**(m||2);let x,k,I=Math.abs(p),Q=0,pe=0,J=0,_e=1;if((p=I)%1==0)k=[p*y,1];else if(p<1e-19)k=[y,1e19];else if(p>1e19)k=[1e19*y,1];else{do if(I=1/(I-Math.floor(I)),x=_e,_e=_e*Math.floor(I)+Q,Q=x,pe=J,J=Math.floor(p*_e+.5),J>=N||_e>=U)return[y*pe,Q];while(Math.abs(p-J/_e)>=1e-10&&I!==Math.floor(I));k=[y*J,_e]}return k}const w={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},T=Object.assign({},w);function z(p){if(p===null&&(p=w),p){for(const g in p)if(g in w){const m=p[g];T[g]=m==null?w[g]:m}}return{...T}}const G={"#":"",0:"0","?":" "},de={"@":"text","-":"minus","+":"plus"},M=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],A=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],j=new RegExp("["+A.join("")+"]");function Z(p,g,m){return g[m+"_max"]=p.length,g[m+"_min"]=p.replace(/#/g,"").length,g}const fe={};function ae(p){if(!(p in fe)){const g=[],m=p.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,y=>"?".repeat(y.length));for(let y=0;y<m.length;y++){const N=m.charAt(y);g[y]=N in G?G[N]:N}fe[p]=g.join("")}return fe[p]}function _(p,g){typeof p=="string"&&(p={type:"string",value:p=p.replace(/ /g,G["?"])}),g.push(p)}function H(p){const g=[],m={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:g};let y=p+"",N="int",U=!1,x=null;const k=[];let I,Q,pe=!1;for(;y&&!U;){if(I=/^General/i.exec(y))m.general=!0,_({type:"general"},g);else if(N==="int"&&(I=/^[#?0]+(?:,[#?0]+)*/.exec(y))||N==="den"&&(I=/^[#?\d]+/.exec(y))||(I=/^[#?0]+/.exec(y)))m[N+"_pattern"].push(I[0]),x={type:N,num:I[0]},_(x,g);else if((I=/^\//.exec(y))&&m[N+"_pattern"].length){if(!x)throw new SyntaxError("Missing a numerator in pattern ".concat(p));m.fractions=!0,m.num_pattern.push(m[N+"_pattern"].pop()),x.type="num",N="den",_({type:"div"},g)}else if(I=/^,+/.exec(y)){const L=y.charAt(1)in G;Q.slice(-1)in G&&(I[0].length>1||!L)?m.scale=.001**I[0].length:m.dec_fractions||_(I[0],g)}else{if(I=/^;/.exec(y)){U=!0;break}if(I=/^[@+-]/.exec(y))I[0]==="@"&&(m.text=!0),_({type:de[I[0]]},g);else if(I=/^(?:\[(h+|m+|s+)\])/i.exec(y)){const L=I[1].toLowerCase(),ee=L[0],Ce={type:"",size:0,date:1,raw:I[0],pad:L.length};ee==="h"?(Ce.size=16,Ce.type="hour-elap"):ee==="m"?(Ce.size=32,Ce.type="min-elap"):(Ce.size=64,Ce.type="sec-elap"),m.date=m.date|Ce.size,k.push(Ce),_(Ce,g)}else if(I=/^(?:B2)/i.exec(y))pe||(m.date_system=6);else if(I=/^(?:B1)/i.exec(y))pe||(m.date_system=1);else if(I=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(y)){const L={type:"",size:0,date:1,raw:I[0]},ee=I[0].toLowerCase(),Ce=ee[0];if(ee==="y"||ee==="yy")L.size=2,L.type="year-short";else if(Ce==="y"||Ce==="e")L.size=2,L.type="year";else if(ee==="b"||ee==="bb")L.size=2,L.type="b-year-short";else if(Ce==="b")L.size=2,L.type="b-year";else if(ee==="d"||ee==="dd")L.size=8,L.type="day",L.pad=/dd/.test(ee);else if(ee==="ddd")L.size=8,L.type="weekday-short";else if(Ce==="d")L.size=8,L.type="weekday";else if(Ce==="h")L.size=16,L.type="hour",L.pad=/hh/i.test(ee);else if(Ce==="m"){ee.length===3?(L.size=4,L.type="monthname-short"):ee.length===5?(L.size=4,L.type="monthname-single"):ee.length>=4&&(L.size=4,L.type="monthname");const Ae=k[k.length-1];!L.type&&Ae&&!Ae.used&&80&Ae.size&&(Ae.used=!0,L.size=32,L.type="min",L.pad=/mm/.test(ee)),L.type||(L.size=4,L.type="month",L.pad=/mm/.test(ee),L.indeterminate=!0)}else if(Ce==="s"){L.size=64,L.type="sec",L.pad=/ss/.test(ee);const Ae=k[k.length-1];Ae&&32&Ae.size?L.used=!0:Ae&&Ae.indeterminate&&(delete Ae.indeterminate,Ae.size=32,Ae.type="min",L.used=!0)}m.date=m.date|L.size,m.date_eval=!0,k.push(L),_(L,g)}else if(I=/^(?:AM\/PM|am\/pm|A\/P)/.exec(y))m.clock=12,m.date=16|m.date,m.date_eval=!0,_({type:"am",short:I[0]==="A/P"},g);else if(m.date&&(I=/^\.0{1,3}/i.exec(y))){const L=I[0].length-1,ee=[64,128,256,512][L];m.date=m.date|ee,m.date_eval=!0,m.sec_decimals=Math.max(m.sec_decimals,L),_({type:"subsec",size:ee,decimals:L,date:1,raw:I[0]},g)}else if((I=/^\\(.)/.exec(y))||(I=/^"([^"]*?)"/.exec(y)))_(I[1],g);else if(I=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(y))m.condition=[I[1],parseFloat(I[2],10)];else if(I=/^\[\$([^\]]+)\]/.exec(y)){const L=I[1].split("-"),ee=L.length<2?"":L[L.length-1],Ce=L[0];Ce&&_(Ce,g);const Ae=u(ee);Ae&&(m.locale=Ae);const ke=parseInt(ee,16);isFinite(ke)&&16711680&ke&&(ke>>16&255)===6&&(m.date_system=6),pe=!0}else if(I=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(y))m.color=I[2]?M[parseInt(I[2],10)]||"#000":I[1].toLowerCase();else if(!(I=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(y))){if(I=/^%/.exec(y))m.scale=100,m.percent=!0,_("%",g);else if(I=/^_(\\.|.)/.exec(y))_(" ",g);else if(I=/^\./.exec(y))_({type:"point",value:I[0]},g),m.dec_fractions=!0,N="frac";else if(I=/^[Ee]([+-]?|(?=[0#?]))/.exec(y))m.exponential=!0,m.exp_plus=I[1]==="+",N="man",_({type:"exp",plus:I[1]==="+"},g);else if(!(I=/^\*(\\.|.)/.exec(y))){if(I=/^[BENn[]/.exec(y))throw new SyntaxError("Unexpected char ".concat(y.charAt(0)," in pattern ").concat(p));y[0]==="("&&(m.parens=!0),I=[y[0]],_(I[0],g)}}}Q=I[0],y=y.slice(I?I[0].length:1)}if(m.pattern=p.slice(0,p.length-y.length),/^((?:\[[^\]]+\])+)(;|$)/.test(m.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(m.pattern)&&_({type:"text"},g),m.fractions&&m.dec_fractions||m.fractions&&m.exponential)throw new SyntaxError("Invalid pattern: ".concat(m.pattern));const J=m.int_pattern.join("");if(m.grouping=J.indexOf(",")>=0,m.grouping){const L=J.split(","),ee=L.length;ee===2?(m.group_pri=L[1].length,m.group_sec=m.group_pri):ee>2&&(m.group_pri=L[ee-1].length,m.group_sec=L[ee-2].length)}else m.group_pri=0,m.group_sec=0;Z(J.replace(/[,]/g,""),m,"int"),Z(m.frac_pattern.join(""),m,"frac"),Z(m.man_pattern.join(""),m,"man");let _e=m.num_pattern.join(""),Oe=m.den_pattern.join("");const ue=/\?/.test(Oe)||/\?/.test(_e);return Oe=Oe.replace(/\d/g,ue?"?":"#"),ue&&(Oe=Oe.replace(/#$/g,"?")),Z(_e,m,"num"),Z(Oe,m,"den"),ue&&(_e=_e.replace(/#$/g,"?")),m.int_padding=ae(m.int_pattern.join("")),m.man_padding=ae(m.man_pattern.join("")),m.num_padding=ae(_e),m.den_padding=ae(Oe),m.den_pattern.length&&(m.denominator=parseInt(m.den_pattern.join("").replace(/\D/g,""),10)),m.integer=!!m.int_pattern.join("").length,m.fractions&&g.forEach((L,ee)=>{const Ce=g[ee+1];L.type==="string"&&Ce&&(Ce.type==="num"?L.rule="num+int":Ce.type==="div"?L.rule="num":Ce.type==="den"&&(L.rule="den"))}),m}const v=p=>{const g=p.condition;g&&g[1]<0&&(g[0]==="<"||g[0]==="<="||g[0]==="=")||p.tokens.unshift({type:"minus",volatile:!0})};function D(p){const g=[];let m,y=!1,N=null,U=p,x=0,k=!1,I=0,Q=0;do{if(k=H(U),(k.date||k.general)&&(k.int_pattern.length||k.frac_pattern.length||k.scale!==1||k.text))throw new Error("Illegal format");if(k.condition&&(Q++,y=!0),k.text){if(N)throw new Error("Unexpected partition");N=k}k.locale&&(m=u(k.locale)),g.push(k),x=U.charAt(k.pattern.length)===";"?1:0,U=U.slice(k.pattern.length+x),I++}while(x&&I<4&&Q<3);if(x)throw new Error("Unexpected partition");if(Q>2)throw new Error("Unexpected condition");const pe=g[3];if(pe&&(pe.int_pattern.length||pe.frac_pattern.length||pe.date))throw new Error("Unexpected partition");if(y){const J=g.length;if(J===1&&(g[1]=H("General"),g[1].generated=!0),J<3){const _e=g[0],Oe=g[1];if(v(_e),Oe.condition)v(Oe);else{const ue=_e.condition;(ue[0]==="="||ue[1]>=0&&(ue[0]===">"||ue[0]===">="))&&Oe.tokens.unshift({type:"minus",volatile:!0})}}else g.forEach(v)}else{if(g.length<4&&N)for(let J=0,_e=g.length;J<_e;J++)g[J]===N&&g.splice(J,1);if(g.length<1&&N&&(g[0]=H("General"),g[0].generated=!0),g.length<2){const J=H(g[0].pattern);J.tokens.unshift({type:"minus",volatile:!0}),J.generated=!0,g.push(J)}if(g.length<3){const J=H(g[0].pattern);J.generated=!0,g.push(J)}if(g.length<4)if(N)g.push(N);else{const J=H("@");J.generated=!0,g.push(J)}g[0].condition=[">",0],g[1].condition=["<",0],g[2].condition=null}return{pattern:p,partitions:g,locale:m}}const b=Math.floor;function O(p){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&p>=0){if(p===0)return[1900,1,0];if(p===60)return[1900,2,29];if(p<60)return[1900,p<32?1:2,(p-1)%31+1]}let m=p+68569+2415019;const y=b(4*m/146097);m-=b((146097*y+3)/4);const N=b(4e3*(m+1)/1461001);m=m-b(1461*N/4)+31;const U=b(80*m/2447),x=m-b(2447*U/80);m=b(U/11);const k=U+2-12*m;return[0|100*(y-49)+N+m,0|k,0|x]}function P(p){return O(p+1462)}function $(p){if(p===60)throw new Error("#VALUE!");if(p<=1)return[1317,8,29];if(p<60)return[1317,p<32?9:10,1+(p-2)%30];const g=10631/30,m=.1335;let y=p+466935;const N=b(y/10631);y-=10631*N;const U=b((y-m)/g);y-=b(U*g+m);const x=b((y+28.5001)/29.5);return x===13?[30*N+U,12,30]:[30*N+U,x,y-b(29.5001*x-29)]}function V(p){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,m=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const y=b(p);return g===6?$(y):g===-1?P(y):O(y,m)}const se=Math.floor,he=86400;function ge(p,g){let m=null;if(Array.isArray(p)){const[y,N,U,x,k,I]=p;m=Date.UTC(y,N==null?0:N-1,U!=null?U:1,x||0,k||0,I||0)}else if(p instanceof Date&&(m=1*p,!g||!g.ignoreTimezone)){const y=new Date;y.setUTCFullYear(p.getFullYear(),p.getMonth(),p.getDate()),y.setUTCHours(p.getHours(),p.getMinutes(),p.getSeconds(),p.getMilliseconds()),m=1*y}if(m!=null&&isFinite(m)){const y=m/864e5;return y-(y<=-25509?-25568:-25569)}return p}function Te(p,g){let m=0|p;const y=he*(p-m);let N=se(y);y-N>.9999&&(N+=1,N===he&&(N=0,m+=1));const U=N<0?he+N:N,[x,k,I]=V(p,0,g&&g.leap1900),Q=se(U/60/60)%60,pe=se(U/60)%60,J=se(U)%60;if(g&&g.nativeDate){const _e=new Date(0);return _e.setUTCFullYear(x,k-1,I),_e.setUTCHours(Q,pe,J),_e}return[x,k,I,Q,pe,J]}function ye(p){return!!(p[0]&&p[0].percent||p[1]&&p[1].percent||p[2]&&p[2].percent||p[3]&&p[3].percent)}function S(p){return!!(p[0]&&p[0].date||p[1]&&p[1].date||p[2]&&p[2].date||p[3]&&p[3].date)}function F(p){const[g,m,y,N]=p;return!(g&&!g.generated||m&&!m.generated||y&&!y.generated||!N||!N.text||N.generated)}const K={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],Y={total:1,sign:0,period:0,int:1,frac:0},W=(p,g)=>p.replace(/\./,g.decimal);function le(p,g,m,y){const N=0|m;if(typeof m=="string")p.push(m);else if(m===N)p.push(Math.abs(N));else{const U=Math.abs(m);let x=U?Math.floor(Math.log10(U)):0,k=x<0?U*10**-x:U/10**x;k===10&&(k=1,x++);const I=function(pe){let J=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const _e=Math.abs(pe);if(!_e)return Y;const Oe=J&&pe<0?1:0,ue=Math.floor(_e),L=Math.floor(Math.log10(_e)+1);let ee=0,Ce=0;if(ue!==_e){ee=1;const Ae=String(E(L<0?_e*10**-L:_e/10**L,15));let ke=Ae.length,Pe=!0,We=0;for(;We<=Ae.length;){if(Ae[We]==="."){ke--;break}Ae[We]==="0"&&Pe?ke--:Pe=!1,We++}Ce=ke-L,Ce<0&&(Ce=0,ee=0)}return{total:Oe+Math.max(L,1)+ee+Ce,digits:Math.max(L,0)+Ce,sign:Oe,period:ee,int:Math.max(L,1),frac:Ce}}(U),Q=()=>{const pe=Math.abs(x);let J;J=k===1?k:E(k,5),p.push(W(J+"",y),y.exponent,x<0?y.negative:y.positive,pe<10?"0":"",pe)};if(x>=-4&&x<=-1){const pe=U.toPrecision(10+x).replace(/\.?0+$/,"");p.push(W(pe,y))}else if(x===10){const pe=U.toFixed(10).slice(0,12).replace(/\.$/,"");p.push(W(pe,y))}else if(Math.abs(x)<=9)if(I.total<=11){const pe=E(U,9).toFixed(I.frac);p.push(W(pe,y))}else x===9?p.push(Math.floor(U)):x>=0&&x<9?p.push(E(U,9-x)):Q();else I.total>=12?Q():Math.floor(U)===U?p.push(Math.floor(U)):p.push(W(E(U,9).toFixed(I.frac),y))}return p}const oe=86400,B={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},te=function(p){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const m=Math.floor(Math.log10(p));return g>1?Math.floor(m/g)*g:m};function ie(p,g,m,y){let N="",U="",x="",k="",I="",Q=0,pe=0|p,J=0,_e=0,Oe=1,ue=0,L=0,ee=0,Ce=0,Ae=0,ke=0;const Pe=y||f;if(!g.text&&isFinite(g.scale)&&g.scale!==1&&(p=function(Se){if(Se===0)return Se;const Me=Math.ceil(Math.log10(Se<0?-Se:Se)),ne=10**(16-Math.floor(Me));return Math.round(Se*ne)/ne}(p*g.scale)),g.exponential){let Se=Math.abs(p);if(Se){const Me=10**-te(Se,g.int_max),ne=E(Se*Me,g.frac_max)/Me;Q=te(ne,g.int_max)}Se/=10**Q,p=p<0?-Se:Se,N+=Math.abs(Q)}if(g.integer){const Se=Math.abs(E(p,g.fractions?1:g.frac_max));I+=Se<1?"":Math.floor(Se)}if(g.grouping){let Se="",Me=I.length;for(Me>g.group_pri&&(Me-=g.group_pri,Se=Pe.group+I.slice(Me,Me+g.group_pri)+Se);Me>g.group_sec;)Me-=g.group_sec,Se=Pe.group+I.slice(Me,Me+g.group_sec)+Se;I=Me?I.slice(0,Me)+Se:Se}g.dec_fractions&&(k=String(E(p,g.frac_max)).split(".")[1]||"");let We=!1;if(g.fractions){const Se=Math.abs(g.integer?p%1:p);if(Se)if(We=!0,isFinite(g.denominator))x+=g.denominator,U+=E(Se*g.denominator),U==="0"&&(U="",x="",We=!1,I||(I="0"));else{const Me=R(Se,g.integer?g.num_max:1/0,g.den_max);U+=Me[0],x+=Me[1],g.integer&&U==="0"&&(I||(I="0"),U="",x="",We=!1)}}if(g.date){pe=Math.trunc(p);const Se=oe*(p-pe);if(J=Math.floor(Se),ke=Se-J,Math.abs(ke)<1e-6?ke=0:ke>.9999&&(ke=0,J+=1,J===oe&&(J=0,pe+=1)),ke){const Me=512&g.date||256&g.date||128&g.date;(Me===512&&ke>.9995||Me===256&&ke>.995||Me===128&&ke>.95||!Me&&ke>=.5)&&(J++,ke=0)}if(pe||g.date_system){const Me=V(p,g.date_system,m.leap1900);_e=Me[0],Oe=Me[1],ue=Me[2]}if(J){const Me=J<0?oe+J:J;Ae=Math.floor(Me)%60,Ce=Math.floor(Me/60)%60,ee=Math.floor(Me/60/60)%60}if(L=(6+pe)%7,g.date_eval&&(dt=p,gt=pe+J/oe,m.dateSpanLarge?dt<-694324||gt>=35830291:dt<0||gt>=2958466)){if(m.dateErrorThrows)throw new Error("Date out of bounds");return m.dateErrorNumber?le(p<0?[Pe.negative]:[],0,p,Pe).join(""):m.overflow}}var dt,gt;if(g.int_padding&&(I=g.int_padding.length===1?I||g.int_padding:g.int_padding.substring(0,g.int_padding.length-I.length)+I),g.num_padding&&(U=g.num_padding.length===1?U||g.num_padding:g.num_padding.substring(0,g.num_padding.length-U.length)+U),g.den_padding&&(x=g.den_padding.length===1?x||g.den_padding:x+g.den_padding.slice(x.length)),g.man_padding){const Se=g.exp_plus?"+":"";N=g.man_padding.length===1?(Q<0?"-":Se)+(N||g.man_padding):(Q<0?"-":Se)+g.man_padding.slice(0,g.man_padding.length-N.length)+N}const Ee=[];let Qe=0;const ve={int:0,frac:0,man:0,num:0,den:0};for(let Se=0,Me=g.tokens.length;Se<Me;Se++){const ne=g.tokens[Se],lt=ne.num?ne.num.length:0;if(ne.type==="string")ne.rule?ne.rule==="num"?We?Ee.push(ne.value):(g.num_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,G["?"])):ne.rule==="num+int"?We&&I?Ee.push(ne.value):g.den_min>0&&(I||g.num_min)&&Ee.push(ne.value.replace(/./g,G["?"])):ne.rule==="den"&&(We?Ee.push(ne.value):(g.den_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,G["?"]))):Ee.push(ne.value);else if(ne.type==="error")Ee.push(m.invalid);else if(ne.type==="point")Ee.push(g.date?ne.value:Pe.decimal);else if(ne.type==="general")le(Ee,0,p,Pe);else if(ne.type==="exp")Ee.push(Pe.exponent);else if(ne.type==="minus")ne.volatile&&g.date||ne.volatile&&(p>=0||typeof p!="number")||(ne.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(p<0&&I&&I!=="0"||k)&&Ee.push(Pe.negative):Ee.push(Pe.negative));else if(ne.type==="plus")Ee.push(Pe.positive);else if(ne.type==="text")Ee.push(p);else if(ne.type==="div")We?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(G["?"]):Ee.push(G["#"]);else if(ne.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const Be=Qe?g.int_pattern.join("").length-ve.int:1/0,Tt=Qe===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+ne.num.length);Ee.push(I.substring(I.length-Be,I.length-Tt)),Qe++,ve.int+=ne.num.length}else if(ne.type==="frac"){const Be=ve.frac;for(let Tt=0;Tt<lt;Tt++)Ee.push(k[Tt+Be]||G[ne.num[Tt]]);ve.frac+=lt}else if(ne.type in B)g[ne.type+"_pattern"].length===1?(ne.type==="int"&&Ee.push(I),ne.type==="frac"&&Ee.push(k),ne.type==="man"&&Ee.push(N),ne.type==="num"&&Ee.push(U),ne.type==="den"&&Ee.push(x)):(Ee.push(B[ne.type].slice(ve[ne.type],ve[ne.type]+lt)),ve[ne.type]+=lt);else if(ne.type==="year")_e<0&&Ee.push(Pe.negative),Ee.push(String(Math.abs(_e)).padStart(4,"0"));else if(ne.type==="year-short"){const Be=_e%100;Ee.push(Be<10?"0":"",Be)}else if(ne.type==="month")Ee.push(ne.pad&&Oe<10?"0":"",Oe);else if(ne.type==="monthname-single")g.date_system===6?Ee.push(Pe.mmmm6[Oe-1].charAt(0)):Ee.push(Pe.mmmm[Oe-1].charAt(0));else if(ne.type==="monthname-short")g.date_system===6?Ee.push(Pe.mmm6[Oe-1]):Ee.push(Pe.mmm[Oe-1]);else if(ne.type==="monthname")g.date_system===6?Ee.push(Pe.mmmm6[Oe-1]):Ee.push(Pe.mmmm[Oe-1]);else if(ne.type==="weekday-short")Ee.push(Pe.ddd[L]);else if(ne.type==="weekday")Ee.push(Pe.dddd[L]);else if(ne.type==="day")Ee.push(ne.pad&&ue<10?"0":"",ue);else if(ne.type==="hour"){const Be=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(ne.pad&&Be<10?"0":"",Be)}else if(ne.type==="min")Ee.push(ne.pad&&Ce<10?"0":"",Ce);else if(ne.type==="sec")Ee.push(ne.pad&&Ae<10?"0":"",Ae);else if(ne.type==="subsec"){Ee.push(Pe.decimal);const Be=ke.toFixed(g.sec_decimals);Ee.push(Be.slice(2,2+ne.decimals))}else if(ne.type==="am"){const Be=ee<12?0:1;ne.short&&!y?Ee.push("AP"[Be]):Ee.push(Pe.ampm[Be])}else if(ne.type==="hour-elap"){p<0&&Ee.push(Pe.negative);const Be=24*pe+Math.floor(Math.abs(J)/3600);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="min-elap"){p<0&&Ee.push(Pe.negative);const Be=1440*pe+Math.floor(Math.abs(J)/60);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="sec-elap"){p<0&&Ee.push(Pe.negative);const Be=pe*oe+Math.abs(J);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="b-year")Ee.push(_e+543);else if(ne.type==="b-year-short"){const Be=(_e+543)%100;Ee.push(Be<10?"0":"",Be)}}return m.nbsp?Ee.join(""):Ee.join("").replace(/\u00a0/g," ")}function me(p,g){for(let m=0;m<3;m++){const y=g[m];if(y){let N;if(y.condition){const U=y.condition[0],x=y.condition[1];U==="="?N=p===x:U===">"?N=p>x:U==="<"?N=p<x:U===">="?N=p>=x:U==="<="?N=p<=x:U==="<>"&&(N=p!==x)}else N=!0;if(N)return y}}}const be=H("@"),De="black",X={};function Re(p,g){if(p){const m=p[0];g[m]=g[m]||{},Re(p.slice(1),g[m])}else g.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","m-d-y","m-d-Y","m-j-y","m-j-Y","n-d-y","n-d-Y","n-j-y","n-j-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"].forEach(p=>{Re(p,X),Re(p+" x",X),Re(p+" l",X),Re(p+" l x",X),Re("l "+p,X),Re("l "+p+" x",X),Re(p+" D",X),Re(p+" D x",X),Re("D "+p,X),Re("D "+p+" x",X)});const ze={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},He={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Ue={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},qe=new Date().getUTCFullYear();function _t(p){const g=new RegExp("^([\\s+%"+A.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+A.join("")+")]*)$").exec(p);if(g){const[,m,y,N,U,x]=g;let k=1,I="",Q=!1,pe=!1,J=!1,_e=!1,Oe=!1,ue=null,L=!1,ee=parseFloat(y.replace(/,/g,""));if(!isFinite(ee))return null;for(let Ae=0;Ae<m.length;Ae++){const ke=m[Ae];if(ke==="-"){if(Q||pe)return null;Q=!0,k=-1}else if(j.test(ke)){if(Oe)return null;Oe=!0,ue=ke}else if(ke==="("){if(pe||Q)return null;pe=!0,k=-1}else if(ke==="%"){if(_e)return null;_e=!0}}for(let Ae=0;Ae<x.length;Ae++){const ke=x[Ae];if(j.test(ke)){if(Oe)return null;Oe=!0,ue=ke,L=!0}else if(ke===")"){if(J||!pe)return null;J=!0}else if(ke==="%"){if(_e)return null;_e=!0}}if(U){if(_e||Oe)return null;I="0.00E+00"}else if(_e){if(Oe)return null;I=N.includes(".")?"0.00%":"0%",ee*=.01}else if(Oe){const Ae=N.includes(".")?"#,##0.00":"#,##0";I=L?Ae+ue:ue+Ae}else N.includes(",")&&(I=N.includes(".")?"#,##0.00":"#,##0");const Ce={v:ee*k};return I&&(Ce.z=I),Ce}}const Ge=(p,g,m)=>{const y=m.path||"",N=Object.keys(g);for(let U=0;U<N.length;U++){let x;const k=N[U];if(g[k]){if(k==="$"||k==="€")p||(x=m);else if(k==="-"){const I=/^(\s*([./-]|,\s)\s*|\s+)/.exec(p);if(I){const Q=I[1]==="-"||I[1]==="/"||I[1]==="."?I[1]:" ";if(!m.sep||m.sep===Q){const pe=I[0].replace(/\s+/g," ");x=Ge(p.slice(I[0].length),g[k],{...m,sep:Q,path:y+pe})}}}else if(k===" "){const I=/^[,.]?\s+/.exec(p);if(I){const Q=I[0].replace(/\s+/g," ");x=Ge(p.slice(I[0].length),g[k],{...m,path:y+Q})}}else if(k==="j"||k==="d"){const I=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(p);I&&(x=Ge(p.slice(I[0].length),g[k],{...m,day:I[0],path:y+k}))}else if(k==="n"||k==="m"){const I=/^(0?[1-9]|1[012])\b/.exec(p);I&&(x=Ge(p.slice(I[0].length),g[k],{...m,month:+I[0],_mon:I[0],path:y+k}))}else if(k==="F"||k==="M"){const I=/^([a-z]{3,9})\b/i.exec(p),Q=I&&(k==="F"?He:ze)[I[0].toLowerCase()];Q&&(x=Ge(p.slice(I[0].length),g[k],{...m,month:Q,_mon:I[0],path:y+k}))}else if(k==="l"||k==="D"){const I=/^([a-z]{3,9})\b/i.exec(p);(I&&Ue[I[0].toLowerCase()])===k&&(x=Ge(p.slice(I[0].length),g[k],{...m,path:y+k}))}else if(k==="y"){const I=/^\d\d\b/.exec(p);if(I){const Q=+I[0]>=30?+I[0]+1900:+I[0]+2e3;x=Ge(p.slice(I[0].length),g[k],{...m,year:Q,path:y+k})}}else if(k==="Y"){const I=/^\d\d\d\d\b/.exec(p);I&&(x=Ge(p.slice(I[0].length),g[k],{...m,year:+I[0],path:y+k}))}else{if(k!=="x")throw new Error('Unknown date token "'.concat(k,'"'));{const I=Ve(p);I&&(x=Ge("",g[k],{...m,time:I.v,tf:I.z,path:y+k}))}}if(x)return x}}};function et(p,g){const m=Ge(p.trim(),X,{path:""});if(m){var y;if(m.sep==="."&&m.path.length===3)return null;const N=+((y=m.year)!==null&&y!==void 0?y:qe);if(m.day||(m.day=1),!function(k,I,Q){if(Q<1||I<1||I>12)return!1;if(I===2){if(Q>(k%4==0&&k%100!=0||k%400==0||k===1900?29:28))return!1}else if((I===4||I===6||I===9||I===11)&&Q>30||(I===1||I===3||I===5||I===7||I===8||I===10||I===12)&&Q>31)return!1;return!0}(N,m.month,m.day))return null;let U=-1/0;if(N<1900)return null;N<=1900&&m.month<=2?U=25568:N<1e4&&(U=25569);const x=Date.UTC(N,m.month-1,m.day)/864e5+U+(m.time||0);if(x>=0&&x<=2958465){const k=m._mon[0]==="0"||m.day[0]==="0"||m._mon.length===2&&m.day.length===2,I=m.path.replace(/[jdlDnmMFyYx-]/g,Q=>Q==="j"||Q==="d"?k?"dd":"d":Q==="D"?"ddd":Q==="l"?"dddd":Q==="n"||Q==="m"?k?"mm":"m":Q==="M"?"mmm":Q==="F"?"mmmm":Q==="y"?"yy":Q==="x"?m.tf||"":Q==="Y"?"yyyy":Q);return g&&g.nativeDate?{v:Te(x,g),z:I}:{v:x,z:I}}}return null}function Ve(p){const g=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(p);if(g){const[,m,y,N,U,x]=g;if(U&&!N||!x&&!y&&!N)return null;let k=1*(m||0);if(x){if(k>=13)return null;x[0]!=="p"&&x[0]!=="P"||(k+=12)}return{v:(60*k*60+60*(1*(y||0))+1*(N||0)+1*(U||0))/86400,z:(m.length===2?"hh":"h")+":mm"+(N?":ss":"")+(x?" AM/PM":"")}}return null}function ct(p){return/^\s*true\s*$/i.test(p)?{v:!0}:/^\s*false\s*$/i.test(p)?{v:!1}:null}const at={};function Lt(p,g){const{pattern:m,partitions:y,locale:N}=p,U=I=>{const Q=Object.assign({},z(),g,I);return N&&(Q.locale=N),Q},x=(I,Q)=>{const pe=U(Q);return function(J,_e,Oe){const ue=c(Oe.locale),L=_e[3]?_e[3]:be;if(typeof J=="boolean"&&(J=J?"TRUE":"FALSE"),J==null)return"";if(typeof J!="number")return ie(J,L,Oe,ue);if(!isFinite(J)){const Ce=ue||f;return isNaN(J)?Ce.nan:(J<0?Ce.negative:"")+Ce.infinity}const ee=me(J,_e);return ee?ie(J,ee,Oe,ue):Oe.overflow}(ge(I,pe),y,pe)};x.color=(I,Q)=>function(pe,J){if(typeof pe!="number"||!isFinite(pe))return(J[3]?J[3].color:be.color)||De;const _e=me(pe,J);return _e&&_e.color||De}(ge(I,U(Q)),y);const k=function(I){var Q;let pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[J,_e]=I,Oe=J.frac_max,ue={type:"general",isDate:S(I),isText:F(I),isPercent:ye(I),maxDecimals:J.general?9:Oe,scale:(Q=J.scale)!==null&&Q!==void 0?Q:1,color:0,parentheses:0,grouped:J.grouping?1:0,_partitions:I},L=!ue.isDate&&!ue.isText&&!J.error&&J.tokens.some(Pe=>Pe.type==="string"&&(pe?Pe.value===pe:j.test(Pe.value)));let ee="G",Ce=Oe>=0?Math.min(15,Oe):"",Ae="",ke="";if(_e&&_e.color&&(ke="-",ue.color=1),J.parens&&(Ae="()",ue.parentheses=1),L)ee="C",ue.type="currency";else if(J.error)ue.type="error",ue.maxDecimals=0;else if(ue.isDate){let Pe=0,We=0,dt="";J.tokens.forEach(Ee=>{const Qe=Ee.type;/^(b-)?year/.test(Qe)?(dt+="Y",We++):Qe.startsWith("month")?(dt+="M",We++):/^(week)?day/.test(Qe)?(dt+="D",We++):Qe!=="hour"&&Qe!=="min"&&Qe!=="sec"&&Qe!=="am"||(dt+=Qe[0],Pe++)}),ue.type="date",We&&Pe?ue.type="datetime":!We&&Pe&&(ue.type="time");const gt=q.find(Ee=>dt.startsWith(Ee[0]));ee=gt?"D":"G",Ce=gt?gt[1]:""}else ue.isText?(ee="G",ue.type="text",Ce="",ue.maxDecimals=0):J.general?(ee="G",ue.type="general",Ce=""):J.fractions?(ee="G",ue.type="fraction",Ce=""):J.exponential?(ee="S",ue.type="scientific"):ue.isPercent?(ee="P",ue.type="percent"):J.grouping?(ee=",",ue.type="grouped"):(J.int_max||Oe)&&(ee="F",ue.type="number");return ue.code=ee+Ce+ke+Ae,ue.level=K[ue.type],Object.freeze(ue)}(y,(g||{}).currency)||new SyntaxError;return x.info=k,x.dateInfo=function(I){const[Q]=I;return{year:!!(2&Q.date),month:!!(4&Q.date),day:!!(8&Q.date),hours:!!(16&Q.date),minutes:!!(32&Q.date),seconds:!!(64&Q.date),clockType:Q.clock===12?12:24}}(y),x.isPercent=()=>!!k.isPercent,x.isDate=()=>!!k.isDate,x.isText=()=>!!k.isText,x.pattern=m,p.error&&(x.error=p.error),x.options=U,x.locale=N||g&&g.locale||"",Object.freeze(x)}function Fe(p,g){p||(p="General");let m=null;return at[p]?m=at[p]:(m=Object.assign({},z(),g).throws?D(p):function(y){try{return D(y)}catch(N){const U={tokens:[{type:"error"}],error:N.message};return{pattern:y,partitions:[U,U,U,U],error:N.message,locale:null}}}(p),m.error||(at[p]=m)),Lt(m,g)}Fe.isDate=p=>Fe(p,{throws:!1}).isDate(),Fe.isPercent=p=>Fe(p,{throws:!1}).isPercent(),Fe.isText=p=>Fe(p,{throws:!1}).isText(),Fe.getInfo=(p,g)=>Fe(p,{...g,throws:!1}).info,Fe.getDateInfo=(p,g)=>Fe(p,{...g,throws:!1}).dateInfo,Fe.dateToSerial=ge,Fe.dateFromSerial=Te,Fe.options=z,Fe.dec2frac=R,Fe.round=E,Fe.codeToLocale=s,Fe.parseLocale=l,Fe.getLocale=c,Fe.addLocale=(p,g)=>{const m=l(g);return delete at[m.lang],delete at[m.language],d(p,m)},Fe.format=function(p,g,m){let y=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const N=m&&typeof m=="object"?m:{locale:m,throws:!y};return Fe(p,N)(ge(g,N),N)},Fe.is_date=Fe.isDate,Fe.parseNumber=_t,Fe.parseDate=et,Fe.parseTime=Ve,Fe.parseBool=ct,Fe.parseValue=function(p,g){var m,y,N;return(m=(y=(N=_t(p))!==null&&N!==void 0?N:et(p,g))!==null&&y!==void 0?y:Ve(p))!==null&&m!==void 0?m:ct(p)};var ht=Fe;return r=r.default}()})}(Pr)),Pr.exports}var us,Fi;function nd(){return Fi||(Fi=1,us=td()),us}var rd=nd();const sd=Rt(rd),id=sd;function Kt(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Ts(e,t,n){const r=Kt(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function Ns(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function od(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let u=0;for(let c=0;c<s;c++,u++){const h=r[c];l[u]=n[h]}for(let c=0;c<a;c++,u++){const h=o[c];l[u]=i[h]}return l}function ad(e,t,n){const r=n;if(Kt(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Ms(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?ld(e,t,n,r):ud(e,t,n,r)}function ld(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function ud(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class bt{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new bt({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Ms(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Ms(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)Ts(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&Ts(r,void 0,i)})}removeRows(t,n){Ns(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Ns(t,n,s)})}getFragment(t,n,r,s){const i=new bt;let o=0;for(let a=t;a<=n;a++){const l={};let u=0;for(let c=r;c<=s;c++){const h=this.getValue(a,c);l[u]=h,u++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new bt;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,re.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Kt(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=Kt(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new bt;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const u=Number(l);s?u<n&&(n=u):(s=!0,n=u);const c=this.getValue(o,u);i.setValue(o-t,u-n,c)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const u=Kt(l)-1;u>r&&(r=u),Object.keys(l).forEach(c=>{const h=Number(c);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}_setOriginValue(t={}){this._matrix=t}}const ir="__INTERNAL_EDITOR__",Zs=`${ir}DOCS_NORMAL`,Qs=`${ir}DOCS_FORMULA_BAR`,Ra=`${ir}ZEN_EDITOR`,Ia=`\r
|
|
2
|
+
`,Sa="isRowStylePrecedeColumnStyle",va=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function cd(e){return`${ir}${e}`}function Oa(e){return e.startsWith(ir)}var wa=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(wa||{}),ba=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(ba||{}),Ne=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(Ne||{}),or=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(or||{}),qt=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(qt||{}),rn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(rn||{}),ya=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(ya||{}),ei=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(ei||{}),Aa=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Aa||{}),Ta=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Ta||{}),Na=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Na||{}),Ma=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Ma||{}),Da=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Da||{}),La=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(La||{}),xa=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(xa||{}),rt=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(rt||{}),Ua=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Ua||{}),ka=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(ka||{}),Pa=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Pa||{}),Fa=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Fa||{}),$a=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))($a||{}),Ba=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(Ba||{}),Ha=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Ha||{}),ja=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(ja||{}),Wa=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Wa||{}),In=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(In||{}),Ya=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(Ya||{}),za=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(za||{}),Ga=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(Ga||{}),Va=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(Va||{}),Ka=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(Ka||{}),Xa=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(Xa||{}),qa=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(qa||{}),Ja=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(Ja||{}),Za=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(Za||{}),ti=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(ti||{}),Qa=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(Qa||{}),el=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(el||{});const hd={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},dd={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},fd={startRow:0,startColumn:0,endRow:0,endColumn:0},gd={row:0,column:0},ut={ff:"Arial",fs:11,it:Ie.FALSE,bl:Ie.FALSE,ul:{s:Ie.FALSE},st:{s:Ie.FALSE},ol:{s:Ie.FALSE},tr:{a:0,v:Ie.FALSE},td:Xn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:wt.UNSPECIFIED,vt:nn.UNSPECIFIED,tb:an.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},tl={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},md=[Zs,Ra,Qs],_d={[rt.HEADING_1]:{fs:20,bl:1},[rt.HEADING_2]:{fs:18,bl:1},[rt.HEADING_3]:{fs:16,bl:1},[rt.HEADING_4]:{fs:14,bl:1},[rt.HEADING_5]:{fs:12,bl:1},[rt.NORMAL_TEXT]:{fs:11},[rt.TITLE]:{fs:26,bl:1},[rt.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null},fn=4,pd={[rt.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+fn}},[rt.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+fn}},[rt.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+fn}},[rt.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+fn}},[rt.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+fn}},[rt.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[rt.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+fn}},[rt.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[rt.NAMED_STYLE_TYPE_UNSPECIFIED]:null};var nl=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(nl||{});function pr(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return Ie.FALSE;switch(e){case"bl":case"it":{if(o[e]===Ie.FALSE)return Ie.FALSE;break}case"ul":case"st":{if(o[e].s===Ie.FALSE)return Ie.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
|
|
3
|
+
`)===r?Ie.TRUE:Ie.FALSE}const Kn=class Kn{constructor(t,n,r){C(this,"_range");C(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new bt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new bt;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||ut.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Kn(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let u=0;u<=r-n;u++)for(let c=0;c<=i-s;c++){if(o==null||((a=o==null?void 0:o[u])==null?void 0:a[c])==null)continue;const h=o[u][c].s;h&&(o[u][c].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("ul",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("st",t.body)===Ie.TRUE?{s:Ie.TRUE}:{s:Ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("it",t.body)===Ie.TRUE?$r.ITALIC:$r.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?pr("bl",t.body)===Ie.TRUE?Br.BOLD:Br.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===an.WRAP?Ie.TRUE:Ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Kn.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||ut[t]}))}};C(Kn,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===Le.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===Le.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===Le.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let bn=Kn;function rl(e,t,n=0,r=e.length-1,s=Ed){for(;r>n;){if(r-n>600){const l=r-n+1,u=t-n+1,c=Math.log(l),h=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1),f=Math.max(n,Math.floor(t-u*h/l+d)),E=Math.min(r,Math.floor(t+(l-u)*h/l+d));rl(e,t,f,E,s)}const i=e[t];let o=n,a=r;for(Ln(e,n,t),s(e[r],i)>0&&Ln(e,n,r);o<a;){for(Ln(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?Ln(e,n,a):(a++,Ln(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function Ln(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ed(e,t){return e<t?-1:e>t?1:0}class Wr{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!Cr(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;Cr(t,l)&&(n.leaf?r.push(a):hs(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!Cr(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(Cr(t,o)){if(n.leaf||hs(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=pn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,u;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),u=!0),r.leaf){const c=Cd(t,r.children,n);if(c!==-1)return r.children.splice(c,1),i.push(r),this._condense(i),this}!u&&!r.leaf&&hs(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],u=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=pn(t.slice(n,r+1)),gn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=pn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),u=l*Math.ceil(Math.sqrt(o));$i(t,n,r,u,this.compareMinX);for(let c=n;c<=r;c+=u){const h=Math.min(c+u-1,r);$i(t,c,h,l,this.compareMinY);for(let d=c;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return gn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const u=n.children[l],c=cs(u),h=Sd(t,u)-c;h<o?(o=h,i=c<i?c:i,a=u):h===o&&c<i&&(i=c,a=u)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),jn(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=pn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,gn(r,this.toBBox),gn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=pn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,gn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=Hn(t,0,a,this.toBBox),u=Hn(t,a,r,this.toBBox),c=vd(l,u),h=cs(l)+cs(u);c<i?(i=c,s=a,o=h<o?h:o):c===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:Rd,i=t.leaf?this.compareMinY:Id,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=Hn(t,0,n,i),a=Hn(t,r-n,r,i);let l=Er(o)+Er(a);for(let u=n;u<r-n;u++){const c=t.children[u];jn(o,t.leaf?i(c):c),l+=Er(o)}for(let u=r-n-1;u>=n;u--){const c=t.children[u];jn(a,t.leaf?i(c):c),l+=Er(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)jn(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():gn(t[n],this.toBBox)}}function Cd(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 gn(e,t){Hn(e,0,e.children.length,t,e)}function Hn(e,t,n,r,s){s||(s=pn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];jn(s,e.leaf?r(o):o)}return s}function jn(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 Rd(e,t){return e.minX-t.minX}function Id(e,t){return e.minY-t.minY}function cs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Er(e){return e.maxX-e.minX+(e.maxY-e.minY)}function Sd(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 vd(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function hs(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Cr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function pn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function $i(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;rl(e,o,t,n,s),i.push(t,o,o,n)}}function Od(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||tt.NONE,o=s.endAbsoluteRefType||tt.NONE,a=s.rangeType||Le.NORMAL;if(!r&&i===tt.ALL&&o===tt.ALL)return s;const l=Bi(s.startRow,n,s.startColumn,t,a),u=Bi(s.endRow,n,s.endColumn,t,a);return r||i===tt.NONE&&o===tt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:u.row,endColumn:u.column}:(i===tt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===tt.COLUMN?s={...s,startRow:l.row}:i===tt.ROW&&(s={...s,startColumn:l.column}),o===tt.NONE?s={...s,endRow:u.row,endColumn:u.column}:o===tt.COLUMN?s={...s,endRow:u.row}:o===tt.ROW&&(s={...s,endColumn:u.column}),s)}function Bi(e,t,n,r,s){return s===Le.NORMAL?{row:e+t,column:n+r}:s===Le.ROW?{row:e+t,column:n}:s===Le.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function ni(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],u=r[a+1]-1,c=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=c&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=u){i.push({startColumn:l,endColumn:u,startRow:c,endRow:h});break}}}return i}function wd(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function bd(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function yd(e){const t=ni(e),n=wd(t);return bd(n)}function Ad(e,t){const n=[];return e.forEach(r=>{n.push(...Jt.subtract(r,t))}),Jt.mergeRanges(n)}function sl(e,t){const n=Hi(e.startRow,e.endRow,t.startRow,t.endRow),r=Hi(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Td(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function Hi(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),u=Math.min(i,a);if(l<=u){const c=l===-1/0?Number.NaN:l,h=u===1/0?Number.NaN:u;return[c,h]}else return null}function Td(e,t,n,r,s,i){const o=e!==void 0?e:ji(n,r,s,i),a=t!==void 0?t:ji(n,r,s,i);return o===Le.ALL||a===Le.ALL?o===a?o:o===Le.ALL?a:o:o===a?o:(o===Le.NORMAL||a===Le.NORMAL,Le.NORMAL)}function ji(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?Le.NORMAL:s?Le.ROW:i?Le.COLUMN:Le.ALL}const xt=class xt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===Le.NORMAL||n.rangeType===void 0&&t.rangeType===Le.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:u,endColumn:c}=n,h=r<=l&&s>=a,d=i<=c&&o>=u;return h&&d}static intersects(t,n){if(t.rangeType===Le.ROW&&n.rangeType===Le.COLUMN||t.rangeType===Le.COLUMN&&n.rangeType===Le.ROW)return!0;if(t.rangeType===Le.ROW&&n.rangeType===Le.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===Le.COLUMN&&n.rangeType===Le.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,u=Number.isNaN(n.endRow)?r:n.endRow,c=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-c-h),f=Math.abs(o-a)+Math.abs(c-h),E=Math.abs(s+i-l-u),R=Math.abs(s-i)+Math.abs(l-u);return d<=f&&E<=R}static doAnyRangesIntersect(t,n){const r=new Wr;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,u=n.startColumn,c=n.endColumn;let h,d,f,E;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?E=s:E=l;else return null;if(u<=o)u>i?h=u:h=i;else return null;if(c>=i)c>=o?f=o:f=c;else return null;return{startRow:d,endRow:E,startColumn:h,endColumn:f,rangeType:Le.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return xt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:Le.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===Le.COLUMN),r=t.some(i=>i.rangeType===Le.ROW),s=xt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?Le.ROW:n?Le.COLUMN:Le.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return yd(t)}static splitIntoGrid(t){return ni(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Ad(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};C(xt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(xt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[tt.ROW,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[tt.ROW,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[tt.COLUMN,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[tt.COLUMN,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(xt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(xt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(xt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Jt=xt;function Nd(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=Md(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function Md(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function Dd(e,t){bn.foreach(t,(n,r)=>{e[n][r]=void 0})}function Ld(e,t){const n=e.toFullArray(),r=[];for(;;){const s=Nd(n,t);if(!s)break;r.push(s),Dd(n,s)}return r}class xd{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Ds(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function Ud(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Yr=65,il=90,kd=97;function Pd(e){const t=il-Yr+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Yr)+n,e=Math.floor(e/t)-1;return n}function ol(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Fd(e,t=!1){const n=il-Yr+1;let r=kd;t&&(r=Yr);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return ol(s,i)}function $d(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function Bd(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function ar(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var al=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(al||{}),Wt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
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.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))(Wt||{});function Hd(e){return`${e}`}const jd=[Wt.TABLE_START,Wt.TABLE_ROW_START,Wt.TABLE_CELL_START,Wt.TABLE_CELL_END,Wt.TABLE_ROW_END,Wt.TABLE_END],Qr=e=>{const t=e.endsWith(`\r
|
|
5
|
+
`)?e.slice(0,-2):e;return jd.reduce((n,r)=>n.replaceAll(r,""),t)},Wd=e=>e?Qr(e).replaceAll("\r","")==="":!0,Yd=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,u=!0)=>{const c=t.slice(s,l);if(re.isLegalUrl(c)){const h=kt(),d=`${c}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:qt.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,u&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,u&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}};var ll=typeof global=="object"&&global&&global.Object===Object&&global,zd=typeof self=="object"&&self&&self.Object===Object&&self,cn=ll||zd||Function("return this")(),yn=cn.Symbol,ul=Object.prototype,Gd=ul.hasOwnProperty,Vd=ul.toString,xn=yn?yn.toStringTag:void 0;function Kd(e){var t=Gd.call(e,xn),n=e[xn];try{e[xn]=void 0;var r=!0}catch{}var s=Vd.call(e);return r&&(t?e[xn]=n:delete e[xn]),s}var Xd=Object.prototype,qd=Xd.toString;function Jd(e){return qd.call(e)}var Zd="[object Null]",Qd="[object Undefined]",Wi=yn?yn.toStringTag:void 0;function lr(e){return e==null?e===void 0?Qd:Zd:Wi&&Wi in Object(e)?Kd(e):Jd(e)}function Mn(e){return e!=null&&typeof e=="object"}var ef="[object Symbol]";function es(e){return typeof e=="symbol"||Mn(e)&&lr(e)==ef}function tf(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var An=Array.isArray,Yi=yn?yn.prototype:void 0,zi=Yi?Yi.toString:void 0;function cl(e){if(typeof e=="string")return e;if(An(e))return tf(e,cl)+"";if(es(e))return zi?zi.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var nf=/\s/;function rf(e){for(var t=e.length;t--&&nf.test(e.charAt(t)););return t}var sf=/^\s+/;function of(e){return e&&e.slice(0,rf(e)+1).replace(sf,"")}function Ct(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Gi=NaN,af=/^[-+]0x[0-9a-f]+$/i,lf=/^0b[01]+$/i,uf=/^0o[0-7]+$/i,cf=parseInt;function Vi(e){if(typeof e=="number")return e;if(es(e))return Gi;if(Ct(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ct(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=of(e);var n=lf.test(e);return n||uf.test(e)?cf(e.slice(2),n?2:8):af.test(e)?Gi:+e}function hl(e){return e}var hf="[object AsyncFunction]",df="[object Function]",ff="[object GeneratorFunction]",gf="[object Proxy]";function ri(e){if(!Ct(e))return!1;var t=lr(e);return t==df||t==ff||t==hf||t==gf}var ds=cn["__core-js_shared__"],Ki=function(){var e=/[^.]+$/.exec(ds&&ds.keys&&ds.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function mf(e){return!!Ki&&Ki in e}var _f=Function.prototype,pf=_f.toString;function Ef(e){if(e!=null){try{return pf.call(e)}catch{}try{return e+""}catch{}}return""}var Cf=/[\\^$.*+?()[\]{}|]/g,Rf=/^\[object .+?Constructor\]$/,If=Function.prototype,Sf=Object.prototype,vf=If.toString,Of=Sf.hasOwnProperty,wf=RegExp("^"+vf.call(Of).replace(Cf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bf(e){if(!Ct(e)||mf(e))return!1;var t=ri(e)?wf:Rf;return t.test(Ef(e))}function yf(e,t){return e==null?void 0:e[t]}function si(e,t){var n=yf(e,t);return bf(n)?n:void 0}var Xi=Object.create,Af=function(){function e(){}return function(t){if(!Ct(t))return{};if(Xi)return Xi(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Tf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Nf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Mf=800,Df=16,Lf=Date.now;function xf(e){var t=0,n=0;return function(){var r=Lf(),s=Df-(r-n);if(n=r,s>0){if(++t>=Mf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Uf(e){return function(){return e}}var zr=function(){try{var e=si(Object,"defineProperty");return e({},"",{}),e}catch{}}(),kf=zr?function(e,t){return zr(e,"toString",{configurable:!0,enumerable:!1,value:Uf(t),writable:!0})}:hl,Pf=xf(kf),Ff=9007199254740991,$f=/^(?:0|[1-9]\d*)$/;function ii(e,t){var n=typeof e;return t=t==null?Ff:t,!!t&&(n=="number"||n!="symbol"&&$f.test(e))&&e>-1&&e%1==0&&e<t}function oi(e,t,n){t=="__proto__"&&zr?zr(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ts(e,t){return e===t||e!==e&&t!==t}var Bf=Object.prototype,Hf=Bf.hasOwnProperty;function dl(e,t,n){var r=e[t];(!(Hf.call(e,t)&&ts(r,n))||n===void 0&&!(t in e))&&oi(e,t,n)}function jf(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?oi(n,a,l):dl(n,a,l)}return n}var qi=Math.max;function Wf(e,t,n){return t=qi(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=qi(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Tf(e,this,a)}}function Yf(e,t){return Pf(Wf(e,t,hl),e+"")}var zf=9007199254740991;function fl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=zf}function ai(e){return e!=null&&fl(e.length)&&!ri(e)}function Gf(e,t,n){if(!Ct(n))return!1;var r=typeof t;return(r=="number"?ai(n)&&ii(t,n.length):r=="string"&&t in n)?ts(n[t],e):!1}function gl(e){return Yf(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&Gf(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var Vf=Object.prototype;function ml(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Vf;return e===n}function Kf(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Xf="[object Arguments]";function Ji(e){return Mn(e)&&lr(e)==Xf}var _l=Object.prototype,qf=_l.hasOwnProperty,Jf=_l.propertyIsEnumerable,Ls=Ji(function(){return arguments}())?Ji:function(e){return Mn(e)&&qf.call(e,"callee")&&!Jf.call(e,"callee")};function Zf(){return!1}var pl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zi=pl&&typeof module=="object"&&module&&!module.nodeType&&module,Qf=Zi&&Zi.exports===pl,Qi=Qf?cn.Buffer:void 0,eg=Qi?Qi.isBuffer:void 0,El=eg||Zf,tg="[object Arguments]",ng="[object Array]",rg="[object Boolean]",sg="[object Date]",ig="[object Error]",og="[object Function]",ag="[object Map]",lg="[object Number]",ug="[object Object]",cg="[object RegExp]",hg="[object Set]",dg="[object String]",fg="[object WeakMap]",gg="[object ArrayBuffer]",mg="[object DataView]",_g="[object Float32Array]",pg="[object Float64Array]",Eg="[object Int8Array]",Cg="[object Int16Array]",Rg="[object Int32Array]",Ig="[object Uint8Array]",Sg="[object Uint8ClampedArray]",vg="[object Uint16Array]",Og="[object Uint32Array]",Ze={};Ze[_g]=Ze[pg]=Ze[Eg]=Ze[Cg]=Ze[Rg]=Ze[Ig]=Ze[Sg]=Ze[vg]=Ze[Og]=!0;Ze[tg]=Ze[ng]=Ze[gg]=Ze[rg]=Ze[mg]=Ze[sg]=Ze[ig]=Ze[og]=Ze[ag]=Ze[lg]=Ze[ug]=Ze[cg]=Ze[hg]=Ze[dg]=Ze[fg]=!1;function wg(e){return Mn(e)&&fl(e.length)&&!!Ze[lr(e)]}function bg(e){return function(t){return e(t)}}var Cl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Vn=Cl&&typeof module=="object"&&module&&!module.nodeType&&module,yg=Vn&&Vn.exports===Cl,fs=yg&&ll.process,eo=function(){try{var e=Vn&&Vn.require&&Vn.require("util").types;return e||fs&&fs.binding&&fs.binding("util")}catch{}}(),to=eo&&eo.isTypedArray,Rl=to?bg(to):wg;function Ag(e,t){var n=An(e),r=!n&&Ls(e),s=!n&&!r&&El(e),i=!n&&!r&&!s&&Rl(e),o=n||r||s||i,a=o?Kf(e.length,String):[],l=a.length;for(var u in e)o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||ii(u,l))||a.push(u);return a}function Tg(e,t){return function(n){return e(t(n))}}function Ng(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Mg=Object.prototype,Dg=Mg.hasOwnProperty;function Lg(e){if(!Ct(e))return Ng(e);var t=ml(e),n=[];for(var r in e)r=="constructor"&&(t||!Dg.call(e,r))||n.push(r);return n}function Il(e){return ai(e)?Ag(e):Lg(e)}var xg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ug=/^\w*$/;function kg(e,t){if(An(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||es(e)?!0:Ug.test(e)||!xg.test(e)||t!=null&&e in Object(t)}var Jn=si(Object,"create");function Pg(){this.__data__=Jn?Jn(null):{},this.size=0}function Fg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $g="__lodash_hash_undefined__",Bg=Object.prototype,Hg=Bg.hasOwnProperty;function jg(e){var t=this.__data__;if(Jn){var n=t[e];return n===$g?void 0:n}return Hg.call(t,e)?t[e]:void 0}var Wg=Object.prototype,Yg=Wg.hasOwnProperty;function zg(e){var t=this.__data__;return Jn?t[e]!==void 0:Yg.call(t,e)}var Gg="__lodash_hash_undefined__";function Vg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Jn&&t===void 0?Gg:t,this}function un(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])}}un.prototype.clear=Pg;un.prototype.delete=Fg;un.prototype.get=jg;un.prototype.has=zg;un.prototype.set=Vg;function Kg(){this.__data__=[],this.size=0}function ns(e,t){for(var n=e.length;n--;)if(ts(e[n][0],t))return n;return-1}var Xg=Array.prototype,qg=Xg.splice;function Jg(e){var t=this.__data__,n=ns(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():qg.call(t,n,1),--this.size,!0}function Zg(e){var t=this.__data__,n=ns(t,e);return n<0?void 0:t[n][1]}function Qg(e){return ns(this.__data__,e)>-1}function em(e,t){var n=this.__data__,r=ns(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function $t(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])}}$t.prototype.clear=Kg;$t.prototype.delete=Jg;$t.prototype.get=Zg;$t.prototype.has=Qg;$t.prototype.set=em;var Sl=si(cn,"Map");function tm(){this.size=0,this.__data__={hash:new un,map:new(Sl||$t),string:new un}}function nm(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function rs(e,t){var n=e.__data__;return nm(t)?n[typeof t=="string"?"string":"hash"]:n.map}function rm(e){var t=rs(this,e).delete(e);return this.size-=t?1:0,t}function sm(e){return rs(this,e).get(e)}function im(e){return rs(this,e).has(e)}function om(e,t){var n=rs(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function Zt(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])}}Zt.prototype.clear=tm;Zt.prototype.delete=rm;Zt.prototype.get=sm;Zt.prototype.has=im;Zt.prototype.set=om;var am="Expected a function";function li(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(am);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(li.Cache||Zt),n}li.Cache=Zt;var lm=500;function um(e){var t=li(e,function(r){return n.size===lm&&n.clear(),r}),n=t.cache;return t}var cm=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,hm=/\\(\\)?/g,dm=um(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(cm,function(n,r,s,i){t.push(s?i.replace(hm,"$1"):r||n)}),t});function fm(e){return e==null?"":cl(e)}function vl(e,t){return An(e)?e:kg(e,t)?[e]:dm(fm(e))}function Ol(e){if(typeof e=="string"||es(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function gm(e,t){t=vl(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ol(t[n++])];return n&&n==r?e:void 0}function mm(e,t,n){var r=e==null?void 0:gm(e,t);return r===void 0?n:r}var wl=Tg(Object.getPrototypeOf,Object),_m="[object Object]",pm=Function.prototype,Em=Object.prototype,bl=pm.toString,Cm=Em.hasOwnProperty,Rm=bl.call(Object);function Im(e){if(!Mn(e)||lr(e)!=_m)return!1;var t=wl(e);if(t===null)return!0;var n=Cm.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&bl.call(n)==Rm}function Sm(){this.__data__=new $t,this.size=0}function vm(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Om(e){return this.__data__.get(e)}function wm(e){return this.__data__.has(e)}var bm=200;function ym(e,t){var n=this.__data__;if(n instanceof $t){var r=n.__data__;if(!Sl||r.length<bm-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Zt(r)}return n.set(e,t),this.size=n.size,this}function Dn(e){var t=this.__data__=new $t(e);this.size=t.size}Dn.prototype.clear=Sm;Dn.prototype.delete=vm;Dn.prototype.get=Om;Dn.prototype.has=wm;Dn.prototype.set=ym;var yl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,no=yl&&typeof module=="object"&&module&&!module.nodeType&&module,Am=no&&no.exports===yl,ro=Am?cn.Buffer:void 0;ro&&ro.allocUnsafe;function Tm(e,t){return e.slice()}var so=cn.Uint8Array;function Nm(e){var t=new e.constructor(e.byteLength);return new so(t).set(new so(e)),t}function Mm(e,t){var n=Nm(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Dm(e){return typeof e.constructor=="function"&&!ml(e)?Af(wl(e)):{}}function Lm(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var xm=Lm(),gs=function(){return cn.Date.now()},Um="Expected a function",km=Math.max,Pm=Math.min;function Fm(e,t,n){var r,s,i,o,a,l,u=0,c=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(Um);t=Vi(t)||0,Ct(n)&&(c=!!n.leading,h="maxWait"in n,i=h?km(Vi(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(A){var j=r,Z=s;return r=s=void 0,u=A,o=e.apply(Z,j),o}function E(A){return u=A,a=setTimeout(T,t),c?f(A):o}function R(A){var j=A-l,Z=A-u,fe=t-j;return h?Pm(fe,i-Z):fe}function w(A){var j=A-l,Z=A-u;return l===void 0||j>=t||j<0||h&&Z>=i}function T(){var A=gs();if(w(A))return z(A);a=setTimeout(T,R(A))}function z(A){return a=void 0,d&&r?f(A):(r=s=void 0,o)}function G(){a!==void 0&&clearTimeout(a),u=0,r=l=s=a=void 0}function de(){return a===void 0?o:z(gs())}function M(){var A=gs(),j=w(A);if(r=arguments,s=this,l=A,j){if(a===void 0)return E(l);if(h)return clearTimeout(a),a=setTimeout(T,t),f(l)}return a===void 0&&(a=setTimeout(T,t)),o}return M.cancel=G,M.flush=de,M}function xs(e,t,n){(n!==void 0&&!ts(e[t],n)||n===void 0&&!(t in e))&&oi(e,t,n)}function $m(e){return Mn(e)&&ai(e)}function Us(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function Bm(e){return jf(e,Il(e))}function Hm(e,t,n,r,s,i,o){var a=Us(e,n),l=Us(t,n),u=o.get(l);if(u){xs(e,n,u);return}var c=i?i(a,l,n+"",e,t,o):void 0,h=c===void 0;if(h){var d=An(l),f=!d&&El(l),E=!d&&!f&&Rl(l);c=l,d||f||E?An(a)?c=a:$m(a)?c=Nf(a):f?(h=!1,c=Tm(l)):E?(h=!1,c=Mm(l)):c=[]:Im(l)||Ls(l)?(c=a,Ls(a)?c=Bm(a):(!Ct(a)||ri(a))&&(c=Dm(l))):h=!1}h&&(o.set(l,c),s(c,l,r,i,o),o.delete(l)),xs(e,n,c)}function ui(e,t,n,r,s){e!==t&&xm(t,function(i,o){if(s||(s=new Dn),Ct(i))Hm(e,t,o,n,ui,r,s);else{var a=r?r(Us(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),xs(e,o,a)}},Il)}var jm=gl(function(e,t,n,r){ui(e,t,n,r)}),ci=gl(function(e,t,n){ui(e,t,n)});function Wm(e,t,n,r){if(!Ct(e))return e;t=vl(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Ol(t[s]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var c=a[l];u=void 0,u===void 0&&(u=Ct(c)?c:ii(t[s+1])?[]:{})}dl(a,l,u),a=a[l]}return e}function Ym(e,t,n){return e==null?e:Wm(e,t,n)}var ms,io;function zm(){if(io)return ms;io=1;var e=-1,t=1,n=0;function r(_,H,v,D,b){if(_===H)return _?[[n,_]]:[];if(v!=null){var O=fe(_,H,v);if(O)return O}var P=a(_,H),$=_.substring(0,P);_=_.substring(P),H=H.substring(P),P=u(_,H);var V=_.substring(_.length-P);_=_.substring(0,_.length-P),H=H.substring(0,H.length-P);var se=s(_,H);return $&&se.unshift([n,$]),V&&se.push([n,V]),z(se,b),D&&h(se),se}function s(_,H){var v;if(!_)return[[t,H]];if(!H)return[[e,_]];var D=_.length>H.length?_:H,b=_.length>H.length?H:_,O=D.indexOf(b);if(O!==-1)return v=[[t,D.substring(0,O)],[n,b],[t,D.substring(O+b.length)]],_.length>H.length&&(v[0][0]=v[2][0]=e),v;if(b.length===1)return[[e,_],[t,H]];var P=c(_,H);if(P){var $=P[0],V=P[1],se=P[2],he=P[3],ge=P[4],Te=r($,se),ye=r(V,he);return Te.concat([[n,ge]],ye)}return i(_,H)}function i(_,H){for(var v=_.length,D=H.length,b=Math.ceil((v+D)/2),O=b,P=2*b,$=new Array(P),V=new Array(P),se=0;se<P;se++)$[se]=-1,V[se]=-1;$[O+1]=0,V[O+1]=0;for(var he=v-D,ge=he%2!==0,Te=0,ye=0,S=0,F=0,K=0;K<b;K++){for(var q=-K+Te;q<=K-ye;q+=2){var Y=O+q,W;q===-K||q!==K&&$[Y-1]<$[Y+1]?W=$[Y+1]:W=$[Y-1]+1;for(var le=W-q;W<v&&le<D&&_.charAt(W)===H.charAt(le);)W++,le++;if($[Y]=W,W>v)ye+=2;else if(le>D)Te+=2;else if(ge){var oe=O+he-q;if(oe>=0&&oe<P&&V[oe]!==-1){var B=v-V[oe];if(W>=B)return o(_,H,W,le)}}}for(var te=-K+S;te<=K-F;te+=2){var oe=O+te,B;te===-K||te!==K&&V[oe-1]<V[oe+1]?B=V[oe+1]:B=V[oe-1]+1;for(var ie=B-te;B<v&&ie<D&&_.charAt(v-B-1)===H.charAt(D-ie-1);)B++,ie++;if(V[oe]=B,B>v)F+=2;else if(ie>D)S+=2;else if(!ge){var Y=O+he-te;if(Y>=0&&Y<P&&$[Y]!==-1){var W=$[Y],le=O+W-Y;if(B=v-B,W>=B)return o(_,H,W,le)}}}}return[[e,_],[t,H]]}function o(_,H,v,D){var b=_.substring(0,v),O=H.substring(0,D),P=_.substring(v),$=H.substring(D),V=r(b,O),se=r(P,$);return V.concat(se)}function a(_,H){if(!_||!H||_.charAt(0)!==H.charAt(0))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(O,b)==H.substring(O,b)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return G(_.charCodeAt(b-1))&&b--,b}function l(_,H){var v=_.length,D=H.length;if(v==0||D==0)return 0;v>D?_=_.substring(v-D):v<D&&(H=H.substring(0,v));var b=Math.min(v,D);if(_==H)return b;for(var O=0,P=1;;){var $=_.substring(b-P),V=H.indexOf($);if(V==-1)return O;P+=V,(V==0||_.substring(b-P)==H.substring(0,P))&&(O=P,P++)}}function u(_,H){if(!_||!H||_.slice(-1)!==H.slice(-1))return 0;for(var v=0,D=Math.min(_.length,H.length),b=D,O=0;v<b;)_.substring(_.length-b,_.length-O)==H.substring(H.length-b,H.length-O)?(v=b,O=v):D=b,b=Math.floor((D-v)/2+v);return de(_.charCodeAt(_.length-b))&&b--,b}function c(_,H){var v=_.length>H.length?_:H,D=_.length>H.length?H:_;if(v.length<4||D.length*2<v.length)return null;function b(ye,S,F){for(var K=ye.substring(F,F+Math.floor(ye.length/4)),q=-1,Y="",W,le,oe,B;(q=S.indexOf(K,q+1))!==-1;){var te=a(ye.substring(F),S.substring(q)),ie=u(ye.substring(0,F),S.substring(0,q));Y.length<ie+te&&(Y=S.substring(q-ie,q)+S.substring(q,q+te),W=ye.substring(0,F-ie),le=ye.substring(F+te),oe=S.substring(0,q-ie),B=S.substring(q+te))}return Y.length*2>=ye.length?[W,le,oe,B,Y]:null}var O=b(v,D,Math.ceil(v.length/4)),P=b(v,D,Math.ceil(v.length/2)),$;if(!O&&!P)return null;P?O?$=O[4].length>P[4].length?O:P:$=P:$=O;var V,se,he,ge;_.length>H.length?(V=$[0],se=$[1],he=$[2],ge=$[3]):(he=$[0],ge=$[1],V=$[2],se=$[3]);var Te=$[4];return[V,se,he,ge,Te]}function h(_){for(var H=!1,v=[],D=0,b=null,O=0,P=0,$=0,V=0,se=0;O<_.length;)_[O][0]==n?(v[D++]=O,P=V,$=se,V=0,se=0,b=_[O][1]):(_[O][0]==t?V+=_[O][1].length:se+=_[O][1].length,b&&b.length<=Math.max(P,$)&&b.length<=Math.max(V,se)&&(_.splice(v[D-1],0,[e,b]),_[v[D-1]+1][0]=t,D--,D--,O=D>0?v[D-1]:-1,P=0,$=0,V=0,se=0,b=null,H=!0)),O++;for(H&&z(_),T(_),O=1;O<_.length;){if(_[O-1][0]==e&&_[O][0]==t){var he=_[O-1][1],ge=_[O][1],Te=l(he,ge),ye=l(ge,he);Te>=ye?(Te>=he.length/2||Te>=ge.length/2)&&(_.splice(O,0,[n,ge.substring(0,Te)]),_[O-1][1]=he.substring(0,he.length-Te),_[O+1][1]=ge.substring(Te),O++):(ye>=he.length/2||ye>=ge.length/2)&&(_.splice(O,0,[n,he.substring(0,ye)]),_[O-1][0]=t,_[O-1][1]=ge.substring(0,ge.length-ye),_[O+1][0]=e,_[O+1][1]=he.substring(ye),O++),O++}O++}}var d=/[^a-zA-Z0-9]/,f=/\s/,E=/[\r\n]/,R=/\n\r?\n$/,w=/^\r?\n\r?\n/;function T(_){function H(ye,S){if(!ye||!S)return 6;var F=ye.charAt(ye.length-1),K=S.charAt(0),q=F.match(d),Y=K.match(d),W=q&&F.match(f),le=Y&&K.match(f),oe=W&&F.match(E),B=le&&K.match(E),te=oe&&ye.match(R),ie=B&&S.match(w);return te||ie?5:oe||B?4:q&&!W&&le?3:W||le?2:q||Y?1:0}for(var v=1;v<_.length-1;){if(_[v-1][0]==n&&_[v+1][0]==n){var D=_[v-1][1],b=_[v][1],O=_[v+1][1],P=u(D,b);if(P){var $=b.substring(b.length-P);D=D.substring(0,D.length-P),b=$+b.substring(0,b.length-P),O=$+O}for(var V=D,se=b,he=O,ge=H(D,b)+H(b,O);b.charAt(0)===O.charAt(0);){D+=b.charAt(0),b=b.substring(1)+O.charAt(0),O=O.substring(1);var Te=H(D,b)+H(b,O);Te>=ge&&(ge=Te,V=D,se=b,he=O)}_[v-1][1]!=V&&(V?_[v-1][1]=V:(_.splice(v-1,1),v--),_[v][1]=se,he?_[v+1][1]=he:(_.splice(v+1,1),v--))}v++}}function z(_,H){_.push([n,""]);for(var v=0,D=0,b=0,O="",P="",$;v<_.length;){if(v<_.length-1&&!_[v][1]){_.splice(v,1);continue}switch(_[v][0]){case t:b++,P+=_[v][1],v++;break;case e:D++,O+=_[v][1],v++;break;case n:var V=v-b-D-1;if(H){if(V>=0&&A(_[V][1])){var se=_[V][1].slice(-1);if(_[V][1]=_[V][1].slice(0,-1),O=se+O,P=se+P,!_[V][1]){_.splice(V,1),v--;var he=V-1;_[he]&&_[he][0]===t&&(b++,P=_[he][1]+P,he--),_[he]&&_[he][0]===e&&(D++,O=_[he][1]+O,he--),V=he}}if(M(_[v][1])){var se=_[v][1].charAt(0);_[v][1]=_[v][1].slice(1),O+=se,P+=se}}if(v<_.length-1&&!_[v][1]){_.splice(v,1);break}if(O.length>0||P.length>0){O.length>0&&P.length>0&&($=a(P,O),$!==0&&(V>=0?_[V][1]+=P.substring(0,$):(_.splice(0,0,[n,P.substring(0,$)]),v++),P=P.substring($),O=O.substring($)),$=u(P,O),$!==0&&(_[v][1]=P.substring(P.length-$)+_[v][1],P=P.substring(0,P.length-$),O=O.substring(0,O.length-$)));var ge=b+D;O.length===0&&P.length===0?(_.splice(v-ge,ge),v=v-ge):O.length===0?(_.splice(v-ge,ge,[t,P]),v=v-ge+1):P.length===0?(_.splice(v-ge,ge,[e,O]),v=v-ge+1):(_.splice(v-ge,ge,[e,O],[t,P]),v=v-ge+2)}v!==0&&_[v-1][0]===n?(_[v-1][1]+=_[v][1],_.splice(v,1)):v++,b=0,D=0,O="",P="";break}}_[_.length-1][1]===""&&_.pop();var Te=!1;for(v=1;v<_.length-1;)_[v-1][0]===n&&_[v+1][0]===n&&(_[v][1].substring(_[v][1].length-_[v-1][1].length)===_[v-1][1]?(_[v][1]=_[v-1][1]+_[v][1].substring(0,_[v][1].length-_[v-1][1].length),_[v+1][1]=_[v-1][1]+_[v+1][1],_.splice(v-1,1),Te=!0):_[v][1].substring(0,_[v+1][1].length)==_[v+1][1]&&(_[v-1][1]+=_[v+1][1],_[v][1]=_[v][1].substring(_[v+1][1].length)+_[v+1][1],_.splice(v+1,1),Te=!0)),v++;Te&&z(_,H)}function G(_){return _>=55296&&_<=56319}function de(_){return _>=56320&&_<=57343}function M(_){return de(_.charCodeAt(0))}function A(_){return G(_.charCodeAt(_.length-1))}function j(_){for(var H=[],v=0;v<_.length;v++)_[v][1].length>0&&H.push(_[v]);return H}function Z(_,H,v,D){return A(_)||M(D)?null:j([[n,_],[e,H],[t,v],[n,D]])}function fe(_,H,v){var D=typeof v=="number"?{index:v,length:0}:v.oldRange,b=typeof v=="number"?null:v.newRange,O=_.length,P=H.length;if(D.length===0&&(b===null||b.length===0)){var $=D.index,V=_.slice(0,$),se=_.slice($),he=b?b.index:null;e:{var ge=$+P-O;if(he!==null&&he!==ge||ge<0||ge>P)break e;var Te=H.slice(0,ge),ye=H.slice(ge);if(ye!==se)break e;var S=Math.min($,ge),F=V.slice(0,S),K=Te.slice(0,S);if(F!==K)break e;var q=V.slice(S),Y=Te.slice(S);return Z(F,q,Y,se)}e:{if(he!==null&&he!==$)break e;var W=$,Te=H.slice(0,W),ye=H.slice(W);if(Te!==V)break e;var le=Math.min(O-W,P-W),oe=se.slice(se.length-le),B=ye.slice(ye.length-le);if(oe!==B)break e;var q=se.slice(0,se.length-le),Y=ye.slice(0,ye.length-le);return Z(V,q,Y,oe)}}if(D.length>0&&b&&b.length===0)e:{var F=_.slice(0,D.index),oe=_.slice(D.index+D.length),S=F.length,le=oe.length;if(P<S+le)break e;var K=H.slice(0,S),B=H.slice(P-le);if(F!==K||oe!==B)break e;var q=_.slice(S,O-le),Y=H.slice(S,P-le);return Z(F,q,Y,oe)}return null}function ae(_,H,v,D){return r(_,H,v,D,!0)}return ae.INSERT=t,ae.DELETE=e,ae.EQUAL=n,ms=ae,ms}var Gm=zm();const hi=Rt(Gm),Vm=new Set(["true","false"]);function Km(e){return Vm.has(e.toLowerCase())}function Al(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}var $e=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))($e||{}),Mt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Mt||{}),ks=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ks||{});class ss extends st{}function Xm(e=re.generateRandomId(6),t=sr.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
6
|
+
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:ei.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Ie.TRUE,doNotHyphenateCaps:Ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Ie.FALSE,useFirstPageHeaderFooter:Ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var en={},Un={},Rr={},oo;function qm(){if(oo)return Rr;oo=1,Object.defineProperty(Rr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Rr.default=n,Rr}var Ir={},ao;function Jm(){if(ao)return Ir;ao=1,Object.defineProperty(Ir,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Ir.default=e,Ir}var _s={},lo;function Tl(){return lo||(lo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(c,h){if(!c)throw new Error(h)}const n=c=>c!=null&&typeof c=="object"&&!Array.isArray(c),r=(c,h)=>typeof c==typeof h?c>h:typeof c=="string"&&typeof h=="number";function s(c,h){for(let d in c){const f=d;h.write(f,c[f])}}e.isValidPathItem=c=>typeof c=="number"||typeof c=="string"&&c!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,E=this.idx;for(;E>=0;)h.unshift(d[E]),E===0?(E=this.indexes[f*2],d=this.parents[f--]):E-=n(d[E-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,E){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=E.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const E of this)h&&h.descend(E),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,E)=>{f.p!=null&&d(f.p,E)})}eachDrop(h,d){this.traverse(h,(f,E)=>{f.d!=null&&d(f.d,E)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const E=this.container.splice(f,this.container.length-f);this.container.push(E),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const E=[d];this.container.splice(f,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,E=this.parents.length;let R=0;for(let w=0;w<h.length;w++){const T=h[w];typeof T=="string"||typeof T=="number"?(R++,this.descend(T)):Array.isArray(T)?this.mergeTree(T,d):typeof T=="object"&&d(T,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===E?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=c=>new o(c);function l(c,h,d){let f,E;E=f=c?c.descendFirst():!1;function R(w){let T;for(;E;){const z=T=c.getKey();if(w!=null){let G=!1;if(h&&typeof z=="number"&&(T=h(z,c.getComponent()),T<0&&(T=~T,G=!0)),r(T,w))return null;if(T===w&&!G)return c}d&&typeof T=="number"&&d(T,c.getComponent()),E=c.nextSibling()}return null}return R.end=()=>{f&&c.ascend()},R}e.advancer=l;function u(c,h,d){let f,E,R,w;for(f=E=c&&c.descendFirst(),R=w=h&&h.descendFirst();f||R;){let T=f?c.getKey():null,z=R?h.getKey():null;T!==null&&z!==null&&(r(z,T)?z=null:T!==z&&(T=null)),d(T==null?z:T,T!=null?c:null,z!=null?h:null),T!=null&&f&&(f=c.nextSibling()),z!=null&&R&&(R=h.nextSibling())}E&&c.ascend(),w&&h.ascend()}e.eachChildOf=u}(_s)),_s}var ps={},uo;function Nl(){return uo||(uo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"}(e.ConflictType||(e.ConflictType={}))}(ps)),ps}var St={},tn={},co;function di(){return co||(co=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.uniToStrPos=tn.strPosToUni=void 0,tn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},tn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),tn}var Es={},ho;function Ps(){return ho||(ho=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=di(),n=M=>{if(!Array.isArray(M))throw Error("Op must be an array of components");let A=null;for(let j=0;j<M.length;j++){const Z=M[j];switch(typeof Z){case"object":if(typeof Z.d!="number"&&typeof Z.d!="string")throw Error("Delete must be number or string");if(e.dlen(Z.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(Z.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(Z>0))throw Error("Skip components must be >0");if(typeof A=="number")throw Error("Adjacent skip components should be combined");break}A=Z}if(typeof A=="number")throw Error("Op has a trailing skip")};function r(M,A){let j=0,Z=0;for(let fe=0;fe<M.length;fe++){const ae=M[fe];switch(A(ae,j,Z),typeof ae){case"object":j+=e.dlen(ae.d);break;case"string":Z+=t.strPosToUni(ae);break;case"number":j+=ae,Z+=ae;break}}}e.eachOp=r;function s(M,A){const j=[],Z=a(j);return r(M,(fe,ae,_)=>{Z(A(fe,ae,_))}),h(j)}const i=M=>M,o=M=>s(M,i);e.dlen=M=>typeof M=="number"?M:t.strPosToUni(M);const a=M=>A=>{if(!(!A||A.d===0||A.d===""))if(M.length===0)M.push(A);else if(typeof A==typeof M[M.length-1])if(typeof A=="object"){const j=M[M.length-1];j.d=typeof j.d=="string"&&typeof A.d=="string"?j.d+A.d:e.dlen(j.d)+e.dlen(A.d)}else M[M.length-1]+=A;else M.push(A)},l=M=>typeof M=="number"?M:typeof M=="string"?t.strPosToUni(M):typeof M.d=="number"?M.d:t.strPosToUni(M.d);e.uniSlice=(M,A,j)=>{const Z=t.uniToStrPos(M,A),fe=j==null?1/0:t.uniToStrPos(M,j);return M.slice(Z,fe)};const u=(M,A,j)=>typeof M=="number"?j==null?M-A:Math.min(M,j)-A:e.uniSlice(M,A,j),c=M=>{let A=0,j=0;return{take:(ae,_)=>{if(A===M.length)return ae===-1?null:ae;const H=M[A];let v;if(typeof H=="number")return ae===-1||H-j<=ae?(v=H-j,++A,j=0,v):(j+=ae,ae);if(typeof H=="string"){if(ae===-1||_==="i"||t.strPosToUni(H.slice(j))<=ae)return v=H.slice(j),++A,j=0,v;{const D=j+t.uniToStrPos(H.slice(j),ae);return v=H.slice(j,D),j=D,v}}else{if(ae===-1||_==="d"||e.dlen(H.d)-j<=ae)return v={d:u(H.d,j)},++A,j=0,v;{let D=u(H.d,j,j+ae);return j+=ae,{d:D}}}},peek:()=>M[A]}},h=M=>(M.length>0&&typeof M[M.length-1]=="number"&&M.pop(),M);function d(M,A,j){if(j!=="left"&&j!=="right")throw Error("side ("+j+") must be 'left' or 'right'");n(M),n(A);const Z=[],fe=a(Z),{take:ae,peek:_}=c(M);for(let v=0;v<A.length;v++){const D=A[v];let b,O;switch(typeof D){case"number":for(b=D;b>0;)O=ae(b,"i"),fe(O),typeof O!="string"&&(b-=l(O));break;case"string":j==="left"&&typeof _()=="string"&&fe(ae(-1)),fe(t.strPosToUni(D));break;case"object":for(b=e.dlen(D.d);b>0;)switch(O=ae(b,"i"),typeof O){case"number":b-=O;break;case"string":fe(O);break;case"object":b-=e.dlen(O.d)}break}}let H;for(;H=ae(-1);)fe(H);return h(Z)}function f(M,A){n(M),n(A);const j=[],Z=a(j),{take:fe}=c(M);for(let _=0;_<A.length;_++){const H=A[_];let v,D;switch(typeof H){case"number":for(v=H;v>0;)D=fe(v,"d"),Z(D),typeof D!="object"&&(v-=l(D));break;case"string":Z(H);break;case"object":v=e.dlen(H.d);let b=0;for(;b<v;)switch(D=fe(v-b,"d"),typeof D){case"number":Z({d:u(H.d,b,b+D)}),b+=D;break;case"string":b+=t.strPosToUni(D);break;case"object":Z(D)}break}}let ae;for(;ae=fe(-1);)Z(ae);return h(j)}const E=(M,A)=>{let j=0;for(let Z=0;Z<A.length&&M>j;Z++){const fe=A[Z];switch(typeof fe){case"number":{j+=fe;break}case"string":const ae=t.strPosToUni(fe);j+=ae,M+=ae;break;case"object":M-=Math.min(e.dlen(fe.d),M-j);break}}return M},R=(M,A)=>typeof M=="number"?E(M,A):M.map(j=>E(j,A));function w(M,A,j){return s(M,(Z,fe)=>typeof Z=="object"&&typeof Z.d=="number"?{d:j.slice(A,fe,fe+Z.d)}:Z)}function T(M){return s(M,A=>{switch(typeof A){case"object":if(typeof A.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return A.d;case"string":return{d:A};case"number":return A}})}function z(M){return s(M,A=>typeof A=="object"&&typeof A.d=="string"?{d:t.strPosToUni(A.d)}:A)}function G(M){let A=!0;return r(M,j=>{typeof j=="object"&&typeof j.d=="number"&&(A=!1)}),A}function de(M){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(A=""){if(typeof A!="string")throw Error("Initial data must be a string");return M.create(A)},apply(A,j){n(j);const Z=M.builder(A);for(let fe=0;fe<j.length;fe++){const ae=j[fe];switch(typeof ae){case"number":Z.skip(ae);break;case"string":Z.append(ae);break;case"object":Z.del(e.dlen(ae.d));break}}return Z.build()},transform:d,compose:f,transformPosition:E,transformSelection:R,isInvertible:G,makeInvertible(A,j){return w(A,j,M)},stripInvertible:z,invert:T,invertWithDoc(A,j){return T(w(A,j,M))},isNoop:A=>A.length===0}}e.default=de}(Es)),Es}var Sr={},fo;function Zm(){if(fo)return Sr;fo=1,Object.defineProperty(Sr,"__esModule",{value:!0});const e=Ps(),t=di();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const u=e.dlen(o.d);this.onRemove&&this.onRemove(l,u)}})},onInsert:null,onRemove:null}}return Sr.default=n,n.provides={text:!0},Sr}var go;function Qm(){return go||(go=1,function(e){var t=St&&St.__createBinding||(Object.create?function(d,f,E,R){R===void 0&&(R=E),Object.defineProperty(d,R,{enumerable:!0,get:function(){return f[E]}})}:function(d,f,E,R){R===void 0&&(R=E),d[R]=f[E]}),n=St&&St.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=St&&St.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var E in d)Object.hasOwnProperty.call(d,E)&&t(f,d,E);return n(f,d),f},s=St&&St.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=di(),o=r(Ps()),a=s(Zm()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(E){let R=i.uniToStrPos(d,E);if(R>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,R)),d=d.slice(R)},append(E){f.push(E)},del(E){d=d.slice(i.uniToStrPos(d,E))},build(){return f.join("")+d}}},slice:o.uniSlice},u=o.default(l),c=Object.assign(Object.assign({},u),{api:a.default});e.type=c,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=Ps();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})}(St)),St}var mo;function e_(){return mo||(mo=1,function(e){var t=Un&&Un.__importDefault||function(S){return S&&S.__esModule?S:{default:S}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(qm()),r=t(Jm()),s=Tl(),i=Nl();function o(S,F){if(!S)throw new Error(F)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:S=>S,isNoop:S=>S==null,setDebug(S){},registerSubtype:T,checkValidOp:fe,normalize:ae,apply:_,transformPosition:H,compose:v,tryTransform:V,transform:he,makeInvertible:O,invert:D,invertWithDoc:P,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(S,F,K)=>ye(()=>!0,S,F,K),typeAllowingConflictsPred:S=>Object.assign(Object.assign({},e.type),{transform:(F,K,q)=>ye(S,F,K,q)})};const a=S=>S?S.getComponent():null;function l(S){return S&&typeof S=="object"&&!Array.isArray(S)}const u=S=>Array.isArray(S)?S.slice():S!==null&&typeof S=="object"?Object.assign({},S):S,c=S=>S&&(S.p!=null||S.r!==void 0),h=S=>S&&(S.d!=null||S.i!==void 0);function d(S,F){return o(S!=null),typeof F=="number"?(o(Array.isArray(S),"Invalid key - child is not an array"),(S=S.slice()).splice(F,1)):(o(l(S),"Invalid key - child is not an object"),delete(S=Object.assign({},S))[F]),S}function f(S,F,K){return typeof F=="number"?(o(S!=null,"Container is missing for key"),o(Array.isArray(S),"Cannot use numerical key for object container"),o(S.length>=F,"Cannot insert into out of bounds index"),S.splice(F,0,K)):(o(l(S),"Cannot insert into missing item"),o(S[F]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),S[F]=K),K}e.removeOp=(S,F=!0)=>s.writeCursor().writeAtPath(S,"r",F).get(),e.moveOp=(S,F)=>s.writeCursor().writeMove(S,F).get(),e.insertOp=(S,F)=>s.writeCursor().writeAtPath(S,"i",F).get(),e.replaceOp=(S,F,K)=>s.writeCursor().at(S,q=>{q.write("r",F),q.write("i",K)}).get(),e.editOp=(S,F,K,q=!1)=>s.writeCursor().at(S,Y=>A(Y,F,K,q)).get();const E=(S,F)=>S!=null&&(typeof F=="number"?Array.isArray(S):typeof S=="object"),R=(S,F)=>E(S,F)?S[F]:void 0,w={};function T(S){let F=S.type?S.type:S;F.name&&(w[F.name]=F),F.uri&&(w[F.uri]=F)}const z=S=>{const F=w[S];if(F)return F;throw Error("Missing type: "+S)};T(Qm());const G=(S,F)=>S+F;T({name:"number",apply:G,compose:G,invert:S=>-S,transform:S=>S});const de=S=>S==null?null:S.et?z(S.et):S.es?w["text-unicode"]:S.ena!=null?w.number:null,M=S=>S.es?S.es:S.ena!=null?S.ena:S.e,A=(S,F,K,q=!1)=>{const[Y,W]=typeof F=="string"?[z(F),F]:[F,F.name];!q&&Y.isNoop&&Y.isNoop(K)||(W==="number"?S.write("ena",K):W==="text-unicode"?S.write("es",K):(S.write("et",W),S.write("e",K)))};function j(S){o(typeof S=="number"),o(S>=0),o(S===(0|S))}function Z(S){typeof S=="number"?j(S):o(typeof S=="string")}function fe(S){if(S===null)return;const F=new Set,K=new Set,q=W=>{let le=!0,oe=!1;for(let B in W){const te=W[B];if(le=!1,o(B==="p"||B==="r"||B==="d"||B==="i"||B==="e"||B==="es"||B==="ena"||B==="et","Invalid component item '"+B+"'"),B==="p")j(te),o(!F.has(te)),F.add(te),o(W.r===void 0);else if(B==="d")j(te),o(!K.has(te)),K.add(te),o(W.i===void 0);else if(B==="e"||B==="es"||B==="ena"){o(!oe),oe=!0;const ie=de(W);o(ie,"Missing type in edit"),ie.checkValidOp&&ie.checkValidOp(M(W))}}o(!le)},Y=(W,le,oe)=>{if(!Array.isArray(W))throw Error("Op must be null or a list");if(W.length===0)throw Error("Empty descent");le||Z(W[0]);let B=1,te=0,ie=0;for(let me=0;me<W.length;me++){const be=W[me];if(o(be!=null),Array.isArray(be)){const De=Y(be,!1);if(te){const X=typeof ie,Re=typeof De;X===Re?o(ie<De,"descent keys are not in order"):o(X==="number"&&Re==="string")}ie=De,te++,B=3}else typeof be=="object"?(o(B===1,`Prev not scalar - instead ${B}`),q(be),B=2):(o(B!==3),Z(be),o(s.isValidPathItem(be),"Invalid path key"),B=1)}return o(te!==1,"Operation makes multiple descents. Remove some []"),o(B===2||B===3),W[0]};Y(S,!0),o(F.size===K.size,"Mismatched picks and drops in op");for(let W=0;W<F.size;W++)o(F.has(W)),o(K.has(W))}function ae(S){let F=0,K=[];const q=s.writeCursor();return q.mergeTree(S,(Y,W)=>{const le=de(Y);if(le){const B=M(Y);A(W,le,le.normalize?le.normalize(B):B)}for(const B of["r","p","i","d"])if(Y[B]!==void 0){const te=B==="p"||B==="d"?(oe=Y[B],K[oe]==null&&(K[oe]=F++),K[oe]):Y[B];W.write(B,te)}var oe}),q.get()}function _(S,F){if(fe(F),F===null)return S;const K=[];return function q(Y,W){let le=Y,oe=0,B={root:Y},te=0,ie=B,me="root";function be(){for(;te<oe;te++){let De=W[te];typeof De!="object"&&(o(E(ie,me)),ie=ie[me]=u(ie[me]),me=De)}}for(;oe<W.length;oe++){const De=W[oe];if(Array.isArray(De)){const X=q(le,De);X!==le&&X!==void 0&&(be(),le=ie[me]=X)}else if(typeof De=="object"){De.d!=null?(be(),le=f(ie,me,K[De.d])):De.i!==void 0&&(be(),le=f(ie,me,De.i));const X=de(De);if(X)be(),le=ie[me]=X.apply(le,M(De));else if(De.e!==void 0)throw Error("Subtype "+De.et+" undefined")}else le=R(le,De)}return B.root}(S=function q(Y,W){const le=[];let oe=0;for(;oe<W.length;oe++){const me=W[oe];if(Array.isArray(me))break;typeof me!="object"&&(le.push(Y),Y=R(Y,me))}for(let me=W.length-1;me>=oe;me--)Y=q(Y,W[me]);for(--oe;oe>=0;oe--){const me=W[oe];if(typeof me!="object"){const be=le.pop();Y=Y===R(be,me)?be:Y===void 0?d(be,me):(te=me,ie=Y,(B=u(B=be))[te]=ie,B)}else c(me)&&(o(Y!==void 0,"Cannot pick up or remove undefined"),me.p!=null&&(K[me.p]=Y),Y=void 0)}var B,te,ie;return Y}(S,F),F)}function H(S,F){S=S.slice(),fe(F);const K=s.readCursor(F);let q,Y,W=!1;const le=[];for(let B=0;;B++){const te=S[B],ie=K.getComponent();if(ie&&(ie.r!==void 0?W=!0:ie.p!=null&&(W=!1,q=ie.p,Y=B)),B>=S.length)break;let me=0;const be=s.advancer(K,void 0,(X,Re)=>{c(Re)&&me++});le.unshift(be);const De=be(te);if(typeof te=="number"&&(S[B]-=me),!De)break}if(le.forEach(B=>B.end()),W)return null;const oe=()=>{let B=0;if(q!=null){const te=K.getPath();B=te.length,S=te.concat(S.slice(Y))}for(;B<S.length;B++){const te=S[B],ie=a(K),me=de(ie);if(me){const X=M(ie);me.transformPosition&&(S[B]=me.transformPosition(S[B],X));break}let be=0;const De=s.advancer(K,(X,Re)=>h(Re)?~(X-be):X-be,(X,Re)=>{h(Re)&&be++})(te);if(typeof te=="number"&&(S[B]+=be),!De)break}};return q!=null?K.eachDrop(null,B=>{B===q&&oe()}):oe(),S}function v(S,F){if(fe(S),fe(F),S==null)return F;if(F==null)return S;let K=0;const q=s.readCursor(S),Y=s.readCursor(F),W=s.writeCursor(),le=[],oe=[],B=[],te=[],ie=[],me=[],be=new Set;q.traverse(null,X=>{X.p!=null&&(B[X.p]=q.clone())}),Y.traverse(null,X=>{X.d!=null&&(te[X.d]=Y.clone())});const De=s.writeCursor();return function X(Re,ze,He,Ue,qe,_t,Ge,et){o(ze||He);const Ve=a(ze),ct=a(He),at=!!ct&&ct.r!==void 0,Lt=!!Ve&&Ve.i!==void 0,Fe=Ve?Ve.d:null,ht=ct?ct.p:null,p=(_t||at)&&ht==null;if(ht!=null)Ue=te[ht],Ge=oe[ht]=new s.WriteCursor;else if(ct&&ct.r!==void 0)Ue=null;else{const L=a(Ue);L&&L.d!=null&&(Ue=null)}const g=a(Ue);if(Fe!=null)if(Re=B[Fe],et=le[Fe]=new s.WriteCursor,p)_t&&!at&&et.write("r",!0);else{const L=ie[Fe]=K++;Ge.write("d",L)}else if(Ve&&Ve.i!==void 0)Re=null;else{const L=a(Re);L&&L.p!=null&&(Re=null)}let m;Lt?(o(qe===void 0),m=Ve.i):m=qe;const y=(ht==null?!Lt||_t||at:m===void 0)?null:Ge.getComponent();if(ht!=null){if(!(qe!==void 0||Lt)){const L=Fe!=null?ie[Fe]:K++;me[ht]=L,et.write("p",L)}}else at&&(Lt||qe!==void 0||(ct.r,et.write("r",ct.r)));const N=p?null:de(Ve),U=de(g);if((N||U)&&(N&&N.name,U&&U.name),N&&U){o(N===U);const L=M(Ve),ee=M(g),Ce=N.compose(L,ee);A(Ge,N,Ce),be.add(g)}else N?A(Ge,N,M(Ve)):U&&(A(Ge,U,M(g)),be.add(g));const x=typeof m=="object"&&m!=null;let k=!1,I=0,Q=0,pe=0,J=0,_e=0;const Oe=s.advancer(Ue,(L,ee)=>h(ee)?J-L-1:L-J,(L,ee)=>{h(ee)&&J++}),ue=s.advancer(Re,(L,ee)=>c(ee)?I-L-1:L-I,(L,ee)=>{c(ee)&&I++});if(s.eachChildOf(ze,He,(L,ee,Ce)=>{let Ae,ke,Pe=L,We=L,dt=L;if(typeof L=="number"){let Me=L+pe;ke=Oe(Me),We=Me+J;let ne=L+Q;Ae=ue(ne),h(a(ke))&&(Ae=null),Pe=ne+I,dt=L+_e,o(Pe>=0,"p1PickKey is negative"),o(We>=0,"p2DropKey is negative");const lt=h(a(ee)),Be=c(a(Ce));(lt||Be&&!p)&&_e--,lt&&Q--,Be&&pe--}else Ae=ue(L),ke=Oe(L);et.descend(Pe),Ge.descend(We);const gt=x&&!h(a(ee))?m[dt]:void 0,Ee=X(Ae,ee,Ce,ke,gt,p,Ge,et);var Qe,ve,Se;x&&!p?gt!==Ee&&(k||(m=Array.isArray(m)?m.slice():Object.assign({},m),k=!0),Qe=m,Se=Ee,typeof(ve=dt)=="number"?(o(Array.isArray(Qe)),o(ve<Qe.length)):(o(!Array.isArray(Qe)),o(Qe[ve]!==void 0)),Se===void 0?typeof ve=="number"?Qe.splice(ve,1):delete Qe[ve]:Qe[ve]=Se):o(Ee===void 0),Ge.ascend(),et.ascend()}),ue.end(),Oe.end(),y!=null)y.i=m;else if(!_t&&!at&&ht==null)return m}(q,q.clone(),Y,Y.clone(),void 0,!1,W,De),W.reset(),W.mergeTree(De.get()),W.reset(),W.get(),le.map(X=>X.get()),oe.map(X=>X.get()),q.traverse(W,(X,Re)=>{const ze=X.p;if(ze!=null){const He=ie[ze];He!=null&&Re.write("p",He);const Ue=le[ze];Ue&&Ue.get(),Ue&&Re.mergeTree(Ue.get())}else X.r!==void 0&&Re.write("r",X.r)}),W.reset(),W.get(),Y.traverse(W,(X,Re)=>{const ze=X.d;if(ze!=null){const Ue=me[ze];Ue!=null&&Re.write("d",Ue);const qe=oe[ze];qe&&Re.mergeTree(qe.get())}else X.i!==void 0&&Re.write("i",X.i);const He=de(X);He&&!be.has(X)&&A(Re,He,M(X))}),W.get()}function D(S){if(S==null)return null;const F=new s.ReadCursor(S),K=new s.WriteCursor;let q;const Y=[],W=[];return function le(oe,B,te){const ie=oe.getComponent();let me,be=!1;if(ie){ie.p!=null&&(B.write("d",ie.p),Y[ie.p]=oe.clone()),ie.r!==void 0&&B.write("i",ie.r),ie.d!=null&&(B.write("p",ie.d),te=void 0),ie.i!==void 0&&(te=me=ie.i);const X=de(ie);X&&(te===void 0?(q||(q=new Set),q.add(ie)):(M(ie),te=X.apply(te,M(ie)),be=!0))}let De=0;for(const X of oe){B.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(te,Re);h(oe.getComponent())&&De++;const He=le(oe,B,ze);if(te!==void 0&&He!==void 0){if(be||(be=!0,te=u(te)),!E(te,Re))throw Error("Cannot modify child - invalid operation");te[Re]=He}B.ascend()}if(me===void 0)return be?te:void 0;B.write("r",te)}(F,K,void 0),q&&(K.reset(),function le(oe,B,te){const ie=B.getComponent();if(ie){const X=ie.d;if(X!=null&&(oe=Y[X],te=W[X]=s.writeCursor()),q.has(ie)){const Re=de(ie);if(!Re.invert)throw Error(`Cannot invert subtype ${Re.name}`);A(te,Re,Re.invert(M(ie)))}}let me=0,be=0;const De=s.advancer(oe,(X,Re)=>c(Re)?me-X-1:X-me,(X,Re)=>{c(Re)&&me++});for(const X of B)if(typeof X=="number"){const Re=X-be,ze=De(Re),He=Re+me;te.descend(He),le(ze,B,te),h(B.getComponent())&&be++,te.ascend()}else te.descend(X),le(De(X),B,te),te.ascend();De.end()}(F.clone(),F,K),W.length&&(K.reset(),F.traverse(K,(le,oe)=>{const B=le.p;if(B!=null){const te=W[B];te&&te.get(),te&&oe.mergeTree(te.get())}}))),K.get()}const b=(S,F)=>S.some(K=>typeof K=="object"&&(Array.isArray(K)?b(K,F):F(K)));function O(S,F){if(S==null||!b(S,B=>{var te;return B.r!==void 0||((te=de(B))===null||te===void 0?void 0:te.makeInvertible)!=null}))return S;const K=new s.ReadCursor(S),q=new s.WriteCursor;let Y=!1;const W=[],le=[],oe=(B,te,ie)=>{const me=B.getComponent();let be=!1;if(me){me.d!=null&&te.write("d",me.d),me.i!==void 0&&te.write("i",me.i);const X=me.p;if(X!=null&&(W[X]=B.clone(),o(ie!==void 0,"Operation picks up at an invalid key"),le[X]=ie,te.write("p",me.p)),me.r!==void 0&&ie===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Re=de(me);Re&&(Re.makeInvertible?Y=!0:A(te,Re,M(me),!0))}let De=0;for(const X of B){te.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(ie,Re),He=oe(B,te,ze);ze!==He&&(be||(be=!0,ie=u(ie)),He===void 0?(ie=d(ie,Re),typeof X=="number"&&De++):ie[Re]=He),te.ascend()}return me&&(me.r!==void 0?(te.write("r",r.default(ie)),ie=void 0):me.p!=null&&(ie=void 0)),ie};return oe(K,q,F),q.get(),Y&&(q.reset(),function B(te,ie,me,be,De){const X=ie.getComponent();if(X){X.i!==void 0?(be=X.i,De=!0):X.d!=null&&(be=le[X.d],te=W[X.d],De=!1,X.d);let Ue=de(X);if(Ue&&Ue.makeInvertible){const qe=M(X);A(me,Ue,Ue.makeInvertible(qe,be),!0)}}let Re=0,ze=0;const He=s.advancer(te,(Ue,qe)=>c(qe)?Re-Ue-1:Ue-Re,(Ue,qe)=>{c(qe)&&Re++});for(const Ue of ie)if(typeof Ue=="number"){const qe=Ue-ze,_t=He(qe),Ge=qe+Re,et=R(be,De?qe:Ge);me.descend(Ue),B(_t,ie,me,et,De),h(ie.getComponent())&&ze++,me.ascend()}else{const qe=R(be,Ue);me.descend(Ue),B(He(Ue),ie,me,qe,De),me.ascend()}He.end()}(K.clone(),K,q,F,!1)),q.get()}function P(S,F){return D(O(S,F))}const $=S=>{if(S==null)return null;const F=S.slice();for(let K=0;K<S.length;K++){const q=F[K];Array.isArray(q)&&(F[K]=$(q))}return F};function V(S,F,K){o(K==="left"||K==="right","Direction must be left or right");const q=K==="left"?0:1;if(F==null)return{ok:!0,result:S};fe(S),fe(F);let Y=null;const W=[],le=[],oe=[],B=[],te=[],ie=[],me=[],be=[],De=[],X=[],Re=[],ze=[],He=[],Ue=[],qe=[];let _t=0;const Ge=s.readCursor(S),et=s.readCursor(F),Ve=s.writeCursor();if(function g(m,y=null,N){const U=a(y);U&&(U.r!==void 0?N=y.clone():U.p!=null&&(N=null,ie[U.p]=m.clone()));const x=m.getComponent();let k;x&&(k=x.p)!=null&&(te[k]=y?y.clone():null,oe[k]=m.clone(),N&&(X[k]=!0,De[k]=N),U&&U.p!=null&&(Ue[k]=U.p));const I=s.advancer(y);for(const Q of m)g(m,I(Q),N);I.end()}(et,Ge,null),function g(m,y,N,U,x){const k=N.getComponent();let I,Q=!1;k&&((I=k.d)!=null?(B[I]=N.clone(),U!=null&&(qe[U]==null&&(qe[U]=[]),qe[U].push(I)),X[I],m=te[I]||null,y=oe[I]||null,X[I]?(x&&(Re[I]=!0),x=De[I]||null):!x||q!==1&&Ue[I]!=null||Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.moveOp(y.getPath(),N.getPath())}),Q=!0):k.i!==void 0&&(m=y=null,Q=!0,x&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.insertOp(N.getPath(),k.i)})));const pe=a(m);pe&&(pe.r!==void 0?x=m.clone():pe.p!=null&&(pe.p,U=pe.p,x=null));const J=de(k);J&&x&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(x.getPath()),op2:e.editOp(N.getPath(),J,M(k),!0)});let _e=0,Oe=0;const ue=s.advancer(y,(ee,Ce)=>c(Ce)?_e-ee-1:ee-_e,(ee,Ce)=>{c(Ce)&&_e++}),L=s.advancer(m);for(const ee of N)if(typeof ee=="number"){const Ce=ee-Oe,Ae=ue(Ce);Oe+=+g(L(Ce+_e),Ae,N,U,x)}else{const Ce=ue(ee);g(L(ee),Ce,N,U,x)}return ue.end(),L.end(),Q}(Ge,et,et.clone(),null,null),B.map(g=>g&&g.get()),Y)return{ok:!1,conflict:Y};Re.map(g=>!!g);const ct=[];let at=null;(function g(m,y,N,U,x){let k=!1;const I=a(y);if(c(I)){const ue=I.p;ue!=null?(N=B[ue],U=ze[ue]=s.writeCursor(),k=!0,x=null):(N=null,x=y.clone())}else h(a(N))&&(N=null);const Q=m.getComponent();if(Q){const ue=Q.p;ue!=null?(x&&(be[ue]=x),ct[ue]=x||q===1&&k?null:U.getComponent(),W[ue]=m.clone(),N&&(me[ue]=N.clone())):Q.r!==void 0&&(x||U.write("r",!0),(x||k)&&(at==null&&(at=new Set),at.add(Q)))}let pe=0,J=0;const _e=s.advancer(y,void 0,(ue,L)=>{c(L)&&pe++}),Oe=s.advancer(N,(ue,L)=>h(L)?~(ue-J):ue-J,(ue,L)=>{h(L)&&J++});if(m)for(const ue of m)if(typeof ue=="string"){const L=_e(ue),ee=Oe(ue);U.descend(ue),g(m,L,ee,U,x),U.ascend()}else{const L=_e(ue),ee=ue-pe,Ce=c(a(L))?null:Oe(ee),Ae=ee+J;o(Ae>=0),U.descend(Ae),g(m,L,Ce,U,x),U.ascend()}_e.end(),Oe.end()})(Ge,et,et.clone(),Ve,null),Ve.reset();let Lt=[];if(function g(m,y,N,U,x,k){o(y);const I=y.getComponent();let Q=a(U),pe=!1;const J=(ve,Se,Me)=>ve?e.moveOp(ve.getPath(),Se.getPath()):e.insertOp(Se.getPath(),Me.i);if(h(I)){const ve=I.d;ve!=null&&(le[ve]=y.clone());const Se=ve!=null?ct[ve]:null;let Me=!1;if(I.i!==void 0||ve!=null&&Se){let ne;Q&&(Q.i!==void 0||(ne=Q.d)!=null&&!X[ne])&&(Me=ne!=null?ve!=null&&ve===Ue[ne]:n.default(Q.i,I.i),Me||ne!=null&&q!==1&&Ue[ne]!=null||Y==null&&(Y={type:i.ConflictType.DROP_COLLISION,op1:J(ve!=null?W[ve]:null,y,I),op2:J(ne!=null?oe[ne]:null,U,Q)})),Me||(k?Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:J(ve!=null?W[ve]:null,y,I),op2:e.removeOp(k.getPath())}):(ve!=null?(Lt[_t]=ve,x.write("d",Se.p=_t++)):x.write("i",r.default(I.i)),pe=!0))}else if(ve!=null&&!Se){const ne=be[ve];ne&&(k=ne.clone())}ve!=null?(m=W[ve],N=ie[ve],U=me[ve]):I.i!==void 0&&(m=N=null,Me||(U=null))}else c(a(m))&&(m=N=U=null);const _e=a(m),Oe=a(N);if(c(Oe)){const ve=Oe.p;Oe.r!==void 0&&(!_e||_e.r===void 0)||X[ve]?(U=null,k=N.clone()):ve!=null&&(U=B[ve],q!==1&&Ue[ve]!=null||((x=He[ve])||(x=He[ve]=s.writeCursor()),x.reset(),k=null))}else!h(I)&&h(Q)&&(U=null);Q=U!=null?U.getComponent():null;const ue=de(I);if(ue){const ve=M(I);if(k)Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(y.getPath(),ue,ve,!0),op2:e.removeOp(k.getPath())});else{const Se=de(Q);let Me;if(Se){if(ue!==Se)throw Error("Transforming incompatible types");const ne=M(Q);Me=ue.transform(ve,ne,K)}else Me=r.default(ve);A(x,ue,Me)}}let L=0,ee=0,Ce=0,Ae=0,ke=0,Pe=0,We=m!=null&&m.descendFirst(),dt=We;const gt=s.advancer(N,void 0,(ve,Se)=>{c(Se)&&Ce++});let Ee=U!=null&&U.descendFirst(),Qe=Ee;for(const ve of y)if(typeof ve=="number"){let Se;const Me=h(y.getComponent()),ne=ve-ee;{let Bt;for(;We&&typeof(Bt=m.getKey())=="number";){Bt+=L;const It=m.getComponent(),dn=c(It);if(Bt>ne||Bt===ne&&(!dn||q===0&&Me))break;if(dn){L--;const Qt=It.p;Ue.includes(Qt),It.d,a(He[It.d]),c(a(He[It.d])),(It.r===void 0||at&&at.has(It))&&(Qt==null||!ct[Qt]||q!==1&&Ue.includes(Qt))||ke--}We=m.nextSibling()}Se=We&&Bt===ne?m:null}const lt=ne-L;let Be=gt(lt);const Tt=lt-Ce;let fr=null;{let Bt,It;for(;Ee&&typeof(Bt=U.getKey())=="number";){It=Bt-Ae;const dn=U.getComponent(),Qt=h(dn);if(It>Tt)break;if(It===Tt){if(!Qt){fr=U;break}{if(q===0&&Me){fr=U;break}const Ht=Be&&c(Be.getComponent());if(q===0&&Ht)break}}if(Qt){const Ht=dn.d;X[Ht],Ue[Ht],dn.i===void 0&&(X[Ht]||Ue[Ht]!=null&&q!==1)?(X[Ht]||Ue[Ht]!=null&&q===0)&&(Ae++,Pe--):Ae++}Ee=U.nextSibling()}}const wi=Tt+Ae+ke+Pe;o(wi>=0,"trying to descend to a negative index"),x.descend(wi),Me&&(Se=Be=fr=null,ee++),g(Se,y,Be,fr,x,k)&&Pe++,x.ascend()}else{let Se;for(;We&&(Se=m.getKey(),typeof Se!="string"||!(Se>ve||Se===ve));)We=m.nextSibling();const Me=We&&Se===ve?m:null,ne=gt(ve);let lt;for(;Ee&&(lt=U.getKey(),typeof lt!="string"||!(lt>ve||lt===ve));)Ee=U.nextSibling();const Be=Ee&<===ve?U:null;x.descend(ve),g(Me,y,ne,Be,x,k),x.ascend()}return gt.end(),dt&&m.ascend(),Qe&&U.ascend(),pe}(Ge,Ge.clone(),et,et.clone(),Ve,null),Y)return{ok:!1,conflict:Y};Ve.reset();const Fe=(g,m,y)=>g.traverse(m,(N,U)=>{N.d!=null&&y(N.d,g,U)});(X.length||ze.length)&&(Fe(et,Ve,(g,m,y)=>{X[g]&&!Re[g]&&y.write("r",!0),ze[g]&&y.mergeTree(ze[g].get())}),Ve.reset());const ht=[],p=[];if((He.length||X.length)&&!Y){const g=s.readCursor($(Ve.get()));if(Fe(g,null,(m,y)=>{ht[m]=y.clone()}),He.forEach(m=>{m&&Fe(s.readCursor(m.get()),null,(y,N)=>{ht[y]=N.clone()})}),function m(y,N,U,x,k,I){const Q=a(N);if(Q&&c(Q))if(Q.p!=null){const L=Q.p;ht[L].getPath(),U=ht[L],x=p[L]=s.writeCursor()}else Q.r!==void 0&&(U=null);else h(a(U))&&(U=null);const pe=y.getComponent();if(pe){let L;if((L=pe.d)!=null){const ee=He[L];ee&&(ee.get(),x.mergeTree(ee.get()),U=s.readCursor(ee.get()))}}let J=0,_e=0;const Oe=s.advancer(N,void 0,(L,ee)=>{c(ee)&&J--}),ue=s.advancer(U,(L,ee)=>h(ee)?-(L-_e)-1:L-_e,(L,ee)=>{h(ee)&&_e++});for(const L of y)if(typeof L=="number"){const ee=Oe(L),Ce=L+J,Ae=ue(Ce),ke=Ce+_e;x.descend(ke),m(y,ee,Ae,x),x.ascend()}else x.descend(L),m(y,Oe(L),ue(L),x),x.ascend();Oe.end(),ue.end()}(et,g,g.clone(),Ve),Ve.reset(),Y)return{ok:!1,conflict:Y};if(Ve.get(),p.length){const m=p.map(N=>N?N.get():null),y=s.readCursor($(Ve.get()));if(Fe(y,Ve,(N,U,x)=>{const k=m[N];k&&(x.mergeTree(k),m[N]=null)}),m.find(N=>N)){const N=s.writeCursor(),U=s.writeCursor();let x=0,k=0;m.forEach(I=>{I!=null&&Fe(s.readCursor(I),null,Q=>{const pe=Lt[Q];N.writeMove(W[pe].getPath(),le[pe].getPath(),x++);const J=qe[pe];J&&J.forEach(_e=>{X[_e]||q!==1&&Ue[_e]!=null||U.writeMove(oe[_e].getPath(),B[_e].getPath(),k++)})})}),Y={type:i.ConflictType.BLACKHOLE,op1:N.get(),op2:U.get()}}}}return Y?{ok:!1,conflict:Y}:{ok:!0,result:Ve.get()}}const se=S=>{const F=new Error("Transform detected write conflict");throw F.conflict=S,F.type=F.name="writeConflict",F};function he(S,F,K){const q=V(S,F,K);if(q.ok)return q.result;se(q.conflict)}const ge=S=>{const F=s.writeCursor();return s.readCursor(S).traverse(F,(K,q)=>{(h(K)||de(K))&&q.write("r",!0)}),F.get()},Te=(S,F)=>{const{type:K,op1:q,op2:Y}=S;switch(K){case i.ConflictType.DROP_COLLISION:return F==="left"?[null,ge(Y)]:[ge(q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let W=!1;return s.readCursor(q).traverse(null,le=>{le.r!==void 0&&(W=!0)}),W?[null,ge(Y)]:[ge(q),null];case i.ConflictType.BLACKHOLE:return[ge(q),ge(Y)];default:throw Error("Unrecognised conflict: "+K)}};function ye(S,F,K,q){let Y=null;for(;;){const W=V(F,K,q);if(W.ok)return v(Y,W.result);{const{conflict:le}=W;S(le)||se(le);const[oe,B]=Te(le,q);F=v(ae(F),oe),K=v(ae(K),B),Y=v(Y,B)}}}}(Un)),Un}var _o;function t_(){return _o||(_o=1,function(e){var t=en&&en.__createBinding||(Object.create?function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}:function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]}),n=en&&en.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(e_(),e);var r=Tl();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Nl();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(en)),en}var mt=t_();const n_=Rt(mt),r_=Ku({__proto__:null,default:n_},[mt]);var ce=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(ce||{});function ur(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();_a(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Ml(e,t,n,r){var u;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(u=t.textRuns)!=null?u:[];if(l.length)for(const c of l)c.st+=r,c.ed+=r;for(let c=0;c<o;c++){const h=s[c],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const E={...h,ed:r};i.push(E),l.length&&i.push(...l);const R={...h,st:r+n,ed:f+n};i.push(R)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=ur(i)}function Dl(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,u=s.length;l<u;l++){const c=s[l],{startIndex:h}=c;h>=r&&(c.startIndex+=n),o.push(c.startIndex)}let a=-1;if(i){for(let l=0,u=i.length;l<u;l++){const c=i[l];c.startIndex+=r;const h=c.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(ar("startIndex"))}}function Ll(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ar("startIndex"))}}function xl(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(ar("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function Ul(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u,endIndex:c}=l;u>r?(l.startIndex+=n,l.endIndex+=n):c>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(ar("startIndex"))}}const kl="$",po=e=>e.split(kl)[0];function fi(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=po(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=po(i.rangeId),i.rangeId===n.rangeId&&Al(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${kl}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Fs(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Pl(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function $s(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function s_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Fs(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=fi(s)}function i_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;$s(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:u}=l;u>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Pl(s)}function Fl(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{st:h,ed:d}=c;if(s<=h&&i>=d){o.push({...c,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...c,st:s-s,ed:i-s}),c.ed-=t):s>=h&&s<d?(o.push({...c,st:s-s,ed:d-s}),c.ed=s):i>h&&i<=d?(o.push({...c,st:h-s,ed:i-s}),c.st=i-t,c.ed-=t):h>=i&&(c.st-=t,c.ed-=t);a.push(c)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function $l(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<i){o.push({...c,startIndex:h-n});continue}else h>=i&&(c.startIndex-=t);a.push(c)}e.paragraphs=a}return o}function Bl(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.sectionBreaks=a}return o}function Hl(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h}=c;if(h>=s&&h<=i){o.push({...c,startIndex:h-n});continue}else h>i&&(c.startIndex-=t);a.push(c)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function jl(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(s<=h&&i>=d){o.push({...c,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=Zr(h,d,s,i);if(f.length===0||(c.startIndex=f[0],c.endIndex=f[1],c.startIndex===c.endIndex))continue}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.tables=a}return o}function o_(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,u=r.length;l<u;l++){const c=r[l],{startIndex:h,endIndex:d}=c;if(h>=s&&d<=i){o.push(c);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=Zr(h,d,s,i);if(f.length===0)continue;c.startIndex=f[0],c.endIndex=f[1]}else i<h&&(c.startIndex-=t,c.endIndex-=t);a.push(c)}e.customRanges=fi(a)}return o}function a_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let u=0,c=s.length;u<c;u++){const h=s[u],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const E=Zr(d,f,i,o);if(E.length===0)continue;h.startIndex=E[0],h.endIndex=E[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Wl=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(Wl||{}),Dt=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Dt||{});const vr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},mn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),_n=e=>e.map((t,n)=>({...t,bulletAlignment:or.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Eo=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:or.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),cr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:mn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:mn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:mn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:mn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:mn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:mn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:_n(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:_n([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Eo("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Eo("☑",{st:{s:Ie.TRUE}})}},Or=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(cr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},l_={ORDER_LIST_QUICK_2:Or(vr["a)"]),ORDER_LIST_QUICK_3:Or(vr["a."]),ORDER_LIST_QUICK_4:Or(vr["i."]),ORDER_LIST_QUICK_6:Or(vr["I."])};Object.assign(cr,l_);const u_={"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 c_(e,t,n,r,s){const i=h_(e,t,n,r,s),o=d_(e,t,n,r,s),a=f_(e,t,n,r,s),l=g_(e,t,n,r,s),u=m_(e,t,n,r,s),c=__(e,t,n,r),h=p_(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:u,customRanges:c,customDecorations:h}}function h_(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Fl(e,n,r);if(s!==xe.REPLACE){const l=Yl(o,a,s);t.textRuns=l}return Ml(e,t,n,r),a}function Yl(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function u(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:E,ts:R}=e[o],{st:w,ed:T,ts:z,sId:G}=t[a];let de;if(n===xe.COVER?de={...z,...R}:de={...R},E<w)u()||r.push(e[o]),o++;else if(T<f)u()||r.push(t[a]),a++;else{const M={st:Math.min(f,w),ed:Math.max(f,w),ts:f<w?{...R}:{...z},sId:f<w?void 0:G};M.ed>M.st&&r.push(M),r.push({st:Math.max(f,w),ed:Math.min(E,T),ts:de,sId:G}),E<T?(o++,t[a].st=E,t[a].st===t[a].ed&&a++):(a++,e[o].st=T,e[o].st===e[o].ed&&o++);const A={st:Math.min(E,T),ed:Math.max(E,T),ts:E<T?{...z}:{...R},sId:E<T?G:void 0};l=A.ed>A.st?A:null}}u();const c=r[r.length-1],h=e[s-1],d=t[i-1];return c&&c.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),ur(r)}function d_(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=$l(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,paragraphStyle:h,bullet:d}=u;let f=[];for(const E of a){const{startIndex:R,paragraphStyle:w,bullet:T}=E;let z,G;if(s===xe.COVER?(z={...w,...h},G={listId:"",listType:Dt.BULLET_LIST,nestingLevel:0,textStyle:{},...T,...d}):(z={...h,...w},G={listId:"",listType:Dt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...T}),c===R){f.push({startIndex:c,paragraphStyle:z,bullet:G});break}}l.push(...f),f=[]}t.paragraphs=l}return Dl(e,t,n,r),a}function f_(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Bl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return Ll(e,t,n,r),a}function g_(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Hl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c}=u;let h=[];for(const d of a){const{startIndex:f}=d;if(c===f){s===xe.COVER?h.push({...d,...u}):h.push({...u,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return xl(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function m_(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=jl(e,n,r);if(s!==xe.REPLACE){const l=[];for(const u of o){const{startIndex:c,endIndex:h}=u;let d=[];for(const f of a){const{startIndex:E,endIndex:R}=f;if(E>=c&&R<=h){s===xe.COVER?d.push({...f,...u}):d.push({...u,...f});break}}l.push(...d),d=[]}t.tables=l}return Ul(e,t,n,r),a}function __(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Fs(e.customRanges,r),Fs(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],u=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?u.set(h.rangeId,h):l.push(h)});const c=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=fi(l),c):[]}function p_(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),$s(e.customDecorations,r),$s(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===xe.REPLACE){for(let l=0;l<o.length;l++){const u=o[l],{startIndex:c,endIndex:h}=u;c>=r&&h<=r+n-1&&i.push(u)}a.forEach(l=>{const{startIndex:u,endIndex:c}=l;o.push({...l,startIndex:u+r,endIndex:c+r})})}else for(const l of a){const{id:u}=l;if(l.type===rn.DELETED){const c=o.filter(h=>h.id===u);c.length&&i.push(...c)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:u}=l,c=o.findIndex(h=>h.id===u);c!==-1&&o.splice(c,1)}return e.customDecorations=Pl(o),i}var gi=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(gi||{});function Gr(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=re.deepClone(o),{st:l,ed:u}=a;re.hasIntersectionBetweenTwoRanges(l,u,t,n)&&(t>=l&&t<=u?i.push({...a,st:t,ed:Math.min(n,u)}):n>=l&&n<=u?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return ur(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function zl(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=re.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Gl(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function E_(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Vl(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(re.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function yt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=Gr(e,t,n,r);const a=zl(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Gl(e,t,n),s===1){const u=Xl(e,t,n);u?o.customDecorations=u:r&&(o.customDecorations=[])}const{customRanges:l}=Kl(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Vl(e,t,n),o}function C_(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(c=>{c.startIndex<0&&(a=Math.max(a,-c.startIndex)),c.endIndex>t.length-1&&(l=Math.max(l,c.endIndex-t.length+1))});const u=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(c=>{c.st+=a,c.ed+=a}),r==null||r.forEach(c=>{c.startIndex+=a}),s==null||s.forEach(c=>{c.startIndex+=a,c.endIndex+=a}),i==null||i.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),o==null||o.forEach(c=>{c.startIndex+=a,c.endIndex+=l}),{...e,dataStream:u,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Kl(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Xl(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function R_(e,t,n){return e==null||t==null?e!=null?e:t:Yl(e,t,n)}function I_(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===xe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function S_(e,t,n){return t.length===0||e.length===0||n===xe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function Bs(e,t,n=xe.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:u=[],customRanges:c,customDecorations:h=[]}=t;r.textRuns=R_(l,s,n),r.customRanges=I_(c,o,n);const d=S_(h,a,n);d.length&&(r.customDecorations=d);const f=[];let E=0,R=0;for(;E<i.length&&R<u.length;){const w=i[E],T=u[R],{startIndex:z}=w,{startIndex:G}=T;z===G?(f.push(re.deepMerge(w,T)),E++,R++):z<G?(f.push(re.deepClone(w)),E++):(f.push(re.deepClone(T)),R++)}return E<i.length&&f.push(...i.slice(E)),R<u.length&&f.push(...u.slice(R)),f.length&&(r.paragraphs=f),r}function v_(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class En{constructor(t){C(this,"_index",0);C(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===ce.DELETE||n.t===ce.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:yt(n.body,r,r+t,!1)})}else return{t:ce.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:ce.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}class hn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function ql(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Fl(e,t,n),a=$l(e,t,n),l=Bl(e,t,n),u=Hl(e,t,n),c=jl(e,t,n),h=o_(e,t,n),d=a_(e,t,n);let f="";return r&&(e.dataStream=Ca(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:u,tables:c,customRanges:h,customDecorations:d}}function Jl(e,t,n,r){e.dataStream=Ea(e.dataStream,r,t.dataStream),Ml(e,t,n,r),Dl(e,t,n,r),Ll(e,t,n,r),xl(e,t,n,r),Ul(e,t,n,r),s_(e,t,n,r),i_(e,t,n,r)}function O_(e,t,n,r,s=xe.COVER){return c_(e,t,n,r,s)}function w_(e,t,n){return t<=0?{dataStream:""}:ql(e,t,n)}function b_(e,t,n,r){n!==0&&Jl(e,t,n,r)}function y_(e,t){const n=new hn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case ce.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&O_(e,o,a,n.cursor,i),n.moveCursor(a);break}case ce.INSERT:{const{body:i,len:o}=s;b_(e,i,o,n.cursor),n.moveCursor(o);break}case ce.DELETE:{const{len:i}=s;w_(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function A_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,u=0,c=null;function h(){return c?(i.push(c),c=null,!0):!1}for(;l<o&&u<a;){const{st:R,ed:w,ts:T}=t[l],{st:z,ed:G,ts:de,sId:M}=e[u];let A={};if(s===0)A={...T},n===xe.COVER&&r===xe.REPLACE&&de&&(A=Object.assign({},de,A));else if(A={...T},n===xe.REPLACE){if(r===xe.REPLACE)A={...de};else if(T&&de){const j=Object.keys(T);for(const Z of j)de[Z]&&delete A[Z]}}else if(r===xe.REPLACE){if(de){const j=Object.keys(de);for(const Z of j)de[Z]!==void 0&&(A[Z]=de[Z])}}else if(de){const j=Object.keys(de);for(const Z of j)A[Z]!==void 0&&delete A[Z]}if(w<z)h()||i.push(t[l]),l++;else if(G<R)h()||i.push(e[u]),u++;else{const j={st:Math.min(R,z),ed:Math.max(R,z),ts:R<z?{...T}:{...de}};j.ed>j.st&&i.push(),i.push({st:Math.max(R,z),ed:Math.min(w,G),ts:A,sId:M}),w<G?(l++,e[u].st=w,e[u].st===e[u].ed&&u++):(u++,t[l].st=G,t[l].st===t[l].ed&&l++);const Z={st:Math.min(w,G),ed:Math.max(w,G),ts:w<G?{...de}:{...T},sId:w<G?M:void 0};c=Z.ed>Z.st?Z:null}}h();const d=i[i.length-1],f=t[o-1],E=e[a-1];return d.ed!==Math.max(f.ed,E.ed)&&(f.ed>E.ed?i.push(f):i.push(E)),ur(i,!0)}function T_(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===xe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===xe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function Co(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===xe.REPLACE)if(r===xe.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===xe.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===xe.REPLACE&&r===xe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===xe.REPLACE||r===xe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function N_(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===rn.DELETED||i===rn.DELETED)&&(o=!0,n.push({...r,type:rn.DELETED}));break}o||n.push(r)}return n}function M_(e,t,n=!1){const{body:r,coverType:s=xe.COVER}=e,{body:i,coverType:o=xe.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:u,paragraphs:c=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:E=[],customRanges:R,customDecorations:w}=i,T=A_(u,f,s,o,n?1:0);T&&(a.textRuns=T);const z=T_(h,R,s,o,n?1:0);z&&(a.customRanges=z);const G=N_(d,w);G&&(a.customDecorations=G);const de=[];let M=0,A=0;for(;M<c.length&&A<E.length;){const j=c[M],Z=E[A],{startIndex:fe}=j,{startIndex:ae}=Z;if(fe===ae){let _={startIndex:fe};n?_=Co(j,Z,s,o,1):_=Co(j,Z,s,o,0),de.push(_),M++,A++}else fe<ae?M++:(de.push(re.deepClone(Z)),A++)}return A<E.length&&de.push(...E.slice(A)),de.length&&(a.paragraphs=de),{coverType:l,body:a}}function Ro(e){return Object.keys(e).length===1}const On=class On{constructor(){C(this,"_actions",[])}static apply(t,n){return y_(t,n)}static compose(t,n){const r=new En(t),s=new En(n),i=new On;for(;r.hasNext()||s.hasNext();)if(s.peekType()===ce.INSERT)i.push(s.next());else if(r.peekType()===ce.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===ce.INSERT&&l.t===ce.RETAIN)l.body==null?i.push(a):i.push({...a,body:Bs(a.body,l.body,l.coverType)});else if(a.t===ce.RETAIN&&l.t===ce.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const u=a.coverType===xe.REPLACE||l.coverType===xe.REPLACE?xe.REPLACE:xe.COVER;i.push({...a,t:ce.RETAIN,coverType:u,body:Bs(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===ce.RETAIN&&l.t===ce.DELETE?i.push(l):a.t===ce.INSERT&&(l.t,ce.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new En(t),i=new En(n),o=new On;for(;s.hasNext()||i.hasNext();)if(s.peekType()===ce.INSERT&&(r==="left"||i.peekType()!==ce.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===ce.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),u=i.next(a);if(l.t===ce.DELETE)continue;if(u.t===ce.DELETE){o.push(u);continue}if(l.body==null||u.body==null)o.push(u);else{const{coverType:c,body:h}=M_(l,u,r==="left");o.push({...u,t:ce.RETAIN,coverType:c,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new En(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===ce.DELETE){n-=Math.min(o,n-i);continue}else a===ce.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===ce.INSERT)n.push({t:ce.DELETE,len:r.len,body:r.body});else if(r.t===ce.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:ce.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:ce.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:xe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===ce.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=yt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===ce.RETAIN&&i.body!=null){const o=yt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==ce.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:ce.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:ce.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:ce.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=re.deepClone(t[0]);if(s.t===ce.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===ce.DELETE&&s.t===ce.DELETE)return r.len+=s.len,this;if(r.t===ce.DELETE&&s.t===ce.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===ce.RETAIN&&s.t===ce.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===ce.INSERT&&Ro(r.body)&&s.t===ce.INSERT&&Ro(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===ce.RETAIN&&v_(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(On,"id","text-x"),C(On,"uri","https://github.com/dream-num/univer#text-x");let Ye=On;Object.defineProperty(Ye,"name",{value:"text-x"});const wn=class wn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ye.id||(this._subTypes.set(t.name,t),mt.type.registerSubtype(t))}static apply(t,n){if(!mt.type.isNoop(n))return mt.type.apply(t,n)}static compose(t,n){return mt.type.compose(t,n)}static transform(t,n,r){return mt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ye.name?Ye.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return mt.type.invertWithDoc(t,n)}static isNoop(t){return mt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new wn),this._instance}removeOp(t,n){return mt.removeOp(t,n)}moveOp(t,n){return mt.moveOp(t,n)}insertOp(t,n){return mt.insertOp(t,n)}replaceOp(t,n,r){return mt.replaceOp(t,n,r)}editOp(t,n=["body"]){return mt.editOp(n,Ye.name,t)}};C(wn,"uri","https://github.com/dream-num/univer#json-x"),C(wn,"_subTypes",new Map),C(wn,"_instance",null);let Pt=wn;Pt.registerSubtype(Ye);const mi={id:"default_doc",documentStyle:{}};class D_ extends ss{constructor(n){var r;super();C(this,"type",$e.UNIVER_DOC);C(this,"_name$",new we.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...mi,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...cr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,u=s==null?void 0:s[n];if(!u)return;const c=u.docTransform;c.size.width=i,c.size.height=o,c.positionH.posOffset=a,c.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class At extends D_{constructor(n){var s,i;super(re.isEmptyObject(n)?Xm():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);C(this,"change$",new we.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...mi,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Pt.isNoop(n))return this.snapshot=Pt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=gi.copy){const i=this.getBody();if(i!=null)return yt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new At(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new At(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return Qr((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function L_(e){const{ranges:t,id:n,type:r}=e,s=new Ye;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:u}=a;l>0&&s.push({t:ce.RETAIN,len:l-i}),s.push({t:ce.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:u-l-1}]},len:u-l}),i=u}return s}function x_(e){var c,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(c=r.getSelfOrHeaderFooterModel(n))==null?void 0:c.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ye,{startIndex:a,endIndex:l}=i,u=l-a+1;return o.push({t:ce.RETAIN,len:a}),o.push({t:ce.RETAIN,len:u,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:u-1,id:t,type:rn.DELETED}]}}),o}function Zl(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function U_(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Zl(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function k_(e){return{...re.deepClone(e),rangeId:kt()}}function P_(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Ql(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function F_(e,t){var i,o,a,l,u;const n=Ql(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((u=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?u:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}function $_(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(E=>E.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ye,u=a-o+1;l.push({t:ce.RETAIN,len:o}),l.push({t:ce.RETAIN,len:u,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:ce.INSERT,body:s,len:s.dataStream.length});const c=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:c,endOffset:c,collapsed:!0}],l}function B_(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ye;let u=!1;return t.forEach(c=>{var G,de,M;const h=F_(c,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,E=(G=o.customRanges)!=null?G:[],R=(A,j,Z)=>{var v,D,b,O;const fe=Ql(A,j,E,r),ae=Math.min((D=(v=fe[0])==null?void 0:v.startIndex)!=null?D:1/0,A),_=Math.max((O=(b=fe[fe.length-1])==null?void 0:b.endIndex)!=null?O:-1/0,j),H={rangeId:Z?`${n}$${Z}`:n,rangeType:r,startIndex:0,endIndex:_-ae,wholeEntity:s,properties:{...i}};l.push({t:ce.RETAIN,len:ae-a}),l.push({t:ce.RETAIN,len:_-ae+1,body:{dataStream:"",customRanges:[H]},coverType:xe.COVER}),a=_+1},w=((de=o.paragraphs)!=null?de:[]).filter(A=>A.startIndex<f&&A.startIndex>d),T=((M=o.customBlocks)!=null?M:[]).filter(A=>A.startIndex<f&&A.startIndex>d);P_([d,f-1],[...w.map(A=>A.startIndex),...T.map(A=>A.startIndex)]).forEach(([A,j],Z)=>R(A,j,Z)),u=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),u?l:!1}function eu(e,t,n=0,r=null,s=!0){e.sort((u,c)=>u.startOffset-c.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(u=>u.startIndex>=e[0].startOffset&&u.startIndex<e[0].endOffset);let l=n;if(e.forEach(u=>{const{startOffset:c,endOffset:h}=u;c>l&&(i.push({t:ce.RETAIN,len:c-l}),l=c),l<h&&(i.push({t:ce.DELETE,len:h-l}),l=h)}),r&&i.push({t:ce.INSERT,body:r,len:r.dataStream.length}),a&&s){const u=o.find(c=>c.startIndex-n>=e[e.length-1].endOffset-1);u&&(u.startIndex>l&&(i.push({t:ce.RETAIN,len:u.startIndex-l}),l=u.startIndex),i.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...u,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:xe.REPLACE}))}return i}function H_(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:ce.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:ce.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const j_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:yt(i,t.startOffset,t.endOffset),a=hi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const E={t:ce.RETAIN,body:{...yt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,E}case 1:{const E={t:ce.INSERT,body:yt(n,l,l+f.length),len:f.length};return l+=f.length,E}default:return{t:ce.DELETE,len:f.length}}}),c=new Ye;return c.push({t:ce.RETAIN,len:t.startOffset}),c.push(...u),c};function W_(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const Y_=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:yt(i,t.startOffset,t.endOffset),a=hi(o?o.dataStream:"",n.dataStream);let l=0;const u=a.map(([d,f])=>{switch(d){case 0:{const E=Gr(n,l,l+f.length,!1),R=Gr(o,l,l+f.length,!1),w={t:ce.RETAIN,body:W_(E,R)?void 0:{textRuns:E,dataStream:""},len:f.length};return l+=f.length,w}case 1:{const E={t:ce.INSERT,body:yt(n,l,l+f.length),len:f.length};return l+=f.length,E}default:return{t:ce.DELETE,len:f.length}}});if(u.every(d=>d.t===ce.RETAIN&&!d.body))return!1;const c=new Ye;return c.push({t:ce.RETAIN,len:t.startOffset}),c.push(...u),c};function z_(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function G_(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const V_=e=>{var R,w,T,z;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ye,l=Pt.getInstance(),u=[],c=n.getSelfOrHeaderFooterModel(o).getBody();if(!c)return!1;const h=(w=(R=n.getSnapshot().drawingsOrder)==null?void 0:R.length)!=null?w:0;let d=0;if(s)i>0&&a.push({t:ce.RETAIN,len:i});else{const G=eu([t],c,0,null,!1);a.push(...G);const de=z_(c,[t]),M=(T=n.getDrawings())!=null?T:{},A=(z=n.getDrawingsOrder())!=null?z:[],j=de.sort((Z,fe)=>A.indexOf(Z)>A.indexOf(fe)?-1:A.indexOf(Z)<A.indexOf(fe)?1:0);if(j.length>0)for(const Z of j){const fe=M[Z],ae=A.indexOf(Z);if(fe==null||ae<0)continue;const _=l.removeOp(["drawings",Z],fe),H=l.removeOp(["drawingsOrder",ae],Z);u.push(_),u.push(H),d++}}a.push({t:ce.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((G,de)=>({startIndex:de,blockId:G.drawingId}))},len:r.length});const f=G_(n,o),E=l.editOp(a.serialize(),f);u.push(E);for(const G of r){const{drawingId:de}=G,M=l.insertOp(["drawings",de],G),A=l.insertOp(["drawingsOrder",h-d],de);u.push(M),u.push(A)}return u.reduce((G,de)=>Pt.compose(G,de),null)};function K_(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function X_(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function q_(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function Hs(e,t){var o,a;const{startOffset:n,endOffset:r}=e,s=[];let i=-1;for(let l=0;l<t.length;l++){const u=t[l],c=t[l-1],{startIndex:h}=u;n>i&&n<=h||r>i&&r<=h?s.push({...u,paragraphStart:((o=c==null?void 0:c.startIndex)!=null?o:-1)+1,paragraphEnd:u.startIndex}):h>=n&&h<=r&&s.push({...u,paragraphStart:((a=c==null?void 0:c.startIndex)!=null?a:-1)+1,paragraphEnd:u.startIndex}),i=h}return s}function js(e,t){const n=[];for(const r of e){const s=Hs(r,t);n.push(...s)}return n}function J_(e){var n;const t=[];for(let r=0;r<e.length;r++){const s=e[r],i=e[r-1],{startIndex:o}=s;t.push({...s,paragraphStart:((n=i==null?void 0:i.startIndex)!=null?n:-1)+1,paragraphEnd:s.startIndex})}return t}const Z_=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(E=>{var R;return((R=E.bullet)==null?void 0:R.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const E=i.indexOf(t[0]),R=i[E-1],w=i[E+1];R&&R.bullet&&R.bullet.listType.indexOf(s)===0?(l=R.bullet.listId,s!==Dt.CHECK_LIST&&(s=R.bullet.listType)):w&&w.bullet&&w.bullet.listType.indexOf(s)===0&&(l=w.bullet.listId,s!==Dt.CHECK_LIST&&(s=w.bullet.listType))}const u=new hn;u.reset();const c=new Ye;for(const E of t){const{startIndex:R,paragraphStyle:w={},bullet:T}=E;c.push({t:ce.RETAIN,len:R-u.cursor}),c.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:w,startIndex:0}:{startIndex:0,paragraphStyle:{...w},bullet:{nestingLevel:(f=T==null?void 0:T.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:xe.REPLACE}),u.moveCursorTo(R+1)}return c},Q_=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Dt.CHECK_LIST)===-1)return!1;const o=new hn;o.reset();const a=new Ye,{startIndex:l,paragraphStyle:u={}}=i,c=i.bullet.listType===Dt.CHECK_LIST?Dt.CHECK_LIST_CHECKED:Dt.CHECK_LIST;return a.push({t:ce.RETAIN,len:l-o.cursor}),a.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:u,startIndex:0,bullet:{...i.bullet,listType:c}}]},coverType:xe.REPLACE}),o.moveCursorTo(l+1),a},ep=e=>{var c,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((c=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:c.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new hn;l.reset();const u=new Ye;for(const d of t){const{startIndex:f,paragraphStyle:E={},bullet:R}=d;u.push({t:ce.RETAIN,len:f-l.cursor}),u.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:E,bullet:{nestingLevel:(h=R==null?void 0:R.nestingLevel)!=null?h:0,textStyle:(R==null?void 0:R.listType)===n?R.textStyle:{fs:20},listType:n,listId:a}}]},coverType:xe.REPLACE}),l.moveCursorTo(f+1)}return u};function tp(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const np=e=>{var u,c,h;const{paragraphs:t,document:n,type:r}=e,s=new hn;s.reset();const i=new Ye,o=(u=n.getSnapshot().lists)!=null?u:{},a=(h=(c=n.getBody())==null?void 0:c.tables)!=null?h:[],l={...cr,...o};for(const d of t){const{startIndex:f,paragraphStyle:E={},bullet:R}=d,w=tp(d,a);if(i.push({t:ce.RETAIN,len:f-s.cursor}),R){const T=R.listType;let z=l[T].nestingLevel.length-1;w&&(z=Math.min(z,2)),i.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...E},bullet:{...R,nestingLevel:Math.max(Math.min(R.nestingLevel+r,z),0)}}]},coverType:xe.REPLACE})}else i.push({t:ce.RETAIN,len:1});s.moveCursorTo(f+1)}return i},rp=e=>{var E,R;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,u=(R=(E=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:E.paragraphs)!=null?R:[],c=js(t,u),h=new hn;o&&h.moveCursorTo(o);const d=l!=null?l:new Ye;c.sort((w,T)=>w.startIndex-T.startIndex);const f=Math.max(0,c[0].paragraphStart-1);f>h.cursor&&(d.push({t:ce.RETAIN,len:f-h.cursor}),h.moveCursorTo(f)),a&&d.push({t:ce.DELETE,len:a});for(const w of c){const{startIndex:T,paragraphStyle:z={}}=w,G=T-h.cursor;d.push({t:ce.RETAIN,len:G,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:G}]},coverType:xe.REPLACE}:null}),d.push({t:ce.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...z,...s}}]},coverType:xe.REPLACE}),h.moveCursorTo(T+1)}return d};class ot{}C(ot,"customRange",{add:B_,delete:$_,copyCustomRange:k_,getCustomRangesInterestsWithSelection:U_,isIntersecting:Zl}),C(ot,"customDecoration",{add:L_,delete:x_}),C(ot,"selection",{replace:j_,makeSelection:K_,normalizeSelection:X_,delete:eu,replaceTextRuns:Y_,retain:H_}),C(ot,"range",{isIntersects:q_,getParagraphsInRange:Hs,getParagraphsInRanges:js}),C(ot,"transform",{getPlainText:Qr,fromPlainText:Yd,isEmptyDocument:Wd}),C(ot,"paragraph",{bullet:{set:ep,switch:Z_,toggleChecklist:Q_,changeNestLevel:np},style:{set:rp},util:{transform:J_,getParagraphsInRange:Hs,getParagraphsInRanges:js}}),C(ot,"drawing",{add:V_});function sp(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function tu(e){var t;return e.body=sp((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class hr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new hr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Ie.TRUE}get bold(){return this._style.bl===Ie.TRUE}get underline(){return this._style.ul&&zt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&zt.create(this._style.bbl)}get strikethrough(){return this._style.st&&zt.create(this._style.st)}get overline(){return this._style.ol&&zt.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 Xt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Xt extends hr{static create(t={}){return new Xt(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return Xt.create(re.deepClone(this._style))}build(){return this.getValue()}}class zt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new zt(t)}get show(){return this._decoration.s===Ie.TRUE}get followFontColor(){return this._decoration.c===Ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return zt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class dr{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new dr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===Ie.TRUE}get keepNext(){return this._style.keepNext===Ie.TRUE}get wordWrap(){return this._style.wordWrap===Ie.TRUE}get widowControl(){return this._style.widowControl===Ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Ie.TRUE}copy(){return Zn.create(re.deepClone(this._style))}getValue(){return this._style}}class Zn extends dr{static create(t={}){return new Zn(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return Zn.create(re.deepClone(this._style))}build(){return this.getValue()}}class Gt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=tu(t)}static create(t){return new Gt(t)}static createByBody(t){return new Gt({body:t,id:"d",documentStyle:{}})}copy(){return sn.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return sn.create({...re.deepClone(s),body:yt(r,t,n)})}toPlainText(){var t,n;return ot.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
7
|
+
`)}getParagraphStyle(){var t,n;return dr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?hr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===qt.HYPERLINK))!=null?r:[]}getData(){return this._data}}class sn extends Gt{constructor(n){super(n);C(this,"_doc");this._doc=new At(n)}static newEmptyData(){return tu({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
8
|
+
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new sn(n!=null?n:sn.newEmptyData())}insertText(n,r,s){var c,h;let i=((h=(c=this._data.body)==null?void 0:c.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Xt?r.build():r:a=s instanceof Xt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},u=ot.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!u)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),u.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof Gt?n.getData():n:(s=Math.min(n,s),i=r instanceof Gt?r.getData():r);const o=ot.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=ot.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ye.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Xt?s.build():s,st:0,ed:r-n}]},o=ot.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ye.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=ot.customRange.add({rangeType:qt.HYPERLINK,rangeId:kt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return Ye.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=ot.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=ot.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ye.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,Gt.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=sn.createByBody({dataStream:i,customRanges:[{rangeType:qt.HYPERLINK,rangeId:kt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function ip(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var Sn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(Sn||{});function op(e){return`sheet_interceptor_${e}`}const nu=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class ap{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),nu(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function lp(e){return`sheet_async_interceptor_${e}`}const up=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class cp{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),up(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>tr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function hp(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function ru(e){return/^-?\d+(\.\d+)?$/.test(e)}function dp(e){return ru(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}class _i{constructor(){C(this,"_data",[])}static create(){return new _i}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class pi{constructor(){C(this,"_data",new Map)}static create(){return new pi}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function fp(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}function gp(e,t){return t.forEach(n=>e.add(n)),e}function mp(e,t,n,r){var u;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new At(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const c=new Ye,h=Pt.getInstance();if(a>0&&c.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(u=d==null?void 0:d.customRanges)!=null&&u.length){const E=d.customRanges[0];f.customRanges=[{...E,startIndex:0,endIndex:n.length-1}]}c.insert(n.length,f)}c.delete(o),i.apply(h.editOp(c.serialize()))}const l=i.getBody();return i.dispose(),l}const _p="__default_document_sub_component_id20231101__";class su{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class pp extends we.Subject{constructor(){super(...arguments);C(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new su;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function Ep(e){return new we.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const is=je.createIdentifier("core.resource-manager.service"),Ws={[Mt.Editor]:"Editor",[Mt.Owner]:"Owner",[Mt.Reader]:"Reader",[Mt.UNRECOGNIZED]:"UNRECOGNIZED"},Vr=e=>e?{userID:`${Ws[e]}_${re.generateRandomId(8)}`,name:Ws[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},Cp=(e,t)=>e.startsWith(Ws[t]);class Qn{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new we.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new we.BehaviorSubject(Vr()));C(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var Rp=Object.getOwnPropertyDescriptor,Ip=(e,t,n,r)=>{for(var s=r>1?void 0:r?Rp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Io=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Vr(Mt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?Cp(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[$e.UNIVER_SHEET,$e.UNIVER_DOC,$e.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return kt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Mt.Owner,shareScope:-1,scope:{read:ks.AllCollaborator,edit:ks.AllCollaborator},creator:Vr(Mt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Mt.Owner)||this._getRole(Mt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=Ip([Io(0,is),Io(1,je.Inject(Qn))],exports.AuthzIoLocalService);const iu=je.createIdentifier("IAuthzIoIoService");var Sp=Object.getOwnPropertyDescriptor,vp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Sp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Op=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:Fr.PERSON,mentions:[{objectType:Fr.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=vp([Op(0,je.Inject(Qn))],exports.MentionIOLocalService);const ou=je.createIdentifier("univer.service.mention-io"),Ei=je.createIdentifier("univer.config-service");class au{constructor(){C(this,"_configChanged$",new we.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=ci(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new we.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(we.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const Wn="FOCUSING_UNIT",vn="FOCUSING_SHEET",Yn="FOCUSING_DOC",zn="FOCUSING_SLIDE",wp="FOCUSING_EDITOR_BUT_HIDDEN",lu="EDITOR_ACTIVATED",bp="FOCUSING_EDITOR_INPUT_FORMULA",uu="FOCUSING_FX_BAR_EDITOR",yp="FOCUSING_UNIVER_EDITOR",Ap="FOCUSING_EDITOR_INPUT_FORMULA",Tp="FOCUSING_PANEL_EDITOR",Np="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",Mp="FOCUSING_COMMON_DRAWINGS",Dp="FORMULA_EDITOR_ACTIVATED";class cu extends st{constructor(){super(...arguments);C(this,"_error$",new we.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}const Lp="0.6.8",xp={version:Lp};function Up(e="",t=sr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:xp.version,locale:t,styles:{},sheets:{},resources:[]}}class hu{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new qn(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=re.generateRandomId(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(re.diffValue(n[r],t))return r;return null}}const kp=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Jt.equals(r,n))),Pp=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Jt.equals(n.range,s.range)}),Ys={t:0,b:2,l:2,r:2},Fp=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),So=90;function Gn(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=wt.UNSPECIFIED,verticalAlign:a=nn.UNSPECIFIED,wrapStrategy:l=an.UNSPECIFIED,cellValueType:u}=n,{t:c,r:h,b:d,l:f}=i||Ys,{vertexAngle:E,centerAngle:R}=gu(s),w={id:"d",body:{dataStream:`${e}${Ia}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:c,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:R,vertexAngle:E,wrapStrategy:l,cellValueType:u,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new At(w)}function $p(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function vo(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),u}function du(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===qt.HYPERLINK))return;const s=ot.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:qt.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&Ye.apply(r,s.serialize())}function fu(e){return e!=null}const Bp='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Oo(e){const t=ut.ff,n=ut.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=In.ITALIC;(e.it===0||e.it===void 0)&&(r=In.NORMAL);let s=In.BOLD;(e.bl===0||e.bl===void 0)&&(s=In.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Ut.SUBSCRIPT||a===Ut.SUPERSCRIPT){const h=Hp(o,l),{sbr:d,spr:f}=h;l*=a===Ut.SUBSCRIPT?d:f}const u=`${r} ${s} ${l}pt ${o}`,c=`${u}, ${Bp} `;return{fontCache:u,fontString:c,fontSize:l,originFontSize:i,fontFamily:o}}function Hp(e,t){return Fp(t)}function gu(e){const{a:t=0,v:n=Ie.FALSE}=e||{a:0,v:Ie.FALSE};let r=0,s=t;return n===Ie.TRUE&&(r=So,s=So),{centerAngle:r,vertexAngle:s}}class jp{constructor(t,n){C(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==Ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:Le.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:Le.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return Kt(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Ie.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}class Wp{constructor(t,n,r){C(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRowOrCreate(i);r[s]=o,s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:Ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:u,h:c=s.defaultRowHeight}=a;i+=(l==null||l===Ie.TRUE)&&typeof u=="number"?u:c}return i}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:Le.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:Le.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Ie.TRUE:!0}getSize(){return Kt(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const Yp="DEFAULT_WORKSHEET_ROW_COUNT",mu=1e3,zp="DEFAULT_WORKSHEET_COLUMN_COUNT",_u=20,Gp="DEFAULT_WORKSHEET_ROW_HEIGHT",pu=24,Vp="DEFAULT_WORKSHEET_COLUMN_WIDTH",Eu=88,Kp="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Cu=46,Xp="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ru=20;function Iu(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Ie.FALSE,rowCount:mu,columnCount:_u,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Eu,defaultRowHeight:pu,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Ie.TRUE,rowHeader:{width:Cu,hidden:Ie.FALSE},columnHeader:{height:Ru,hidden:Ie.FALSE},rightToLeft:Ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class qp extends st{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new qn(5e4));C(this,"_skeletonCache",new qn(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===Le.ROW?this._createRowCache(s,r):i===Le.COLUMN?this._createColumnCache(s,r):i===Le.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const u=[];for(const c of this._mergeData||[])Jt.intersects(c,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...c}),u.push(l)),l++;return this._rangeMap.set(a,u),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const u=[];for(let c=0;c<a.length;c++){const{startRow:h,endRow:d,startColumn:f,endColumn:E}=a[c];for(let R=n;R<=s;R++){let w=!1;for(let T=r;T<=i;T++)if(R>=h&&R<=d&&T>=f&&T<=E){o.push({startRow:h,endRow:d,startColumn:f,endColumn:E}),u.push(c),w=!0;break}if(w)break}}return this._skeletonCache.set(l,u),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class Su extends st{constructor(n){super();C(this,"_cellContentInterceptor",null);C(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Value|Sn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,Sn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,nt(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,nt(()=>this._rowFilteredInterceptor=null)}}const wo={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class er{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=Iu(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new bt(o),this._viewModel=new Su((l,u)=>this.getCellRaw(l,u)),this._rowManager=new Wp(this._snapshot,this._viewModel,i),this._columnManager=new jp(this._snapshot,s),this._spanModel=new qp(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r=!0){const s=this.getCellStyle(t,n),i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n);return r?ws(i,o,a,s):ws(i,a,o,s)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((u,c)=>{Object.keys(c).forEach(h=>{const d=+h,f=t.getValue(u,d),E=f!=null&&f.s?this._styles.get(f.s):null,R=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(f&&(f.v||f.p)||E!=null&&E.bg||R)&&(a?r=Math.min(r,u):(r=u,a=!0),s=Math.max(s,u),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(u=>{a?r=Math.min(r,u.startRow):(r=u.startRow,a=!0),s=Math.max(s,u.endRow),l?i=Math.min(i,u.startColumn):(i=u.startColumn,a=!0),o=Math.max(o,u.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=re.deepClone(t);return new er(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,u=n;if(r){const{startRow:c,endRow:h,startColumn:d,endColumn:f}=r;t===c&&n===d?(o=h,a=f,l=c,u=d,i=!0):t>=c&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=c,u=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:u}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getMatrixWithMergedCells(t,n,r,s,i=Rn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new bt;return Ds(t,r,n,s).forEach((u,c)=>{var d;let h;if(i===Rn.Raw)h=this.getCellRaw(u,c);else if(i===Rn.Intercepted)h=this.getCell(u,c);else if(i===Rn.Both){const f=this.getCellRaw(u,c);if(f){h={...f};const E=(d=this.getCell(u,c))==null?void 0:d.v;fu(E)&&h&&(h.displayV=String(E))}}h&&l.setValue(u,c,h)}),a.forEach(u=>{const{startColumn:c,startRow:h,endColumn:d,endRow:f}=u;Ds(h,f,c,d).forEach((E,R)=>{E===h&&R===c&&l.setValue(E,R,{...o.getValue(E,R),rowSpan:f-h+1,colSpan:d-c+1}),(E!==h||R!==c)&&l.realDeleteValue(E,R)})}),l}getRange(t,n,r,s){return typeof t=="object"?new bn(this,t,{getStyles:()=>this._styles}):new bn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,u=s;return{next(){for(;;){if(u>o&&(l+=1,u=s),l>i)return{done:!0,value:void 0};const c=a.getCell(l,u),h=!c,d=a.getMergedCell(l,u);if(d){if(l!==d.startRow||u!==d.startColumn){u=d.endColumn+1;continue}if(h&&n){u=d.endColumn+1;continue}const E={row:l,col:u,value:c};return E.colSpan=d.endColumn-d.startColumn+1,E.rowSpan=d.endRow-d.startRow+1,u=d.endColumn+1,{done:!1,value:E}}if(h&&n)u+=1;else{const f={row:l,col:u,value:c};return u+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let u=s,c=i;return{next(){for(;;){if(u>o&&(c+=1,u=s),c>a)return{done:!0,value:void 0};const h=l.getMergedCell(u,c);if(h){const E=u!==h.startRow,R=E||c!==h.startColumn;if(r&&R||!r&&E){u=h.endRow+1;continue}const w=l.getCell(h.startRow,h.startColumn);if(!w&&n){u=h.endRow+1;continue}const z={row:u,col:h.startColumn,value:w};return z.colSpan=h.endColumn-h.startColumn+1,z.rowSpan=h.endRow-h.startRow+1,u=h.endRow+1,{done:!1,value:z}}const d=l.getCell(u,c);if(!d&&n)u+=1;else{const E={row:u,col:c,value:d};return u+=1,{done:!1,value:E}}}}}}}}_getCellDocumentModel(t,n=wo){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...wo,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const u=$p(o),c=i?ut.tr:u.textRotation||ut.tr;let h=u.horizontalAlign||ut.ht;const d=u.verticalAlign||ut.vt,f=u.wrapStrategy||ut.tb,E=u.paddingData||Ys;if(t.f&&s)a=Gn(t.f.toString(),{},{verticalAlign:d}),h=ut.ht;else if(t.p){const{centerAngle:w,vertexAngle:T}=gu(c);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,h,E,{horizontalAlign:h,verticalAlign:d,centerAngle:w,vertexAngle:T,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const w=vo(o);l=Oo(w).fontCache;let T=vu(t);t.t===Vt.FORCE_STRING&&s&&(T=`'${T}`),a=Gn(T,w,{...u,textRotation:c,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&du(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:c,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:E,fill:(R=o==null?void 0:o.bg)==null?void 0:R.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,u,c;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(u=r.l)!=null?u:2,t.documentStyle.marginRight=(c=r.r)!=null?c:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new At(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=vo(r);if(n!=null)return n.documentModel==null&&(n.documentModel=Gn("",s)),n;const i="";let o="document";const a=ut.tr,l=ut.ht,u=ut.vt,c=ut.tb,h=Ys;return o=Oo({}).fontCache,{documentModel:Gn(i,s),fontString:o,textRotation:a,wrapStrategy:c,verticalAlign:u,horizontalAlign:l,paddingData:h}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function vu(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return ot.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===Vt.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===Vt.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function Jp(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return ot.transform.getPlainText(n)}return e==null?void 0:e.v}var Zp=Object.getOwnPropertyDescriptor,Qp=(e,t,n,r)=>{for(var s=r>1?void 0:r?Zp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},eE=(e,t)=>(n,r)=>t(n,r,e);function tE(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends ss{constructor(n={},r){super();C(this,"type",$e.UNIVER_SHEET);C(this,"_sheetCreated$",new we.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new we.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new we.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=Up();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new hu(i),this._count=1,this._worksheets=new Map,this._name$=new we.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return re.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n);const a=new er(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==Ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===Ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(re.isEmptyObject(s)){const o=re.generateRandomId();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const u=new er(this._unitId,a,this._styles);r.set(o,u),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=Qp([eE(1,Ot)],exports.Workbook);class Ci extends ss{constructor(n){var r;super();C(this,"type",$e.UNIVER_SLIDE);C(this,"_activePage$",new we.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...tl,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new we.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:kt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=kt(6);return{id:n,pageType:ti.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var nE=Object.getOwnPropertyDescriptor,rE=(e,t,n,r)=>{for(var s=r>1?void 0:r?nE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},bo=(e,t)=>(n,r)=>t(n,r,e);const Tn=je.createIdentifier("univer.current");exports.UniverInstanceService=class extends st{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new we.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new we.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new we.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new we.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(we.map(r=>{var s;return(s=r.get(n))!=null?s:null}),we.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(we.filter(r=>r.type===n))}__addUnit(n,r){var a;const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(we.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType($e.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,$e.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,$e.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType($e.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!0),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof At?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!0),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!1),this.setCurrentUnitForType(n)):this.focused instanceof Ci?(this._contextService.setContextValue(Wn,!0),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Wn,!1),this._contextService.setContextValue(Yn,!1),this._contextService.setContextValue(vn,!1),this._contextService.setContextValue(zn,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:$e.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=rE([bo(0,je.Inject(je.Injector)),bo(1,Nn)],exports.UniverInstanceService);var Je=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Je||{});const sE={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var iE=Object.getOwnPropertyDescriptor,oE=(e,t,n,r)=>{for(var s=r>1?void 0:r?iE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},aE=(e,t)=>(n,r)=>t(n,r,e);exports.LifecycleService=class extends st{constructor(n){super();C(this,"_lifecycle$",new we.BehaviorSubject(Je.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(Je.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return we.firstValueFrom(this.lifecycle$.pipe(we.filter(r=>r>=n),Os(r=>r===n),we.map(()=>{})))}subscribeWithPrevious(){return we.merge(Ou(this.stage),this._lifecycle$.pipe(we.skip(1))).pipe(Os(n=>n===Je.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${sE[n]}".`)}};exports.LifecycleService=oE([aE(0,Ot)],exports.LifecycleService);function Ou(e){switch(e){case Je.Starting:return we.of(Je.Starting);case Je.Ready:return we.of(Je.Starting,Je.Ready);case Je.Rendered:return we.of(Je.Starting,Je.Ready,Je.Rendered);default:return we.of(Je.Starting,Je.Ready,Je.Rendered,Je.Steady)}}const lE=je.createIdentifier("ILocalStorageService");class on extends st{constructor(){super();C(this,"_currentLocale$",new we.BehaviorSubject(sr.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new we.Subject);C(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(nt(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=ci((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var Ri=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(Ri||{});const wu=je.createIdentifier("univer.permission-service");class bu extends st{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new we.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof we.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new we.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=Ri.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return we.combineLatest(r).pipe(br.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}var uE=Object.getOwnPropertyDescriptor,cE=(e,t,n,r)=>{for(var s=r>1?void 0:r?uE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Cs=(e,t)=>(n,r)=>t(n,r,e);const hE=4,yu=Symbol("DependentOn");class zs extends st{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(zs,"pluginName"),C(zs,"type",$e.UNIVER_UNKNOWN);class dE{constructor(){C(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function fE(...e){return function(t){t[yu]=e}}exports.PluginService=class{constructor(t,n,r){C(this,"_pluginRegistry",new Map);C(this,"_pluginStore",new dE);C(this,"_seenPlugins",new Set);C(this,"_loadedPlugins",new Set);C(this,"_loadedPluginTypes",new Set([$e.UNIVER_UNKNOWN]));C(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===$e.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===$e.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},hE))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const u=a[yu];u&&u.forEach(c=>{const h=this._pluginRegistry.get(c.pluginName);if(h)s(h);else if(!this._seenPlugins.has(c.pluginName)&&!r.has(c.pluginName)){if(a.type===$e.UNIVER_UNKNOWN&&c.type!==$e.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${c.pluginName}.`);a.type!==c.type&&c.type!==$e.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${c.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(c),s({plugin:c,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(Ou(n).subscribe(r=>this._runStage(t,r)),n!==Je.Steady){const r=this._lifecycleService.lifecycle$.pipe(we.skip(1)).subscribe(s=>{this._runStage(t,s),s===Je.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Je.Starting:r.onStarting();break;case Je.Ready:r.onReady();break;case Je.Rendered:r.onRendered();break;case Je.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=cE([Cs(0,je.Inject(je.Injector)),Cs(1,je.Inject(exports.LifecycleService)),Cs(2,Ot)],exports.PluginService);function Au(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}const Gs=je.createIdentifier("resource-loader-service");class Tu extends st{constructor(){super(...arguments);C(this,"_resourceMap",new Map);C(this,"_register$",new we.Subject);C(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),nt(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Ii extends st{constructor(){super();C(this,"_currentTheme");C(this,"_currentTheme$",new we.BehaviorSubject({}));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(nt(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}var gE=Object.getOwnPropertyDescriptor,mE=(e,t,n,r)=>{for(var s=r>1?void 0:r?gE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Rs=(e,t)=>(n,r)=>t(n,r,e);const os=je.createIdentifier("univer.undo-redo.service"),_E=20;class Nu{dispose(){}async dispatchToHandlers(){return!1}}const Mu="univer.command.redo",Du="univer.command.undo",Lu=new class extends Nu{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",Du)}handler(t){const n=t.get(os),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},xu=new class extends Nu{constructor(){super(...arguments);C(this,"type",nr.COMMAND);C(this,"id",Mu)}handler(t){const n=t.get(os),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(rr);return Xr(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends st{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new we.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Lu)),this.disposeWithMe(this._commandService.registerCommand(xu)),this.disposeWithMe(nt(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(nt(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>_E&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Xr(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),nt(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,u;let n="";const r=this._contextService.getContextValue(vn),s=this._contextService.getContextValue(uu),i=this._contextService.getContextValue(lu);return r?s?n=Qs:i?n=Zs:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(u=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?u:"",n}};exports.LocalUndoRedoService=mE([Rs(0,Tn),Rs(1,rr),Rs(2,Nn)],exports.LocalUndoRedoService);function pE(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function EE(e){return new Promise(t=>setTimeout(t,e))}function CE(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var Si=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Si||{}),Uu=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Uu||{});const Vs=je.createIdentifier("core.image-io.service");class ku{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new qn(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(Vs)?this._injector.get(Vs):null;if(t===Si.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const RE=["script","style","meta","comment","link"];var Pu=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Pu||{}),Fu=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Fu||{}),$u=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))($u||{}),Bu=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(Bu||{}),Hu=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Hu||{}),ju=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(ju||{}),IE=Object.getOwnPropertyDescriptor,SE=(e,t,n,r)=>{for(var s=r>1?void 0:r?IE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},vE=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends st{constructor(n){super();C(this,"_fontLocale");C(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=SE([vE(0,je.Inject(on))],exports.Skeleton);var OE=Object.getOwnPropertyDescriptor,wE=(e,t,n,r)=>{for(var s=r>1?void 0:r?OE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},wr=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);C(this,"_worksheetData");C(this,"_renderRawFormula",!1);C(this,"_cellData");C(this,"_imageCacheMap");C(this,"_isRowStylePrecedeColumnStyle",!1);C(this,"_skipAutoHeightForMergedCells",!0);C(this,"_rowTotalHeight",0);C(this,"_columnTotalWidth",0);C(this,"_rowHeaderWidth",0);C(this,"_columnHeaderHeight",0);C(this,"_rowHeightAccumulation",[]);C(this,"_columnWidthAccumulation",[]);C(this,"_marginTop",0);C(this,"_marginLeft",0);C(this,"_scaleX");C(this,"_scaleY");C(this,"_scrollX");C(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new ku(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(va))!=null&&n),this._isRowStylePrecedeColumnStyle=(r=this._configService.getConfig(Sa))!=null?r:!1}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){re.isDefine(n)&&(this._scrollX=n),re.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(this.worksheet.getRowFiltered(l))u=0;else if(a[l]!=null){const c=a[l];if(!c)continue;const{h=s,ah:d,ia:f}=c;(f==null||f===Ie.TRUE)&&typeof d=="number"?u=d:u=h,c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let u=s;if(a[l]!=null){const c=a[l];if(!c)continue;c.w!=null&&(u=c.w),c.hd===Ie.TRUE&&(u=0)}i+=u,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=wt.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let u=r;u>=s;u--){const c=u,h=this.worksheet.getCell(n,c);if(!As(h)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c+1>l?l:c+1;const{startX:d,endX:f}=Cn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===wt.CENTER&&c===r?a+=(f-d)/2:a+=f-d,i<a)return c}return r}for(let l=r;l<=s;l++){const u=l,c=this.worksheet.getCell(n,u);if(!As(c)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u-1<0?0:u-1;const{startX:h,endX:d}=Cn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===wt.CENTER&&u===r?a+=(d-h)/2:a+=d-h,i<a)return u}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:u}=this._worksheetData,{rowTotalHeight:c,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==Ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=u.hidden!==Ie.TRUE?u.height:0,this._rowTotalHeight=c,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n){let{startRow:r,startColumn:s,endRow:i,endColumn:o}=n;const a=this._worksheetData.mergeData;if(!a)return{startRow:r,startColumn:s,endRow:i,endColumn:o};let l=!0;const u=new bt;for(;l;){l=!1;for(let c=0;c<a.length;c++){const{startRow:h,startColumn:d,endRow:f,endColumn:E}=a[c];if(u.getValue(h,d))continue;sl({startColumn:s,startRow:r,endColumn:o,endRow:i},{startColumn:d,startRow:h,endColumn:E,endRow:f})&&(r=Math.min(r,h),s=Math.min(s,d),i=Math.max(i,f),o=Math.max(o,E),u.setValue(h,d,!0),l=!0)}}return{startRow:r,startColumn:s,endRow:i,endColumn:o}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:u,endY:c,startX:h,endX:d}=Cn(n,r,i,o);return s&&(u+=l,c+=l,h+=a,d+=a),{startY:u,endY:c,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:u}=Cn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:u}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Yu(n,r,s,this.columnHeaderHeightAndMarginTop);let a=Fn(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var u;const o=Wu(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=Fn(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((u=a[l-1])!=null?u:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),u=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:u}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,u=Cn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:c,isMergedMainCell:h}=u;let{startY:d,endY:f,startX:E,endX:R,mergeInfo:w}=u,T=a,z=l;return s===!1&&(T=0,z=0),d+=z,f+=z,E+=T,R+=T,w.startY+=z,w.endY+=z,w.startX+=T,w.endX+=T,{actualRow:n,actualColumn:r,startX:E,startY:d,endX:R,endY:f,isMerged:c,isMergedMainCell:h,mergeInfo:w}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:u}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,u)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=Fn(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=Fn(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,u,c,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(u=s.b)!=null?u:2,n.documentStyle.marginLeft=(c=s.l)!=null?c:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new At(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null}};exports.SheetSkeleton=wE([wr(2,je.Inject(on)),wr(3,Nn),wr(4,Ei),wr(5,je.Inject(je.Injector))],exports.SheetSkeleton);function vi(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let u=r[t];return u==null&&(u=r[r.length-1]),{startY:o,endY:a,startX:l,endX:u}}function bE(e,t,n,r){return vi(e,t,n,r)}function Cn(e,t,n,r,s){e=re.clamp(e,0,n.length-1),t=re.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=vi(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:u,isMergedMainCell:c,startRow:h,startColumn:d,endRow:f,endColumn:E}=s;let R={startRow:h,startColumn:d,endRow:f,endColumn:E,startY:i,endY:o,startX:a,endX:l};const w=n.length-1,T=r.length-1;if(u&&h!==-1&&d!==-1){const z=n[h-1]||0,G=n[f]||n[w],de=r[d-1]||0,M=r[E]||r[T];R={...R,startY:z,endY:G,startX:de,endX:M}}else if(!u&&f!==-1&&E!==-1){const z=n[f]||n[w],G=r[E]||r[T];R={...R,startY:i,endY:z,startX:a,endX:G}}return{isMerged:u,isMergedMainCell:c,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:R}}function Wu(e,t,n,r){const{x:s}=n;return e/t+s-r}function Yu(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const yo=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Is=1,kn=8;class Oi{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Is)throw new Error(`Got v${s} data when expected v${Is}.`);const i=yo[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new Oi(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=yo.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,kn,t),this.coords=new this.ArrayType(this.data,kn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(kn+o+a+l),this.ids=new this.IndexArrayType(this.data,kn,t),this.coords=new this.ArrayType(this.data,kn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Is<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Ks(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],u=[];for(;l.length;){const c=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let w=d;w<=h;w++){const T=o[2*w],z=o[2*w+1];T>=t&&T<=r&&z>=n&&z<=s&&u.push(i[w])}continue}const f=d+h>>1,E=o[2*f],R=o[2*f+1];E>=t&&E<=r&&R>=n&&R<=s&&u.push(i[f]),(c===0?t<=E:n<=R)&&(l.push(d),l.push(f-1),l.push(1-c)),(c===0?r>=E:s>=R)&&(l.push(f+1),l.push(h),l.push(1-c))}return u}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],u=r*r;for(;a.length;){const c=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let w=d;w<=h;w++)Ao(i[2*w],i[2*w+1],t,n)<=u&&l.push(s[w]);continue}const f=d+h>>1,E=i[2*f],R=i[2*f+1];Ao(E,R,t,n)<=u&&l.push(s[f]),(c===0?t-r<=E:n-r<=R)&&(a.push(d),a.push(f-1),a.push(1-c)),(c===0?t+r>=E:n+r>=R)&&(a.push(f+1),a.push(h),a.push(1-c))}return l}}function Ks(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;zu(e,t,o,r,s,i),Ks(e,t,n,r,o-1,1-i),Ks(e,t,n,o+1,s,1-i)}function zu(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const u=s-r+1,c=n-r+1,h=Math.log(u),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1),E=Math.max(r,Math.floor(n-c*d/u+f)),R=Math.min(s,Math.floor(n+(u-c)*d/u+f));zu(e,t,n,E,R,i)}const o=t[2*n+i];let a=r,l=s;for(Pn(e,t,r,n),t[2*s+i]>o&&Pn(e,t,r,s);a<l;){for(Pn(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Pn(e,t,r,l):(l++,Pn(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Pn(e,t,n,r){Ss(e,n,r),Ss(t,2*n,2*r),Ss(t,2*n+1,2*r+1)}function Ss(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ao(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class yE{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Wr),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const u=l.get(s);u&&u.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:u,endRow:c,endColumn:h}=s;for(let d=l;d<=c;d++){const f=a.get(d);if(f)for(let E=u;E<=h;E++){const R=f.get(E);R&&R.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var E;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,u=(E=this._kdTree.get(n))==null?void 0:E.get(r);if(!u)return[];const{tree:c,items:h}=u,d=c.range(o,i,l,a),f=[];for(const R of d){const w=h[R];f.push(...Array.from(w.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new Oi(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:u}=s;if(this._enableOneCellCache&&o===a&&l===u){this._insertOneCellCache(n,r,o,l,i);return}const c=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(u)&&(u=Number.POSITIVE_INFINITY),c.insert({minX:l,minY:o,maxX:u,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const u of l)yield u}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:u}=s;this._enableOneCellCache?o===l&&a===u?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Wr;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}var AE=Object.getOwnPropertyDescriptor,TE=(e,t,n,r)=>{for(var s=r>1?void 0:r?AE(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},To=(e,t)=>(n,r)=>t(n,r,e);let Xs=class extends st{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case $e.UNRECOGNIZED:case $e.UNIVER_UNKNOWN:case $e.UNIVER_SLIDE:case $e.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType($e.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case $e.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType($e.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Oa(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Xs=TE([To(0,je.Inject(is)),To(1,je.Inject(Tn))],Xs);class NE{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Kr);const r=this._injector=ME(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(Ii).setTheme(s),o&&this._injector.get(on).load(o),i&&this._injector.get(on).setLocale(i),a&&this._injector.get(Ot).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(Tn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(nt(t));return nt(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(on).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(Ot).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(Ot).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(Ot).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType($e.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType($e.UNIVER_DOC,At),this._univerInstanceService.registerCtorForType($e.UNIVER_SLIDE,Ci);const n=t.get(Tn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Je.Ready&&(this._injector.get(exports.LifecycleService).stage=Je.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function ME(e,t){const n=Au([[cu],[on],[Ii],[exports.LifecycleService],[exports.PluginService],[Qn],[Tn,{useClass:exports.UniverInstanceService}],[wu,{useClass:bu}],[Ot,{useClass:Po,lazy:!0}],[rr,{useClass:exports.CommandService}],[os,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Ei,{useClass:au}],[Nn,{useClass:Uo}],[is,{useClass:Tu,lazy:!0}],[Gs,{useClass:Xs,lazy:!0}],[iu,{useClass:exports.AuthzIoLocalService}],[ou,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new je.Injector(n);return Do(r,[[Qn],[Gs]]),r}qu();exports.ABCToNumber=Ud;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=va;exports.AbsoluteRefType=tt;exports.ActionIterator=En;exports.AlignTypeH=Va;exports.AlignTypeV=Ka;exports.ArrangeTypeEnum=Ja;exports.ArrowsAndMarkersShapes=ea;exports.AsyncInterceptorManager=cp;exports.AutoFillSeries=Wo;exports.BaselineOffset=Ut;exports.BasicShapes=Qo;exports.BlockType=ya;exports.BooleanNumber=Ie;exports.BorderStyleTypes=Xe;exports.BorderType=Yo;exports.BuildTextUtils=ot;exports.BulletAlignment=or;exports.COLORS=ys;exports.CanceledError=rc;exports.CellModeEnum=Rn;exports.CellValueType=Vt;exports.Color=ln;exports.ColorBuilder=Jr;exports.ColorKit=vt;exports.ColorType=Et;exports.ColumnSeparatorType=Na;exports.CommandType=nr;exports.CommonHideTypes=zo;exports.ConfigService=au;exports.ContextService=Uo;exports.CopyPasteType=Go;exports.CustomCommandExecutionError=vs;exports.CustomDecorationType=rn;exports.CustomRangeType=qt;exports.DEFAULT_CELL=gd;exports.DEFAULT_DOC=mi;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=_p;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Ia;exports.DEFAULT_RANGE=dd;exports.DEFAULT_RANGE_ARRAY=hd;exports.DEFAULT_SELECTION=fd;exports.DEFAULT_SLIDE=tl;exports.DEFAULT_STYLES=ut;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=_u;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=zp;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ru;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=Xp;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Eu;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=Vp;exports.DEFAULT_WORKSHEET_ROW_COUNT=mu;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=Yp;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=pu;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=Gp;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Cu;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=Kp;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Qs;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Zs;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Ra;exports.DOC_RANGE_TYPE=fa;exports.DashStyleType=ka;exports.DataStreamTreeNodeType=al;exports.DataStreamTreeTokenType=Wt;exports.DataValidationErrorStyle=Pu;exports.DataValidationImeMode=Fu;exports.DataValidationOperator=$u;exports.DataValidationRenderMode=Bu;exports.DataValidationStatus=Hu;exports.DataValidationType=ju;exports.DeleteDirection=Vo;exports.DependentOn=fE;exports.DesktopLogService=Po;exports.DeveloperMetadataVisibility=Ko;exports.Dimension=Xo;exports.Direction=qo;exports.Disposable=st;exports.DisposableCollection=Kr;exports.DocStyleType=wa;exports.DocumentDataModel=At;exports.DocumentFlavor=ei;exports.DrawingTypeEnum=Za;exports.EDITOR_ACTIVATED=lu;exports.EXTENSION_NAMES=nl;exports.ErrorService=cu;exports.EventState=su;exports.EventSubject=pp;exports.FOCUSING_COMMON_DRAWINGS=Mp;exports.FOCUSING_DOC=Yn;exports.FOCUSING_EDITOR_BUT_HIDDEN=wp;exports.FOCUSING_EDITOR_INPUT_FORMULA=bp;exports.FOCUSING_EDITOR_STANDALONE=Ap;exports.FOCUSING_FX_BAR_EDITOR=uu;exports.FOCUSING_PANEL_EDITOR=Tp;exports.FOCUSING_SHEET=vn;exports.FOCUSING_SLIDE=zn;exports.FOCUSING_UNIT=Wn;exports.FOCUSING_UNIVER_EDITOR=yp;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Np;exports.FORMULA_EDITOR_ACTIVATED=Dp;exports.FollowNumberWithType=ba;exports.FontItalic=$r;exports.FontStyleType=In;exports.FontWeight=Br;exports.GridType=Aa;exports.HLSColor=ca;exports.HorizontalAlign=wt;exports.IAuthzIoService=iu;exports.ICommandService=rr;exports.IConfigService=Ei;exports.IContextService=Nn;exports.IImageIoService=Vs;exports.ILocalStorageService=lE;exports.ILogService=Ot;exports.IMentionIOService=ou;exports.IPermissionService=wu;exports.IResourceLoaderService=Gs;exports.IResourceManagerService=is;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Sa;exports.IUndoRedoService=os;exports.IUniverInstanceService=Tn;exports.ImageCacheMap=ku;exports.ImageSourceType=Si;exports.ImageUploadStatusType=Uu;exports.InterceptorEffectEnum=Sn;exports.InterceptorManager=ap;exports.InterpolationPointType=Jo;exports.JSON1=r_;exports.JSONX=Pt;exports.LRUHelper=Bn;exports.LRUMap=qn;exports.LifecycleStages=Je;exports.ListGlyphType=Ne;exports.LocaleService=on;exports.LocaleType=sr;exports.LogLevel=ko;exports.MOVE_BUFFER_VALUE=$n;exports.MemoryCursor=hn;exports.MentionType=Fr;exports.NAMED_STYLE_MAP=_d;exports.NAMED_STYLE_SPACE_MAP=pd;exports.NamedStyleType=rt;exports.NilCommand=Fo;exports.NumberUnitType=Ga;exports.ObjectMatrix=bt;exports.ObjectRelativeFromH=Ya;exports.ObjectRelativeFromV=za;exports.OtherShapes=ta;exports.PRESET_LIST_TYPE=cr;exports.PageElementType=Qa;exports.PageOrientType=qa;exports.PageType=ti;exports.ParagraphElementType=Da;exports.ParagraphStyleBuilder=Zn;exports.ParagraphStyleValue=dr;exports.PermissionService=bu;exports.PermissionStatus=Ri;exports.Plugin=zs;exports.PositionedObjectLayoutType=xa;exports.PresetListType=Dt;exports.ProtectionType=Zo;exports.QuickListType=Wl;exports.QuickListTypeMap=u_;exports.RANGE_DIRECTION=da;exports.RANGE_TYPE=Le;exports.RBush=Wr;exports.RCDisposable=ac;exports.RGBA_PAREN=kc;exports.RGB_PAREN=Uc;exports.ROTATE_BUFFER_VALUE=jo;exports.RTree=yE;exports.Range=bn;exports.Rectangle=Jt;exports.RedoCommand=xu;exports.RedoCommandId=Mu;exports.RefAlias=xd;exports.Registry=_i;exports.RegistryAsMap=pi;exports.RelativeDate=ra;exports.RelativeSlideLink=el;exports.ResourceManagerService=Tu;exports.RgbColor=Hr;exports.RichTextBuilder=sn;exports.RichTextValue=Gt;exports.RxDisposable=oc;exports.SHEET_EDITOR_UNITS=md;exports.SectionType=Ta;exports.SheetTypes=sa;exports.SheetViewModel=Su;exports.SliceBodyType=gi;exports.SlideDataModel=Ci;exports.SpacingRule=Ua;exports.SpecialShapes=na;exports.Styles=hu;exports.THEME_COLORS=ua;exports.TabStopAlignment=Pa;exports.TableAlignmentType=$a;exports.TableLayoutType=Ba;exports.TableRowHeightRule=ja;exports.TableSizeType=Fa;exports.TableTextWrapType=Ha;exports.TextDecoration=ia;exports.TextDecorationBuilder=zt;exports.TextDirection=Xn;exports.TextDirectionType=Ma;exports.TextStyleBuilder=Xt;exports.TextStyleValue=hr;exports.TextX=Ye;exports.TextXActionType=ce;exports.ThemeColor=jr;exports.ThemeColorType=ft;exports.ThemeColors=qr;exports.ThemeService=Ii;exports.Tools=re;exports.UndoCommand=Lu;exports.UndoCommandId=Du;exports.UnitModel=ss;exports.Univer=NE;exports.UniverInstanceType=$e;exports.UpdateDocsAttributeType=xe;exports.UserManagerService=Qn;exports.VerticalAlign=nn;exports.VerticalAlignmentType=Wa;exports.Worksheet=er;exports.WrapStrategy=an;exports.WrapTextType=La;exports.addLinkToDocumentModel=du;exports.afterInitApply=_c;exports.afterTime=mc;exports.awaitTime=EE;exports.binSearchFirstGreaterThanTarget=Ho;exports.binarySearchArray=pc;exports.bufferDebounceTime=gc;exports.cellToRange=ch;exports.characterSpacingControlType=Xa;exports.checkForSubstrings=hh;exports.checkIfMove=Cc;exports.checkParagraphHasBullet=Vh;exports.checkParagraphHasIndent=Kh;exports.checkParagraphHasIndentByStyle=pa;exports.codeToBlob=Ec;exports.composeBody=Bs;exports.composeInterceptors=nu;exports.composeStyles=ws;exports.concatMatrixArray=od;exports.convertBodyToHtml=xc;exports.convertCellToRange=ga;exports.covertTextRunToHtml=bs;exports.createAsyncInterceptorKey=lp;exports.createDefaultUser=Vr;exports.createDocumentModelWithStyle=Gn;exports.createInterceptorKey=op;exports.createInternalEditorID=cd;exports.createRowColIter=Ds;exports.dayjs=Ft;exports.debounce=Fm;exports.dedupe=Ju;exports.deepCompare=Js;exports.delayAnimationFrame=CE;exports.deleteContent=Ca;exports.extractPureTextFromCell=vu;exports.fromCallback=$o;exports.fromEventSubject=Ep;exports.fromObservable=ic;exports.generateRandomId=kt;exports.get=mm;exports.getArrayLength=Kt;exports.getBodySlice=yt;exports.getBodySliceHtml=yr;exports.getBorderStyleType=ah;exports.getCellCoordByIndexSimple=vi;exports.getCellInfoInMergeData=th;exports.getCellPositionByIndexSimple=bE;exports.getCellValueType=Jc;exports.getCellWithCoordByIndexCore=Cn;exports.getColorStyle=Nt;exports.getCustomBlockSlice=Vl;exports.getCustomDecorationSlice=Xl;exports.getCustomRangeSlice=Kl;exports.getDocsUpdateBody=lh;exports.getIntersectRange=sl;exports.getOriginCellValue=Jp;exports.getParagraphsSlice=Gl;exports.getPlainText=Qr;exports.getReverseDirection=Rc;exports.getSectionBreakSlice=E_;exports.getTableSlice=zl;exports.getTextRunSlice=Gr;exports.getTransformOffsetX=Wu;exports.getTransformOffsetY=Yu;exports.getWorksheetUID=tE;exports.groupBy=ec;exports.handleStyleToString=oh;exports.hashAlgorithm=qh;exports.horizontalLineSegmentsSubtraction=Zr;exports.insertMatrixArray=Ts;exports.insertTextToContent=Ea;exports.isBlackColor=Kc;exports.isBooleanString=Km;exports.isCellCoverable=As;exports.isCellV=Qc;exports.isEmptyCell=ma;exports.isFormulaId=ih;exports.isFormulaString=sh;exports.isICellData=qc;exports.isInternalEditorID=Oa;exports.isNodeEnv=Lc;exports.isNotNullOrUndefined=fu;exports.isNullCell=Zc;exports.isNumeric=ru;exports.isRangesEqual=kp;exports.isRealNum=Xh;exports.isSafeNumeric=dp;exports.isSameStyleTextRun=_a;exports.isUnitRangesEqual=Pp;exports.isValidRange=uh;exports.isWhiteColor=Xc;exports.makeArray=tc;exports.makeCellRangeToRangeData=rh;exports.makeCellToSelection=nh;exports.makeCustomRangeStream=Hd;exports.merge=ci;exports.mergeOverrideWithDependencies=Au;exports.mergeSets=gp;exports.mergeWith=jm;exports.mergeWorksheetSnapshotWithDefault=Iu;exports.mixinClass=hp;exports.moveMatrixArray=Ms;exports.moveRangeByOffset=Od;exports.nameCharacterCheck=pE;exports.normalizeBody=C_;exports.normalizeTextRuns=ur;exports.numberToABC=Pd;exports.numberToListABC=Fd;exports.numfmt=id;exports.queryObjectMatrix=Ld;exports.registerDependencies=nc;exports.remove=tr;exports.repeatStringNumTimes=ol;exports.replaceInDocumentBody=mp;exports.requestImmediateMacroTask=fp;exports.rotate=Qu;exports.searchArray=Fn;exports.searchInOrderedArray=Bo;exports.selectionToArray=eh;exports.sequence=xo;exports.sequenceAsync=Lo;exports.sequenceExecute=Xr;exports.sequenceExecuteAsync=fc;exports.set=Ym;exports.shallowEqual=Al;exports.skipParseTagNames=RE;exports.sliceMatrixArray=ad;exports.sortRules=$d;exports.sortRulesByDesc=Bd;exports.sortRulesFactory=ar;exports.spliceArray=Ns;exports.splitIntoGrid=ni;exports.takeAfter=Os;exports.textDiff=hi;exports.throttle=ip;exports.toDisposable=nt;exports.touchDependencies=Do;exports.updateAttributeByDelete=ql;exports.updateAttributeByInsert=Jl;Object.keys(je).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>je[e]})});
|