@silurus/ooxml 0.89.3 → 0.89.5
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/dist/assets/{render-worker-CyUrUidp.js → render-worker-B5HWxkbU.js} +7 -7
- package/dist/assets/render-worker-CeSlHUkL.js +15 -0
- package/dist/assets/{render-worker-Bye3wDV9.js → render-worker-ph4iY7VS.js} +28 -28
- package/dist/{bounded-raw-part-cache-Bi_VqXmg.js → bounded-raw-part-cache-B8t03tSP.js} +740 -731
- package/dist/{canvas-viewer-mechanics-ycCX6v-z.js → canvas-viewer-mechanics-DI38gHNV.js} +1 -1
- package/dist/{comment-overlay-controller-CR5ySvki.js → comment-overlay-controller-Crm5Syhx.js} +2 -2
- package/dist/{comment-ui-runtime-CwTOCwA8.js → comment-ui-runtime-BfEPgl5r.js} +2 -2
- package/dist/{comment-ui-runtime-BWhLz4gq.js → comment-ui-runtime-u7zk49cg.js} +3 -3
- package/dist/{document-model-source-Csow9uxO.js → document-model-source-qsnWuGuH.js} +6 -6
- package/dist/{document-pull-client-CHpz0Q1p.js → document-pull-client-Ckq8THk6.js} +54 -53
- package/dist/{document-pull-worker-1ZJv9f9W.js → document-pull-worker-Bkewz-So.js} +2 -2
- package/dist/{docx-GXxH0AwW.js → docx-ChGrdRyp.js} +16 -16
- package/dist/{docx-D9E0vCq-.js → docx-DRojqjH-.js} +9 -9
- package/dist/{docx-model-source-aKx2gZH9.js → docx-model-source-D0dmXDOs.js} +6 -6
- package/dist/docx.mjs +3 -3
- package/dist/{drawingml-shape-BwELUfNW.js → drawingml-shape-BcXkRayC.js} +1 -1
- package/dist/{font-preload-demand-BuMy4iJ1.js → font-preload-demand-B6HPFxDp.js} +1 -1
- package/dist/{host-layout-measure-GU0oJ4Me.js → host-layout-measure-DP918TOq.js} +1 -1
- package/dist/index.mjs +3 -3
- package/dist/internal-companion.mjs +2 -2
- package/dist/{line-distribute-C_CJisnJ.js → line-distribute-DR9Qwd3u.js} +1 -1
- package/dist/{model-source-DLXFe4_2.js → model-source-DcI3vC00.js} +1 -1
- package/dist/{model-source-session-B3WVQCM5.js → model-source-session-BCteVilS.js} +2 -2
- package/dist/{model-source-session-BVZBHZ04.js → model-source-session-BlQWNyj2.js} +2 -2
- package/dist/{model-source-session-DfUgVpr1.js → model-source-session-D0LF49Ve.js} +2 -2
- package/dist/node.mjs +4 -4
- package/dist/{pptx-CLyebeF_.js → pptx-CfCiVlNB.js} +15 -15
- package/dist/{pptx-BD0jwWs6.js → pptx-SmjDGyub.js} +8 -8
- package/dist/{pptx-model-source-D_2mnSxI.js → pptx-model-source-B2Irk68a.js} +5 -5
- package/dist/pptx.mjs +4 -4
- package/dist/{presentation-model-source-rWZ3Y-S_.js → presentation-model-source-DL6duh5l.js} +5 -5
- package/dist/{render-Cs1bgbEm.js → render-CMUEAeHp.js} +2 -2
- package/dist/{render-worker-host-BR7n4xKy.js → render-worker-host-CtlBbau5.js} +1 -1
- package/dist/{render-worker-host-BxsA-yJo.js → render-worker-host-DSrgUCkT.js} +1 -1
- package/dist/{render-worker-host-CZC0WOn8.js → render-worker-host-DYUY1TuP.js} +1 -1
- package/dist/{renderer-DFDF48zw.js → renderer-BYt3nsdR.js} +4 -4
- package/dist/{resource-measurement-CTGrNAsD.js → resource-measurement-D2bu0Qfx.js} +1 -1
- package/dist/{session-B5CgMc2N.js → session-KIWcCCP2.js} +4 -4
- package/dist/{slide-pull-client-43mS9T70.js → slide-pull-client-BUuJQQVE.js} +48 -48
- package/dist/types/index.d.ts +4 -1
- package/dist/types/xlsx.d.ts +4 -1
- package/dist/{wasm-runtime-generation-BsWKRY7U.js → wasm-runtime-generation-BLweKv8r.js} +1 -1
- package/dist/{workbook-model-source-ChIQjX9a.js → workbook-model-source-CbEnWvU-.js} +6 -6
- package/dist/{worksheet-pull-client-D5zAevQv.js → worksheet-pull-client-Du0MuIro.js} +2 -2
- package/dist/{xlsx-DelYm4VZ.js → xlsx-CVVWeouT.js} +363 -331
- package/dist/{xlsx-S6orTmKI.js → xlsx-Deg8dBy8.js} +4 -4
- package/dist/{xlsx-model-source-Cm9ocDgT.js → xlsx-model-source-D2rRp5-N.js} +6 -6
- package/dist/xlsx.mjs +4 -4
- package/package.json +1 -1
- package/dist/assets/render-worker-BUa1gyCE.js +0 -15
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { t as e } from "./chunk-D5OxutzX.js";
|
|
2
2
|
import { Aa as t, Er as n, Tr as r, Yn as i, a, c as o, d as s, h as c, ja as l, ka as u, m as d, o as f, r as p, u as m, vo as h, wr as g, yo as _ } from "./plot-area-frame-D3JtHvov.js";
|
|
3
3
|
import { n as v, t as y } from "./cfb-guard-BIaHdonq.js";
|
|
4
|
-
import { Dn as b, M as x, N as S, On as C, P as w, V as T, X as E, Xt as D, Y as O, Yt as k, _t as A,
|
|
5
|
-
import { f as
|
|
6
|
-
import { L as
|
|
7
|
-
import { i as
|
|
8
|
-
import { C as
|
|
9
|
-
import { A as
|
|
10
|
-
import { n as
|
|
11
|
-
import { _ as
|
|
12
|
-
import { n as
|
|
13
|
-
import { a as
|
|
14
|
-
var Yt = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,ee,te=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,ee=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ne(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var re=e((()=>{}));function f(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function ie(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return f(t.requiredBytes)&&f(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var p=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function ae(e){if(e instanceof p)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!ie(r)))return new p(r)}i(),te(),re();const m=`OOXML_RESOURCE_LIMIT:`;function h(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function oe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return h(t.archiveEntryCount)&&h(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||h(t.largestInflatedEntryBytes))&&h(t.distinctInflatedBytes)&&h(t.operationInflatedBytes)}function g(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!oe(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function se(e){return e===`docx`||e===`xlsx`||e===`pptx`}function ce(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function _(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function v(e){return _(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function le(e){return!_(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const y=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ue=new Set([...y.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),de=new Set([...y.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function fe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!se(t.format)||!_(t.operation,256)||!v(t.resource)||!v(t.metric)||!h(t.limit)||!h(t.observed)||typeof t.configurable!=`boolean`||!oe(t.usage)?!1:!(`part`in t)||le(t.part)}function b(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!ce(t.stage)||!fe(t.violation))return!1;let n=t.violation,r=y.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ue.has(n.resource)&&de.has(n.metric))}function pe(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function me(e){if(!b(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:pe(t.usage)}};return b(n)?n:void 0}function x(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function S(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(m))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!b(i.details)))return new r(x(i.details),i.details)}function he(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:S(e)??e}}function ge(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!v(n)||r!==`source-subset`))return{format:n,reason:r}}function _e(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ve(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=C(JSON.parse(t.slice(25)));return e?_e(e):void 0}catch{return}}function ye(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ve(e)??S(e)??ge(e)}function be(e){let t=s(e);if(t){let e=new ee(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=ne(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=ae(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:ye(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=me(e.details);return t?{message:typeof e.message==`string`?e.message:x(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=C(c.details);return e?{message:_e(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:_(o.name,128)?o.name:`OoxmlError`,...v(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(m))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:_(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function w(e){try{return be(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var xe=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function Se(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function Ce(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function we(e,t){return e({module_or_path:t})}var Te=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new xe(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),Ee),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return he(()=>this.runtime.run(e))}poison(){this.runtime.poison(new T(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):we(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,Ce(e)}};function Ee(e){return Se(e)?new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function De(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Oe(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const E=`ooxml-pull-v1`;function D(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function ke(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var Ae=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,D(this.maxRetainedBytes,`max retained lease bytes`),D(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},je=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){ke(e.sessionId),D(e.operationId,`operation id`),D(e.generation,`generation`),D(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&D(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=w(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(D(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:E,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){D(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(D(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:E,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:E,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};const O=2**53-1-1;function k(e){return Object.freeze({maxRows:e.maxRows,maxCells:e.maxCells,maxOwnedUtf8Bytes:e.maxOwnedUtf8Bytes,maxJsonBytes:e.maxJsonBytes})}const A=Object.freeze({worksheet:k({maxRows:1e5,maxCells:25e4,maxOwnedUtf8Bytes:33554432,maxJsonBytes:67108864}),cache:k({maxRows:2e5,maxCells:5e5,maxOwnedUtf8Bytes:67108864,maxJsonBytes:134217728}),maxCoordinateIndexEntries:25e4});function j(e,t){let n=e[t];if(n===void 0)return A.worksheet[t];if(typeof n!=`number`)throw TypeError(`xlsxWorksheetLimits.${t} must be a number`);if(!Number.isSafeInteger(n)||n<=0||n>O)throw RangeError(`xlsxWorksheetLimits.${t} must be a positive safe integer no greater than ${O}`);return n}function Me(e={}){let t=e.xlsxWorksheetLimits,n={};if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`xlsxWorksheetLimits must be a non-null, non-array object`);n=t}let r=k({maxRows:j(n,`maxRows`),maxCells:j(n,`maxCells`),maxOwnedUtf8Bytes:j(n,`maxOwnedUtf8Bytes`),maxJsonBytes:j(n,`maxJsonBytes`)}),i=A,a=k({maxRows:Math.max(i.cache.maxRows,r.maxRows),maxCells:Math.max(i.cache.maxCells,r.maxCells),maxOwnedUtf8Bytes:Math.max(i.cache.maxOwnedUtf8Bytes,r.maxOwnedUtf8Bytes),maxJsonBytes:Math.max(i.cache.maxJsonBytes,r.maxJsonBytes)});return Object.freeze({worksheet:r,cache:a,maxCoordinateIndexEntries:Math.max(i.maxCoordinateIndexEntries,r.maxCells)})}function Ne(e){let{worksheet:t}=e;return[BigInt(t.maxRows),BigInt(t.maxCells),BigInt(t.maxOwnedUtf8Bytes),BigInt(t.maxJsonBytes)]}var M=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_xlsxarchive_free(e,0)}acknowledge_sheet_cursor_terminal(){let e=K.xlsxarchive_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);if(e[1])throw V(e[0])}assert_healthy(){let e=K.xlsxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw V(e[0])}cancel_sheet_cursor(){K.xlsxarchive_cancel_sheet_cursor(this.__wbg_ptr)}close_sheet_cursor(){K.xlsxarchive_close_sheet_cursor(this.__wbg_ptr)}extract_image(e){let t=B(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.xlsxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw V(r[2]);var i=P(r[0],r[1]).slice();return K.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Ie(e,K.__wbindgen_malloc),a=G,o=K.xlsxarchive_new(i,a,!z(t),z(t)?BigInt(0):t,!z(n),z(n)?BigInt(0):n,!z(r),z(r)?BigInt(0):r);if(o[2])throw V(o[1]);return this.__wbg_ptr=o[0]>>>0,N.register(this,this.__wbg_ptr,this),this}open_sheet_cursor(e,t){let n=B(t,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.xlsxarchive_open_sheet_cursor(this.__wbg_ptr,e,n,r);if(i[1])throw V(i[0])}parse(){let e=K.xlsxarchive_parse(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}pull_sheet_cursor(e){let t=K.xlsxarchive_pull_sheet_cursor(this.__wbg_ptr,e);if(t[3])throw V(t[2]);var n=P(t[0],t[1]).slice();return K.__wbindgen_free(t[0],t[1]*1,1),n}resource_usage(){let e=K.xlsxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}set_worksheet_limits(e,t,n,r){let i=K.xlsxarchive_set_worksheet_limits(this.__wbg_ptr,e,t,n,r);if(i[1])throw V(i[0])}sheet_cursor_pull_finished(){return K.xlsxarchive_sheet_cursor_pull_finished(this.__wbg_ptr)!==0}sheet_cursor_resource_usage(){let e=K.xlsxarchive_sheet_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=K.xlsxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,V(i[2]);return e=n,t=r,I(n,r)}finally{K.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);function Pe(){return{__proto__:null,\"./xlsx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(I(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(I(e,t))}finally{K.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=B(n,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G;Fe().setInt32(e+4,i,!0),Fe().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return I(e,t)},__wbindgen_init_externref_table:function(){let e=K.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const N=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_xlsxarchive_free(e>>>0,1));function P(e,t){return e>>>=0,R().subarray(e/1,e/1+t)}let F=null;function Fe(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==K.memory.buffer)&&(F=new DataView(K.memory.buffer)),F}function I(e,t){return e>>>=0,Le(e,t)}let L=null;function R(){return(L===null||L.byteLength===0)&&(L=new Uint8Array(K.memory.buffer)),L}function z(e){return e==null}function Ie(e,t){let n=t(e.length*1,1)>>>0;return R().set(e,n/1),G=e.length,n}function B(e,t,n){if(n===void 0){let n=W.encode(e),r=t(n.length,1)>>>0;return R().subarray(r,r+n.length).set(n),G=n.length,r}let r=e.length,i=t(r,1)>>>0,a=R(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=R().subarray(i+o,i+r),a=W.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return G=o,i}function V(e){let t=K.__wbindgen_externrefs.get(e);return K.__externref_table_dealloc(e),t}let H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});H.decode();let U=0;function Le(e,t){return U+=t,U>=2146435072&&(H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),H.decode(),U=t),H.decode(R().subarray(e,e+t))}const W=new TextEncoder;`encodeInto`in W||(W.encodeInto=function(e,t){let n=W.encode(e);return t.set(n),{read:e.length,written:n.length}});let G=0,K;function Re(e,t){return K=e.exports,F=null,L=null,K.__wbindgen_start(),K}async function ze(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Be(e){if(K!==void 0)return K;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=Pe();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ze(await e,t);return Re(n,r)}async function Ve(e){return K=void 0,F=null,L=null,Be(e)}function He(e,t){return{workbook:e(),usage:g(t())}}function Ue(e,t){for(let n of e)for(let e of n.cells){let n=e.value;if(n.type===`shared`){let r=t[n.si];if(r){let t={type:`text`,text:r.text};r.runs!==void 0&&(t.runs=r.runs),r.phoneticRuns!==void 0&&(t.phoneticRuns=r.phoneticRuns),r.phoneticPr!==void 0&&(t.phoneticPr=r.phoneticPr),e.value=t}else e.value={type:`text`,text:``}}}return e}const We=new Set([`outline`,`merge`,`conditional-format`,`ancillary-content`,`metadata-unavailable`,`unordered-rows`]);function Ge(e,t,n,r){let i=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=JSON.parse(new TextDecoder().decode(i));if(!a||typeof a!=`object`||!(`kind`in a))throw Error(`worksheet cursor returned an invalid unit`);let o=a;if(t!==(o.kind===`finished`))throw Error(`worksheet cursor terminal marker mismatch`);if(o.kind===`rows`){if(!Array.isArray(o.rows))throw Error(`worksheet row unit is missing rows`);return n&&Ue(o.rows,n),r?.(o.rows),{kind:`rows`,rows:o.rows}}if(o.kind===`preview`){if(!Number.isSafeInteger(o.maxRow)||!Number.isSafeInteger(o.maxCol)||o.maxRow<0||o.maxCol<0||o.worksheet===null==(o.reason===null)||o.worksheet!==null&&(typeof o.worksheet!=`object`||Array.isArray(o.worksheet))||o.reason!==null&&!We.has(o.reason))throw Error(`worksheet preview unit is invalid`);return o.worksheet&&(o.worksheet.rows=[]),o}if(o.kind===`finished`){if(!o.worksheet||typeof o.worksheet!=`object`)throw Error(`worksheet terminal unit is missing its worksheet`);return o.worksheet.rows=[],{kind:`finished`,worksheet:o.worksheet}}throw Error(`worksheet cursor returned an unknown unit kind`)}const Ke=new WeakMap;function qe(e,t){Ke.set(e,t)}function q(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function J(e,t,n){return q(e,`resource measurement`),q(t,`resource measurement`),q(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function Je(e,t=2**53-1){q(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=J(n,a,t),n>t)return n}return n}function Ye(e,t=2**53-1){q(t,`resource measurement limit`);let n=J(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=J(n,a,t),n>t)return n}return n}function Y(e,t){return J(0,e,t)}function X(e,t=2**53-1,n=!1){if(q(t,`resource measurement limit`),e===null)return{jsonBytes:Y(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:Ye(e,t),stringValueUtf8Bytes:Je(e,t)};if(typeof e==`boolean`)return{jsonBytes:Y(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:Y((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=Y(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=J(n,1,t));let a=X(e[i],t,!0);n=J(n,a.jsonBytes,t),r=J(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=Y(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=J(n,1,t)),n=J(n,Ye(a,t),t),n=J(n,1,t);let e=X(o,t);n=J(n,e.jsonBytes,t),r=J(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?Y(4,t):0,stringValueUtf8Bytes:0}}i();const Xe=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0});function Ze(e,t=A){let{maxCells:n,maxOwnedUtf8Bytes:r}=t.worksheet,i=e.reduce((e,t)=>J(e,t.cells.length,n),0);return{rows:e.length,cells:i,ownedUtf8Bytes:e.reduce((e,t)=>t.cells.reduce((e,t)=>{let n=X(t.value,r).stringValueUtf8Bytes;return J(e,J(n,t.formula===void 0?0:Je(t.formula,r),r),r)},e),0)}}function Qe(e,t,n=A){let r=X(e,n.worksheet.maxJsonBytes);return{...t,jsonBytes:r.jsonBytes}}function $e(e,t,n=A){let r=n.worksheet;return{rows:J(e.rows,t.rows,r.maxRows),cells:J(e.cells,t.cells,r.maxCells),ownedUtf8Bytes:J(e.ownedUtf8Bytes,t.ownedUtf8Bytes,r.maxOwnedUtf8Bytes)}}function et(e,t,n,i,a,o,s,c=n!==`delimited-text-source`){let l=n===`worksheet-json`?`serialization`:`parsing`;return new r(x({stage:l,violation:{part:t,resource:n,metric:i,observed:o,limit:a}}),{stage:l,violation:{format:`xlsx`,operation:e,resource:n,metric:i,...t===void 0?{}:{part:t},limit:a,observed:Math.min(o,a+1),configurable:c,usage:s??Xe}})}function tt(e,t,n,r,i=A){let a=i.worksheet,o=[[`rows`,e.rows,a.maxRows],[`cells`,e.cells,a.maxCells],[`owned-utf8-bytes`,e.ownedUtf8Bytes,a.maxOwnedUtf8Bytes]];for(let[e,i,a]of o)if(i>a)throw et(t,n,e===`owned-utf8-bytes`?`worksheet-cell-content`:`worksheet-model`,e,a,i,r)}function nt(e,t,n,r,i=A){let a=i.worksheet.maxJsonBytes;if(e>a)throw et(t,n,`worksheet-json`,`bytes`,a,e,r)}i();var rt=class{archive;acceptWorksheet;executeArchive;prepareRows;provisional;worksheetPolicy;coordinator=new Ae;sessions=new Map;operationTail=Promise.resolve();pendingOpens=new Map;resourceFailure;constructor(e,t,n=e=>e(this.requireArchive()),r,i,a=()=>A){this.archive=e,this.acceptWorksheet=t,this.executeArchive=n,this.prepareRows=r,this.provisional=i,this.worksheetPolicy=a}reserveOpen(e){this.pendingOpens.set(e.sessionId,{identity:e,canceled:!1})}abandonOpen(e){this.pendingOpens.delete(e)}get pendingOpenCount(){return this.pendingOpens.size}runDuringPull(e){return this.sessions.size===0?this.run(e):this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;try{return e()}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}})}async open(e,t,n){if(this.resourceFailure)throw this.resourceFailure;let i=this.pendingOpens.get(n.sessionId);if(!i||i.identity.operationId!==n.operationId||i.identity.generation!==n.generation)throw Error(`worksheet pull session open reservation is stale or missing`);let a=this.worksheetPolicy(),o,s=new Promise(e=>{o=e}),c=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(i.canceled)throw Error(`worksheet pull session open was canceled`);this.executeArchive(n=>n.open_sheet_cursor(e,t));let s=[],c={rows:0,cells:0,ownedUtf8Bytes:0},l,u=!1,d=new je({...n,maxByteCredit:67108864,coordinator:this.coordinator,driver:{pull:()=>{let t=this.executeArchive(e=>e.pull_sheet_cursor(128)),n=this.executeArchive(e=>e.sheet_cursor_pull_finished());if(this.acceptWorksheet){let i=Ge(t,n,void 0,this.prepareRows);try{if(i.kind===`preview`)i.worksheet&&(i.worksheet.rows=s,qe(i.worksheet,a),this.provisional?.preview(e,i.worksheet));else if(i.kind===`rows`){let e=$e(c,Ze(i.rows,a),a);tt(e,`get-worksheet-worker`,void 0,this.readResourceUsage(),a),s.push(...i.rows),c=e}else i.kind===`finished`&&(l=i.worksheet)}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}}u=n;let i=De(t);return{payload:i,byteLength:i.byteLength,done:n,transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:()=>{if(!u)return;let t,i;try{if(this.acceptWorksheet){if(!l)throw Error(`worksheet terminal payload is missing`);l.rows=l.parseError?[]:s;let n=l.parseError?{rows:0,cells:0,ownedUtf8Bytes:0}:c,r=Qe(l,n,a),o=this.readResourceUsage();tt(r,`get-worksheet-worker`,void 0,o,a),nt(r.jsonBytes,`get-worksheet-worker`,void 0,o,a),qe(l,a);let u=this.acceptWorksheet(e,l,r,o);typeof u==`function`?t=u:u&&({rollback:t,commit:i}=u)}this.executeArchive(e=>e.acknowledge_sheet_cursor_terminal()),i?.()}catch(e){throw t?.(),e instanceof r&&(this.resourceFailure??=e),e}u=!1,this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()},cancel:()=>{try{this.archive()&&this.executeArchive(e=>e.cancel_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},close:()=>{try{this.archive()&&this.executeArchive(e=>e.close_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},resourceUsage:()=>this.readResourceUsage()}});this.sessions.set(n.sessionId,{host:d,identity:n}),this.pendingOpens.delete(n.sessionId)}));this.operationTail=c.then(()=>s,()=>void 0);try{await c}catch(e){throw this.pendingOpens.delete(n.sessionId),o(),e}}async postOpenedSafely(e,t,n){try{t()}catch(t){await this.closeIdentity(e);try{n(t)}catch{}}}dispatch(e,t){let n=this.sessions.get(e.sessionId);if(n)return n.host.dispatch(e,t);let r=this.pendingOpens.get(e.sessionId);if(r&&(e.kind===`cancel`||e.kind===`close`)){let n=r.identity.operationId===e.operationId&&r.identity.generation===e.generation;return n&&(r.canceled=!0),t(n?{protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}:{protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:{message:`stale lifecycle targets another pending worksheet operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`}}),Promise.resolve()}return e.kind===`cancel`||e.kind===`close`?(t({protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}),Promise.resolve()):(t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(Error(`worksheet pull session is not open`))}),Promise.resolve())}async dispatchSafely(e,t){try{await this.dispatch(e,t)}catch(n){try{t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(n)})}catch{}}}run(e){let t=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;return e()})).catch(e=>{throw e instanceof r&&(this.resourceFailure??=e),e});return this.operationTail=t.then(()=>void 0,()=>void 0),t}async reset(){for(let e of this.pendingOpens.values())e.canceled=!0;let e=1;for(let{host:t,identity:n}of[...this.sessions.values()])await t.dispatch({protocol:E,kind:`close`,...n,requestId:e++},()=>void 0);this.sessions.clear(),await this.operationTail,this.pendingOpens.clear(),this.resourceFailure=void 0}requireArchive(){let e=this.archive();if(!e)throw Error(`Workbook not loaded`);return e}async closeIdentity(e){let t=this.sessions.get(e.sessionId);if(t){await t.host.dispatch({protocol:E,kind:`close`,...e,requestId:1},()=>void 0);return}let n=this.pendingOpens.get(e.sessionId);n&&n.identity.operationId===e.operationId&&n.identity.generation===e.generation&&(n.canceled=!0)}readResourceUsage(){return g(this.executeArchive(e=>e.sheet_cursor_resource_usage()))}};function it(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const Z=new Te(Be,{freeArchive:e=>e.free(),reinit:Ve});let Q=A;const $=new rt(()=>Z.archive,void 0,e=>{let t=Z.archive;if(!t)throw Error(`Workbook not loaded`);return Z.run(()=>e(t))},void 0,void 0,()=>Q);self.onmessage=async e=>{let n=e.data;if(it(n)){await $.dispatchSafely(n,(e,t)=>self.postMessage(e,t));return}if(n.type===`init`){Z.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;n.type===`openSheetSession`&&$.reserveOpen(n);try{let e=n.type===`parse`?Me({xlsxWorksheetLimits:n.worksheetPolicy?.worksheet}):void 0;if(n.type===`openSheetSession`){await Z.ensureReady(),Z.archive&&Z.run(()=>Z.archive?.assert_healthy()),await $.open(n.sheetIndex,n.sheetName,n),await $.postOpenedSafely(n,()=>self.postMessage({type:`sheetSessionOpened`,id:r,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation}),e=>self.postMessage({type:`error`,id:r,...w(e)}));return}n.type===`parse`&&await $.reset(),await(n.type===`extractImage`?$.runDuringPull:$.run).call($,async()=>{if(await Z.ensureReady(),n.type!==`parse`&&Z.archive){let e=Z.archive;Z.run(()=>e.assert_healthy())}if(n.type===`parse`){let[t,i,a]=Oe(n.resourcePolicy),o=new Uint8Array(n.data);Q=e??A;let s=Ne(Q),{workbook:c,usage:l}=He(()=>Z.run(()=>{let e=new M(o,t,i,a);return Z.setArchive(e),e.set_worksheet_limits(...s),e.parse()}),()=>Z.run(()=>Z.archive.resource_usage())),u=c.buffer,d={type:`parsed`,id:r,workbookJson:u,usage:l};self.postMessage(d,[u]);return}let t=Z.archive;if(n.type===`extractImage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>t.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:e};self.postMessage(i,[e]);return}if(n.type===`resourceUsage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>g(t.resource_usage()));self.postMessage({type:`resourceUsage`,id:r,usage:e});return}if(n.type===`toMarkdown`){if(!t)throw Error(`No xlsx loaded`);let e={type:`markdownRendered`,id:r,markdown:Z.run(()=>t.to_markdown())};self.postMessage(e);return}})}catch(e){n.type===`openSheetSession`&&$.abandonOpen(n.sessionId);let t={type:`error`,id:r,...w(e)};try{self.postMessage(t)}catch{}}};", Xt = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", Yt], { type: "text/javascript;charset=utf-8" });
|
|
15
|
-
function
|
|
4
|
+
import { Dn as b, M as x, N as S, On as C, P as w, V as T, X as E, Xt as D, Y as O, Yt as k, _t as A, ft as ee, gt as te, hn as j, j as M, lt as N, nt as P, ot as ne, qt as F, rt as re, st as I, t as ie, tt as ae, u as L, vt as oe, yt as se } from "./bounded-raw-part-cache-B8t03tSP.js";
|
|
5
|
+
import { f as R, u as ce } from "./pixel-budget-DI82Hn3R.js";
|
|
6
|
+
import { L as le, R as ue, V as de, n as fe, t as pe } from "./renderer-xdugdcMd.js";
|
|
7
|
+
import { i as me, t as he } from "./tiff-contract-DEd8CGuz.js";
|
|
8
|
+
import { C as ge, D as _e, E as ve, S as ye, T as be, _ as xe, a as Se, b as Ce, d as we, f as Te, g as Ee, h as De, m as Oe, o as ke, p as Ae, t as je, u as Me, w as Ne, x as Pe, y as Fe } from "./canvas-viewer-mechanics-DI38gHNV.js";
|
|
9
|
+
import { A as Ie, B as Le, C as Re, D as ze, E as Be, F as Ve, H as He, I as Ue, L as We, M as z, N as Ge, O as Ke, P as qe, R as Je, S as Ye, T as Xe, V as B, _ as Ze, b as V, c as Qe, d as $e, f as et, g as tt, h as nt, i as rt, j as it, k as at, l as ot, m as st, n as ct, o as lt, p as ut, r as dt, s as H, t as ft, u as pt, v as mt, w as ht, x as gt, y as _t, z as vt } from "./renderer-BYt3nsdR.js";
|
|
10
|
+
import { n as yt } from "./renderer-module-contract-BuTx2FWJ.js";
|
|
11
|
+
import { _ as bt, a as xt, b as U, c as St, d as Ct, f as wt, g as Tt, h as Et, l as Dt, m as Ot, n as kt, o as At, p as jt, s as Mt, t as Nt, u as Pt, v as Ft, y as It } from "./worksheet-pull-client-Du0MuIro.js";
|
|
12
|
+
import { n as Lt, r as Rt, t as zt } from "./visible-index-vN-4BNn7.js";
|
|
13
|
+
import { a as Bt, c as Vt, d as Ht, f as Ut, l as W, n as G, o as Wt, p as Gt, r as K, t as q, u as Kt } from "./grid-geometry-CqTDvpDr.js";
|
|
14
|
+
var qt = "var e=(e,t)=>()=>(e&&(t=e(e=0)),t);function t(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var n,r,i=e((()=>{n=class e extends Error{code;details;constructor(t,n,r){super(n),this.name=`OoxmlError`,this.code=t,t===`unsupported-content`&&r&&(this.details=Object.freeze({format:r.format,reason:r.reason})),Object.setPrototypeOf(this,e.prototype)}},r=class e extends Error{code=`ooxml-resource-limit`;details;constructor(t,n){super(t),this.name=`OoxmlResourceLimitError`;let r=n.violation,i=Object.freeze({format:r.format,operation:r.operation,resource:r.resource,metric:r.metric,...r.part===void 0?{}:{part:r.part},limit:r.limit,observed:r.observed,configurable:r.configurable,usage:Object.freeze({archiveEntryCount:r.usage.archiveEntryCount,declaredInflatedBytes:r.usage.declaredInflatedBytes,...r.usage.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:r.usage.largestInflatedEntryBytes},distinctInflatedBytes:r.usage.distinctInflatedBytes,operationInflatedBytes:r.usage.operationInflatedBytes})});this.details=Object.freeze({stage:n.stage,violation:i}),Object.setPrototypeOf(this,e.prototype)}}}));function a(e){return e===`image-dimension`||e===`image-pixels`||e===`active-decoded-bytes`||e===`image-effect-count`||e===`image-effect-work`||e===`tiff-lzw-work`||e===`metafile-path-commands`||e===`metafile-record-points`||e===`metafile-record-polygons`||e===`metafile-record-rectangles`||e===`metafile-record-text-units`}function o(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function s(e){if(!(!e||typeof e!=`object`))try{let t=e,n=t.code,r=t.metric,i=t.limit,s=t.observed;return n!==`ooxml-decoded-image-limit`||!a(r)||!o(i)||!o(s)||s<=i?void 0:{metric:r,limit:i,observed:s}}catch{return}}var c,l,u,d,ee,te=e((()=>{c=1<<25,l=1<<27,c*4,l*4,u=Math.floor(c/4),d=l,d/u,ee=class e extends RangeError{metric;limit;observed;code=`ooxml-decoded-image-limit`;constructor(t,n,r){super(`OOXML decoded image limit exceeded: ${t} ${r} > ${n}`),this.metric=t,this.limit=n,this.observed=r,this.name=`OoxmlDecodedImageLimitError`,Object.setPrototypeOf(this,e.prototype)}}}));function ne(e){if(!(typeof e!=`object`||!e))try{let t=e,n=t.code,r=t.message;return n===`ooxml-tiff-decode`&&typeof r==`string`?{message:r}:void 0}catch{return}}var re=e((()=>{}));function f(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>0}function ie(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return f(t.requiredBytes)&&f(t.offeredBytes)&&t.requiredBytes>t.offeredBytes}var p=class e extends RangeError{code=`ooxml-insufficient-credit`;requiredBytes;offeredBytes;constructor(t){super(`Pull unit requires ${t.requiredBytes} bytes but credit is ${t.offeredBytes}`),this.name=`PullSessionInsufficientCreditError`,this.requiredBytes=t.requiredBytes,this.offeredBytes=t.offeredBytes,Object.setPrototypeOf(this,e.prototype)}};function ae(e){if(e instanceof p)return e;let t=e instanceof Error?e.message:String(e);if(!t.startsWith(`OOXML_INSUFFICIENT_CREDIT:`))return;let n;try{n=JSON.parse(t.slice(26))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(!(r.code!==`ooxml-insufficient-credit`||!ie(r)))return new p(r)}i(),te(),re();const m=`OOXML_RESOURCE_LIMIT:`;function h(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function oe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return h(t.archiveEntryCount)&&h(t.declaredInflatedBytes)&&(t.largestInflatedEntryBytes===void 0||h(t.largestInflatedEntryBytes))&&h(t.distinctInflatedBytes)&&h(t.operationInflatedBytes)}function g(e){let t;try{t=JSON.parse(new TextDecoder().decode(e))}catch{throw TypeError(`OOXML resource usage checkpoint is not valid JSON`)}if(!oe(t))throw TypeError(`OOXML resource usage checkpoint is invalid`);return t}function se(e){return e===`docx`||e===`xlsx`||e===`pptx`}function ce(e){return e===`container`||e===`decompression`||e===`parsing`||e===`serialization`||e===`layout`||e===`rendering`||e===`worker`}function _(e,t){return typeof e==`string`&&e.length>0&&e.length<=t&&!/[\\u0000-\\u001f\\u007f]/u.test(e)}function v(e){return _(e,128)&&/^[a-z0-9][a-z0-9-]*$/u.test(e)}function le(e){return!_(e,4096)||e.startsWith(`/`)||e.startsWith(`\\\\`)||e.includes(`\\\\`)||e.includes(`?`)||e.includes(`#`)||e.includes(`://`)||/^[a-z]:/iu.test(e)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)}const y=new Map([[`archive-entry:declared-inflated-bytes`,{stage:`container`,part:`required`}],[`archive-entry:actual-inflated-bytes`,{stage:`decompression`,part:`required`}],[`archive:entry-count`,{stage:`container`,part:`forbidden`}],[`archive:central-directory-bytes`,{stage:`container`,part:`forbidden`,configurable:!1}],[`archive:distinct-inflated-bytes`,{stage:`decompression`,part:`required`}],[`xml-event:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`xml-context:bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`image-effect:work`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:elements`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chartex-allocation:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-cache:points`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`numbering-marker:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`chart-style-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-custom-number-formats:entries`,{stage:`parsing`,part:`required`,configurable:!1}],[`chart-number-format-bytes:bytes`,{stage:`parsing`,part:`required`,configurable:!1}],[`xml-tree:depth`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-row:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`worksheet-shell:projected-bytes`,{stage:`parsing`,part:`optional`,configurable:!1}],[`theme-style-reparse:bytes`,{stage:`parsing`,part:`forbidden`,configurable:!1}],[`style-inheritance:depth`,{stage:`parsing`,part:`required`,configurable:!1}],[`complex-field:depth`,{stage:`parsing`,part:`forbidden`,configurable:!1}]]),ue=new Set([...y.keys()].map(e=>e.slice(0,e.indexOf(`:`)))),de=new Set([...y.keys()].map(e=>e.slice(e.indexOf(`:`)+1)));function fe(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return!se(t.format)||!_(t.operation,256)||!v(t.resource)||!v(t.metric)||!h(t.limit)||!h(t.observed)||typeof t.configurable!=`boolean`||!oe(t.usage)?!1:!(`part`in t)||le(t.part)}function b(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;if(!ce(t.stage)||!fe(t.violation))return!1;let n=t.violation,r=y.get(`${n.resource}:${n.metric}`);return r?t.stage!==r.stage||r.configurable===!1&&n.configurable!==!1?!1:r.part===`required`?n.part!==void 0:r.part===`forbidden`?n.part===void 0:!0:!(ue.has(n.resource)&&de.has(n.metric))}function pe(e){return{archiveEntryCount:e.archiveEntryCount,declaredInflatedBytes:e.declaredInflatedBytes,...e.largestInflatedEntryBytes===void 0?{}:{largestInflatedEntryBytes:e.largestInflatedEntryBytes},distinctInflatedBytes:e.distinctInflatedBytes,operationInflatedBytes:e.operationInflatedBytes}}function me(e){if(!b(e))return;let t=e.violation,n={stage:e.stage,violation:{format:t.format,operation:t.operation,resource:t.resource,metric:t.metric,...t.part===void 0?{}:{part:t.part},limit:t.limit,observed:t.observed,configurable:t.configurable,usage:pe(t.usage)}};return b(n)?n:void 0}function x(e){let t=e.violation;return`OOXML resource limit exceeded${t.part?` for ${t.part}`:``} (${t.resource}, ${e.stage}): ${t.metric} ${t.observed} > ${t.limit}`}function S(e){let t=e instanceof Error?e.message:String(e);if(!t.startsWith(m))return;let n;try{n=JSON.parse(t.slice(21))}catch{return}if(!n||typeof n!=`object`)return;let i=n;if(!(i.code!==`ooxml-resource-limit`||!b(i.details)))return new r(x(i.details),i.details)}function he(e){try{return e()}catch(e){throw e instanceof r||typeof e!=`string`&&!(e instanceof Error)?e:S(e)??e}}function ge(e){let t=e instanceof Error?e.message:String(e);if(t.startsWith(`OOXML_NOT_OOXML:`))return new n(`not-ooxml`,`This file is not an Office Open XML document: ${t.slice(16)}`)}function C(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=t.format,r=t.reason;if(!(!v(n)||r!==`source-subset`))return{format:n,reason:r}}function _e(e){return new n(`unsupported-content`,`Input is outside the source’s supported subset.`,e)}function ve(e){let t=typeof e==`string`?e:e instanceof Error?e.message:``;if(!(!t.startsWith(`MODEL_SOURCE_UNSUPPORTED:`)||t.length>1024))try{let e=C(JSON.parse(t.slice(25)));return e?_e(e):void 0}catch{return}}function ye(e){return e===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`||e instanceof Error&&e.message===`OOXML_SOURCE_UNSUPPORTED_ENCRYPTION`?new n(`unsupported-encryption`,`The configured source cannot decrypt this input.`):ve(e)??S(e)??ge(e)}function be(e){let t=s(e);if(t){let e=new ee(t.metric,t.limit,t.observed);return{message:e.message,errorName:e.name,code:e.code,decodedImage:t}}let i=ne(e);if(i)return{message:i.message,errorName:`TiffDecodeError`,code:`ooxml-tiff-decode`};let a=ae(e);if(a)return{message:a.message,errorName:a.name,code:a.code,insufficientCredit:{requiredBytes:a.requiredBytes,offeredBytes:a.offeredBytes}};let o=e instanceof n||e instanceof r?e:ye(e),c=o??e;if(o instanceof r||c&&typeof c==`object`&&c.code===`ooxml-resource-limit`){let e=c,t=me(e.details);return t?{message:typeof e.message==`string`?e.message:x(t),errorName:`OoxmlResourceLimitError`,code:`ooxml-resource-limit`,resourceLimit:t}:{message:`Invalid OOXML resource-limit error payload`,errorName:`Error`}}if(c&&typeof c==`object`&&c.code===`unsupported-content`){let e=C(c.details);return e?{message:_e(e).message,code:`unsupported-content`,unsupportedContent:e}:{message:`Invalid unsupported-content error payload`,errorName:`Error`}}if(o instanceof n)return{message:typeof o.message==`string`?o.message:String(o.message),errorName:_(o.name,128)?o.name:`OoxmlError`,...v(o.code)?{code:o.code}:{}};let l=e instanceof Error?e.message:String(e);if(typeof l==`string`&&l.startsWith(m))return{message:`Invalid OOXML resource-limit payload`,errorName:`Error`};let u=e instanceof Error?e:Error(l),d=u;return{message:typeof u.message==`string`?u.message:String(u.message),errorName:_(u.name,128)?u.name:`Error`,...typeof d.code==`string`?{code:d.code}:{}}}function w(e){try{return be(e)}catch{return{message:`Worker operation failed with an unreadable error`,errorName:`Error`}}}var xe=class{initialize;reinitialize;normalizeFailure;state=`uninitialized`;generationValue=0;readiness;poisonListeners=new Set;constructor(e,t,n){this.initialize=e,this.reinitialize=t,this.normalizeFailure=n}get generation(){return this.generationValue}get poisoned(){return this.state===`poisoned`}onPoison(e){return this.poisonListeners.add(e),()=>this.poisonListeners.delete(e)}async ensureReady(){if(this.state!==`ready`){if(!this.readiness){let e=this.state===`uninitialized`?this.initialize:this.reinitialize;this.readiness=Promise.resolve().then(e).then(()=>{this.generationValue+=1,this.state=`ready`,this.readiness=void 0},e=>{throw this.readiness=void 0,e})}await this.readiness}}run(e){try{return e()}catch(e){let t=this.normalizeFailure(e);throw t?(this.poison(t),t):e}}tryRunReady(e){if(this.state!==`ready`)return{current:!1};let t=this.generationValue,n=this.run(e);return this.state!==`ready`||t!==this.generationValue?{current:!1}:{current:!0,generation:t,value:n}}poison(e){this.state=`poisoned`,this.readiness=void 0;for(let t of this.poisonListeners)t(e)}assertCurrent(e){if(this.state!==`ready`||e!==this.generationValue)throw Error(`WASM archive session belongs to a discarded runtime generation`)}},T=class e extends Error{code=`parser-crashed`;constructor(t){super(t),this.name=`WasmTrapError`,Object.setPrototypeOf(this,e.prototype)}};function Se(e){let t=globalThis.WebAssembly?.RuntimeError;return t&&e instanceof t||e instanceof RangeError?!0:e instanceof Error?e.name===`RuntimeError`||e.name===`CompileError`||e.name===`LinkError`||e.name===`InternalError`||e.name===`OOMError`:!1}function Ce(e){try{if((typeof e!=`object`||!e)&&typeof e!=`function`)return;let t=Reflect.get(e,`__destroy_into_raw`);typeof t==`function`&&Reflect.apply(t,e,[])}catch{}}function we(e,t){return e({module_or_path:t})}var Te=class{init;options;runtime;wasmInput=null;currentArchive=null;constructor(e,t={}){this.init=e,this.options=t,this.runtime=new xe(()=>this.invokeConfigured(this.init),()=>this.invokeConfigured(this.options.reinit??this.init),Ee),this.runtime.onPoison(()=>this.dropPoisonedArchive())}setWasmInput(e){this.wasmInput=e,this.runtime.ensureReady().catch(()=>void 0)}setWasmUrl(e){this.setWasmInput(e)}get archive(){return this.currentArchive}setArchive(e){this.freeArchive(),this.currentArchive=e}disposeArchive(){this.freeArchive()}get poisoned(){return this.runtime.poisoned}async ensureReady(){await this.runtime.ensureReady()}run(e){return he(()=>this.runtime.run(e))}poison(){this.runtime.poison(new T(`WASM parser was recycled`))}invokeConfigured(e){return this.wasmInput===null?Promise.reject(Error(`WasmParserHost: setWasmInput was never called`)):we(e,this.wasmInput)}freeArchive(){this.currentArchive!==null&&this.options.freeArchive&&this.options.freeArchive(this.currentArchive),this.currentArchive=null}dropPoisonedArchive(){let e=this.currentArchive;this.currentArchive=null,Ce(e)}};function Ee(e){return Se(e)?new T(`WASM parser trapped and was recycled: ${e instanceof Error?e.message:String(e)}`):null}function De(e){return e.byteOffset===0&&e.byteLength===e.buffer.byteLength&&e.buffer instanceof ArrayBuffer?e.buffer:e.slice().buffer}Object.freeze({maxArchiveEntryBytes:134217728,maxTotalInflatedBytes:268435456,maxArchiveEntries:4096});function Oe(e){return[e.maxArchiveEntryBytes===null?0n:BigInt(e.maxArchiveEntryBytes),e.maxTotalInflatedBytes===null?0n:BigInt(e.maxTotalInflatedBytes),e.maxArchiveEntries===null?0n:BigInt(e.maxArchiveEntries)]}const E=`ooxml-pull-v1`;function D(e,t){if(!Number.isSafeInteger(e)||e<=0)throw RangeError(`${t} must be a positive safe integer`)}function ke(e){if(!(typeof e==`string`&&e.length>0||typeof e==`number`&&Number.isSafeInteger(e)&&e>0))throw RangeError(`session id must be a non-empty string or positive safe integer`)}var Ae=class{owner;queue=Promise.resolve();leases=new Map;retainedBytes=0;retainedCount=0;maxRetainedBytes;maxRetainedCount;cleanups=new Set;pendingFatalCleanups=[];poisonRunning=!1;fatal;constructor(e){this.maxRetainedBytes=e?.maxRetainedBytes??64*1024*1024,this.maxRetainedCount=e?.maxRetainedCount??256,D(this.maxRetainedBytes,`max retained lease bytes`),D(this.maxRetainedCount,`max retained lease count`)}enqueue(e){let t=this.queue.then(e,e);return this.queue=t.then(()=>void 0,()=>void 0),t}acquire(e){return this.owner===void 0?(this.owner=e,!0):this.owner===e}release(e){this.owner===e&&(this.owner=void 0)}retainLease(e,t,n){if(!Number.isSafeInteger(n)||n<0)throw RangeError(`retained lease bytes are invalid`);let r=this.leases.get(e)??new Map;if(r.has(t))throw Error(`driver returned a duplicate lease id`);if(this.retainedCount+1>this.maxRetainedCount)throw RangeError(`retained lease count exceeds limit`);if(this.retainedBytes+n>this.maxRetainedBytes)throw RangeError(`retained lease bytes exceed limit`);r.set(t,n),this.leases.set(e,r),this.retainedCount++,this.retainedBytes+=n}releaseLease(e,t){let n=this.leases.get(e),r=n?.get(t);r!==void 0&&(n?.delete(t),n?.size===0&&this.leases.delete(e),this.retainedCount--,this.retainedBytes-=r)}registerCleanup(e){return this.fatal?(this.poisonRunning?this.pendingFatalCleanups.push(e):this.enqueue(e).catch(()=>void 0),()=>void 0):(this.cleanups.add(e),()=>this.cleanups.delete(e))}get fatalError(){return this.fatal}get registeredHostCount(){return this.cleanups.size}async poison(e){if(this.fatal??=e,this.poisonRunning)return this.fatal;this.poisonRunning=!0,this.pendingFatalCleanups.push(...this.cleanups);try{let e;for(;(e=this.pendingFatalCleanups.shift())!==void 0;)await e().catch(()=>void 0)}finally{this.poisonRunning=!1}return this.fatal}},je=class{options;coordinator;coordinatorOwner=Symbol(`pull-session-host`);unregisterCleanup;sequence=0;unacked;leases=new Map;activeDriverLeases=new Set;nextWireLeaseId;cancelRequested=!1;cancelComplete=!1;closeRequested=!1;closeComplete=!1;driverCancelComplete=!1;driverCloseComplete=!1;completed=!1;constructor(e){ke(e.sessionId),D(e.operationId,`operation id`),D(e.generation,`generation`),D(e.maxByteCredit,`max byte credit`),e.wireLeaseIdStart!==void 0&&D(e.wireLeaseIdStart,`wire lease id start`),this.options=e,this.coordinator=e.coordinator,this.nextWireLeaseId=e.wireLeaseIdStart??1,this.unregisterCleanup=this.coordinator.registerCleanup(()=>this.forceFatalCleanup())}dispatch(e,t){return this.coordinator.enqueue(async()=>{let n=await this.execute(e);try{t(n.response,n.transfer)}catch(e){throw await this.rollbackFailedPost(n),e}})}async rollbackFailedPost(e){let t=e.response;if(t.kind===`chunk`){let n=t.leaseId===void 0?void 0:this.leases.get(t.leaseId);try{await this.options.driver.disposeInvalidChunk?.({payload:t.payload,byteLength:t.byteLength,done:t.done,leaseId:n?.driverLeaseId,retainedBytes:n?.retainedBytes,transfer:e.transfer})}catch{}}this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);for(let[e,t]of[...this.leases])try{await this.options.driver.releaseLease?.(t.driverLeaseId)}catch{}finally{this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e)}if(this.cancelRequested=!0,!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch{}this.unregisterCleanup()}async execute(e){try{if(this.isStaleLifecycle(e)){let t=e.kind===`cancel`?`cancel`:`close`;return this.sameOperationIdentity(e)?{response:this.accepted(e,t,!0)}:{response:this.errorResponse(e,{message:`stale lifecycle targets another session or operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`})}}this.validateCommandIdentity(e);let t=this.coordinator.fatalError;if(t)return e.kind===`pull`?{response:this.errorResponse(e,t)}:(e.kind===`cancel`?await this.cancel():e.kind===`close`?await this.close():e.kind===`release`&&await this.release(e.leaseId),{response:this.accepted(e,e.kind)});switch(e.kind){case`pull`:return await this.pull(e);case`ack`:return await this.ack(e.sequence),{response:this.accepted(e,`ack`)};case`release`:return await this.release(e.leaseId),{response:this.accepted(e,`release`)};case`cancel`:return await this.cancel(),{response:this.accepted(e,`cancel`)};case`close`:return await this.close(),{response:this.accepted(e,`close`)}}}catch(t){let n=w(t);return n.code===`ooxml-resource-limit`&&(n=await this.coordinator.poison(n)),{response:this.errorResponse(e,n)}}}async pull(e){if(this.closeRequested||this.cancelRequested||this.completed)throw Error(`pull session is closed`);if(this.unacked)throw Error(`previous chunk is not acknowledged`);if(!Number.isSafeInteger(e.sequence)||e.sequence<0||e.sequence!==this.sequence)throw Error(`pull command sequence mismatch`);if(this.validateHostCredit(e.byteCredit),!this.coordinator.acquire(this.coordinatorOwner))throw Error(`another operation has an unacknowledged package chunk`);let t;try{t=await this.options.driver.pull(e.byteCredit)}catch(e){throw this.coordinator.release(this.coordinatorOwner),e}let n=!1,r=!1,i,a;try{let o=this.options.driver.measureChunk(t),s=this.arrayBufferTransferBytes(t.transfer);if(o<s)throw RangeError(`measured chunk bytes are below ArrayBuffer transfer bytes`);if(a=Math.max(o,s),t.leaseId!==void 0){if(D(t.leaseId,`lease id`),t.retainedBytes===void 0)throw Error(`retained lease bytes are required`);if(this.activeDriverLeases.has(t.leaseId))throw r=!0,Error(`driver returned an active duplicate lease id`);i=this.allocateWireLeaseId(),this.coordinator.retainLease(this.coordinatorOwner,i,t.retainedBytes),this.leases.set(i,{driverLeaseId:t.leaseId,retainedBytes:t.retainedBytes}),this.activeDriverLeases.add(t.leaseId),n=!0}else if(t.retainedBytes!==void 0)throw Error(`retained lease bytes require a lease id`);if(!Number.isSafeInteger(a)||a<0)throw RangeError(`host chunk byte length must be a non-negative safe integer`);if(a>e.byteCredit)throw RangeError(`host chunk exceeds byte credit`)}catch(e){let a;try{await this.options.driver.disposeInvalidChunk?.(t)}catch(e){a=e}if(n&&i!==void 0)try{await this.release(i)}catch(e){a??=e}else if(t.leaseId!==void 0&&!r)try{await this.options.driver.releaseLease?.(t.leaseId)}catch(e){a??=e}if(r)try{await this.cancel()}catch(e){a??=e}throw this.coordinator.release(this.coordinatorOwner),a||e}return this.unacked={sequence:this.sequence,done:t.done},{response:{kind:`chunk`,protocol:E,...this.identity(),requestId:e.requestId,sequence:this.sequence,byteLength:a,done:t.done,payload:t.payload,leaseId:i,usage:this.resourceUsage()},transfer:t.transfer}}async ack(e){if(!Number.isSafeInteger(e)||e<0)throw RangeError(`invalid ack sequence`);if(e<this.sequence)return;if(!this.unacked||e!==this.sequence)throw Error(`ack sequence mismatch`);let t=this.unacked.done;await this.options.driver.acknowledge?.(e),this.unacked=void 0,this.coordinator.release(this.coordinatorOwner),this.sequence++,t&&(this.completed=!0,this.maybeUnregisterCompleted())}async release(e){D(e,`wire lease id`);let t=this.leases.get(e);t&&(await this.options.driver.releaseLease?.(t.driverLeaseId),this.leases.delete(e),this.activeDriverLeases.delete(t.driverLeaseId),this.coordinator.releaseLease(this.coordinatorOwner,e),this.maybeUnregisterCompleted())}async cancel(){if(this.cancelComplete)return;this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.cancelComplete=!0,this.unregisterCleanup()}async close(){if(this.closeComplete)return;this.closeRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;try{await this.releaseAllLeases()}catch(t){e=t}if(!this.driverCloseComplete)try{await this.options.driver.close?.(),this.driverCloseComplete=!0}catch(t){e??=t}if(e)throw e;this.closeComplete=!0,this.unregisterCleanup()}async releaseAllLeases(){let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(e)throw e}validateCommandIdentity(e){if(e.protocol!==`ooxml-pull-v1`||e.sessionId!==this.options.sessionId||e.operationId!==this.options.operationId||e.generation!==this.options.generation||!Number.isSafeInteger(e.requestId)||e.requestId<=0)throw Error(`stale or mismatched pull session command`)}validateHostCredit(e){if(D(e,`byte credit`),e>this.options.maxByteCredit)throw RangeError(`byte credit exceeds host maximum`)}accepted(e,t,n=!1){return{kind:`accepted`,protocol:E,...n?{sessionId:e.sessionId,operationId:e.operationId,generation:e.generation}:this.identity(),requestId:e.requestId,command:t,usage:this.resourceUsage()}}identity(){return{sessionId:this.options.sessionId,operationId:this.options.operationId,generation:this.options.generation}}isStaleLifecycle(e){return(e.kind===`cancel`||e.kind===`close`)&&e.protocol===`ooxml-pull-v1`&&Number.isSafeInteger(e.requestId)&&e.requestId>0&&Number.isSafeInteger(e.generation)&&e.generation>0&&e.generation<this.options.generation}sameOperationIdentity(e){return e.sessionId===this.options.sessionId&&e.operationId===this.options.operationId}errorResponse(e,t){return{kind:`error`,protocol:E,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:t,usage:this.errorResourceUsage()}}async forceFatalCleanup(){this.cancelRequested=!0,this.unacked=void 0,this.coordinator.release(this.coordinatorOwner);let e;for(let t of[...this.leases.keys()])try{await this.release(t)}catch(t){e??=t}if(!this.driverCancelComplete)try{await this.options.driver.cancel?.(),this.driverCancelComplete=!0}catch(t){e??=t}if(e)throw e;this.unregisterCleanup()}allocateWireLeaseId(){if(!Number.isSafeInteger(this.nextWireLeaseId)||this.nextWireLeaseId<=0)throw RangeError(`wire lease id space exhausted`);return this.nextWireLeaseId++}arrayBufferTransferBytes(e){let t=0;for(let n of e??[])if(n instanceof ArrayBuffer&&(t+=n.byteLength,!Number.isSafeInteger(t)))throw RangeError(`ArrayBuffer transfer bytes overflow`);return t}maybeUnregisterCompleted(){this.completed&&this.leases.size===0&&this.unregisterCleanup()}resourceUsage(){return this.options.driver.resourceUsage?.()}errorResourceUsage(){try{return this.resourceUsage()}catch{return}}};const O=2**53-1-1;function k(e){return Object.freeze({maxRows:e.maxRows,maxCells:e.maxCells,maxOwnedUtf8Bytes:e.maxOwnedUtf8Bytes,maxJsonBytes:e.maxJsonBytes})}const A=Object.freeze({worksheet:k({maxRows:1e5,maxCells:25e4,maxOwnedUtf8Bytes:33554432,maxJsonBytes:67108864}),cache:k({maxRows:2e5,maxCells:5e5,maxOwnedUtf8Bytes:67108864,maxJsonBytes:134217728}),maxCoordinateIndexEntries:25e4});function j(e,t){let n=e[t];if(n===void 0)return A.worksheet[t];if(typeof n!=`number`)throw TypeError(`xlsxWorksheetLimits.${t} must be a number`);if(!Number.isSafeInteger(n)||n<=0||n>O)throw RangeError(`xlsxWorksheetLimits.${t} must be a positive safe integer no greater than ${O}`);return n}function Me(e={}){let t=e.xlsxWorksheetLimits,n={};if(t!==void 0){if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`xlsxWorksheetLimits must be a non-null, non-array object`);n=t}let r=k({maxRows:j(n,`maxRows`),maxCells:j(n,`maxCells`),maxOwnedUtf8Bytes:j(n,`maxOwnedUtf8Bytes`),maxJsonBytes:j(n,`maxJsonBytes`)}),i=A,a=k({maxRows:Math.max(i.cache.maxRows,r.maxRows),maxCells:Math.max(i.cache.maxCells,r.maxCells),maxOwnedUtf8Bytes:Math.max(i.cache.maxOwnedUtf8Bytes,r.maxOwnedUtf8Bytes),maxJsonBytes:Math.max(i.cache.maxJsonBytes,r.maxJsonBytes)});return Object.freeze({worksheet:r,cache:a,maxCoordinateIndexEntries:Math.max(i.maxCoordinateIndexEntries,r.maxCells)})}function Ne(e){let{worksheet:t}=e;return[BigInt(t.maxRows),BigInt(t.maxCells),BigInt(t.maxOwnedUtf8Bytes),BigInt(t.maxJsonBytes)]}var M=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,N.unregister(this),e}free(){let e=this.__destroy_into_raw();K.__wbg_xlsxarchive_free(e,0)}acknowledge_sheet_cursor_terminal(){let e=K.xlsxarchive_acknowledge_sheet_cursor_terminal(this.__wbg_ptr);if(e[1])throw V(e[0])}assert_healthy(){let e=K.xlsxarchive_assert_healthy(this.__wbg_ptr);if(e[1])throw V(e[0])}cancel_sheet_cursor(){K.xlsxarchive_cancel_sheet_cursor(this.__wbg_ptr)}close_sheet_cursor(){K.xlsxarchive_close_sheet_cursor(this.__wbg_ptr)}extract_image(e){let t=B(e,K.__wbindgen_malloc,K.__wbindgen_realloc),n=G,r=K.xlsxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw V(r[2]);var i=P(r[0],r[1]).slice();return K.__wbindgen_free(r[0],r[1]*1,1),i}constructor(e,t,n,r){let i=Ie(e,K.__wbindgen_malloc),a=G,o=K.xlsxarchive_new(i,a,!z(t),z(t)?BigInt(0):t,!z(n),z(n)?BigInt(0):n,!z(r),z(r)?BigInt(0):r);if(o[2])throw V(o[1]);return this.__wbg_ptr=o[0]>>>0,N.register(this,this.__wbg_ptr,this),this}open_sheet_cursor(e,t){let n=B(t,K.__wbindgen_malloc,K.__wbindgen_realloc),r=G,i=K.xlsxarchive_open_sheet_cursor(this.__wbg_ptr,e,n,r);if(i[1])throw V(i[0])}parse(){let e=K.xlsxarchive_parse(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}pull_sheet_cursor(e){let t=K.xlsxarchive_pull_sheet_cursor(this.__wbg_ptr,e);if(t[3])throw V(t[2]);var n=P(t[0],t[1]).slice();return K.__wbindgen_free(t[0],t[1]*1,1),n}resource_usage(){let e=K.xlsxarchive_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}set_worksheet_limits(e,t,n,r){let i=K.xlsxarchive_set_worksheet_limits(this.__wbg_ptr,e,t,n,r);if(i[1])throw V(i[0])}sheet_cursor_pull_finished(){return K.xlsxarchive_sheet_cursor_pull_finished(this.__wbg_ptr)!==0}sheet_cursor_resource_usage(){let e=K.xlsxarchive_sheet_cursor_resource_usage(this.__wbg_ptr);if(e[3])throw V(e[2]);var t=P(e[0],e[1]).slice();return K.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=K.xlsxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,V(i[2]);return e=n,t=r,I(n,r)}finally{K.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);function Pe(){return{__proto__:null,\"./xlsx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(I(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(I(e,t))}finally{K.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=B(n,K.__wbindgen_malloc,K.__wbindgen_realloc),i=G;Fe().setInt32(e+4,i,!0),Fe().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return I(e,t)},__wbindgen_init_externref_table:function(){let e=K.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,!0),e.set(t+3,!1)}}}}const N=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>K.__wbg_xlsxarchive_free(e>>>0,1));function P(e,t){return e>>>=0,R().subarray(e/1,e/1+t)}let F=null;function Fe(){return(F===null||F.buffer.detached===!0||F.buffer.detached===void 0&&F.buffer!==K.memory.buffer)&&(F=new DataView(K.memory.buffer)),F}function I(e,t){return e>>>=0,Le(e,t)}let L=null;function R(){return(L===null||L.byteLength===0)&&(L=new Uint8Array(K.memory.buffer)),L}function z(e){return e==null}function Ie(e,t){let n=t(e.length*1,1)>>>0;return R().set(e,n/1),G=e.length,n}function B(e,t,n){if(n===void 0){let n=W.encode(e),r=t(n.length,1)>>>0;return R().subarray(r,r+n.length).set(n),G=n.length,r}let r=e.length,i=t(r,1)>>>0,a=R(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=R().subarray(i+o,i+r),a=W.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return G=o,i}function V(e){let t=K.__wbindgen_externrefs.get(e);return K.__externref_table_dealloc(e),t}let H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});H.decode();let U=0;function Le(e,t){return U+=t,U>=2146435072&&(H=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),H.decode(),U=t),H.decode(R().subarray(e,e+t))}const W=new TextEncoder;`encodeInto`in W||(W.encodeInto=function(e,t){let n=W.encode(e);return t.set(n),{read:e.length,written:n.length}});let G=0,K;function Re(e,t){return K=e.exports,F=null,L=null,K.__wbindgen_start(),K}async function ze(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if(e.ok&&n(e.type)&&e.headers.get(`Content-Type`)!==`application/wasm`)console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",t);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function Be(e){if(K!==void 0)return K;e!==void 0&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn(`using deprecated parameters for the initialization function; pass a single object instead`));let t=Pe();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:n,module:r}=await ze(await e,t);return Re(n,r)}async function Ve(e){return K=void 0,F=null,L=null,Be(e)}function He(e,t){return{workbook:e(),usage:g(t())}}function Ue(e,t){for(let n of e)for(let e of n.cells){let n=e.value;if(n.type===`shared`){let r=t[n.si];if(r){let t={type:`text`,text:r.text};r.runs!==void 0&&(t.runs=r.runs),r.phoneticRuns!==void 0&&(t.phoneticRuns=r.phoneticRuns),r.phoneticPr!==void 0&&(t.phoneticPr=r.phoneticPr),e.value=t}else e.value={type:`text`,text:``}}}return e}const We=new Set([`outline`,`merge`,`conditional-format`,`ancillary-content`,`metadata-unavailable`,`unordered-rows`]);function Ge(e,t,n,r){let i=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),a=JSON.parse(new TextDecoder().decode(i));if(!a||typeof a!=`object`||!(`kind`in a))throw Error(`worksheet cursor returned an invalid unit`);let o=a;if(t!==(o.kind===`finished`))throw Error(`worksheet cursor terminal marker mismatch`);if(o.kind===`rows`){if(!Array.isArray(o.rows))throw Error(`worksheet row unit is missing rows`);return n&&Ue(o.rows,n),r?.(o.rows),{kind:`rows`,rows:o.rows}}if(o.kind===`preview`){if(!Number.isSafeInteger(o.maxRow)||!Number.isSafeInteger(o.maxCol)||o.maxRow<0||o.maxCol<0||o.worksheet===null==(o.reason===null)||o.worksheet!==null&&(typeof o.worksheet!=`object`||Array.isArray(o.worksheet))||o.reason!==null&&!We.has(o.reason))throw Error(`worksheet preview unit is invalid`);return o.worksheet&&(o.worksheet.rows=[]),o}if(o.kind===`finished`){if(!o.worksheet||typeof o.worksheet!=`object`)throw Error(`worksheet terminal unit is missing its worksheet`);return o.worksheet.rows=[],{kind:`finished`,worksheet:o.worksheet}}throw Error(`worksheet cursor returned an unknown unit kind`)}const Ke=new WeakMap;function qe(e,t){Ke.set(e,t)}function q(e,t){if(!Number.isSafeInteger(e)||e<0)throw Error(`${t} must be a non-negative safe integer`)}function J(e,t,n){return q(e,`resource measurement`),q(t,`resource measurement`),q(n,`resource measurement limit`),e>n||t>n||t>n-e?n===2**53-1?n:n+1:e+t}function Je(e,t=2**53-1){q(t,`resource measurement limit`);let n=0;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=3}else a=3;if(n=J(n,a,t),n>t)return n}return n}function Ye(e,t=2**53-1){q(t,`resource measurement limit`);let n=J(0,2,t);if(n>t)return n;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r),a;if(i===34||i===92||i===8||i===9||i===10||i===12||i===13)a=2;else if(i<=31)a=6;else if(i<=127)a=1;else if(i<=2047)a=2;else if(i>=55296&&i<=56319&&r+1<e.length){let t=e.charCodeAt(r+1);t>=56320&&t<=57343?(a=4,r+=1):a=6}else a=i>=55296&&i<=57343?6:3;if(n=J(n,a,t),n>t)return n}return n}function Y(e,t){return J(0,e,t)}function X(e,t=2**53-1,n=!1){if(q(t,`resource measurement limit`),e===null)return{jsonBytes:Y(4,t),stringValueUtf8Bytes:0};if(typeof e==`string`)return{jsonBytes:Ye(e,t),stringValueUtf8Bytes:Je(e,t)};if(typeof e==`boolean`)return{jsonBytes:Y(e?4:5,t),stringValueUtf8Bytes:0};if(typeof e==`number`)return{jsonBytes:Y((Number.isFinite(e)?String(Object.is(e,-0)?0:e):`null`).length,t),stringValueUtf8Bytes:0};if(typeof e==`bigint`)throw TypeError(`BigInt values cannot be serialized to JSON`);if(Array.isArray(e)){let n=Y(2,t),r=0;for(let i=0;i<e.length;i+=1){i!==0&&(n=J(n,1,t));let a=X(e[i],t,!0);n=J(n,a.jsonBytes,t),r=J(r,a.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}if(typeof e==`object`){let n=Y(2,t),r=0,i=0;for(let[a,o]of Object.entries(e)){if(o===void 0||typeof o==`function`||typeof o==`symbol`)continue;i++!==0&&(n=J(n,1,t)),n=J(n,Ye(a,t),t),n=J(n,1,t);let e=X(o,t);n=J(n,e.jsonBytes,t),r=J(r,e.stringValueUtf8Bytes,t)}return{jsonBytes:n,stringValueUtf8Bytes:r}}return{jsonBytes:n?Y(4,t):0,stringValueUtf8Bytes:0}}i();const Xe=Object.freeze({archiveEntryCount:0,declaredInflatedBytes:0,distinctInflatedBytes:0,operationInflatedBytes:0});function Ze(e,t=A){let{maxCells:n,maxOwnedUtf8Bytes:r}=t.worksheet,i=e.reduce((e,t)=>J(e,t.cells.length,n),0);return{rows:e.length,cells:i,ownedUtf8Bytes:e.reduce((e,t)=>t.cells.reduce((e,t)=>{let n=X(t.value,r).stringValueUtf8Bytes;return J(e,J(n,t.formula===void 0?0:Je(t.formula,r),r),r)},e),0)}}function Qe(e,t,n=A){let r=X(e,n.worksheet.maxJsonBytes);return{...t,jsonBytes:r.jsonBytes}}function $e(e,t,n=A){let r=n.worksheet;return{rows:J(e.rows,t.rows,r.maxRows),cells:J(e.cells,t.cells,r.maxCells),ownedUtf8Bytes:J(e.ownedUtf8Bytes,t.ownedUtf8Bytes,r.maxOwnedUtf8Bytes)}}function et(e,t,n,i,a,o,s,c=n!==`delimited-text-source`){let l=n===`worksheet-json`?`serialization`:`parsing`;return new r(x({stage:l,violation:{part:t,resource:n,metric:i,observed:o,limit:a}}),{stage:l,violation:{format:`xlsx`,operation:e,resource:n,metric:i,...t===void 0?{}:{part:t},limit:a,observed:Math.min(o,a+1),configurable:c,usage:s??Xe}})}function tt(e,t,n,r,i=A){let a=i.worksheet,o=[[`rows`,e.rows,a.maxRows],[`cells`,e.cells,a.maxCells],[`owned-utf8-bytes`,e.ownedUtf8Bytes,a.maxOwnedUtf8Bytes]];for(let[e,i,a]of o)if(i>a)throw et(t,n,e===`owned-utf8-bytes`?`worksheet-cell-content`:`worksheet-model`,e,a,i,r)}function nt(e,t,n,r,i=A){let a=i.worksheet.maxJsonBytes;if(e>a)throw et(t,n,`worksheet-json`,`bytes`,a,e,r)}i();var rt=class{archive;acceptWorksheet;executeArchive;prepareRows;provisional;worksheetPolicy;coordinator=new Ae;sessions=new Map;operationTail=Promise.resolve();pendingOpens=new Map;resourceFailure;constructor(e,t,n=e=>e(this.requireArchive()),r,i,a=()=>A){this.archive=e,this.acceptWorksheet=t,this.executeArchive=n,this.prepareRows=r,this.provisional=i,this.worksheetPolicy=a}reserveOpen(e){this.pendingOpens.set(e.sessionId,{identity:e,canceled:!1})}abandonOpen(e){this.pendingOpens.delete(e)}get pendingOpenCount(){return this.pendingOpens.size}runDuringPull(e){return this.sessions.size===0?this.run(e):this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;try{return e()}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}})}async open(e,t,n){if(this.resourceFailure)throw this.resourceFailure;let i=this.pendingOpens.get(n.sessionId);if(!i||i.identity.operationId!==n.operationId||i.identity.generation!==n.generation)throw Error(`worksheet pull session open reservation is stale or missing`);let a=this.worksheetPolicy(),o,s=new Promise(e=>{o=e}),c=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(i.canceled)throw Error(`worksheet pull session open was canceled`);this.executeArchive(n=>n.open_sheet_cursor(e,t));let s=[],c={rows:0,cells:0,ownedUtf8Bytes:0},l,u=!1,d=new je({...n,maxByteCredit:67108864,coordinator:this.coordinator,driver:{pull:()=>{let t=this.executeArchive(e=>e.pull_sheet_cursor(128)),n=this.executeArchive(e=>e.sheet_cursor_pull_finished());if(this.acceptWorksheet){let i=Ge(t,n,void 0,this.prepareRows);try{if(i.kind===`preview`)i.worksheet&&(i.worksheet.rows=s,qe(i.worksheet,a),this.provisional?.preview(e,i.worksheet));else if(i.kind===`rows`){let e=$e(c,Ze(i.rows,a),a);tt(e,`get-worksheet-worker`,void 0,this.readResourceUsage(),a),s.push(...i.rows),c=e}else i.kind===`finished`&&(l=i.worksheet)}catch(e){throw e instanceof r&&(this.resourceFailure??=e),e}}u=n;let i=De(t);return{payload:i,byteLength:i.byteLength,done:n,transfer:[i]}},measureChunk:({payload:e})=>e.byteLength,acknowledge:()=>{if(!u)return;let t,i;try{if(this.acceptWorksheet){if(!l)throw Error(`worksheet terminal payload is missing`);l.rows=l.parseError?[]:s;let n=l.parseError?{rows:0,cells:0,ownedUtf8Bytes:0}:c,r=Qe(l,n,a),o=this.readResourceUsage();tt(r,`get-worksheet-worker`,void 0,o,a),nt(r.jsonBytes,`get-worksheet-worker`,void 0,o,a),qe(l,a);let u=this.acceptWorksheet(e,l,r,o);typeof u==`function`?t=u:u&&({rollback:t,commit:i}=u)}this.executeArchive(e=>e.acknowledge_sheet_cursor_terminal()),i?.()}catch(e){throw t?.(),e instanceof r&&(this.resourceFailure??=e),e}u=!1,this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()},cancel:()=>{try{this.archive()&&this.executeArchive(e=>e.cancel_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},close:()=>{try{this.archive()&&this.executeArchive(e=>e.close_sheet_cursor())}finally{this.sessions.delete(n.sessionId),this.provisional?.stop(e),o()}},resourceUsage:()=>this.readResourceUsage()}});this.sessions.set(n.sessionId,{host:d,identity:n}),this.pendingOpens.delete(n.sessionId)}));this.operationTail=c.then(()=>s,()=>void 0);try{await c}catch(e){throw this.pendingOpens.delete(n.sessionId),o(),e}}async postOpenedSafely(e,t,n){try{t()}catch(t){await this.closeIdentity(e);try{n(t)}catch{}}}dispatch(e,t){let n=this.sessions.get(e.sessionId);if(n)return n.host.dispatch(e,t);let r=this.pendingOpens.get(e.sessionId);if(r&&(e.kind===`cancel`||e.kind===`close`)){let n=r.identity.operationId===e.operationId&&r.identity.generation===e.generation;return n&&(r.canceled=!0),t(n?{protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}:{protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:{message:`stale lifecycle targets another pending worksheet operation`,errorName:`PullSessionProtocolError`,code:`ooxml-stale-lifecycle`}}),Promise.resolve()}return e.kind===`cancel`||e.kind===`close`?(t({protocol:E,kind:`accepted`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,command:e.kind}),Promise.resolve()):(t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(Error(`worksheet pull session is not open`))}),Promise.resolve())}async dispatchSafely(e,t){try{await this.dispatch(e,t)}catch(n){try{t({protocol:E,kind:`error`,sessionId:e.sessionId,operationId:e.operationId,generation:e.generation,requestId:e.requestId,error:w(n)})}catch{}}}run(e){let t=this.operationTail.then(()=>this.coordinator.enqueue(async()=>{if(this.resourceFailure)throw this.resourceFailure;return e()})).catch(e=>{throw e instanceof r&&(this.resourceFailure??=e),e});return this.operationTail=t.then(()=>void 0,()=>void 0),t}async reset(){for(let e of this.pendingOpens.values())e.canceled=!0;let e=1;for(let{host:t,identity:n}of[...this.sessions.values()])await t.dispatch({protocol:E,kind:`close`,...n,requestId:e++},()=>void 0);this.sessions.clear(),await this.operationTail,this.pendingOpens.clear(),this.resourceFailure=void 0}requireArchive(){let e=this.archive();if(!e)throw Error(`Workbook not loaded`);return e}async closeIdentity(e){let t=this.sessions.get(e.sessionId);if(t){await t.host.dispatch({protocol:E,kind:`close`,...e,requestId:1},()=>void 0);return}let n=this.pendingOpens.get(e.sessionId);n&&n.identity.operationId===e.operationId&&n.identity.generation===e.generation&&(n.canceled=!0)}readResourceUsage(){return g(this.executeArchive(e=>e.sheet_cursor_resource_usage()))}};function it(e){return!!e&&typeof e==`object`&&e.protocol===`ooxml-pull-v1`}const Z=new Te(Be,{freeArchive:e=>e.free(),reinit:Ve});let Q=A;const $=new rt(()=>Z.archive,void 0,e=>{let t=Z.archive;if(!t)throw Error(`Workbook not loaded`);return Z.run(()=>e(t))},void 0,void 0,()=>Q);self.onmessage=async e=>{let n=e.data;if(it(n)){await $.dispatchSafely(n,(e,t)=>self.postMessage(e,t));return}if(n.type===`init`){Z.setWasmInput(t(n.wasmUrl)??n.wasmUrl);return}let r=n.id;n.type===`openSheetSession`&&$.reserveOpen(n);try{let e=n.type===`parse`?Me({xlsxWorksheetLimits:n.worksheetPolicy?.worksheet}):void 0;if(n.type===`openSheetSession`){await Z.ensureReady(),Z.archive&&Z.run(()=>Z.archive?.assert_healthy()),await $.open(n.sheetIndex,n.sheetName,n),await $.postOpenedSafely(n,()=>self.postMessage({type:`sheetSessionOpened`,id:r,sessionId:n.sessionId,operationId:n.operationId,generation:n.generation}),e=>self.postMessage({type:`error`,id:r,...w(e)}));return}n.type===`parse`&&await $.reset(),await(n.type===`extractImage`?$.runDuringPull:$.run).call($,async()=>{if(await Z.ensureReady(),n.type!==`parse`&&Z.archive){let e=Z.archive;Z.run(()=>e.assert_healthy())}if(n.type===`parse`){let[t,i,a]=Oe(n.resourcePolicy),o=new Uint8Array(n.data);Q=e??A;let s=Ne(Q),{workbook:c,usage:l}=He(()=>Z.run(()=>{let e=new M(o,t,i,a);return Z.setArchive(e),e.set_worksheet_limits(...s),e.parse()}),()=>Z.run(()=>Z.archive.resource_usage())),u=c.buffer,d={type:`parsed`,id:r,workbookJson:u,usage:l};self.postMessage(d,[u]);return}let t=Z.archive;if(n.type===`extractImage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>t.extract_image(n.path).buffer),i={type:`imageExtracted`,id:r,bytes:e};self.postMessage(i,[e]);return}if(n.type===`resourceUsage`){if(!t)throw Error(`No xlsx loaded`);let e=Z.run(()=>g(t.resource_usage()));self.postMessage({type:`resourceUsage`,id:r,usage:e});return}if(n.type===`toMarkdown`){if(!t)throw Error(`No xlsx loaded`);let e={type:`markdownRendered`,id:r,markdown:Z.run(()=>t.to_markdown())};self.postMessage(e);return}})}catch(e){n.type===`openSheetSession`&&$.abandonOpen(n.sessionId);let t={type:`error`,id:r,...w(e)};try{self.postMessage(t)}catch{}}};", Jt = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", qt], { type: "text/javascript;charset=utf-8" });
|
|
15
|
+
function Yt(e) {
|
|
16
16
|
let t;
|
|
17
17
|
try {
|
|
18
|
-
if (t =
|
|
18
|
+
if (t = Jt && (self.URL || self.webkitURL).createObjectURL(Jt), !t) throw "";
|
|
19
19
|
let n = new Worker(t, {
|
|
20
20
|
type: "module",
|
|
21
21
|
name: e?.name
|
|
@@ -24,27 +24,27 @@ function Zt(e) {
|
|
|
24
24
|
(self.URL || self.webkitURL).revokeObjectURL(t);
|
|
25
25
|
}), n;
|
|
26
26
|
} catch {
|
|
27
|
-
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(
|
|
27
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(qt), {
|
|
28
28
|
type: "module",
|
|
29
29
|
name: e?.name
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
var
|
|
34
|
-
function
|
|
33
|
+
var Xt = new URL("xlsx_parser_bg.wasm", import.meta.url).href;
|
|
34
|
+
function Zt(e, t) {
|
|
35
35
|
return !Number.isInteger(t) || t < 0 || t >= e.length ? "visible" : e[t].visibility ?? "visible";
|
|
36
36
|
}
|
|
37
|
-
var
|
|
38
|
-
function
|
|
37
|
+
var Qt = Symbol("xlsx-render-commit-guard");
|
|
38
|
+
function $t(e, t) {
|
|
39
39
|
return {
|
|
40
40
|
...e,
|
|
41
|
-
[
|
|
41
|
+
[Qt]: t
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function en(e, t) {
|
|
45
45
|
return e === void 0 ? t : t === void 0 ? e : Math.max(e, t);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function tn(e, t) {
|
|
48
48
|
if (!e && !t) return null;
|
|
49
49
|
let n = e ? 1 - e.l - e.r : 1, r = (t ? 1 - t.l - t.r : 1) < n ? t : e, i = e ? 1 - e.t - e.b : 1, a = (t ? 1 - t.t - t.b : 1) < i ? t : e;
|
|
50
50
|
return {
|
|
@@ -54,27 +54,27 @@ function nn(e, t) {
|
|
|
54
54
|
b: a?.b ?? 0
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function nn(e, t) {
|
|
58
58
|
return e ? t ? e === t ? e : void 0 : e : t;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function rn(e, t) {
|
|
61
61
|
return {
|
|
62
62
|
...e,
|
|
63
|
-
svgImagePath:
|
|
64
|
-
widthPt:
|
|
65
|
-
heightPt:
|
|
66
|
-
srcRect:
|
|
63
|
+
svgImagePath: nn(e.svgImagePath, t.svgImagePath),
|
|
64
|
+
widthPt: en(e.widthPt, t.widthPt),
|
|
65
|
+
heightPt: en(e.heightPt, t.heightPt),
|
|
66
|
+
srcRect: tn(e.srcRect, t.srcRect),
|
|
67
67
|
failClosedOnDuotoneFailure: e.failClosedOnDuotoneFailure || t.failClosedOnDuotoneFailure || void 0,
|
|
68
|
-
targetWidthPx:
|
|
69
|
-
targetHeightPx:
|
|
68
|
+
targetWidthPx: en(e.targetWidthPx, t.targetWidthPx),
|
|
69
|
+
targetHeightPx: en(e.targetHeightPx, t.targetHeightPx)
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function an(e, t, n) {
|
|
73
73
|
let r = e.get(t);
|
|
74
|
-
e.set(t, r ?
|
|
74
|
+
e.set(t, r ? rn(r, n) : n);
|
|
75
75
|
}
|
|
76
|
-
function
|
|
77
|
-
let { col: i, row: a } = (n ??
|
|
76
|
+
function on(e, t, n, r) {
|
|
77
|
+
let { col: i, row: a } = (n ?? H(t)).axesAtScale(r), o = Ie(t, e, i, a, r);
|
|
78
78
|
return o.width > 0 && o.height > 0 ? {
|
|
79
79
|
width: o.width,
|
|
80
80
|
height: o.height
|
|
@@ -86,7 +86,7 @@ var sn = {
|
|
|
86
86
|
};
|
|
87
87
|
function cn(e, t, n, r, i) {
|
|
88
88
|
if (!e?.length) return sn;
|
|
89
|
-
let a =
|
|
89
|
+
let a = re(e, t, n);
|
|
90
90
|
return a === null ? null : a.x === 0 && a.y === 0 ? sn : r > 0 && i > 0 ? {
|
|
91
91
|
x: a.x / r,
|
|
92
92
|
y: a.y / i
|
|
@@ -99,10 +99,10 @@ function ln(e, t) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
function un(e, t, n, r, i, a = sn) {
|
|
102
|
-
if (!n || a === null) return e.anchorTag === void 0 ||
|
|
103
|
-
let o = r ??
|
|
102
|
+
if (!n || a === null) return e.anchorTag === void 0 || on(e, t, r, i?.scale ?? 1) !== null;
|
|
103
|
+
let o = r ?? H(t), s = i?.scale ?? 1, { col: c, row: l } = o.axesAtScale(s), u = Ie(t, e, c, l, s);
|
|
104
104
|
if (u.width <= 0 || u.height <= 0) return !1;
|
|
105
|
-
let d = u.width * a.x, f = u.height * a.y, p =
|
|
105
|
+
let d = u.width * a.x, f = u.height * a.y, p = Re({
|
|
106
106
|
x: u.x - d,
|
|
107
107
|
y: u.y - f,
|
|
108
108
|
width: u.width + 2 * d,
|
|
@@ -136,36 +136,36 @@ async function dn(e, t, r, i, a = 0, o = 0, s = null, c = null, l, u = !1, d, f,
|
|
|
136
136
|
offscreenFactory: l,
|
|
137
137
|
failClosedOnDuotoneFailure: u,
|
|
138
138
|
tiff: d,
|
|
139
|
-
svgDecoder: p ?? (typeof Image < "u" ?
|
|
139
|
+
svgDecoder: p ?? (typeof Image < "u" ? A : void 0),
|
|
140
140
|
...f ?? {},
|
|
141
141
|
...m ? { maxRetainedPixels: m } : {}
|
|
142
142
|
}), b = {
|
|
143
143
|
svgImagePath: r,
|
|
144
144
|
srcRect: s
|
|
145
145
|
};
|
|
146
|
-
if (!c &&
|
|
147
|
-
return await
|
|
146
|
+
if (!c && P(b)) try {
|
|
147
|
+
return await I(b.svgImagePath, i, {
|
|
148
148
|
...f,
|
|
149
149
|
maxRetainedPixels: m,
|
|
150
150
|
workerDecoder: p
|
|
151
151
|
});
|
|
152
152
|
} catch (t) {
|
|
153
|
-
if (t instanceof _ ||
|
|
154
|
-
return h ?
|
|
153
|
+
if (t instanceof _ || R(t)) throw t;
|
|
154
|
+
return h ? I(e, i, {
|
|
155
155
|
...f,
|
|
156
156
|
maxRetainedPixels: m,
|
|
157
157
|
workerDecoder: p
|
|
158
158
|
}) : y();
|
|
159
159
|
}
|
|
160
|
-
return h && c ? y() : h ?
|
|
160
|
+
return h && c ? y() : h ? I(e, i, {
|
|
161
161
|
...f,
|
|
162
162
|
maxRetainedPixels: m,
|
|
163
163
|
workerDecoder: p
|
|
164
164
|
}) : y();
|
|
165
165
|
}
|
|
166
166
|
async function fn(e, n, i, g) {
|
|
167
|
-
if (n.clear(),
|
|
168
|
-
let v = i, y = /* @__PURE__ */ new Map(), b = g?.viewport ?
|
|
167
|
+
if (n.clear(), ht(n), !i) return;
|
|
168
|
+
let v = i, y = /* @__PURE__ */ new Map(), b = g?.viewport ? H(e) : void 0, x = g?.viewport && g.width !== void 0 && g.height !== void 0 ? {
|
|
169
169
|
width: g.width,
|
|
170
170
|
height: g.height,
|
|
171
171
|
scale: g.cellScale ?? 1,
|
|
@@ -173,9 +173,9 @@ async function fn(e, n, i, g) {
|
|
|
173
173
|
freezeCols: g.freezeCols ?? e.freezeCols ?? 0
|
|
174
174
|
} : void 0;
|
|
175
175
|
if (e.images) for (let n of e.images) {
|
|
176
|
-
if (!un(n, e, g?.viewport, b, x, ((e) => cn(n.blipEffects, e.cx, e.cy, e.cx, e.cy))(
|
|
177
|
-
let i =
|
|
178
|
-
|
|
176
|
+
if (!un(n, e, g?.viewport, b, x, ((e) => cn(n.blipEffects, e.cx, e.cy, e.cx, e.cy))(pt(n)))) continue;
|
|
177
|
+
let i = on(n, e, b, g?.cellScale ?? 1), a = pt(n), o = et(n, a), s = n.blipEffects?.length ? rt(a) : null;
|
|
178
|
+
an(y, $e(n.imagePath, o, a), {
|
|
179
179
|
imagePath: n.imagePath,
|
|
180
180
|
mimeType: n.mimeType,
|
|
181
181
|
svgImagePath: n.svgImagePath,
|
|
@@ -195,8 +195,8 @@ async function fn(e, n, i, g) {
|
|
|
195
195
|
if (e.shapeGroups) {
|
|
196
196
|
for (let n of e.shapeGroups) if (un(n, e, g?.viewport, b, x, n.shapes.reduce((e, t) => t.geom?.type === "image" ? ln(e, cn(t.geom.blipEffects, n.nativeExtCx * t.w, n.nativeExtCy * t.h, n.nativeExtCx, n.nativeExtCy)) : e, sn))) {
|
|
197
197
|
for (let i of n.shapes) if (i.geom.type === "image") {
|
|
198
|
-
let a =
|
|
199
|
-
|
|
198
|
+
let a = on(n, e, b, g?.cellScale ?? 1), o = Qe(n, i), s = et(i.geom, o), c = i.geom.blipEffects?.length ? rt(o) : null;
|
|
199
|
+
an(y, $e(i.geom.imagePath, s, o), {
|
|
200
200
|
imagePath: i.geom.imagePath,
|
|
201
201
|
mimeType: i.geom.mimeType,
|
|
202
202
|
svgImagePath: i.geom.svgImagePath,
|
|
@@ -215,10 +215,10 @@ async function fn(e, n, i, g) {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
let S = e.charts ?? [], C = S.length > 0 ? b ??
|
|
218
|
+
let S = e.charts ?? [], C = S.length > 0 ? b ?? H(e) : b, w = [];
|
|
219
219
|
for (let n of S) {
|
|
220
220
|
if (!un(n, e, g?.viewport, C, x)) continue;
|
|
221
|
-
let r =
|
|
221
|
+
let r = on(n, e, C, g?.cellScale ?? 1);
|
|
222
222
|
if (!r || !Number.isFinite(r.width) || !Number.isFinite(r.height) || r.width <= 0 || r.height <= 0) continue;
|
|
223
223
|
let i = d(n.chart), a = {
|
|
224
224
|
widthPt: r.width * (t / u),
|
|
@@ -260,7 +260,7 @@ async function fn(e, n, i, g) {
|
|
|
260
260
|
}
|
|
261
261
|
let D = new Set(T.map(({ fill: e }) => a(e))), O = (e) => {
|
|
262
262
|
let t = [], n = g?.cellScale ?? 1;
|
|
263
|
-
for (let r of w) for (let { fill: i, occurrence: o } of
|
|
263
|
+
for (let r of w) for (let { fill: i, occurrence: o } of fe(r.chart.chart, {
|
|
264
264
|
x: 0,
|
|
265
265
|
y: 0,
|
|
266
266
|
w: r.displayWidth / n,
|
|
@@ -277,7 +277,7 @@ async function fn(e, n, i, g) {
|
|
|
277
277
|
renderedSize: o
|
|
278
278
|
}), t.push(e));
|
|
279
279
|
}
|
|
280
|
-
return
|
|
280
|
+
return pe(E.size), t;
|
|
281
281
|
};
|
|
282
282
|
O();
|
|
283
283
|
for (let e of w) for (let { usage: t, size: n } of e.usages) {
|
|
@@ -298,7 +298,7 @@ async function fn(e, n, i, g) {
|
|
|
298
298
|
}
|
|
299
299
|
let k = (e, t) => {
|
|
300
300
|
let { fill: n, widthPt: r, heightPt: i, targetWidthPx: a, targetHeightPx: s, hasSourceCrop: c, renderedSize: l } = t;
|
|
301
|
-
|
|
301
|
+
an(y, e, {
|
|
302
302
|
imagePath: n.imagePath,
|
|
303
303
|
mimeType: n.mimeType,
|
|
304
304
|
svgImagePath: n.svgImagePath,
|
|
@@ -320,22 +320,22 @@ async function fn(e, n, i, g) {
|
|
|
320
320
|
};
|
|
321
321
|
for (let [e, t] of E) k(e, t);
|
|
322
322
|
if (y.size === 0) return;
|
|
323
|
-
let A =
|
|
324
|
-
if (!t.targetWidthPx || !t.targetHeightPx || t.mimeType === "image/svg+xml" || t.duotone || !t.duotone &&
|
|
323
|
+
let A = oe(g?.imageResources), te = se((await Promise.all([...y].map(async ([e, t]) => {
|
|
324
|
+
if (!t.targetWidthPx || !t.targetHeightPx || t.mimeType === "image/svg+xml" || t.duotone || !t.duotone && P({
|
|
325
325
|
svgImagePath: t.svgImagePath,
|
|
326
326
|
srcRect: t.srcRect
|
|
327
327
|
})) return null;
|
|
328
|
-
if (
|
|
328
|
+
if (le(t.mimeType) && (A.resolution === "display" || A.strategy === "adaptive")) return {
|
|
329
329
|
key: e,
|
|
330
330
|
targetWidthPx: t.targetWidthPx,
|
|
331
331
|
targetHeightPx: t.targetHeightPx,
|
|
332
332
|
retainedSurfaceCount: 1
|
|
333
333
|
};
|
|
334
|
-
let n = await
|
|
335
|
-
if (e instanceof _ ||
|
|
334
|
+
let n = await ee(t.imagePath, t.mimeType, v).catch((e) => {
|
|
335
|
+
if (e instanceof _ || R(e)) throw e;
|
|
336
336
|
return null;
|
|
337
337
|
});
|
|
338
|
-
return !n?.dimensions || !
|
|
338
|
+
return !n?.dimensions || !ue(n.format, g?.tiff !== void 0) ? null : {
|
|
339
339
|
key: e,
|
|
340
340
|
targetWidthPx: t.targetWidthPx,
|
|
341
341
|
targetHeightPx: t.targetHeightPx,
|
|
@@ -345,14 +345,14 @@ async function fn(e, n, i, g) {
|
|
|
345
345
|
};
|
|
346
346
|
}))).filter((e) => e !== null), A);
|
|
347
347
|
for (let [e, t] of y) {
|
|
348
|
-
if (t.mimeType === "image/svg+xml" || !t.duotone &&
|
|
348
|
+
if (t.mimeType === "image/svg+xml" || !t.duotone && P({
|
|
349
349
|
svgImagePath: t.svgImagePath,
|
|
350
350
|
srcRect: t.srcRect
|
|
351
351
|
})) continue;
|
|
352
|
-
let n =
|
|
352
|
+
let n = te.targets.get(e);
|
|
353
353
|
t.targetWidthPx = n?.width, t.targetHeightPx = n?.height, t.plannedPixelLimit = n?.maxRetainedPixels;
|
|
354
354
|
}
|
|
355
|
-
let
|
|
355
|
+
let j = async ([e, t]) => {
|
|
356
356
|
try {
|
|
357
357
|
let r = await dn(t.imagePath, t.mimeType, t.svgImagePath, v, t.widthPt, t.heightPt, t.srcRect, t.duotone, g?.offscreenFactory, t.failClosedOnDuotoneFailure ?? !1, g?.tiff, t.targetWidthPx && t.targetHeightPx ? {
|
|
358
358
|
targetWidthPx: t.targetWidthPx,
|
|
@@ -360,46 +360,46 @@ async function fn(e, n, i, g) {
|
|
|
360
360
|
} : void 0, g?.svgDecoder, t.plannedPixelLimit);
|
|
361
361
|
n.set(e, r);
|
|
362
362
|
} catch (t) {
|
|
363
|
-
if (
|
|
364
|
-
n.set(e, null),
|
|
363
|
+
if (de(t, "tiff") || me(t)) {
|
|
364
|
+
n.set(e, null), Xe(n, e, "tiff");
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
if (t instanceof _ ||
|
|
367
|
+
if (t instanceof _ || R(t) || t instanceof h && t.code === "unsupported-image-effect") throw t;
|
|
368
368
|
n.delete(e);
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
|
-
for (await Promise.all([...y.entries()].map(
|
|
371
|
+
for (await Promise.all([...y.entries()].map(j));;) {
|
|
372
372
|
let e = O(m(n, void 0, !1));
|
|
373
373
|
if (e.length === 0) break;
|
|
374
374
|
for (let t of e) k(t, E.get(t));
|
|
375
|
-
await Promise.all(e.map((e) =>
|
|
375
|
+
await Promise.all(e.map((e) => j([e, y.get(e)])));
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
var pn = /* @__PURE__ */ new WeakMap();
|
|
379
379
|
function mn(e, t, n, r) {
|
|
380
|
-
if (
|
|
381
|
-
let i =
|
|
382
|
-
if (a && a.sourceGeometry === i &&
|
|
380
|
+
if (ot(t)) return t;
|
|
381
|
+
let i = H(t), a = pn.get(t);
|
|
382
|
+
if (a && a.sourceGeometry === i && bt(a.projection) === bt(t)) return a.projection;
|
|
383
383
|
let o = {
|
|
384
384
|
...t,
|
|
385
385
|
rowHeights: { ...t.rowHeights }
|
|
386
386
|
};
|
|
387
|
-
|
|
387
|
+
Wt(t, o), ut(t, o);
|
|
388
388
|
let s = i.maximumDigitWidth;
|
|
389
|
-
return
|
|
389
|
+
return q.forWorksheet(o, s), ft(e, o, n, r), q.forWorksheet(o, s), pn.set(t, {
|
|
390
390
|
projection: o,
|
|
391
391
|
sourceGeometry: i
|
|
392
392
|
}), o;
|
|
393
393
|
}
|
|
394
394
|
async function hn(e, t, n, r = {}, i) {
|
|
395
395
|
let a = () => gn(e, t, n, r, i), o = !e.ws.isDialogSheet && ((e.ws.images?.length ?? 0) > 0 || (e.ws.shapeGroups?.some((e) => e.shapes.some((e) => e.geom.type === "image")) ?? !1) || c((e.ws.charts ?? []).map((e) => e.chart)).length > 0);
|
|
396
|
-
return r.fetchImage && o ?
|
|
396
|
+
return r.fetchImage && o ? te(r.fetchImage, r.imageResources, a) : a();
|
|
397
397
|
}
|
|
398
398
|
async function gn(e, t, n, r = {}, a) {
|
|
399
|
-
if (r[
|
|
399
|
+
if (r[Qt]?.() === !1) return;
|
|
400
400
|
let o = e.styles, s = t.getContext("2d");
|
|
401
401
|
if (!s) throw Error("XLSX render target does not provide a 2-D canvas context");
|
|
402
|
-
|
|
402
|
+
ct(s, e.ws, r.officeFontRoutes, r.googleSubstitutes === !0), tt(e.ws, r.authoritativeMdw);
|
|
403
403
|
let c = e.ws.isDialogSheet ? e.ws : mn(s, e.ws, o, e.cjkFallback), l = E(t) ? t.clientWidth || 800 : t.width, u = E(t) ? t.clientHeight || 600 : t.height, d = r.width ?? l, f = r.height ?? u, p = r.dpr ?? O(), m = i(d * p, f * p), h = m.clamped ? p * m.scale : p, g = /* @__PURE__ */ new Map();
|
|
404
404
|
if (c.isDialogSheet || await fn(c, g, r.fetchImage, {
|
|
405
405
|
viewport: n,
|
|
@@ -415,7 +415,7 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
415
415
|
threeD: e.threeD,
|
|
416
416
|
regionMap: e.regionMap,
|
|
417
417
|
chartEx: e.chartEx
|
|
418
|
-
}), !c.isDialogSheet && e.math &&
|
|
418
|
+
}), !c.isDialogSheet && e.math && gt(c) && await Ze(c, e.math), r[Qt]?.() === !1) return;
|
|
419
419
|
let _ = m.width, v = m.height;
|
|
420
420
|
if (t.width !== _ && (t.width = _), t.height !== v && (t.height = v), E(t)) {
|
|
421
421
|
let e = `${d}px`, n = `${f}px`;
|
|
@@ -430,7 +430,7 @@ async function gn(e, t, n, r = {}, a) {
|
|
|
430
430
|
_n(y, d, f);
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
mt(y, c, o, n, {
|
|
434
434
|
...r,
|
|
435
435
|
dpr: h,
|
|
436
436
|
loadedImages: g,
|
|
@@ -477,9 +477,9 @@ function yn(e) {
|
|
|
477
477
|
let e = t.slice(0, i);
|
|
478
478
|
e.startsWith("'") && e.endsWith("'") && e.length >= 2 && (e = e.slice(1, -1).replace(/''/g, "'")), n = e, r = t.slice(i + 1);
|
|
479
479
|
}
|
|
480
|
-
let [a, o] = r.split(":"), s =
|
|
480
|
+
let [a, o] = r.split(":"), s = z(a ?? "");
|
|
481
481
|
if (s) {
|
|
482
|
-
let e = o ?
|
|
482
|
+
let e = o ? z(o) : s;
|
|
483
483
|
if (e) {
|
|
484
484
|
let t = {
|
|
485
485
|
row: Math.min(s.row, e.row),
|
|
@@ -540,15 +540,15 @@ function Sn(e, t) {
|
|
|
540
540
|
function Cn(e, t) {
|
|
541
541
|
if (!t) return;
|
|
542
542
|
let n = !1;
|
|
543
|
-
if (t.rowHeightRanges && (
|
|
544
|
-
n &&
|
|
543
|
+
if (t.rowHeightRanges && (Kt(e, t.rowHeightRanges), n = !0), t.rows && (n = Sn(e.rowHeights, t.rows) || n), t.cols && (n = Sn(e.colWidths, t.cols) || n), t.columnCssWidths) for (let [r, i] of Object.entries(t.columnCssWidths)) W(e, Number(r), i) && (n = !0);
|
|
544
|
+
n && q.invalidate(e);
|
|
545
545
|
}
|
|
546
546
|
function wn(e, t) {
|
|
547
547
|
return t ? Tn(e, t) : e;
|
|
548
548
|
}
|
|
549
549
|
function Tn(e, t) {
|
|
550
550
|
let n = { ...e };
|
|
551
|
-
return t && (n.rowHeights = { ...e.rowHeights }, n.colWidths = { ...e.colWidths }),
|
|
551
|
+
return t && (n.rowHeights = { ...e.rowHeights }, n.colWidths = { ...e.colWidths }), B(e, n), Ft(e, n), Wt(e, n), Cn(n, t), n;
|
|
552
552
|
}
|
|
553
553
|
var En = Symbol("xlsx-viewer-render-context");
|
|
554
554
|
function Dn(e, t, n) {
|
|
@@ -571,9 +571,9 @@ function On(e) {
|
|
|
571
571
|
projection: t.projection
|
|
572
572
|
} : { opts: n };
|
|
573
573
|
}
|
|
574
|
-
var kn = "load-delimited-text", J =
|
|
574
|
+
var kn = "load-delimited-text", J = At;
|
|
575
575
|
function An(e) {
|
|
576
|
-
if (e > J) throw
|
|
576
|
+
if (e > J) throw Et(kn, void 0, "delimited-text-source", "bytes", J, e);
|
|
577
577
|
}
|
|
578
578
|
Object.freeze({
|
|
579
579
|
fonts: [Object.freeze({
|
|
@@ -723,15 +723,15 @@ function Rn(e, t = {}) {
|
|
|
723
723
|
r = Math.max(r, t, n), i = Math.max(i, a, o);
|
|
724
724
|
}
|
|
725
725
|
return {
|
|
726
|
-
maxRow: Math.min(
|
|
727
|
-
maxCol: Math.min(
|
|
726
|
+
maxRow: Math.min(K, r),
|
|
727
|
+
maxCol: Math.min(G, i)
|
|
728
728
|
};
|
|
729
729
|
}
|
|
730
730
|
var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-row-heights"), Vn = Symbol("release-xlsx-viewer-projection"), Hn = Symbol("load-xlsx-sheet-source"), Un = class e {
|
|
731
731
|
metrics = null;
|
|
732
732
|
bridge = null;
|
|
733
733
|
delimitedTextBacked = !1;
|
|
734
|
-
japaneseCellFonts =
|
|
734
|
+
japaneseCellFonts = He();
|
|
735
735
|
parsedWorkbook = null;
|
|
736
736
|
sheetCache = /* @__PURE__ */ new Map();
|
|
737
737
|
sheetCacheUsage = /* @__PURE__ */ new Map();
|
|
@@ -741,11 +741,11 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
741
741
|
sheetPreviews = /* @__PURE__ */ new Map();
|
|
742
742
|
rawParts = new ie({
|
|
743
743
|
maxEntries: 64,
|
|
744
|
-
maxBytes:
|
|
744
|
+
maxBytes: j
|
|
745
745
|
});
|
|
746
746
|
queuedImageLoads = /* @__PURE__ */ new Map();
|
|
747
747
|
_fetchImage = (e, t) => this.getImageWithinArchiveOperation(e, t);
|
|
748
|
-
worksheetPolicy =
|
|
748
|
+
worksheetPolicy = It;
|
|
749
749
|
cjkFallback = "jp";
|
|
750
750
|
math;
|
|
751
751
|
threeD;
|
|
@@ -770,14 +770,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
770
770
|
};
|
|
771
771
|
resourceFailure = null;
|
|
772
772
|
constructor(e, t, n, r = !0) {
|
|
773
|
-
if (this._mode = t, e && (this.bridge = new
|
|
773
|
+
if (this._mode = t, e && (this.bridge = new ve(e, {
|
|
774
774
|
correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
|
|
775
775
|
toError: (e) => "type" in e && e.type === "error" ? T(e) : void 0,
|
|
776
776
|
onUnsolicited: (t) => {
|
|
777
|
-
|
|
777
|
+
Ne((t, n) => e.postMessage(t, n), t);
|
|
778
778
|
}
|
|
779
779
|
}), r)) {
|
|
780
|
-
let e = new URL(n ??
|
|
780
|
+
let e = new URL(n ?? Xt, location.href).href;
|
|
781
781
|
this.bridge.post({
|
|
782
782
|
type: "init",
|
|
783
783
|
wasmUrl: e
|
|
@@ -793,7 +793,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
793
793
|
throw TypeError("Unsupported XlsxSheetViewer source format");
|
|
794
794
|
}
|
|
795
795
|
static async loadDelimitedText(t, n, r) {
|
|
796
|
-
let i =
|
|
796
|
+
let i = U(n);
|
|
797
797
|
n = {
|
|
798
798
|
...n,
|
|
799
799
|
xlsxWorksheetLimits: i.worksheet
|
|
@@ -801,7 +801,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
801
801
|
...n,
|
|
802
802
|
cjkFallback: F(n.cjkFallback)
|
|
803
803
|
};
|
|
804
|
-
let a = jn(r), o = S(n), s = n.mode ?? "main", c = new
|
|
804
|
+
let a = jn(r), o = S(n), s = n.mode ?? "main", c = new M({
|
|
805
805
|
enabled: !0,
|
|
806
806
|
format: "xlsx",
|
|
807
807
|
mode: s,
|
|
@@ -819,29 +819,29 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
819
819
|
i = await Mn(e);
|
|
820
820
|
} else i = t;
|
|
821
821
|
An(i.byteLength), c.setSourceBytes(i.byteLength), c.checkpoint("source ready");
|
|
822
|
-
let o = s === "worker" ? (await import("./render-worker-host-
|
|
822
|
+
let o = s === "worker" ? (await import("./render-worker-host-DSrgUCkT.js")).createRenderWorker() : (await import("./delimited-text-worker-host-RwvuSsP2.js")).createDelimitedTextWorker(), l;
|
|
823
823
|
try {
|
|
824
824
|
let t = new e(o, s, void 0, !1);
|
|
825
825
|
return l = t, t.metrics = c, await t._loadDelimitedText(r === i ? i.slice(0) : i, n, a), s === "main" && (t.bridge?.terminate(), t.bridge = null), c.checkpoint("worksheet ready"), c.succeed({ sheets: 1 }), t;
|
|
826
826
|
} catch (e) {
|
|
827
827
|
let t = l;
|
|
828
|
-
throw
|
|
828
|
+
throw be(o, t ? () => t.destroy() : void 0), e;
|
|
829
829
|
}
|
|
830
830
|
} catch (e) {
|
|
831
831
|
throw c.fail(e), e;
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
static async load(t, n = {}) {
|
|
835
|
-
let r =
|
|
835
|
+
let r = U(n);
|
|
836
836
|
if (n = {
|
|
837
837
|
...n,
|
|
838
838
|
xlsxWorksheetLimits: r.worksheet
|
|
839
|
-
}, n.legacyXls !== void 0) return (await import("./workbook-model-source-
|
|
839
|
+
}, n.legacyXls !== void 0) return (await import("./workbook-model-source-CbEnWvU-.js")).loadXlsxModelSource(t, n, e);
|
|
840
840
|
n = {
|
|
841
841
|
...n,
|
|
842
842
|
cjkFallback: F(n.cjkFallback)
|
|
843
843
|
};
|
|
844
|
-
let i = S(n), a = n.mode ?? "main", o = new
|
|
844
|
+
let i = S(n), a = n.mode ?? "main", o = new M({
|
|
845
845
|
enabled: !0,
|
|
846
846
|
format: "xlsx",
|
|
847
847
|
mode: a,
|
|
@@ -861,26 +861,26 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
861
861
|
s = v(await y(s, n.password));
|
|
862
862
|
let c = s === r;
|
|
863
863
|
o.setSourceBytes(s.byteLength), o.checkpoint("container ready");
|
|
864
|
-
let l = a === "worker" ? (await import("./render-worker-host-
|
|
864
|
+
let l = a === "worker" ? (await import("./render-worker-host-DSrgUCkT.js")).createRenderWorker() : new Yt(), u;
|
|
865
865
|
try {
|
|
866
866
|
return u = new e(l, a, n.wasmUrl), u.metrics = o, await u._load(s, n, i.policy, (e) => o.observeUsage(e), c), o.checkpoint("workbook index ready"), o.succeed({ sheets: u.sheetCount }), u;
|
|
867
867
|
} catch (e) {
|
|
868
868
|
let t = u;
|
|
869
|
-
throw
|
|
869
|
+
throw be(l, t ? () => t.destroy() : void 0), e;
|
|
870
870
|
}
|
|
871
871
|
} catch (e) {
|
|
872
872
|
throw o.fail(e), e;
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
async _load(e, t = {}, n = w(t), r, i = !1) {
|
|
876
|
-
let a =
|
|
876
|
+
let a = U(t), o = this.requireBridge();
|
|
877
877
|
this.worksheetPolicy = a, this.resourceFailure = null, this.retainedSheetUsage = {
|
|
878
878
|
rows: 0,
|
|
879
879
|
cells: 0,
|
|
880
880
|
ownedUtf8Bytes: 0,
|
|
881
881
|
jsonBytes: 0
|
|
882
882
|
}, this.sheetCache.clear(), this.sheetCacheUsage.clear(), this.sheetLeases.clear(), this.completePendingEvictions(), await this.worksheetPullClient?.cancelAll("closed"), this.worksheetPullClient = null, this.generation = (this.generation ?? 0) + 1, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback = F(t.cjkFallback), this.math = this._mode === "worker" ? void 0 : t.math, this.threeD = this._mode === "worker" ? void 0 : t.threeD, this.regionMap = this._mode === "worker" ? void 0 : t.regionMap, this.chartEx = this._mode === "worker" ? void 0 : t.chartEx, this.tiff = this._mode === "worker" ? void 0 : t.tiff;
|
|
883
|
-
let s = this._mode === "worker" ?
|
|
883
|
+
let s = this._mode === "worker" ? yt(t) : void 0;
|
|
884
884
|
t.math && this._mode === "worker" && !s?.math && console.warn("[ooxml] a custom math renderer cannot cross the worker boundary; equations will be skipped in mode: 'worker'. Use the math renderer from @silurus/ooxml/math."), t.threeD && this._mode === "worker" && !s?.threeD && console.warn("[ooxml] a custom 3-D chart renderer cannot cross the worker boundary; charts use their 2-D family fallback in mode: 'worker'. Use the renderer from @silurus/ooxml/three-d."), t.regionMap && this._mode === "worker" && !s?.regionMap && console.warn("[ooxml] a custom Region Map renderer cannot cross the worker boundary; geospatial charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/region-map."), t.chartEx && this._mode === "worker" && !s?.chartEx && console.warn("[ooxml] a custom ChartEx renderer cannot cross the worker boundary; ChartEx charts use the unsupported-chart placeholder in mode: 'worker'. Use the renderer from @silurus/ooxml/chart-ex."), t.tiff && this._mode === "worker" && !s?.tiff && console.warn("[ooxml] a custom TIFF codec cannot cross the worker boundary; recognized TIFF images will use an unavailable-image placeholder in mode: 'worker'. Use the codec from @silurus/ooxml/tiff to display them.");
|
|
885
885
|
let c = i ? e.slice(0) : e, l = await o.request((e) => this._mode === "worker" ? {
|
|
886
886
|
type: "parse",
|
|
@@ -908,14 +908,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
908
908
|
}
|
|
909
909
|
let u = this.parsedWorkbook;
|
|
910
910
|
if (!u) throw Error("XLSX worker returned no workbook metadata");
|
|
911
|
-
this.cjkFallback =
|
|
911
|
+
this.cjkFallback = Ve(u, this.cjkFallback), this.ensureWorksheetPullClient();
|
|
912
912
|
let d = u.workbook.parseError;
|
|
913
|
-
d && console.warn(`[ooxml] xlsx opened with a degraded part: ${d}`), this.officeFontRequests =
|
|
913
|
+
d && console.warn(`[ooxml] xlsx opened with a degraded part: ${d}`), this.officeFontRequests = We(u), t.useGoogleFonts && (this.googleFontNames = [...Ue(u, this.cjkFallback)]), typeof document < "u" && document.fonts && await this.retainFontsInSet(document.fonts);
|
|
914
914
|
}
|
|
915
915
|
async _loadDelimitedText(e, t, n) {
|
|
916
|
-
let r =
|
|
916
|
+
let r = U(t), i = this.requireBridge();
|
|
917
917
|
this.worksheetPolicy = r, this.delimitedTextBacked = !0, this.workerTimeoutMs = t.workerTimeoutMs, this.googleSubstitutes = t.useGoogleFonts === !0, this.cjkFallback = F(t.cjkFallback), this.generation++, this.math = this._mode === "worker" ? void 0 : t.math, this.threeD = this._mode === "worker" ? void 0 : t.threeD, this.regionMap = this._mode === "worker" ? void 0 : t.regionMap, this.chartEx = this._mode === "worker" ? void 0 : t.chartEx, this.tiff = this._mode === "worker" ? void 0 : t.tiff;
|
|
918
|
-
let a = this._mode === "worker" ?
|
|
918
|
+
let a = this._mode === "worker" ? yt(t) : void 0, o = await i.request((i) => ({
|
|
919
919
|
type: "parseDelimitedText",
|
|
920
920
|
japaneseCellFonts: this.japaneseCellFonts,
|
|
921
921
|
id: i,
|
|
@@ -926,14 +926,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
926
926
|
cjkFallback: this.cjkFallback,
|
|
927
927
|
renderers: a
|
|
928
928
|
}), [e], { timeoutMs: t.workerTimeoutMs }), s = JSON.parse(new TextDecoder().decode(o.worksheetJson));
|
|
929
|
-
|
|
929
|
+
Tt(s, r), Le(s, this.japaneseCellFonts);
|
|
930
930
|
let c = o.workbook.workbook.sheets;
|
|
931
931
|
if (c.length !== 1 || c[0]?.name !== s.name) throw Error("Delimited text worker returned inconsistent worksheet metadata");
|
|
932
|
-
let l =
|
|
933
|
-
if (
|
|
932
|
+
let l = Ot(s, r);
|
|
933
|
+
if (Ct(l, "load-delimited-text", void 0, void 0, r), Pt(l.jsonBytes, "load-delimited-text", void 0, void 0, r), Dt(l, "load-delimited-text", void 0, void 0, r), this.parsedWorkbook = o.workbook, this.cjkFallback = Ve(o.workbook, this.cjkFallback), this.sheetCache.set(0, s), this.sheetCacheUsage.set(0, l), this.retainedSheetUsage = l, this.officeFontRequests = We(o.workbook), t.useGoogleFonts && (this.googleFontNames = [...Ue(o.workbook, this.cjkFallback)]), typeof document < "u" && document.fonts) {
|
|
934
934
|
await this.retainFontsInSet(document.fonts), await this.retainWorksheetOfficeFonts(s);
|
|
935
935
|
let e = this.retainedFontSets.get(document.fonts)?.loaded?.office;
|
|
936
|
-
|
|
936
|
+
dt(s, e?.routes, this.googleSubstitutes);
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
async retainFontsInSet(e) {
|
|
@@ -941,7 +941,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
941
941
|
let t = this.retainedFontSets.get(e);
|
|
942
942
|
if (t) t.refs++;
|
|
943
943
|
else {
|
|
944
|
-
let n = Promise.all([b(this.googleFontNames,
|
|
944
|
+
let n = Promise.all([b(this.googleFontNames, qe, e), k(this.officeFontRequests, e)]).then(([e, t]) => ({
|
|
945
945
|
google: e,
|
|
946
946
|
office: t
|
|
947
947
|
}));
|
|
@@ -965,7 +965,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
965
965
|
};
|
|
966
966
|
}
|
|
967
967
|
async retainWorksheetOfficeFonts(e) {
|
|
968
|
-
let t =
|
|
968
|
+
let t = Je(e).filter((e) => !this.officeFontRequests.some((t) => vt(t) === vt(e)));
|
|
969
969
|
t.length !== 0 && (this.officeFontRequests.push(...t), await Promise.all([...this.retainedFontSets].map(async ([e, n]) => {
|
|
970
970
|
let r = await n.loading, i = await k(t, e);
|
|
971
971
|
if (this.fontsDestroyed || this.retainedFontSets.get(e) !== n || n.refs <= 0) D(i.faces);
|
|
@@ -983,7 +983,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
983
983
|
[Bn](e, t) {
|
|
984
984
|
if (!this.parsedWorkbook) return;
|
|
985
985
|
let n = E(t.canvas) ? t.canvas.ownerDocument.fonts : null;
|
|
986
|
-
|
|
986
|
+
ct(t, e, n ? this.retainedFontSets.get(n)?.loaded?.office.routes : void 0, this.googleSubstitutes), H(e), ft(t, e, this.parsedWorkbook.styles, this.cjkFallback);
|
|
987
987
|
}
|
|
988
988
|
get sheetNames() {
|
|
989
989
|
return this.parsedWorkbook?.workbook.sheets.map((e) => e.name) ?? [];
|
|
@@ -995,7 +995,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
995
995
|
return this.parsedWorkbook?.workbook.sheets.map((e) => e.tabColor ?? null) ?? [];
|
|
996
996
|
}
|
|
997
997
|
sheetVisibility(e) {
|
|
998
|
-
return
|
|
998
|
+
return Zt(this.parsedWorkbook?.workbook.sheets ?? [], e);
|
|
999
999
|
}
|
|
1000
1000
|
isHidden(e) {
|
|
1001
1001
|
return this.sheetVisibility(e) !== "visible";
|
|
@@ -1113,47 +1113,47 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1113
1113
|
try {
|
|
1114
1114
|
for await (let u of i.stream(e, t)) {
|
|
1115
1115
|
if (u.kind === "preview") {
|
|
1116
|
-
if (u.worksheet && (
|
|
1116
|
+
if (u.worksheet && (Tt(u.worksheet, r), Le(u.worksheet, this.japaneseCellFonts)), n.preview(u.worksheet, u.reason, u.maxRow, u.maxCol), u.worksheet) {
|
|
1117
1117
|
In(u.worksheet, {
|
|
1118
1118
|
maxRow: u.maxRow,
|
|
1119
1119
|
maxCol: u.maxCol
|
|
1120
1120
|
}), await this.retainWorksheetOfficeFonts(u.worksheet);
|
|
1121
1121
|
let e = typeof document < "u" ? this.retainedFontSets.get(document.fonts)?.loaded?.office : void 0;
|
|
1122
|
-
|
|
1122
|
+
dt(u.worksheet, e?.routes, this.googleSubstitutes);
|
|
1123
1123
|
}
|
|
1124
1124
|
continue;
|
|
1125
1125
|
}
|
|
1126
1126
|
if (u.kind === "rows") {
|
|
1127
|
-
let e =
|
|
1128
|
-
|
|
1127
|
+
let e = St(o, jt(u.rows, r), r);
|
|
1128
|
+
Ct(e, "get-worksheet", void 0, u.usage, r), n.append(u.rows), o = e;
|
|
1129
1129
|
continue;
|
|
1130
1130
|
}
|
|
1131
1131
|
let e = u.worksheet;
|
|
1132
|
-
|
|
1133
|
-
let t =
|
|
1132
|
+
Tt(e, r), Le(e, this.japaneseCellFonts), e.rows = e.parseError ? [] : a;
|
|
1133
|
+
let t = wt(e, e.parseError ? {
|
|
1134
1134
|
rows: 0,
|
|
1135
1135
|
cells: 0,
|
|
1136
1136
|
ownedUtf8Bytes: 0
|
|
1137
1137
|
} : o, r);
|
|
1138
|
-
|
|
1139
|
-
let i = this.retainedSheetUsage, d =
|
|
1138
|
+
Ct(t, "get-worksheet", void 0, u.usage, r), Pt(t.jsonBytes, "get-worksheet", void 0, u.usage, r);
|
|
1139
|
+
let i = this.retainedSheetUsage, d = Mt(i, t, {}, r), f = [];
|
|
1140
1140
|
for (let [e] of this.sheetCache) {
|
|
1141
1141
|
try {
|
|
1142
|
-
|
|
1142
|
+
Dt(d, "get-worksheet", void 0, u.usage, r);
|
|
1143
1143
|
break;
|
|
1144
1144
|
} catch (e) {
|
|
1145
1145
|
if (!(e instanceof _)) throw e;
|
|
1146
1146
|
}
|
|
1147
1147
|
if ((this.sheetLeases.get(e) ?? 0) > 0) continue;
|
|
1148
1148
|
let n = this.sheetCacheUsage.get(e);
|
|
1149
|
-
n && (i =
|
|
1149
|
+
n && (i = Mt(i, {
|
|
1150
1150
|
rows: 0,
|
|
1151
1151
|
cells: 0,
|
|
1152
1152
|
ownedUtf8Bytes: 0,
|
|
1153
1153
|
jsonBytes: 0
|
|
1154
|
-
}, n, r), d =
|
|
1154
|
+
}, n, r), d = Mt(i, t, {}, r), f.push(e));
|
|
1155
1155
|
}
|
|
1156
|
-
|
|
1156
|
+
Dt(d, "get-worksheet", void 0, u.usage, r);
|
|
1157
1157
|
let p;
|
|
1158
1158
|
if (f.length && this._mode === "worker") {
|
|
1159
1159
|
let e;
|
|
@@ -1187,7 +1187,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1187
1187
|
if (u = !0, !s || !c || !l) throw Error(`XLSX worksheet ${e} did not produce a terminal model`);
|
|
1188
1188
|
this.retainedSheetUsage = c, this.sheetCache.set(e, s), this.sheetCacheUsage.set(e, l), await this.retainWorksheetOfficeFonts(s);
|
|
1189
1189
|
let d = typeof document < "u" ? this.retainedFontSets.get(document.fonts)?.loaded?.office : void 0;
|
|
1190
|
-
return
|
|
1190
|
+
return dt(s, d?.routes, this.googleSubstitutes), n.finish(s), s;
|
|
1191
1191
|
} catch (e) {
|
|
1192
1192
|
throw this._mode === "worker" && s && !u && this.destroy(), this.latchFatalResourceFailure(e), n.fail(e), e;
|
|
1193
1193
|
}
|
|
@@ -1195,9 +1195,9 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1195
1195
|
ensureWorksheetPullClient() {
|
|
1196
1196
|
if (this.worksheetPullClient) return this.worksheetPullClient;
|
|
1197
1197
|
if (!this.parsedWorkbook) throw Error("Workbook not loaded");
|
|
1198
|
-
return this.worksheetPullClient = new
|
|
1198
|
+
return this.worksheetPullClient = new Nt({
|
|
1199
1199
|
generation: this.generation || 1,
|
|
1200
|
-
transport: this.requireBridge().transport(
|
|
1200
|
+
transport: this.requireBridge().transport(kt),
|
|
1201
1201
|
sharedStrings: this.parsedWorkbook.sharedStrings,
|
|
1202
1202
|
timeoutMs: this.workerTimeoutMs,
|
|
1203
1203
|
open: async (e, t, n, r) => {
|
|
@@ -1269,14 +1269,14 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1269
1269
|
for (let t of e.rows) for (let e of t.cells) r.set(`${e.row}:${e.col}`, e);
|
|
1270
1270
|
return bn(n, (n, i) => {
|
|
1271
1271
|
let a = r.get(`${n}:${i}`);
|
|
1272
|
-
return a ?
|
|
1272
|
+
return a ? Ge(a, t, null, e.date1904) : null;
|
|
1273
1273
|
});
|
|
1274
1274
|
} finally {
|
|
1275
1275
|
i.release();
|
|
1276
1276
|
}
|
|
1277
1277
|
}
|
|
1278
1278
|
cellText(e, t) {
|
|
1279
|
-
return this.parsedWorkbook ?
|
|
1279
|
+
return this.parsedWorkbook ? Ge(t, this.parsedWorkbook.styles, null, e.date1904) : "";
|
|
1280
1280
|
}
|
|
1281
1281
|
async renderViewport(e, t, n, r = {}) {
|
|
1282
1282
|
if (this.assertResourceHealthy(), n = {
|
|
@@ -1310,7 +1310,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1310
1310
|
}
|
|
1311
1311
|
return this.withWorksheetArchiveOperation(t, (t) => {
|
|
1312
1312
|
let r = a.worksheet ?? wn(t, o);
|
|
1313
|
-
return r !== t &&
|
|
1313
|
+
return r !== t && ut(t, r), hn({
|
|
1314
1314
|
ws: r,
|
|
1315
1315
|
styles: i,
|
|
1316
1316
|
cjkFallback: this.cjkFallback,
|
|
@@ -1409,7 +1409,7 @@ var zn = Symbol("retain-xlsx-viewer-fonts"), Bn = Symbol("prepare-xlsx-viewer-ro
|
|
|
1409
1409
|
for (let e of this.sheetPreviews?.values() ?? []) e.fail(/* @__PURE__ */ Error("XLSX workbook has been destroyed"));
|
|
1410
1410
|
this.sheetPreviews?.clear(), this.fontsDestroyed = !0;
|
|
1411
1411
|
for (let e of this.retainedFontSets.values()) e.loaded && (C(e.loaded.google), D(e.loaded.office.faces));
|
|
1412
|
-
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [],
|
|
1412
|
+
this.retainedFontSets.clear(), this.googleFontNames = [], this.googleSubstitutes = !1, this.officeFontRequests = [], N(this._fetchImage), ne(this._fetchImage), this.rawParts.clear(), this.queuedImageLoads?.clear();
|
|
1413
1413
|
}
|
|
1414
1414
|
assertResourceHealthy() {
|
|
1415
1415
|
if (this.resourceFailure) throw this.resourceFailure;
|
|
@@ -1461,11 +1461,11 @@ function Zn(e, t, n) {
|
|
|
1461
1461
|
return t < 1 ? null : Yn(e, 1, t, n) ? "drawing-dependency" : null;
|
|
1462
1462
|
}
|
|
1463
1463
|
function Qn(e, t) {
|
|
1464
|
-
let n =
|
|
1464
|
+
let n = Ie(t.worksheet, e, t.colAxis, t.rowAxis, t.scale), { width: r, height: i } = n;
|
|
1465
1465
|
if (r <= 0 || i <= 0) return null;
|
|
1466
1466
|
let a = t.colAxis.offsetOf(t.startCol), o = t.rowAxis.offsetOf(t.startRow);
|
|
1467
1467
|
return {
|
|
1468
|
-
x:
|
|
1468
|
+
x: V(t.scrollAreaX + (n.x - a) - t.scrollOffsetX, r, t.canvasWidth, t.rtl),
|
|
1469
1469
|
y: t.scrollAreaY + (n.y - o) - t.scrollOffsetY,
|
|
1470
1470
|
width: r,
|
|
1471
1471
|
height: i
|
|
@@ -1475,15 +1475,15 @@ function $n(e, t) {
|
|
|
1475
1475
|
return e.x >= t.x && e.x <= t.x + t.width && e.y >= t.y && e.y <= t.y + t.height;
|
|
1476
1476
|
}
|
|
1477
1477
|
function er(e, t) {
|
|
1478
|
-
let n =
|
|
1478
|
+
let n = V(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1479
1479
|
return e.x + e.width >= n && e.x <= n + t.scrollAreaW && e.y + e.height >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1480
1480
|
}
|
|
1481
1481
|
function tr(e, t) {
|
|
1482
|
-
let n =
|
|
1482
|
+
let n = V(t.scrollAreaX, t.scrollAreaW, t.canvasWidth, t.rtl);
|
|
1483
1483
|
return e.x >= n && e.x <= n + t.scrollAreaW && e.y >= t.scrollAreaY && e.y <= t.scrollAreaY + t.scrollAreaH;
|
|
1484
1484
|
}
|
|
1485
1485
|
function nr(e, t) {
|
|
1486
|
-
let n =
|
|
1486
|
+
let n = H(e), r = t.cellScale, { col: i, row: a } = n.axesAtScale(r), o = Math.round(50 * r), s = Math.round(22 * r), c = i.bandsToCover(1, t.freezeCols, Math.max(0, t.width - o)), l = a.bandsToCover(1, t.freezeRows, Math.max(0, t.height - s)), u = c.reduce((e, t) => e + t.size, 0), d = l.reduce((e, t) => e + t.size, 0);
|
|
1487
1487
|
return {
|
|
1488
1488
|
worksheet: e,
|
|
1489
1489
|
colAxis: i,
|
|
@@ -1515,7 +1515,7 @@ function rr(e, t, n) {
|
|
|
1515
1515
|
height: r.h * o.height
|
|
1516
1516
|
}, a = r.rot);
|
|
1517
1517
|
}
|
|
1518
|
-
let s =
|
|
1518
|
+
let s = V(r.scrollAreaX, r.scrollAreaW, r.canvasWidth, r.rtl);
|
|
1519
1519
|
return {
|
|
1520
1520
|
rect: o,
|
|
1521
1521
|
clip: {
|
|
@@ -1558,7 +1558,7 @@ function ar(e, t) {
|
|
|
1558
1558
|
n.push("\n"), r++;
|
|
1559
1559
|
}
|
|
1560
1560
|
for (let e of o.runs) {
|
|
1561
|
-
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o =
|
|
1561
|
+
let a = e.type === "text" ? e.text : e.type === "break" ? "\n" : "[equation]", o = Ae(a, Math.max(0, t - r));
|
|
1562
1562
|
if (n.push(o), r += o.length, o.length < a.length) {
|
|
1563
1563
|
i = !0;
|
|
1564
1564
|
break;
|
|
@@ -1592,7 +1592,7 @@ function sr(e, t, n, r, i) {
|
|
|
1592
1592
|
for (let a = e.charts.length - 1; a >= 0; a--) {
|
|
1593
1593
|
let o = e.charts[a], s = Qn(o, r);
|
|
1594
1594
|
if (!s || !er(s, r) || !$n(n, s)) continue;
|
|
1595
|
-
let c =
|
|
1595
|
+
let c = Te(o.chart, i);
|
|
1596
1596
|
return {
|
|
1597
1597
|
...or(e, t, "chart", a, o, c.text, c.truncated, c.maxTextCharacters),
|
|
1598
1598
|
seriesCount: o.chart.series.length
|
|
@@ -1638,23 +1638,23 @@ function lr(e, t, n, r, i) {
|
|
|
1638
1638
|
function ur(e, t, n, r, i) {
|
|
1639
1639
|
for (let a = e.images.length - 1; a >= 0; a--) {
|
|
1640
1640
|
let o = e.images[a], s = Qn(o, r);
|
|
1641
|
-
if (s && er(
|
|
1641
|
+
if (s && er(Re(s, o.rotation), r) && $n(Ye(n, s, o.rotation, o.flipH, o.flipV), s)) return {
|
|
1642
1642
|
...or(e, t, "image", a, o, void 0, !1, i),
|
|
1643
1643
|
mimeType: o.svgImagePath ? "image/svg+xml" : o.mimeType
|
|
1644
1644
|
};
|
|
1645
1645
|
}
|
|
1646
1646
|
return null;
|
|
1647
1647
|
}
|
|
1648
|
-
function dr(e, t, n, r, i =
|
|
1648
|
+
function dr(e, t, n, r, i = we) {
|
|
1649
1649
|
if (!Number.isFinite(n.x) || !Number.isFinite(n.y)) throw RangeError("XLSX hit-test point must contain finite coordinates.");
|
|
1650
1650
|
if (!Number.isFinite(i) || i < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1651
|
-
let a = Math.min(
|
|
1651
|
+
let a = Math.min(we, Math.floor(i)), o = nr(e, r);
|
|
1652
1652
|
return tr(n, o) ? sr(e, t, n, o, a) ?? lr(e, t, n, o, a) ?? ur(e, t, n, o, a) : null;
|
|
1653
1653
|
}
|
|
1654
1654
|
function fr(e, t) {
|
|
1655
1655
|
let n = t ?? e.maxTextCharacters;
|
|
1656
1656
|
if (!Number.isFinite(n) || n < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
|
|
1657
|
-
let r = Math.min(
|
|
1657
|
+
let r = Math.min(we, Math.floor(n)), i = e.text === void 0 ? void 0 : Ae(e.text, r), a = e.truncated || e.text !== void 0 && i.length < e.text.length;
|
|
1658
1658
|
return {
|
|
1659
1659
|
...structuredClone(e),
|
|
1660
1660
|
...i === void 0 ? {} : { text: i },
|
|
@@ -1666,7 +1666,7 @@ function fr(e, t) {
|
|
|
1666
1666
|
}
|
|
1667
1667
|
var pr = 128, mr = 1e4, hr = 8 * 1024 * 1024;
|
|
1668
1668
|
function gr(e) {
|
|
1669
|
-
return e.areas.reduce((e, t) => e + (t.kind === "cells" ? (t.bottom - t.top + 1) * (t.right - t.left + 1) : t.kind === "rows" ? (t.lastRow - t.firstRow + 1) *
|
|
1669
|
+
return e.areas.reduce((e, t) => e + (t.kind === "cells" ? (t.bottom - t.top + 1) * (t.right - t.left + 1) : t.kind === "rows" ? (t.lastRow - t.firstRow + 1) * G : t.kind === "columns" ? (t.lastColumn - t.firstColumn + 1) * K : K * G), 0);
|
|
1670
1670
|
}
|
|
1671
1671
|
function Y(e, t) {
|
|
1672
1672
|
return Number.isInteger(e) && e >= 1 && e <= t;
|
|
@@ -1785,7 +1785,7 @@ function xr(e) {
|
|
|
1785
1785
|
}
|
|
1786
1786
|
let i = t.split(":");
|
|
1787
1787
|
if (i.length > 2) return null;
|
|
1788
|
-
let a =
|
|
1788
|
+
let a = z(i[0]), o = i.length === 2 ? z(i[1]) : a;
|
|
1789
1789
|
if (!a || !o) return null;
|
|
1790
1790
|
let s = {
|
|
1791
1791
|
kind: "cells",
|
|
@@ -1830,7 +1830,7 @@ function Cr(e, t, n) {
|
|
|
1830
1830
|
});
|
|
1831
1831
|
}
|
|
1832
1832
|
}
|
|
1833
|
-
return
|
|
1833
|
+
return Ht(i), Object.freeze(i.map((e) => Object.freeze(e)));
|
|
1834
1834
|
}
|
|
1835
1835
|
var wr = class {
|
|
1836
1836
|
stashedRowHeights = /* @__PURE__ */ new Map();
|
|
@@ -1857,11 +1857,11 @@ var wr = class {
|
|
|
1857
1857
|
let t = this.stashedRowHeights.get(r);
|
|
1858
1858
|
t === void 0 ? delete e.rowHeights[r] : e.rowHeights[r] = t, this.stashedRowHeights.delete(r);
|
|
1859
1859
|
} else e.rowHeights[r] === 0 && delete e.rowHeights[r];
|
|
1860
|
-
else if (i) this.stashedColWidths.has(r) || (this.stashedColWidths.set(r, e.colWidths[r]), this.stashedColCssWidths.set(r,
|
|
1860
|
+
else if (i) this.stashedColWidths.has(r) || (this.stashedColWidths.set(r, e.colWidths[r]), this.stashedColCssWidths.set(r, Bt(e, r))), e.colWidths[r] = 0, W(e, r, null);
|
|
1861
1861
|
else if (this.stashedColWidths.has(r)) {
|
|
1862
1862
|
let t = this.stashedColWidths.get(r);
|
|
1863
|
-
t === void 0 ? delete e.colWidths[r] : e.colWidths[r] = t,
|
|
1864
|
-
} else e.colWidths[r] === 0 && (delete e.colWidths[r],
|
|
1863
|
+
t === void 0 ? delete e.colWidths[r] : e.colWidths[r] = t, W(e, r, this.stashedColCssWidths.get(r) ?? null), this.stashedColWidths.delete(r), this.stashedColCssWidths.delete(r);
|
|
1864
|
+
} else e.colWidths[r] === 0 && (delete e.colWidths[r], W(e, r, null));
|
|
1865
1865
|
this.recordSizeOverride(e, t, n, r);
|
|
1866
1866
|
}
|
|
1867
1867
|
recordSizeOverride(e, t, n, r, i) {
|
|
@@ -1877,8 +1877,8 @@ var wr = class {
|
|
|
1877
1877
|
n === "row" && a.automaticRows.delete(r);
|
|
1878
1878
|
let s = n === "row" ? e.rowHeights[r] ?? null : e.colWidths[r] ?? null, c = !1;
|
|
1879
1879
|
if (o.get(r) !== s && (o.set(r, s), c = !0), n === "col") {
|
|
1880
|
-
i !== void 0 &&
|
|
1881
|
-
let t =
|
|
1880
|
+
i !== void 0 && W(e, r, i);
|
|
1881
|
+
let t = Bt(e, r) ?? null;
|
|
1882
1882
|
(a.colCss.has(r) ? a.colCss.get(r) !== t : t !== null) && (a.colCss.set(r, t), c = !0);
|
|
1883
1883
|
}
|
|
1884
1884
|
c && (a.revision++, a.wire = void 0);
|
|
@@ -1889,7 +1889,7 @@ var wr = class {
|
|
|
1889
1889
|
if (o > r) throw RangeError(`A resize projection may retain at most ${r} manually edited bands per axis.`);
|
|
1890
1890
|
}
|
|
1891
1891
|
beginRowResizePreview(e, t, n) {
|
|
1892
|
-
let r =
|
|
1892
|
+
let r = Vt(e), i = !1, a = (n) => {
|
|
1893
1893
|
let r = this.sizeOverrideStore.get(t);
|
|
1894
1894
|
!r && n.length && (r = {
|
|
1895
1895
|
rows: /* @__PURE__ */ new Map(),
|
|
@@ -1897,7 +1897,7 @@ var wr = class {
|
|
|
1897
1897
|
cols: /* @__PURE__ */ new Map(),
|
|
1898
1898
|
colCss: /* @__PURE__ */ new Map(),
|
|
1899
1899
|
revision: 0
|
|
1900
|
-
}, this.sizeOverrideStore.set(t, r)),
|
|
1900
|
+
}, this.sizeOverrideStore.set(t, r)), Kt(e, n), r && (r.rowHeightRanges = n, r.revision++, r.wire = void 0), q.invalidate(e);
|
|
1901
1901
|
};
|
|
1902
1902
|
return {
|
|
1903
1903
|
apply: (e) => {
|
|
@@ -1909,8 +1909,8 @@ var wr = class {
|
|
|
1909
1909
|
};
|
|
1910
1910
|
}
|
|
1911
1911
|
restoreRowResizeRanges(e, t) {
|
|
1912
|
-
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r =
|
|
1913
|
-
(n.length || r.length) && n !== r && (
|
|
1912
|
+
let n = this.sizeOverrideStore.get(e)?.rowHeightRanges ?? [], r = Vt(t);
|
|
1913
|
+
(n.length || r.length) && n !== r && (Kt(t, n), q.invalidate(t));
|
|
1914
1914
|
}
|
|
1915
1915
|
wireSizeOverrides(e) {
|
|
1916
1916
|
let t = this.sizeOverrideStore.get(e);
|
|
@@ -1938,7 +1938,7 @@ var wr = class {
|
|
|
1938
1938
|
return this.sizeOverrideStore.get(e)?.revision ?? 0;
|
|
1939
1939
|
}
|
|
1940
1940
|
syncAutomaticRowOverrides(e, t) {
|
|
1941
|
-
let n = new Map(
|
|
1941
|
+
let n = new Map(lt(t)), r = this.sizeOverrideStore.get(e);
|
|
1942
1942
|
!r && n.size === 0 || (r || (r = {
|
|
1943
1943
|
rows: /* @__PURE__ */ new Map(),
|
|
1944
1944
|
automaticRows: /* @__PURE__ */ new Map(),
|
|
@@ -1960,7 +1960,7 @@ var wr = class {
|
|
|
1960
1960
|
if (n) {
|
|
1961
1961
|
for (let [e, r] of n.rows) r === null ? delete t.rowHeights[e] : t.rowHeights[e] = r;
|
|
1962
1962
|
for (let [e, r] of n.cols) r === null ? delete t.colWidths[e] : t.colWidths[e] = r;
|
|
1963
|
-
for (let [e, r] of n.colCss)
|
|
1963
|
+
for (let [e, r] of n.colCss) W(t, e, r);
|
|
1964
1964
|
}
|
|
1965
1965
|
let r = this.outlineStateStore.get(e);
|
|
1966
1966
|
if (r) {
|
|
@@ -2209,7 +2209,7 @@ var Z = class {
|
|
|
2209
2209
|
u.setTransform(l, 0, 0, l, 0, 0), u.clearRect(0, 0, s, c), u.fillStyle = r.background ?? "#f5f5f5", u.fillRect(0, 0, s, c);
|
|
2210
2210
|
let d = 19 * n;
|
|
2211
2211
|
u.strokeStyle = r.border ?? "#808080", u.lineWidth = 1, u.fillStyle = r.text ?? "#404040";
|
|
2212
|
-
let f =
|
|
2212
|
+
let f = H(t), p = f.effectiveFrozenBands({
|
|
2213
2213
|
scale: n,
|
|
2214
2214
|
width: this.host.canvasArea.clientWidth,
|
|
2215
2215
|
height: this.host.canvasArea.clientHeight,
|
|
@@ -2549,13 +2549,13 @@ function Yr(e, t, n) {
|
|
|
2549
2549
|
if (!e) return !1;
|
|
2550
2550
|
for (let r of e.split(/\s+/)) {
|
|
2551
2551
|
if (!r) continue;
|
|
2552
|
-
let [e, i] = r.split(":"), a =
|
|
2552
|
+
let [e, i] = r.split(":"), a = z(e);
|
|
2553
2553
|
if (!a) continue;
|
|
2554
2554
|
if (!i) {
|
|
2555
2555
|
if (a.row === t && a.col === n) return !0;
|
|
2556
2556
|
continue;
|
|
2557
2557
|
}
|
|
2558
|
-
let o =
|
|
2558
|
+
let o = z(i);
|
|
2559
2559
|
if (!o) continue;
|
|
2560
2560
|
let s = Math.min(a.row, o.row), c = Math.max(a.row, o.row), l = Math.min(a.col, o.col), u = Math.max(a.col, o.col);
|
|
2561
2561
|
if (t >= s && t <= c && n >= l && n <= u) return !0;
|
|
@@ -2705,7 +2705,7 @@ function ei(e) {
|
|
|
2705
2705
|
}
|
|
2706
2706
|
function ti(e, t, n) {
|
|
2707
2707
|
let r = $r(e), i = r >= 0 ? ei(e.slice(0, r)) : void 0, a = (r >= 0 ? e.slice(r + 1) : e).split(":", 1)[0]?.trim() ?? "";
|
|
2708
|
-
if (!
|
|
2708
|
+
if (!z(a)) return null;
|
|
2709
2709
|
let o = t;
|
|
2710
2710
|
if (i !== void 0) {
|
|
2711
2711
|
let e = i.toLocaleLowerCase("en-US");
|
|
@@ -2758,7 +2758,7 @@ var ri = class {
|
|
|
2758
2758
|
};
|
|
2759
2759
|
else return !1;
|
|
2760
2760
|
let r = this.host.onHyperlinkClick();
|
|
2761
|
-
return r ? (r(n), !0) : (n.kind === "external" ?
|
|
2761
|
+
return r ? (r(n), !0) : (n.kind === "external" ? L(n.url, void 0, this.host.hostWindow) : this.navigateInternal(n.ref).catch((e) => this.host.reportError(e)), !0);
|
|
2762
2762
|
}
|
|
2763
2763
|
async navigateInternal(e) {
|
|
2764
2764
|
let t = ni(e, this.host.currentSheet(), this.host.sheetNames(), this.host.definedNames());
|
|
@@ -2800,7 +2800,7 @@ var ri = class {
|
|
|
2800
2800
|
return t ? {
|
|
2801
2801
|
sheet: t.sheet,
|
|
2802
2802
|
sheetName: t.sheetName,
|
|
2803
|
-
ref:
|
|
2803
|
+
ref: it(t.row, t.col),
|
|
2804
2804
|
row: t.row,
|
|
2805
2805
|
col: t.col
|
|
2806
2806
|
} : null;
|
|
@@ -2830,7 +2830,7 @@ var ri = class {
|
|
|
2830
2830
|
if (n !== this._generation) return [];
|
|
2831
2831
|
let o = this._sheetName(a);
|
|
2832
2832
|
for (let n of r) {
|
|
2833
|
-
let r =
|
|
2833
|
+
let r = xe(Ee([{ text: n.text }]), e, t);
|
|
2834
2834
|
for (let e of r) {
|
|
2835
2835
|
let t = e.slices[0], r = n.text.slice(t.start, t.end);
|
|
2836
2836
|
i.push({
|
|
@@ -2846,10 +2846,10 @@ var ri = class {
|
|
|
2846
2846
|
return n === this._generation ? (this._matches = i, this._active = -1, this.matches()) : [];
|
|
2847
2847
|
}
|
|
2848
2848
|
next() {
|
|
2849
|
-
return this._active =
|
|
2849
|
+
return this._active = Oe(this._active, this._matches.length), this._activePublic();
|
|
2850
2850
|
}
|
|
2851
2851
|
prev() {
|
|
2852
|
-
return this._active =
|
|
2852
|
+
return this._active = De(this._active, this._matches.length), this._activePublic();
|
|
2853
2853
|
}
|
|
2854
2854
|
_activePublic() {
|
|
2855
2855
|
let e = this._locationAt(this._active);
|
|
@@ -2900,7 +2900,7 @@ var ci = class {
|
|
|
2900
2900
|
e.clearFind();
|
|
2901
2901
|
let t = this.host.worksheet();
|
|
2902
2902
|
if (!t) return;
|
|
2903
|
-
let n = this.host.scale(), r = (e) => Math.round(e * n), i = r(50), a = r(22), o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c =
|
|
2903
|
+
let n = this.host.scale(), r = (e) => Math.round(e * n), i = r(50), a = r(22), o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = H(t).roundedFrozenExtent(n), l = i + c.width, u = a + c.height, d = this.host.highlightColors(), f = si(!1, d), p = si(!0, d);
|
|
2904
2904
|
for (let t of this.controller.sheetHighlights(this.host.currentSheet())) {
|
|
2905
2905
|
let n = this.host.cellRect(t.row, t.col);
|
|
2906
2906
|
if (!n) continue;
|
|
@@ -3089,34 +3089,37 @@ var xi = class {
|
|
|
3089
3089
|
beginSelectionDrag(e) {
|
|
3090
3090
|
this.pendingTap?.pointerId !== e && (this.pendingTap = null), this.pendingClick?.pointerId !== e && (this.pendingClick = null), this.host.selection.beginDrag(e);
|
|
3091
3091
|
}
|
|
3092
|
-
getHeaderHit(e, t) {
|
|
3093
|
-
let
|
|
3094
|
-
if (!
|
|
3095
|
-
let
|
|
3096
|
-
if (!
|
|
3097
|
-
if (
|
|
3098
|
-
let
|
|
3099
|
-
|
|
3100
|
-
|
|
3092
|
+
getHeaderHit(e, t, n = "displayed") {
|
|
3093
|
+
let r = this.host.worksheet();
|
|
3094
|
+
if (!r) return null;
|
|
3095
|
+
let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect(), o = this.host.screenX(e - a.left, 0), s = t - a.top, c = Math.round(50 * i), l = Math.round(22 * i), u = o < c, d = s < l;
|
|
3096
|
+
if (!u && !d) return null;
|
|
3097
|
+
if (u && d) return { kind: "corner" };
|
|
3098
|
+
let f = H(r), p = n === "logical" ? {
|
|
3099
|
+
x: this.host.scrollLeft(),
|
|
3100
|
+
y: this.host.scrollTop()
|
|
3101
|
+
} : this.host.displayedViewportOffset();
|
|
3102
|
+
if (u) {
|
|
3103
|
+
let e = s - l;
|
|
3101
3104
|
if (e < 0) return { kind: "corner" };
|
|
3102
|
-
let t =
|
|
3105
|
+
let t = f.rowAt(e, p.y, i);
|
|
3103
3106
|
return t === null ? null : {
|
|
3104
3107
|
kind: "row",
|
|
3105
3108
|
row: t
|
|
3106
3109
|
};
|
|
3107
3110
|
}
|
|
3108
|
-
let
|
|
3109
|
-
if (
|
|
3110
|
-
let
|
|
3111
|
-
return
|
|
3111
|
+
let m = o - c;
|
|
3112
|
+
if (m < 0) return { kind: "corner" };
|
|
3113
|
+
let h = f.colAt(m, p.x, i);
|
|
3114
|
+
return h === null ? null : {
|
|
3112
3115
|
kind: "col",
|
|
3113
|
-
col:
|
|
3116
|
+
col: h
|
|
3114
3117
|
};
|
|
3115
3118
|
}
|
|
3116
3119
|
getResizeTarget(e, t) {
|
|
3117
3120
|
let n = this.host.worksheet();
|
|
3118
3121
|
if (!n) return null;
|
|
3119
|
-
let r = this.host.scale(), i = this.host.canvasArea.getBoundingClientRect(), a = this.host.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r), l =
|
|
3122
|
+
let r = this.host.scale(), i = this.host.canvasArea.getBoundingClientRect(), a = this.host.screenX(e - i.left, 0), o = t - i.top, s = Math.round(50 * r), c = Math.round(22 * r), l = H(n), u = l.maximumDigitWidth, d = l.axesAtScale(r);
|
|
3120
3123
|
if (o <= c && a > s) {
|
|
3121
3124
|
let n = this.getHeaderHit(e, t);
|
|
3122
3125
|
if (n?.kind !== "col") return null;
|
|
@@ -3169,7 +3172,7 @@ var xi = class {
|
|
|
3169
3172
|
t && e[0] <= t[1] + 1 ? t[1] = Math.max(t[1], e[1]) : i.push([...e]);
|
|
3170
3173
|
}
|
|
3171
3174
|
if (i.reduce((e, [t, n]) => e + n - t + 1, 0) > yi) throw RangeError(`A resize gesture may affect at most ${yi} selected bands.`);
|
|
3172
|
-
let a =
|
|
3175
|
+
let a = H(n), o = e === "col" ? a.col : a.row, s = [];
|
|
3173
3176
|
for (let [e, t] of i) for (let n = e; n <= t; n++) o.sizeOf(n) > 0 && s.push(n);
|
|
3174
3177
|
return s;
|
|
3175
3178
|
}
|
|
@@ -3189,9 +3192,9 @@ var xi = class {
|
|
|
3189
3192
|
let t = i.at(-1);
|
|
3190
3193
|
t && e.first <= t.last + 1 ? t.last = Math.max(t.last, e.last) : i.push({ ...e });
|
|
3191
3194
|
}
|
|
3192
|
-
if (!t && !
|
|
3195
|
+
if (!t && !Vt(n).length && i.reduce((e, t) => e + t.last - t.first + 1, 0) <= yi) return;
|
|
3193
3196
|
let a = [], o = 0;
|
|
3194
|
-
for (let e of
|
|
3197
|
+
for (let e of H(n).row.positiveRanges()) {
|
|
3195
3198
|
for (; o < i.length && i[o].last < e.first;) o++;
|
|
3196
3199
|
for (let t = o; t < i.length && i[t].first <= e.last; t++) {
|
|
3197
3200
|
let n = Math.max(e.first, i[t].first), r = Math.min(e.last, i[t].last);
|
|
@@ -3235,21 +3238,21 @@ var xi = class {
|
|
|
3235
3238
|
}
|
|
3236
3239
|
let i = this.host.scale(), a = this.host.canvasArea.getBoundingClientRect();
|
|
3237
3240
|
if (n.kind === "col") {
|
|
3238
|
-
let t = this.host.screenX(e - a.left, 0), o = Math.max(vi, Math.round((t - n.originScaled) / i)), s =
|
|
3241
|
+
let t = this.host.screenX(e - a.left, 0), o = Math.max(vi, Math.round((t - n.originScaled) / i)), s = Ut(o, n.mdw);
|
|
3239
3242
|
for (let e of n.indices) r.colWidths[e] = s, this.host.recordSizeOverride("col", e, o);
|
|
3240
3243
|
} else if (n.rowPreview) {
|
|
3241
3244
|
let e = t - a.top, o = Math.max(vi, Math.round((e - n.originScaled) / i));
|
|
3242
3245
|
try {
|
|
3243
|
-
n.rowPreview.apply(
|
|
3246
|
+
n.rowPreview.apply(Gt(o)), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3244
3247
|
} catch (e) {
|
|
3245
3248
|
this.finishResize(n.pointerId, !1, !0), this.host.reportError(e);
|
|
3246
3249
|
}
|
|
3247
3250
|
return;
|
|
3248
3251
|
} else {
|
|
3249
|
-
let e = t - a.top, o =
|
|
3252
|
+
let e = t - a.top, o = Gt(Math.max(vi, Math.round((e - n.originScaled) / i)));
|
|
3250
3253
|
for (let e of n.indices) r.rowHeights[e] = o, this.host.recordSizeOverride("row", e);
|
|
3251
3254
|
}
|
|
3252
|
-
|
|
3255
|
+
q.invalidate(r), this.host.updateSpacerSize(r), this.host.updateSelectionOverlay(), this.host.scheduleRender();
|
|
3253
3256
|
}
|
|
3254
3257
|
applyPointerSelection(e, t, n, r, i, a) {
|
|
3255
3258
|
let o = this.getHeaderHit(e, t);
|
|
@@ -3304,27 +3307,27 @@ var xi = class {
|
|
|
3304
3307
|
};
|
|
3305
3308
|
}
|
|
3306
3309
|
extendDragSelection(e, t, n) {
|
|
3307
|
-
let r = e, i = t, a = this.viewportInputBounds(),
|
|
3308
|
-
if (n ||
|
|
3309
|
-
let e = this.host.scale(), t = Math.round(50 * e), n = Math.round(22 * e),
|
|
3310
|
-
r = Math.min(s - 1, Math.max(
|
|
3310
|
+
let r = e, i = t, a = n || this.selectionAutoScrollFrame !== null ? "logical" : "displayed", o = this.viewportInputBounds(), s = e < o.left || e >= o.left + o.width || t < o.top || t >= o.top + o.height;
|
|
3311
|
+
if (n || s) {
|
|
3312
|
+
let e = this.host.scale(), t = Math.round(50 * e), n = Math.round(22 * e), a = o.left + (this.host.isRtl() ? 0 : t), s = o.left + o.width - (this.host.isRtl() ? t : 0);
|
|
3313
|
+
r = Math.min(s - 1, Math.max(a + 1, r)), i = Math.min(o.top + o.height - 1, Math.max(o.top + n + 1, i));
|
|
3311
3314
|
}
|
|
3312
3315
|
if (this.selectionMode === "rows") {
|
|
3313
|
-
let e = n ? null : this.getHeaderHit(r, i), t = e?.kind === "row" ? e.row : this.host.cellAt(r, i)?.row;
|
|
3316
|
+
let e = n ? null : this.getHeaderHit(r, i, a), t = e?.kind === "row" ? e.row : this.host.cellAt(r, i, a)?.row;
|
|
3314
3317
|
return !t || t === this.activeCell?.row ? !1 : (this.host.selection.extend({
|
|
3315
3318
|
row: t,
|
|
3316
3319
|
col: 1
|
|
3317
3320
|
}), !0);
|
|
3318
3321
|
}
|
|
3319
3322
|
if (this.selectionMode === "cols") {
|
|
3320
|
-
let e = n ? null : this.getHeaderHit(r, i), t = e?.kind === "col" ? e.col : this.host.cellAt(r, i)?.col;
|
|
3323
|
+
let e = n ? null : this.getHeaderHit(r, i, a), t = e?.kind === "col" ? e.col : this.host.cellAt(r, i, a)?.col;
|
|
3321
3324
|
return !t || t === this.activeCell?.col ? !1 : (this.host.selection.extend({
|
|
3322
3325
|
row: 1,
|
|
3323
3326
|
col: t
|
|
3324
3327
|
}), !0);
|
|
3325
3328
|
}
|
|
3326
|
-
let
|
|
3327
|
-
return !
|
|
3329
|
+
let c = this.host.cellAt(r, i, a);
|
|
3330
|
+
return !c || c.row === this.activeCell?.row && c.col === this.activeCell?.col ? !1 : (this.host.selection.extend(c), !0);
|
|
3328
3331
|
}
|
|
3329
3332
|
selectionAutoScrollSpeed() {
|
|
3330
3333
|
let e = this.selectionAutoScrollPointer;
|
|
@@ -3372,7 +3375,7 @@ var xi = class {
|
|
|
3372
3375
|
let a = this.host.scrollLeft(), o = this.host.scrollTop();
|
|
3373
3376
|
this.host.setScrollLeft(a + n.x * i), this.host.setScrollTop(o + n.y * i);
|
|
3374
3377
|
let s = this.host.scrollLeft() !== a || this.host.scrollTop() !== o, c = s && this.extendDragSelection(t.clientX, t.clientY, !0);
|
|
3375
|
-
if (s && (this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.scheduleRender(), this.host.emitViewportChange(), c && this.host.emitSelectionChange()), !s) {
|
|
3378
|
+
if (s && (this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.scheduleRender(!0), this.host.emitViewportChange(), c && this.host.emitSelectionChange()), !s) {
|
|
3376
3379
|
this.stopSelectionAutoScroll();
|
|
3377
3380
|
return;
|
|
3378
3381
|
}
|
|
@@ -3494,7 +3497,7 @@ var xi = class {
|
|
|
3494
3497
|
let t = this.host.cellAt(e.clientX, e.clientY);
|
|
3495
3498
|
t ? this.host.comments.scheduleForCell(t) : this.host.hideCommentPopup(), this.host.scrollHost.style.cursor = t && this.host.hyperlinks.at(t) ? "pointer" : "";
|
|
3496
3499
|
}
|
|
3497
|
-
!this.isSelecting || e.pointerId !== this.selectionPointerId || (this.trackSelectionAutoScroll(e), this.extendDragSelection(e.clientX, e.clientY, !1) && (this.host.updateSelectionOverlay(), this.host.scheduleRender(), this.host.emitSelectionChange()));
|
|
3500
|
+
!this.isSelecting || e.pointerId !== this.selectionPointerId || (this.trackSelectionAutoScroll(e), this.extendDragSelection(e.clientX, e.clientY, !1) && (this.host.updateSelectionOverlay(), this.host.scheduleRender(this.selectionAutoScrollFrame !== null), this.host.emitSelectionChange()));
|
|
3498
3501
|
}), this.on("pointerup", (e) => {
|
|
3499
3502
|
if (this.resizeDrag && this.resizeDrag.pointerId === e.pointerId) {
|
|
3500
3503
|
this.finishResize(e.pointerId);
|
|
@@ -3533,7 +3536,7 @@ var xi = class {
|
|
|
3533
3536
|
if (!this.host.nativeScrollbars) {
|
|
3534
3537
|
e.preventDefault();
|
|
3535
3538
|
let t = e.deltaMode === WheelEvent.DOM_DELTA_LINE ? 16 : e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? Math.max(1, this.host.scrollHost.clientHeight) : 1, n = (e.shiftKey ? e.deltaY : e.deltaX) * t, r = (e.shiftKey ? 0 : e.deltaY) * t;
|
|
3536
|
-
this.host.setScrollLeft(this.host.scrollLeft() + n), this.host.setScrollTop(this.host.scrollTop() + r), this.host.scheduleRender(), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
|
|
3539
|
+
this.host.setScrollLeft(this.host.scrollLeft() + n), this.host.setScrollTop(this.host.scrollTop() + r), this.host.scheduleRender(!0), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
|
|
3537
3540
|
}
|
|
3538
3541
|
return;
|
|
3539
3542
|
}
|
|
@@ -3542,7 +3545,7 @@ var xi = class {
|
|
|
3542
3545
|
this.host.zoomAt(Number.isFinite(t) && Number.isFinite(n) ? {
|
|
3543
3546
|
x: t,
|
|
3544
3547
|
y: n
|
|
3545
|
-
} : null,
|
|
3548
|
+
} : null, ge(this.host.scale(), e.deltaY, e.deltaMode));
|
|
3546
3549
|
}, { passive: !1 }), this.on("pointerleave", (e) => {
|
|
3547
3550
|
let t = e.relatedTarget;
|
|
3548
3551
|
t && this.host.comments.contains(t) || this.host.hideCommentPopup();
|
|
@@ -3556,14 +3559,14 @@ var xi = class {
|
|
|
3556
3559
|
e.preventDefault(), this.host.copySelection();
|
|
3557
3560
|
} else if (!e.defaultPrevented && !e.isComposing && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3558
3561
|
let t = this.activeCell, n = e.key === "ArrowUp" ? -1 : +(e.key === "ArrowDown"), r = e.key === "ArrowLeft" ? this.host.isRtl() ? 1 : -1 : e.key === "ArrowRight" ? this.host.isRtl() ? -1 : 1 : 0, i = t ? {
|
|
3559
|
-
row: Math.max(1, Math.min(
|
|
3560
|
-
col: Math.max(1, Math.min(
|
|
3562
|
+
row: Math.max(1, Math.min(K, t.row + n)),
|
|
3563
|
+
col: Math.max(1, Math.min(G, t.col + r))
|
|
3561
3564
|
} : {
|
|
3562
3565
|
row: 1,
|
|
3563
3566
|
col: 1
|
|
3564
3567
|
};
|
|
3565
3568
|
e.preventDefault(), this.host.hideCommentPopup();
|
|
3566
|
-
let a =
|
|
3569
|
+
let a = it(i.row, i.col);
|
|
3567
3570
|
this.host.setSelection(a), this.host.scrollCellIntoView(i.row, i.col), this.host.updateSelectionOverlay(), this.host.updateFindOverlay(), this.host.emitViewportChange();
|
|
3568
3571
|
} else if (e.key === "Escape" && this.resizeDrag?.rowPreview) e.preventDefault(), this.finishResize(this.resizeDrag.pointerId, !1, !0);
|
|
3569
3572
|
else if (e.key === "Escape" && this.host.validation.isOpen()) this.host.hideValidationPanel();
|
|
@@ -3645,7 +3648,7 @@ var Ti = 0, Ei = class {
|
|
|
3645
3648
|
if (!e) return;
|
|
3646
3649
|
let t = this.host.scale(), n = this.host.worksheet();
|
|
3647
3650
|
if (!n) return;
|
|
3648
|
-
let r = (e) => Math.round(e * t), i = r(50), a = r(22), o = this.host.canvasArea.clientWidth, s = this.host.canvasArea.clientHeight, c =
|
|
3651
|
+
let r = (e) => Math.round(e * t), i = r(50), a = r(22), o = this.host.canvasArea.clientWidth, s = this.host.canvasArea.clientHeight, c = H(n), l = c.effectiveFrozenBands({
|
|
3649
3652
|
scale: t,
|
|
3650
3653
|
width: o,
|
|
3651
3654
|
height: s,
|
|
@@ -3660,12 +3663,12 @@ var Ti = 0, Ei = class {
|
|
|
3660
3663
|
end: Math.min(o, i + d)
|
|
3661
3664
|
}, {
|
|
3662
3665
|
first: l.cols + 1,
|
|
3663
|
-
last:
|
|
3666
|
+
last: G,
|
|
3664
3667
|
start: Math.min(o, i + d),
|
|
3665
3668
|
end: o
|
|
3666
3669
|
}] : [{
|
|
3667
3670
|
first: 1,
|
|
3668
|
-
last:
|
|
3671
|
+
last: G,
|
|
3669
3672
|
start: i,
|
|
3670
3673
|
end: o
|
|
3671
3674
|
}], m = l.rows > 0 ? [{
|
|
@@ -3675,12 +3678,12 @@ var Ti = 0, Ei = class {
|
|
|
3675
3678
|
end: Math.min(s, a + f)
|
|
3676
3679
|
}, {
|
|
3677
3680
|
first: l.rows + 1,
|
|
3678
|
-
last:
|
|
3681
|
+
last: K,
|
|
3679
3682
|
start: Math.min(s, a + f),
|
|
3680
3683
|
end: s
|
|
3681
3684
|
}] : [{
|
|
3682
3685
|
first: 1,
|
|
3683
|
-
last:
|
|
3686
|
+
last: K,
|
|
3684
3687
|
start: a,
|
|
3685
3688
|
end: s
|
|
3686
3689
|
}], h = p.filter((e) => e.end > e.start), g = m.filter((e) => e.end > e.start), _ = this.host.selectionColor() ?? Si, { background: v } = Ci(_), y = /* @__PURE__ */ new Set(), b = [], x = [];
|
|
@@ -3698,14 +3701,14 @@ var Ti = 0, Ei = class {
|
|
|
3698
3701
|
top: t.firstRow,
|
|
3699
3702
|
bottom: t.lastRow,
|
|
3700
3703
|
left: 1,
|
|
3701
|
-
right:
|
|
3704
|
+
right: G,
|
|
3702
3705
|
topEdge: !0,
|
|
3703
3706
|
bottomEdge: !0,
|
|
3704
3707
|
leftEdge: !1,
|
|
3705
3708
|
rightEdge: !1
|
|
3706
3709
|
} : t.kind === "columns" ? {
|
|
3707
3710
|
top: 1,
|
|
3708
|
-
bottom:
|
|
3711
|
+
bottom: K,
|
|
3709
3712
|
left: t.firstColumn,
|
|
3710
3713
|
right: t.lastColumn,
|
|
3711
3714
|
topEdge: !1,
|
|
@@ -3714,9 +3717,9 @@ var Ti = 0, Ei = class {
|
|
|
3714
3717
|
rightEdge: !0
|
|
3715
3718
|
} : {
|
|
3716
3719
|
top: 1,
|
|
3717
|
-
bottom:
|
|
3720
|
+
bottom: K,
|
|
3718
3721
|
left: 1,
|
|
3719
|
-
right:
|
|
3722
|
+
right: G,
|
|
3720
3723
|
topEdge: !1,
|
|
3721
3724
|
bottomEdge: !1,
|
|
3722
3725
|
leftEdge: !1,
|
|
@@ -3729,28 +3732,28 @@ var Ti = 0, Ei = class {
|
|
|
3729
3732
|
if (!u || !d) continue;
|
|
3730
3733
|
let f = u.x, p = u.y, m = d.x + d.w, _ = d.y + d.h, v = Math.max(f, r.start), S = Math.max(p, n.start), C = Math.min(m, r.end), w = Math.min(_, n.end), T = C - v, E = w - S;
|
|
3731
3734
|
if (T <= 0 || E <= 0) continue;
|
|
3732
|
-
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1), k = t.kind === "rows" && r === h[0], A = t.kind === "rows" && r === h.at(-1),
|
|
3733
|
-
|
|
3735
|
+
let D = t.kind === "columns" && n === g[0], O = t.kind === "columns" && n === g.at(-1), k = t.kind === "rows" && r === h[0], A = t.kind === "rows" && r === h.at(-1), ee = D || e.topEdge && i === e.top && p >= n.start, te = O || e.bottomEdge && a === e.bottom && _ <= n.end, j = k || e.leftEdge && c === e.left && f >= r.start, M = A || e.rightEdge && l === e.right && m <= r.end, N = this.host.screenX(v, T), P = this.host.isRtl() ? M : j, ne = this.host.isRtl() ? j : M, F = [
|
|
3736
|
+
N,
|
|
3734
3737
|
S,
|
|
3735
3738
|
T,
|
|
3736
3739
|
E,
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3740
|
+
ee,
|
|
3741
|
+
ne,
|
|
3742
|
+
te,
|
|
3743
|
+
P
|
|
3741
3744
|
].join("|");
|
|
3742
|
-
if (y.has(
|
|
3743
|
-
y.add(
|
|
3744
|
-
let re = Math.min(1, T / 2),
|
|
3745
|
+
if (y.has(F)) continue;
|
|
3746
|
+
y.add(F), b.push(`M${N} ${S}h${T}v${E}h${-T}Z`);
|
|
3747
|
+
let re = Math.min(1, T / 2), I = Math.min(1, E / 2), ie = this.host.isRtl() ? A : k, ae = this.host.isRtl() ? k : A, L = (e, t) => e <= 0 || e >= t, oe = N + (ie && L(N, o) ? re : 0), se = N + T - (ae && L(N + T, o) ? re : 0), R = S + (D && L(S, s) ? I : 0), ce = w - (O && L(w, s) ? I : 0);
|
|
3745
3748
|
x.push({
|
|
3746
|
-
x:
|
|
3747
|
-
y:
|
|
3748
|
-
width:
|
|
3749
|
-
height:
|
|
3750
|
-
top:
|
|
3751
|
-
right:
|
|
3752
|
-
bottom:
|
|
3753
|
-
left:
|
|
3749
|
+
x: oe,
|
|
3750
|
+
y: R,
|
|
3751
|
+
width: se - oe,
|
|
3752
|
+
height: ce - R,
|
|
3753
|
+
top: ee,
|
|
3754
|
+
right: ne,
|
|
3755
|
+
bottom: te,
|
|
3756
|
+
left: P
|
|
3754
3757
|
});
|
|
3755
3758
|
}
|
|
3756
3759
|
}
|
|
@@ -3885,7 +3888,7 @@ function Mi(e, t) {
|
|
|
3885
3888
|
}
|
|
3886
3889
|
var Ni = 1 * 1024 * 1024, Pi = 65536;
|
|
3887
3890
|
function Fi(e, t) {
|
|
3888
|
-
return
|
|
3891
|
+
return Ae(e, Math.max(0, t));
|
|
3889
3892
|
}
|
|
3890
3893
|
var Ii = class {
|
|
3891
3894
|
rows = /* @__PURE__ */ new WeakMap();
|
|
@@ -3921,7 +3924,7 @@ var Ii = class {
|
|
|
3921
3924
|
active: !1
|
|
3922
3925
|
}]).sort((e, t) => e.row - t.row || Number(e.active) - Number(t.active)), v = /* @__PURE__ */ new Set(), y = 0, b = [], x = [], S = !1, C = p || h.length > 0 ? [{
|
|
3923
3926
|
first: 1,
|
|
3924
|
-
last:
|
|
3927
|
+
last: K
|
|
3925
3928
|
}] : $([...m, ...g.map((e) => ({
|
|
3926
3929
|
first: e.top,
|
|
3927
3930
|
last: e.bottom
|
|
@@ -3943,7 +3946,7 @@ var Ii = class {
|
|
|
3943
3946
|
}))));
|
|
3944
3947
|
let c = p || Ai(m, a.index) ? [{
|
|
3945
3948
|
first: 1,
|
|
3946
|
-
last:
|
|
3949
|
+
last: G
|
|
3947
3950
|
}] : $([...h, ...b]);
|
|
3948
3951
|
for (let t of c) {
|
|
3949
3952
|
let n = this.cells.get(a);
|
|
@@ -4080,7 +4083,7 @@ var Wi = 150;
|
|
|
4080
4083
|
function Gi(e) {
|
|
4081
4084
|
let t = /* @__PURE__ */ new Map();
|
|
4082
4085
|
for (let n of e) {
|
|
4083
|
-
let e =
|
|
4086
|
+
let e = z(n.cellRef);
|
|
4084
4087
|
e && t.set(`${e.row}:${e.col}`, n);
|
|
4085
4088
|
}
|
|
4086
4089
|
return t;
|
|
@@ -4199,7 +4202,7 @@ var Ki = class {
|
|
|
4199
4202
|
this.resizeObserver?.disconnect(), this.resizeObserver = null, this.hide(), this.commentMap.clear();
|
|
4200
4203
|
}
|
|
4201
4204
|
}, qi = class {
|
|
4202
|
-
owner = new
|
|
4205
|
+
owner = new ke("SheetAcquisition");
|
|
4203
4206
|
get current() {
|
|
4204
4207
|
return this.owner.current;
|
|
4205
4208
|
}
|
|
@@ -4220,7 +4223,7 @@ function Ji(e) {
|
|
|
4220
4223
|
rowHeights: { ...e.rowHeights },
|
|
4221
4224
|
colWidths: { ...e.colWidths }
|
|
4222
4225
|
};
|
|
4223
|
-
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }),
|
|
4226
|
+
return e.colCollapsed && (t.colCollapsed = { ...e.colCollapsed }), B(e, t), Ln(e, t), Ft(e, t), Wt(e, t), t;
|
|
4224
4227
|
}
|
|
4225
4228
|
var Yi = class {
|
|
4226
4229
|
scaleValue;
|
|
@@ -4282,7 +4285,7 @@ var Yi = class {
|
|
|
4282
4285
|
this.frameScheduler = typeof r.requestAnimationFrame == "function" && typeof r.cancelAnimationFrame == "function" ? {
|
|
4283
4286
|
requestAnimationFrame: (e) => r.requestAnimationFrame(e),
|
|
4284
4287
|
cancelAnimationFrame: (e) => r.cancelAnimationFrame(e)
|
|
4285
|
-
} : null, this.staticDispatcher = e ? new
|
|
4288
|
+
} : null, this.staticDispatcher = e ? new Se(e, t) : null;
|
|
4286
4289
|
}
|
|
4287
4290
|
begin() {
|
|
4288
4291
|
return this.staticDispatcher ? this.staticDispatcher.begin() : ++this.generation;
|
|
@@ -4298,10 +4301,10 @@ var Yi = class {
|
|
|
4298
4301
|
cssHeight: r
|
|
4299
4302
|
});
|
|
4300
4303
|
}
|
|
4301
|
-
schedule(e) {
|
|
4304
|
+
schedule(e, t = !1) {
|
|
4302
4305
|
if (!this.destroyed) {
|
|
4303
4306
|
if (this.pendingRender = e, this.activeRender) {
|
|
4304
|
-
this.begin();
|
|
4307
|
+
t || this.begin();
|
|
4305
4308
|
return;
|
|
4306
4309
|
}
|
|
4307
4310
|
this.animationFrame === null && this.queuePendingRender();
|
|
@@ -4692,6 +4695,7 @@ var da = class {
|
|
|
4692
4695
|
return this.selectionController.mode;
|
|
4693
4696
|
}
|
|
4694
4697
|
_pendingZoomAnchor = null;
|
|
4698
|
+
displayedViewport = null;
|
|
4695
4699
|
selectionController = new Zi();
|
|
4696
4700
|
notifier;
|
|
4697
4701
|
contextReader = new Ii();
|
|
@@ -4715,7 +4719,7 @@ var da = class {
|
|
|
4715
4719
|
if (!r) throw Error("XlsxViewer requires a document with an active Window");
|
|
4716
4720
|
this.hostWindow = r, this.opts = t, this.gridExtent = ua(t), this._mountKind = n.kind, this._nativeScrollbars = t.showScrollbars ?? !0;
|
|
4717
4721
|
let i = t[ea];
|
|
4718
|
-
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode :
|
|
4722
|
+
this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode : Me("XlsxViewer", t.mode, i), this._hiddenSheetMode = t.hiddenSheetMode ?? "show", this.viewport = new Yi(t.cellScale ?? 1), this.wrapper = this.hostDocument.createElement("div"), this.wrapper.style.cssText = `position:relative;width:100%;height:100%;background:${n.kind === "composite" ? "var(--ooxml-xlsx-chrome-surface,#fff)" : "transparent"};box-sizing:border-box;font-family:sans-serif;display:flex;flex-direction:column;`, this.gridRegion = this.hostDocument.createElement("div"), this.gridRegion.style.cssText = "position:relative;flex:1;min-height:0;overflow:hidden;", this.canvasArea = this.hostDocument.createElement("div"), this.canvasArea.style.cssText = "position:absolute;inset:0;overflow:hidden;", this.canvas = n.kind === "sheet" ? n.canvas : this.hostDocument.createElement("canvas"), this.canvas.style.cssText = "position:absolute;top:0;left:0;z-index:0;display:block;", this.renderDispatcher = new Xi(this.canvas, this._mode === "worker", this.hostWindow), this.scrollHost = this.hostDocument.createElement("div"), this.scrollHost.setAttribute("data-xlsx-viewport-input", n.kind), this.scrollHost.setAttribute("role", "region"), this.scrollHost.setAttribute("aria-label", "Spreadsheet viewport. Use Arrow keys to move the selected cell. Press Enter to show its comment."), this.scrollHost.tabIndex = 0, this.scrollHost.style.cssText = `position:absolute;inset:0;overflow:${this._nativeScrollbars ? "auto" : "clip"};z-index:2;background:transparent;scrollbar-color:var(--ooxml-xlsx-chrome-scrollbar-color,auto);`, this.spacer = this.hostDocument.createElement("div"), this.spacer.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;", this._nativeScrollbars && this.scrollHost.appendChild(this.spacer), this.surface = new Qi(this.canvas, this.canvasArea, this.scrollHost), this.overlayHost = new $i(this.canvasArea, this.canvas, this.scrollHost, {
|
|
4719
4723
|
commentMaxWidth: 280,
|
|
4720
4724
|
commentMaxHeight: 200,
|
|
4721
4725
|
validationMaxWidth: na,
|
|
@@ -4814,7 +4818,7 @@ var da = class {
|
|
|
4814
4818
|
let e = this.scrollHost.scrollLeft, t = this.isRtl ? this.maxScrollLeft - e : e;
|
|
4815
4819
|
this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setOffset(t, this.scrollHost.scrollTop);
|
|
4816
4820
|
}
|
|
4817
|
-
this.emitViewportChange(), this.scheduleRender(), this.updateSelectionOverlay(), this.updateFindOverlay();
|
|
4821
|
+
this.emitViewportChange(), this.scheduleRender(!0), this.updateSelectionOverlay(), this.updateFindOverlay();
|
|
4818
4822
|
});
|
|
4819
4823
|
let a = new this.hostWindow.ResizeObserver(() => {
|
|
4820
4824
|
let e = {
|
|
@@ -4839,9 +4843,10 @@ var da = class {
|
|
|
4839
4843
|
scale: () => this.viewport.scale,
|
|
4840
4844
|
isRtl: () => this.isRtl,
|
|
4841
4845
|
isDestroyed: () => this._destroyed,
|
|
4842
|
-
cellAt: (e, t) => this.
|
|
4846
|
+
cellAt: (e, t, n) => this.cellAtGeometry(e, t, n),
|
|
4843
4847
|
cellRect: (e, t) => this._cellRect(e, t),
|
|
4844
4848
|
screenX: (e, t) => this.screenX(e, t),
|
|
4849
|
+
displayedViewportOffset: () => this.displayedViewportOffset(),
|
|
4845
4850
|
scrollLeft: () => this.effectiveScrollLeft,
|
|
4846
4851
|
scrollTop: () => this.viewportTop,
|
|
4847
4852
|
setScrollLeft: (e) => this.setViewportLeft(e),
|
|
@@ -4860,7 +4865,7 @@ var da = class {
|
|
|
4860
4865
|
copySelection: () => this.copySelection(),
|
|
4861
4866
|
updateSelectionOverlay: () => this.updateSelectionOverlay(),
|
|
4862
4867
|
updateFindOverlay: () => this.updateFindOverlay(),
|
|
4863
|
-
scheduleRender: () => this.scheduleRender(),
|
|
4868
|
+
scheduleRender: (e) => this.scheduleRender(e),
|
|
4864
4869
|
renderCurrentSheet: () => this.renderCurrentSheet(),
|
|
4865
4870
|
emitSelectionChange: () => this.emitSelectionChange(),
|
|
4866
4871
|
emitViewportChange: () => this.emitViewportChange(),
|
|
@@ -4946,13 +4951,13 @@ var da = class {
|
|
|
4946
4951
|
i = u.worksheet, a = u.release;
|
|
4947
4952
|
let d = () => this.isCurrentSheetRequest(t, n) ? !1 : (a?.(), a = void 0, !0);
|
|
4948
4953
|
if (d()) return;
|
|
4949
|
-
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ?
|
|
4954
|
+
let f = u.partial, p = this.sheetViews.get(e), m = this.initialAnchorReferenceFor(n, e), h = m === void 0 ? Ke(i) : void 0, g = h !== void 0;
|
|
4950
4955
|
if (g && (p !== void 0 && !p.parseError || this.viewEdits.hasViewEdits(e))) throw Error(`XLSX viewer cannot establish the initial size of editAs="oneCell" anchors on sheet ${e} after view edits.`);
|
|
4951
4956
|
let _ = (t) => {
|
|
4952
4957
|
let n = t.parseError || p?.parseError ? void 0 : p, r = n ?? this.createVisibleSheetView(t);
|
|
4953
|
-
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError &&
|
|
4958
|
+
return (n || u.partial) && (r.rows = t.rows), n || (m && !t.parseError && Be(r, m), this.viewEdits.restoreSheetViewState(e, r)), r;
|
|
4954
4959
|
}, v = (r, i) => {
|
|
4955
|
-
i &&
|
|
4960
|
+
i && st(r);
|
|
4956
4961
|
let a = n[Bn];
|
|
4957
4962
|
if (typeof a == "function") {
|
|
4958
4963
|
let e = this.hostDocument.createElement("canvas").getContext("2d");
|
|
@@ -4961,8 +4966,8 @@ var da = class {
|
|
|
4961
4966
|
this.isCurrentSheetRequest(t, n) && this.viewEdits.syncAutomaticRowOverrides(e, r);
|
|
4962
4967
|
}, y = (e) => {
|
|
4963
4968
|
if (!g || e.parseError || !this.isCurrentSheetRequest(t, n)) return;
|
|
4964
|
-
let r =
|
|
4965
|
-
return r &&
|
|
4969
|
+
let r = ze(e, H(e), this.viewport.scale) ?? null;
|
|
4970
|
+
return r && Be(e, r), r;
|
|
4966
4971
|
};
|
|
4967
4972
|
if (r = _(i), u.partial) {
|
|
4968
4973
|
let e = {
|
|
@@ -4971,7 +4976,7 @@ var da = class {
|
|
|
4971
4976
|
scale: this.viewport.scale
|
|
4972
4977
|
};
|
|
4973
4978
|
s = e;
|
|
4974
|
-
let t = () =>
|
|
4979
|
+
let t = () => H(r).visibleRange({
|
|
4975
4980
|
width: e.width,
|
|
4976
4981
|
height: e.height,
|
|
4977
4982
|
scale: e.scale,
|
|
@@ -5003,29 +5008,29 @@ var da = class {
|
|
|
5003
5008
|
} else v(r, !1), c = y(r);
|
|
5004
5009
|
o = f ? u.completion : null;
|
|
5005
5010
|
} catch (e) {
|
|
5006
|
-
if (a?.(), c &&
|
|
5011
|
+
if (a?.(), c && at(c), !this.isCurrentSheetRequest(t, n)) return;
|
|
5007
5012
|
throw await this.restoreDisplayedWorksheetLease(n, t), e;
|
|
5008
5013
|
}
|
|
5009
5014
|
if (!this.isCurrentSheetRequest(t, n)) {
|
|
5010
|
-
a?.(), c &&
|
|
5015
|
+
a?.(), c && at(c);
|
|
5011
5016
|
return;
|
|
5012
5017
|
}
|
|
5013
|
-
this.selectionInput.clearSheetGestures(), this.viewEdits.restoreRowResizeRanges(e, r), c !== void 0 && this.installInitialAnchorReference(n, e, c), this.currentAutoRowHeightsPrepared = l, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = a ?? null, this.sheetViews.clear(), this.sheetViews.set(e, r), this.currentSheet = e, this.currentWorksheet = r, this.previewCompletion = o, this.firstPreviewRender = o !== null, this.previewPreparedViewport = s, o && o.then((i) => {
|
|
5018
|
+
this.selectionInput.clearSheetGestures(), this.viewEdits.restoreRowResizeRanges(e, r), c !== void 0 && this.installInitialAnchorReference(n, e, c), this.currentAutoRowHeightsPrepared = l, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = a ?? null, this.sheetViews.clear(), this.sheetViews.set(e, r), this.currentSheet = e, this.displayedViewport = null, this.currentWorksheet = r, this.previewCompletion = o, this.firstPreviewRender = o !== null, this.previewPreparedViewport = s, o && o.then((i) => {
|
|
5014
5019
|
if (!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r) return;
|
|
5015
5020
|
this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null;
|
|
5016
5021
|
let a = !!i.parseError;
|
|
5017
5022
|
this.selectionInput.clearSheetGestures();
|
|
5018
5023
|
let o = this.createVisibleSheetView(i), s = a ? void 0 : this.initialAnchorReferenceFor(n, e);
|
|
5019
|
-
if (s &&
|
|
5024
|
+
if (s && Be(o, s), this.viewEdits.restoreSheetViewState(e, o), this.displayedViewport = null, this.currentWorksheet = o, this.sheetViews.set(e, o), a) {
|
|
5020
5025
|
this.currentSourceComments = [], this.sourceCommentMap.clear(), this.selectionController.reset(), this.emitSelectionChange(), this.updateSelectionOverlay(), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender();
|
|
5021
5026
|
return;
|
|
5022
5027
|
}
|
|
5023
|
-
|
|
5028
|
+
nt(r), st(r);
|
|
5024
5029
|
let c = this.hostDocument.createElement("canvas").getContext("2d");
|
|
5025
5030
|
c && (n[Bn](o, c), this.currentAutoRowHeightsPrepared = !0), this.viewEdits.syncAutomaticRowOverrides(e, o), this.currentSourceComments = i.comments ?? [], this.sourceCommentMap = Gi(this.currentSourceComments), this.buildCommentMap(o), this.buildHyperlinkMap(o), this.buildOutline(o), this.layoutGutters(), this.updateSpacerSize(o), this.scheduleRender(), this.scheduleSelectionContextNotification();
|
|
5026
5031
|
}).catch((e) => {
|
|
5027
5032
|
if (!(!this.isCurrentSheetRequest(t, n) || this.currentWorksheet !== r)) {
|
|
5028
|
-
if (this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null, this.selectionInput.clearSheetGestures(), this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.renderDispatcher.begin(), this._mode === "worker") {
|
|
5033
|
+
if (this.previewCompletion = null, this.firstPreviewRender = !1, this.previewPreparedViewport = null, this.selectionInput.clearSheetGestures(), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.renderDispatcher.begin(), this._mode === "worker") {
|
|
5029
5034
|
let e = new OffscreenCanvas(1, 1);
|
|
5030
5035
|
e.getContext("2d");
|
|
5031
5036
|
let t = e.transferToImageBitmap();
|
|
@@ -5053,7 +5058,7 @@ var da = class {
|
|
|
5053
5058
|
this.initialAnchorWorkbook !== e && (this.releaseInitialAnchorReferences(), this.initialAnchorWorkbook = e), this.initialAnchorReferences.has(t) || this.initialAnchorReferences.set(t, n);
|
|
5054
5059
|
}
|
|
5055
5060
|
releaseInitialAnchorReferences() {
|
|
5056
|
-
for (let e of this.initialAnchorReferences.values()) e &&
|
|
5061
|
+
for (let e of this.initialAnchorReferences.values()) e && at(e);
|
|
5057
5062
|
this.initialAnchorReferences.clear(), this.initialAnchorWorkbook = null;
|
|
5058
5063
|
}
|
|
5059
5064
|
async restoreDisplayedWorksheetLease(e, t) {
|
|
@@ -5073,7 +5078,7 @@ var da = class {
|
|
|
5073
5078
|
scrollOutlineSummaryToStart(e, t) {
|
|
5074
5079
|
let n = this.currentWorksheet;
|
|
5075
5080
|
if (!n) return;
|
|
5076
|
-
let r = this.viewport.scale, i =
|
|
5081
|
+
let r = this.viewport.scale, i = H(n).scrollOffsetForCell(e === "row" ? t : 1, e === "col" ? t : 1, {
|
|
5077
5082
|
scale: r,
|
|
5078
5083
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5079
5084
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5101,7 +5106,7 @@ var da = class {
|
|
|
5101
5106
|
r && this.viewEdits.setBandCollapsed(r, this.currentSheet, e, t, n);
|
|
5102
5107
|
}
|
|
5103
5108
|
afterOutlineMutation(e, t) {
|
|
5104
|
-
|
|
5109
|
+
q.invalidate(e), this.outlineGutter.rebuild(e), this.updateSpacerSize(e), t && this.scrollOutlineSummaryToStart(t.axis, t.summary), this.updateSelectionOverlay(), this.updateFindOverlay(), this.scheduleRender(), t && this.emitViewportChange();
|
|
5105
5110
|
}
|
|
5106
5111
|
get isRtl() {
|
|
5107
5112
|
return this.currentWorksheet?.rightToLeft === !0;
|
|
@@ -5136,7 +5141,7 @@ var da = class {
|
|
|
5136
5141
|
this.viewport.setOffset(e, this.viewport.y), this._nativeScrollbars && (this.scrollHost.scrollLeft = this.isRtl ? Math.max(0, this.maxScrollLeft - this.viewport.x) : this.viewport.x);
|
|
5137
5142
|
}
|
|
5138
5143
|
screenX(e, t) {
|
|
5139
|
-
return this.isRtl ?
|
|
5144
|
+
return this.isRtl ? _t(e, t, this.canvasArea.clientWidth) : e;
|
|
5140
5145
|
}
|
|
5141
5146
|
resetHorizontalScroll() {
|
|
5142
5147
|
this.viewport.setOffset(0, this.viewport.y), this._nativeScrollbars && (this.scrollHost.scrollLeft = this.isRtl ? this.maxScrollLeft : 0);
|
|
@@ -5172,8 +5177,14 @@ var da = class {
|
|
|
5172
5177
|
emitViewportChange() {
|
|
5173
5178
|
let e = this.opts.onViewportChange;
|
|
5174
5179
|
if (!e) return;
|
|
5175
|
-
let t = this.getViewportOffset(), n = this.
|
|
5176
|
-
|
|
5180
|
+
let t = this.getViewportOffset(), n = this.displayedViewportOffset(), r = {
|
|
5181
|
+
x: n.x,
|
|
5182
|
+
y: n.y
|
|
5183
|
+
}, i = this._lastViewportNotification;
|
|
5184
|
+
i && i.offset.x === t.x && i.offset.y === t.y && i.displayed.x === r.x && i.displayed.y === r.y || (this._lastViewportNotification = {
|
|
5185
|
+
offset: t,
|
|
5186
|
+
displayed: r
|
|
5187
|
+
}, e(t));
|
|
5177
5188
|
}
|
|
5178
5189
|
async setViewportOffset(e) {
|
|
5179
5190
|
if (!Number.isFinite(e.x) || !Number.isFinite(e.y)) throw TypeError("XLSX viewport offsets must be finite numbers");
|
|
@@ -5184,26 +5195,39 @@ var da = class {
|
|
|
5184
5195
|
this.reanchorHorizontalScroll(), this.layoutGutters(), this.currentWorksheet && this.updateSpacerSize(this.currentWorksheet), await this.renderCurrentSheet(), this.updateSelectionOverlay(), this.updateFindOverlay();
|
|
5185
5196
|
}
|
|
5186
5197
|
async scrollToCell(e, t = {}) {
|
|
5187
|
-
let n =
|
|
5198
|
+
let n = z(e);
|
|
5188
5199
|
!n || !this.currentWorksheet || (this.previewCompletion && await this.previewCompletion, this._scrollCellIntoView(n.row, n.col, t.align ?? "nearest"), await this.renderCurrentSheet(), this.updateSelectionOverlay(), this.updateFindOverlay(), this.emitViewportChange());
|
|
5189
5200
|
}
|
|
5190
5201
|
_stepSheet(e) {
|
|
5191
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5202
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Lt(this.currentSheet, e, (e) => this.wb.isHidden(e), this.sheetCount) : this.currentSheet + e;
|
|
5192
5203
|
}
|
|
5193
5204
|
_initialSheet() {
|
|
5194
|
-
return this._hiddenSheetMode === "skip" && this.wb ?
|
|
5205
|
+
return this._hiddenSheetMode === "skip" && this.wb ? Rt(0, (e) => this.wb.isHidden(e), this.sheetCount) : 0;
|
|
5206
|
+
}
|
|
5207
|
+
displayedViewportOffset() {
|
|
5208
|
+
let e = this.displayedViewport;
|
|
5209
|
+
return e && e.worksheet === this.currentWorksheet && e.scale === this.viewport.scale && e.width === this.canvasArea.clientWidth && e.height === this.canvasArea.clientHeight ? e : {
|
|
5210
|
+
x: this.effectiveScrollLeft,
|
|
5211
|
+
y: this.viewportTop
|
|
5212
|
+
};
|
|
5195
5213
|
}
|
|
5196
5214
|
getCellAt(e, t) {
|
|
5215
|
+
return this.cellAtGeometry(e, t, "displayed");
|
|
5216
|
+
}
|
|
5217
|
+
cellAtGeometry(e, t, n = "displayed") {
|
|
5197
5218
|
if (this._destroyed) return null;
|
|
5198
|
-
let
|
|
5199
|
-
if (!
|
|
5200
|
-
let
|
|
5201
|
-
if (
|
|
5202
|
-
let
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5219
|
+
let r = this.currentWorksheet;
|
|
5220
|
+
if (!r) return null;
|
|
5221
|
+
let i = this.viewport.scale, a = this.canvasArea.getBoundingClientRect(), o = this.screenX(e - a.left, 0), s = t - a.top, c = Math.round(50 * i), l = Math.round(22 * i);
|
|
5222
|
+
if (o < c || s < l) return null;
|
|
5223
|
+
let u = o - c, d = s - l, f = n === "logical" ? {
|
|
5224
|
+
x: this.effectiveScrollLeft,
|
|
5225
|
+
y: this.viewportTop
|
|
5226
|
+
} : this.displayedViewportOffset();
|
|
5227
|
+
return H(r).cellAt(u, d, {
|
|
5228
|
+
scrollX: f.x,
|
|
5229
|
+
scrollY: f.y,
|
|
5230
|
+
scale: i
|
|
5207
5231
|
});
|
|
5208
5232
|
}
|
|
5209
5233
|
elementContextViewport() {
|
|
@@ -5211,12 +5235,12 @@ var da = class {
|
|
|
5211
5235
|
if (!e) return null;
|
|
5212
5236
|
let t = this.canvasArea.clientWidth, n = this.canvasArea.clientHeight;
|
|
5213
5237
|
if (t <= 0 || n <= 0) return null;
|
|
5214
|
-
let r = this.viewport.scale, i =
|
|
5238
|
+
let r = this.viewport.scale, i = H(e).visibleRange({
|
|
5215
5239
|
width: t,
|
|
5216
5240
|
height: n,
|
|
5217
5241
|
scale: r,
|
|
5218
|
-
scrollX: this.
|
|
5219
|
-
scrollY: this.
|
|
5242
|
+
scrollX: this.displayedViewportOffset().x,
|
|
5243
|
+
scrollY: this.displayedViewportOffset().y,
|
|
5220
5244
|
headerWidth: 50,
|
|
5221
5245
|
headerHeight: 22,
|
|
5222
5246
|
buffer: 2
|
|
@@ -5246,17 +5270,17 @@ var da = class {
|
|
|
5246
5270
|
let n = this.currentWorksheet;
|
|
5247
5271
|
if (!n) return null;
|
|
5248
5272
|
let r = this.viewport.scale;
|
|
5249
|
-
return
|
|
5273
|
+
return H(n).cellRect(e, t, {
|
|
5250
5274
|
scale: r,
|
|
5251
|
-
scrollX: this.
|
|
5252
|
-
scrollY: this.
|
|
5275
|
+
scrollX: this.displayedViewportOffset().x,
|
|
5276
|
+
scrollY: this.displayedViewportOffset().y,
|
|
5253
5277
|
headerWidth: 50,
|
|
5254
5278
|
headerHeight: 22
|
|
5255
5279
|
});
|
|
5256
5280
|
}
|
|
5257
5281
|
getCellViewportRect(e) {
|
|
5258
5282
|
if (this._destroyed) return null;
|
|
5259
|
-
let t = typeof e == "string" ?
|
|
5283
|
+
let t = typeof e == "string" ? z(e) : e;
|
|
5260
5284
|
if (!t || t.row < 1 || t.col < 1) return null;
|
|
5261
5285
|
let n = this._cellRect(t.row, t.col);
|
|
5262
5286
|
return n ? Object.freeze({
|
|
@@ -5270,12 +5294,12 @@ var da = class {
|
|
|
5270
5294
|
return this.assertOpen(), structuredClone(this.currentSourceComments);
|
|
5271
5295
|
}
|
|
5272
5296
|
async goToComment(e, t, n) {
|
|
5273
|
-
let r =
|
|
5297
|
+
let r = z(t), i = this.wb;
|
|
5274
5298
|
if (!r || !i || !Number.isInteger(e) || e < 0 || e >= i.sheetCount) return !1;
|
|
5275
5299
|
let a = ++this.commentNavigationGeneration, o = e === this.currentSheet && this.currentWorksheet !== null ? this.currentSourceComments : await i.getComments(e);
|
|
5276
5300
|
if (this._destroyed) throw this.destroyedError();
|
|
5277
5301
|
if (a !== this.commentNavigationGeneration || i !== this.wb || !o.some((e) => {
|
|
5278
|
-
let t =
|
|
5302
|
+
let t = z(e.cellRef);
|
|
5279
5303
|
return t?.row === r.row && t.col === r.col;
|
|
5280
5304
|
})) return !1;
|
|
5281
5305
|
if (e !== this.currentSheet || this.currentWorksheet === null) {
|
|
@@ -5320,7 +5344,7 @@ var da = class {
|
|
|
5320
5344
|
refitAutoRowsAfterColumnResize() {
|
|
5321
5345
|
let e = this.currentWorksheet, t = this.preparedWorkbook;
|
|
5322
5346
|
if (!e || !t) return;
|
|
5323
|
-
|
|
5347
|
+
st(e, this.viewEdits.manualRows(this.currentSheet));
|
|
5324
5348
|
let n = t[Bn];
|
|
5325
5349
|
if (typeof n != "function") return;
|
|
5326
5350
|
let r = this.hostDocument.createElement("canvas").getContext("2d");
|
|
@@ -5330,7 +5354,7 @@ var da = class {
|
|
|
5330
5354
|
this.opts.selectionColor = e, this.updateSelectionOverlay();
|
|
5331
5355
|
}
|
|
5332
5356
|
async setHiddenSheetMode(e) {
|
|
5333
|
-
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(
|
|
5357
|
+
this._hiddenSheetMode = e, this.buildTabs(), e === "skip" && this.wb && this.wb.isHidden(this.currentSheet) ? await this.showSheet(Rt(this.currentSheet, (e) => this.wb.isHidden(e), this.sheetCount)) : this.updateTabActive(this.currentSheet);
|
|
5334
5358
|
}
|
|
5335
5359
|
get hiddenSheetMode() {
|
|
5336
5360
|
return this._hiddenSheetMode;
|
|
@@ -5338,7 +5362,7 @@ var da = class {
|
|
|
5338
5362
|
get visibleSheetCount() {
|
|
5339
5363
|
if (!this.wb) return 0;
|
|
5340
5364
|
let e = this.wb;
|
|
5341
|
-
return
|
|
5365
|
+
return zt((t) => e.isHidden(t), this.sheetCount);
|
|
5342
5366
|
}
|
|
5343
5367
|
async copySelection() {
|
|
5344
5368
|
return this.assertOpen(), this.previewCompletion && await this.previewCompletion, this.copier.copy();
|
|
@@ -5364,7 +5388,7 @@ var da = class {
|
|
|
5364
5388
|
_scrollCellIntoView(e, t, n = "nearest") {
|
|
5365
5389
|
let r = this.currentWorksheet;
|
|
5366
5390
|
if (!r) return;
|
|
5367
|
-
let i = this.viewport.scale, a =
|
|
5391
|
+
let i = this.viewport.scale, a = H(r).scrollOffsetForCell(e, t, {
|
|
5368
5392
|
scale: i,
|
|
5369
5393
|
viewportWidth: this.canvasArea.clientWidth,
|
|
5370
5394
|
viewportHeight: this.canvasArea.clientHeight,
|
|
@@ -5390,7 +5414,7 @@ var da = class {
|
|
|
5390
5414
|
commentRefs: [],
|
|
5391
5415
|
comments: []
|
|
5392
5416
|
};
|
|
5393
|
-
return
|
|
5417
|
+
return B(t, e), Ln(t, e), Ft(t, e), e;
|
|
5394
5418
|
}
|
|
5395
5419
|
if ((typeof this.opts.comments == "object" ? this.opts.comments : void 0)?.includeResolved !== !1) return t;
|
|
5396
5420
|
let n = new Set((t.comments ?? []).filter((e) => e.resolved === !0).map((e) => e.cellRef));
|
|
@@ -5400,7 +5424,7 @@ var da = class {
|
|
|
5400
5424
|
commentRefs: t.commentRefs?.filter((e) => !n.has(e)),
|
|
5401
5425
|
comments: t.comments?.filter((e) => !n.has(e.cellRef))
|
|
5402
5426
|
};
|
|
5403
|
-
return
|
|
5427
|
+
return B(t, r), Ln(t, r), Ft(t, r), r;
|
|
5404
5428
|
}
|
|
5405
5429
|
buildHyperlinkMap(e) {
|
|
5406
5430
|
this.hyperlinks.build(e);
|
|
@@ -5420,8 +5444,8 @@ var da = class {
|
|
|
5420
5444
|
if (this.viewport.setScale(i), this.zoomControl?.sync(i, r, t, n), this.currentWorksheet) {
|
|
5421
5445
|
let e = this.effectiveScrollLeft, t = this.viewportTop;
|
|
5422
5446
|
if (this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), o) {
|
|
5423
|
-
this.viewportTop =
|
|
5424
|
-
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s =
|
|
5447
|
+
this.viewportTop = ye(t, o.y, a, i, { maxScroll: this.maxScrollTop });
|
|
5448
|
+
let n = this.screenX(o.x, 0), r = this.maxScrollLeft, s = ye(e, n, a, i, { maxScroll: r });
|
|
5425
5449
|
this.setViewportLeft(s);
|
|
5426
5450
|
} else this.setViewportLeft(e);
|
|
5427
5451
|
}
|
|
@@ -5432,10 +5456,10 @@ var da = class {
|
|
|
5432
5456
|
return this.viewport.scale;
|
|
5433
5457
|
}
|
|
5434
5458
|
zoomIn() {
|
|
5435
|
-
this.setScale(
|
|
5459
|
+
this.setScale(Ce(this.getScale()));
|
|
5436
5460
|
}
|
|
5437
5461
|
zoomOut() {
|
|
5438
|
-
this.setScale(
|
|
5462
|
+
this.setScale(Pe(this.getScale()));
|
|
5439
5463
|
}
|
|
5440
5464
|
fitWidth() {
|
|
5441
5465
|
this._fit("width");
|
|
@@ -5446,7 +5470,7 @@ var da = class {
|
|
|
5446
5470
|
_fit(e) {
|
|
5447
5471
|
let t = this.currentWorksheet;
|
|
5448
5472
|
if (!t) return;
|
|
5449
|
-
let { width: n, height: r } = this._naturalContentExtent(t), i =
|
|
5473
|
+
let { width: n, height: r } = this._naturalContentExtent(t), i = Fe({
|
|
5450
5474
|
contentWidth: n,
|
|
5451
5475
|
contentHeight: r,
|
|
5452
5476
|
containerWidth: this.canvasArea.clientWidth,
|
|
@@ -5456,16 +5480,16 @@ var da = class {
|
|
|
5456
5480
|
}
|
|
5457
5481
|
_naturalContentExtent(e) {
|
|
5458
5482
|
let { maxRow: t, maxCol: n } = Rn(e, this.gridExtent);
|
|
5459
|
-
return
|
|
5483
|
+
return H(e).logicalContentExtent(t, n, 50, 22);
|
|
5460
5484
|
}
|
|
5461
5485
|
updateSpacerSize(e) {
|
|
5462
5486
|
let t = this.viewport.scale, { maxRow: n, maxCol: r } = Rn(e, this.gridExtent);
|
|
5463
5487
|
n += this.gridExtent.marginRows, r += this.gridExtent.marginCols;
|
|
5464
|
-
let i =
|
|
5488
|
+
let i = H(e).roundedContentExtent(n, r, t, 50, 22), a = i.width, o = i.height;
|
|
5465
5489
|
this.spacer.style.width = `${a}px`, this.spacer.style.height = `${o}px`, this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setExtent(a, o), this.setViewportLeft(this.viewport.x), this.viewportTop = this.viewport.y;
|
|
5466
5490
|
}
|
|
5467
|
-
scheduleRender() {
|
|
5468
|
-
this.renderDispatcher.schedule(() => this.renderCurrentSheet().catch((e) => this._reportRenderError(e)));
|
|
5491
|
+
scheduleRender(e = !1) {
|
|
5492
|
+
this.renderDispatcher.schedule(() => this.renderCurrentSheet().catch((e) => this._reportRenderError(e)), e && this._mode === "worker");
|
|
5469
5493
|
}
|
|
5470
5494
|
async renderCurrentSheet() {
|
|
5471
5495
|
let e = this.renderDispatcher.begin(), t = this.selectionInput.rowResizePreview;
|
|
@@ -5492,44 +5516,52 @@ var da = class {
|
|
|
5492
5516
|
}
|
|
5493
5517
|
let t = this.currentWorksheet, n = this.canvasArea.clientWidth, r = this.canvasArea.clientHeight;
|
|
5494
5518
|
if (n <= 0 || r <= 0) return;
|
|
5495
|
-
let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c =
|
|
5519
|
+
let i = this.viewport.scale, a = this.surface.dpr, o = t.freezeRows ?? 0, s = t.freezeCols ?? 0, c = this.effectiveScrollLeft, l = this.viewportTop, u = H(t).visibleRange({
|
|
5496
5520
|
width: n,
|
|
5497
5521
|
height: r,
|
|
5498
5522
|
scale: i,
|
|
5499
|
-
scrollX:
|
|
5500
|
-
scrollY:
|
|
5523
|
+
scrollX: c,
|
|
5524
|
+
scrollY: l,
|
|
5501
5525
|
headerWidth: 50,
|
|
5502
5526
|
headerHeight: 22,
|
|
5503
5527
|
buffer: 2
|
|
5504
|
-
}),
|
|
5528
|
+
}), d = u.range, { offsetX: f, offsetY: p } = u, { selectedRowRange: m, selectedColRange: h } = this.computeHeaderHighlight(), g = {
|
|
5505
5529
|
width: n,
|
|
5506
5530
|
height: r,
|
|
5507
5531
|
dpr: a,
|
|
5508
5532
|
imageResources: this.opts.imageResources,
|
|
5509
5533
|
cellScale: i,
|
|
5510
|
-
scrollOffsetX:
|
|
5511
|
-
scrollOffsetY:
|
|
5534
|
+
scrollOffsetX: f,
|
|
5535
|
+
scrollOffsetY: p,
|
|
5512
5536
|
freezeRows: o,
|
|
5513
5537
|
freezeCols: s,
|
|
5514
|
-
selectedRowRange:
|
|
5515
|
-
selectedColRange:
|
|
5538
|
+
selectedRowRange: m,
|
|
5539
|
+
selectedColRange: h,
|
|
5516
5540
|
chromeColors: this.chromeColors
|
|
5517
|
-
},
|
|
5541
|
+
}, _ = this.wireSizeOverrides(), v = t.parseError ? void 0 : this.initialAnchorReferenceFor(this.workbook, this.currentSheet) ?? void 0, y = _ || v ? {
|
|
5518
5542
|
id: this.projectionId,
|
|
5519
5543
|
revision: this.viewEdits.sizeRevision(this.currentSheet),
|
|
5520
5544
|
autoRowHeightsPrepared: this.currentAutoRowHeightsPrepared,
|
|
5521
|
-
...
|
|
5522
|
-
} : void 0,
|
|
5523
|
-
...
|
|
5524
|
-
sizeOverrides:
|
|
5525
|
-
} :
|
|
5545
|
+
...v ? { initialAnchorSizes: v } : {}
|
|
5546
|
+
} : void 0, b = Dn(_ ? {
|
|
5547
|
+
...g,
|
|
5548
|
+
sizeOverrides: _.overrides
|
|
5549
|
+
} : g, H(t).maximumDigitWidth, {
|
|
5526
5550
|
worksheet: t,
|
|
5527
|
-
projection:
|
|
5551
|
+
projection: y
|
|
5528
5552
|
});
|
|
5529
5553
|
if (this._mode === "worker") {
|
|
5530
|
-
let
|
|
5531
|
-
if (!this.renderDispatcher.commitBitmap(e,
|
|
5532
|
-
|
|
5554
|
+
let a = await this.workbook.renderViewportToBitmap(this.currentSheet, d, b);
|
|
5555
|
+
if (!this.renderDispatcher.commitBitmap(e, a, n, r)) return;
|
|
5556
|
+
this.displayedViewport = {
|
|
5557
|
+
worksheet: t,
|
|
5558
|
+
x: c,
|
|
5559
|
+
y: l,
|
|
5560
|
+
scale: i,
|
|
5561
|
+
width: n,
|
|
5562
|
+
height: r
|
|
5563
|
+
}, this.updateSelectionOverlay(), this.updateFindOverlay(), this._lastViewportNotification && this.emitViewportChange();
|
|
5564
|
+
} else if (await this.workbook.renderViewport(this.canvas, this.currentSheet, d, $t(b, () => !this._destroyed && this.renderDispatcher.isCurrent(e))), !this.renderDispatcher.isCurrent(e) || this._destroyed) return;
|
|
5533
5565
|
this.renderGutters(), this.firstPreviewRender = !1, this.committedFrameCount++;
|
|
5534
5566
|
}
|
|
5535
5567
|
computeHeaderHighlight() {
|
|
@@ -5549,7 +5581,7 @@ var da = class {
|
|
|
5549
5581
|
if (this._destroyed) return;
|
|
5550
5582
|
this._destroyed = !0, this.notifier.destroy(), this.selectionInput.destroy(), this.sheetRequestGeneration++, this.resizeObserver?.disconnect(), this.chromeTheme.destroy(), this.renderDispatcher.destroy(), this.surface.destroy(), this.overlayHost.destroy(), this.sheetTabs?.destroy(), this.zoomControl?.destroy(), this.comments.destroy(), this.validation.destroy(), this.finder.destroy(), this.releaseHostFonts();
|
|
5551
5583
|
let e = this.wb?.[Vn];
|
|
5552
|
-
typeof e == "function" && e.call(this.wb, this.projectionId), this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.sheetViews.clear(), this.releaseInitialAnchorReferences(), this.viewEdits.destroy(), this.currentSourceComments = [], this.sourceCommentMap.clear(), this.hyperlinks.destroy(), this.preparedWorkbook = null, this.outlineGutter.destroy(), this.elementContext = null, this.selectionController.reset(), this.acquisition.destroy(), this.wrapper.remove();
|
|
5584
|
+
typeof e == "function" && e.call(this.wb, this.projectionId), this.displayedViewport = null, this.currentWorksheet = null, this.releaseCurrentWorksheet?.(), this.releaseCurrentWorksheet = null, this.sheetViews.clear(), this.releaseInitialAnchorReferences(), this.viewEdits.destroy(), this.currentSourceComments = [], this.sourceCommentMap.clear(), this.hyperlinks.destroy(), this.preparedWorkbook = null, this.outlineGutter.destroy(), this.elementContext = null, this.selectionController.reset(), this.acquisition.destroy(), this.wrapper.remove();
|
|
5553
5585
|
}
|
|
5554
5586
|
assertOpen() {
|
|
5555
5587
|
if (this._destroyed) throw this.destroyedError();
|
|
@@ -5585,8 +5617,8 @@ var da = class {
|
|
|
5585
5617
|
}
|
|
5586
5618
|
constructor(e, t = {}) {
|
|
5587
5619
|
this.canvasElement = e;
|
|
5588
|
-
let n = t[ea], r =
|
|
5589
|
-
this.canvasMount = new
|
|
5620
|
+
let n = t[ea], r = Me("XlsxSheetViewer", t.mode, n), i = e.getBoundingClientRect();
|
|
5621
|
+
this.canvasMount = new je(e, {
|
|
5590
5622
|
wrapperCssText: `position:relative;display:inline-block;vertical-align:top;overflow:hidden;width:${e.style.width || `${i.width || e.width}px`};height:${e.style.height || `${i.height || e.height}px`};`,
|
|
5591
5623
|
restoreMode: "style-and-bitmap"
|
|
5592
5624
|
}), this.engine = new da(this.canvasMount.wrapper, {
|
|
@@ -5761,17 +5793,17 @@ var da = class {
|
|
|
5761
5793
|
MAX_SELECTION_AREAS: () => 128,
|
|
5762
5794
|
MAX_SELECTION_CONTEXT_CELLS: () => mr,
|
|
5763
5795
|
MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: () => hr,
|
|
5764
|
-
OoxmlDecodedImageLimitError: () =>
|
|
5796
|
+
OoxmlDecodedImageLimitError: () => ce,
|
|
5765
5797
|
OoxmlError: () => h,
|
|
5766
5798
|
OoxmlResourceLimitError: () => _,
|
|
5767
|
-
TiffDecodeError: () =>
|
|
5799
|
+
TiffDecodeError: () => he,
|
|
5768
5800
|
XlsxSheetViewer: () => pa,
|
|
5769
5801
|
XlsxViewer: () => fa,
|
|
5770
5802
|
XlsxWorkbook: () => Un,
|
|
5771
|
-
autoResize: () =>
|
|
5772
|
-
isOoxmlDecodedImageLimitError: () =>
|
|
5773
|
-
isTiffDecodeError: () =>
|
|
5774
|
-
openExternalHyperlink: () =>
|
|
5775
|
-
resolveSharedStrings: () =>
|
|
5803
|
+
autoResize: () => _e,
|
|
5804
|
+
isOoxmlDecodedImageLimitError: () => R,
|
|
5805
|
+
isTiffDecodeError: () => me,
|
|
5806
|
+
openExternalHyperlink: () => L,
|
|
5807
|
+
resolveSharedStrings: () => xt
|
|
5776
5808
|
});
|
|
5777
5809
|
export { mr as a, On as c, pr as i, Dn as l, pa as n, hr as o, fa as r, Un as s, ma as t };
|