@silurus/ooxml 0.85.1 → 0.85.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +3 -2
  2. package/dist/assets/render-worker-CV9Mg4j9.js +10 -0
  3. package/dist/assets/{render-worker-BRKOyWVH.js → render-worker-DHP0rgcW.js} +16 -16
  4. package/dist/assets/render-worker-DdvOGyrn.js +11 -0
  5. package/dist/{canvas-viewer-mechanics-CfRzOhz5.js → canvas-viewer-mechanics-CDNMJ-Yz.js} +1 -1
  6. package/dist/{document-pull-client-BkHHIdR4.js → document-pull-client-BssAk95w.js} +3875 -3865
  7. package/dist/{docx-_uelcAui.js → docx-BY7oyoml.js} +17 -37
  8. package/dist/docx.mjs +5 -5
  9. package/dist/{dom-interaction-boundary-CMDDgICk.js → dom-interaction-boundary-CDGegIB5.js} +1 -1
  10. package/dist/index.mjs +3 -3
  11. package/dist/line-distribute-BsV4MVZ2.js +1023 -0
  12. package/dist/{line-metrics-u87yCAfV.js → line-metrics-BGtFM-ec.js} +650 -607
  13. package/dist/node.mjs +30 -30
  14. package/dist/{pptx-WpBbS0mq.js → pptx-C4z96sAA.js} +23 -23
  15. package/dist/pptx.mjs +6 -6
  16. package/dist/pptx_parser_bg.wasm +0 -0
  17. package/dist/{raster-target-whZhvVMt.js → raster-target-ojDdQizC.js} +11 -7
  18. package/dist/{render-DrAAZWwH.js → render-Dxvwes39.js} +1 -1
  19. package/dist/{render-worker-host-CBVe8aeD.js → render-worker-host-BAXcBGq3.js} +1 -1
  20. package/dist/{render-worker-host-CHlwYJdK.js → render-worker-host-CNKQ76tu.js} +1 -1
  21. package/dist/{render-worker-host-XDMsyVsv.js → render-worker-host-CXTCU4PO.js} +1 -1
  22. package/dist/{resource-measurement-6uR3Huao.js → resource-measurement-D41R-0Bl.js} +4 -4
  23. package/dist/{session-DoPwA4gv.js → session-BmP4lcEo.js} +6 -6
  24. package/dist/{slide-pull-client-8i8C4VyD.js → slide-pull-client-RTwQbJiy.js} +707 -697
  25. package/dist/tiff.mjs +1 -1
  26. package/dist/types/chart-ex.d.ts +2 -2
  27. package/dist/types/docx.d.ts +8 -10
  28. package/dist/types/index.d.ts +12 -14
  29. package/dist/types/node.d.ts +5 -5
  30. package/dist/types/pptx.d.ts +8 -7
  31. package/dist/types/region-map.d.ts +2 -2
  32. package/dist/types/three-d.d.ts +2 -2
  33. package/dist/types/xlsx.d.ts +8 -7
  34. package/dist/{worksheet-pull-client-Btydoxto.js → worksheet-pull-client-C9sC36Vu.js} +20 -20
  35. package/dist/{xlsx-Bd16V4Xx.js → xlsx-DSU6pV1O.js} +1214 -1208
  36. package/dist/xlsx.mjs +6 -6
  37. package/package.json +1 -1
  38. package/dist/assets/render-worker-CtLMFj9r.js +0 -10
  39. package/dist/assets/render-worker-NZPOUOTU.js +0 -11
  40. package/dist/line-distribute-CiKeWjBF.js +0 -1023
package/dist/node.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { t } from "./slide-pull-client-8i8C4VyD.js";
3
- import { B as n, F as r, G as i, Gt as a, H as o, I as s, K as c, P as l, R as u, U as d, Wt as f, Xt as p, pt as m, q as h, sn as g, ut as _ } from "./line-metrics-u87yCAfV.js";
2
+ import { t } from "./slide-pull-client-RTwQbJiy.js";
3
+ import { B as n, F as r, G as i, Gt as a, H as o, I as s, K as c, Kt as l, P as u, R as d, U as f, Zt as p, cn as m, pt as h, q as g, ut as _ } from "./line-metrics-BGtFM-ec.js";
4
4
  import { t as ee } from "./bounded-raw-part-cache-C6ro6Ezf.js";
5
- import { a as te, c as ne, i as re, l as ie, r as ae, u as oe } from "./document-pull-client-BkHHIdR4.js";
5
+ import { a as te, c as ne, i as re, l as ie, r as ae, u as oe } from "./document-pull-client-BssAk95w.js";
6
6
  import { l as se, s as ce } from "./pixel-budget-Dgjw269h.js";
7
7
  import { t as le } from "./transfer-mIj7E7NB.js";
8
- import { a as ue, c as de, d as fe, l as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./worksheet-pull-client-Btydoxto.js";
9
- import { a as ye, i as be, n as xe, r as Se } from "./session-DoPwA4gv.js";
10
- import { a as Ce, n as we, r as Te, t as Ee } from "./render-DrAAZWwH.js";
8
+ import { a as ue, c as de, d as fe, l as pe, o as me, r as he, s as ge, t as _e, u as ve } from "./worksheet-pull-client-C9sC36Vu.js";
9
+ import { a as ye, i as be, n as xe, r as Se } from "./session-BmP4lcEo.js";
10
+ import { a as Ce, n as we, r as Te, t as Ee } from "./render-Dxvwes39.js";
11
11
  import { existsSync as De, readFileSync as Oe } from "node:fs";
12
12
  import { fileURLToPath as ke } from "node:url";
13
13
  import { basename as Ae, dirname as je, resolve as Me } from "node:path";
@@ -134,7 +134,7 @@ var Re = class {
134
134
  async renderSlide(e, t, n) {
135
135
  return this.assertOpen(), this.enqueueRender(async () => {
136
136
  S(this.signal);
137
- let { renderSlideNode: r } = await import("./render-DrAAZWwH.js").then((e) => e.i);
137
+ let { renderSlideNode: r } = await import("./render-Dxvwes39.js").then((e) => e.i);
138
138
  await r(e, {
139
139
  slideWidth: this.slideWidth,
140
140
  slideHeight: this.slideHeight,
@@ -181,7 +181,7 @@ var Re = class {
181
181
  }
182
182
  async release() {
183
183
  let e;
184
- await this.renderTail, m(this.fetchImage), _(this.fetchImage);
184
+ await this.renderTail, h(this.fetchImage), _(this.fetchImage);
185
185
  try {
186
186
  await this.slidePull.reset();
187
187
  } catch (t) {
@@ -209,7 +209,7 @@ var Re = class {
209
209
  }
210
210
  refreshResourceUsage() {
211
211
  try {
212
- this.usage = d(this.archive.resource_usage()), this.metrics.observeUsage(this.usage);
212
+ this.usage = f(this.archive.resource_usage()), this.metrics.observeUsage(this.usage);
213
213
  } catch {}
214
214
  return this.usage;
215
215
  }
@@ -219,7 +219,7 @@ var Re = class {
219
219
  }
220
220
  failOperation(e) {
221
221
  let t = i(e) ?? e;
222
- throw t instanceof g && (this.resourceFailure ??= t), this.metrics.fail(t), t;
222
+ throw t instanceof m && (this.resourceFailure ??= t), this.metrics.fail(t), t;
223
223
  }
224
224
  };
225
225
  async function ze(e, t = {}) {
@@ -239,7 +239,7 @@ function S(e) {
239
239
  }
240
240
  //#endregion
241
241
  //#region packages/docx/src/document-pull-worker.ts
242
- var Ve = Math.max(f, a), He = class {
242
+ var Ve = Math.max(a, l), He = class {
243
243
  coordinator = new s();
244
244
  host = null;
245
245
  identity = null;
@@ -262,7 +262,7 @@ var Ve = Math.max(f, a), He = class {
262
262
  try {
263
263
  r = this.executeArchive((r) => r.pull_document_chunk(t, e.operationId, e.generation, n));
264
264
  } catch (e) {
265
- throw h(e, n, Ve) || e;
265
+ throw g(e, n, Ve) || e;
266
266
  }
267
267
  let i = le(r);
268
268
  return {
@@ -281,14 +281,14 @@ var Ve = Math.max(f, a), He = class {
281
281
  close: () => this.executeArchive((e) => e.close_document_session()),
282
282
  resourceUsage: () => {
283
283
  let e = this.executeArchive((e) => e.document_cursor_resource_usage?.());
284
- return e ? d(e) : void 0;
284
+ return e ? f(e) : void 0;
285
285
  }
286
286
  }
287
287
  });
288
288
  }
289
289
  dispatch(e, t) {
290
290
  return !this.host || !this.identity ? (t({
291
- protocol: l,
291
+ protocol: u,
292
292
  kind: "error",
293
293
  sessionId: e.sessionId,
294
294
  operationId: e.operationId,
@@ -576,7 +576,7 @@ function at(e) {
576
576
  return it;
577
577
  }
578
578
  async function ot(e, t, r, a) {
579
- let s = n(r), c = new u({
579
+ let s = n(r), c = new d({
580
580
  enabled: s.debug || s.onResourceMetrics !== void 0,
581
581
  format: "docx",
582
582
  mode: "node",
@@ -586,30 +586,30 @@ async function ot(e, t, r, a) {
586
586
  emitToConsole: s.debug
587
587
  });
588
588
  c.setSourceBytes(e.byteLength);
589
- let l, d, f;
589
+ let l, u, f;
590
590
  try {
591
591
  ct(r.signal);
592
- let [n, i, u] = o(s.policy), p = C;
593
- l = await at(t).open(() => new p(e, n, i, u), {
592
+ let [n, i, d] = o(s.policy), p = C;
593
+ l = await at(t).open(() => new p(e, n, i, d), {
594
594
  signal: r.signal,
595
595
  abortError: lt,
596
596
  disposeOnAbort: (e) => e.free()
597
597
  }), ct(r.signal);
598
598
  let m = l.proxy;
599
- c.checkpoint("container ready"), d = new He(() => m);
599
+ c.checkpoint("container ready"), u = new He(() => m);
600
600
  let h = {
601
601
  sessionId: 1,
602
602
  operationId: 1,
603
603
  generation: 1
604
604
  };
605
- d.open(h), f = new y((e, t) => d?.dispatch(e, t), () => void 0);
605
+ u.open(h), f = new y((e, t) => u?.dispatch(e, t), () => void 0);
606
606
  let g, _ = await a(f, h, {
607
607
  signal: r.signal,
608
608
  onUsage: (e) => {
609
609
  g = e, c.observeUsage(e);
610
610
  }
611
611
  });
612
- return g ??= st(m.document_cursor_resource_usage()), c.observeUsage(g), c.checkpoint("model streamed"), await d.reset(), f.terminate(), {
612
+ return g ??= st(m.document_cursor_resource_usage()), c.observeUsage(g), c.checkpoint("model streamed"), await u.reset(), f.terminate(), {
613
613
  archive: m,
614
614
  result: _,
615
615
  usage: g,
@@ -617,7 +617,7 @@ async function ot(e, t, r, a) {
617
617
  closeArchive: () => l?.close((e) => e.free())
618
618
  };
619
619
  } catch (e) {
620
- await d?.reset().catch(() => void 0), f?.terminate();
620
+ await u?.reset().catch(() => void 0), f?.terminate();
621
621
  try {
622
622
  l?.close((e) => e.free());
623
623
  } catch {}
@@ -627,7 +627,7 @@ async function ot(e, t, r, a) {
627
627
  }
628
628
  function st(e) {
629
629
  try {
630
- return d(e);
630
+ return f(e);
631
631
  } catch {
632
632
  return;
633
633
  }
@@ -710,7 +710,7 @@ var pt = class {
710
710
  }
711
711
  refreshResourceUsage() {
712
712
  try {
713
- this.lastResourceUsage = d(this.archive.resource_usage()), this.metrics.observeUsage(this.lastResourceUsage);
713
+ this.lastResourceUsage = f(this.archive.resource_usage()), this.metrics.observeUsage(this.lastResourceUsage);
714
714
  } catch {}
715
715
  return this.lastResourceUsage;
716
716
  }
@@ -735,7 +735,7 @@ var pt = class {
735
735
  })), gt(this.signal), r;
736
736
  }).catch((e) => {
737
737
  let t = i(e) ?? e;
738
- throw t instanceof g && (this.resourceFailure ??= t), this.metrics.fail(t), t;
738
+ throw t instanceof m && (this.resourceFailure ??= t), this.metrics.fail(t), t;
739
739
  }));
740
740
  }
741
741
  async *pages(e = {}) {
@@ -770,7 +770,7 @@ var pt = class {
770
770
  return this.renderTail = t.then(() => void 0, () => void 0), t;
771
771
  }
772
772
  async release() {
773
- await this.renderTail, m(this.fetchImage), _(this.fetchImage), this.state = null;
773
+ await this.renderTail, h(this.fetchImage), _(this.fetchImage), this.state = null;
774
774
  try {
775
775
  this.closeArchive();
776
776
  } catch (e) {
@@ -805,7 +805,7 @@ function vt(e, t) {
805
805
  try {
806
806
  return {
807
807
  workbook: n,
808
- usage: d(t())
808
+ usage: f(t())
809
809
  };
810
810
  } catch (e) {
811
811
  if ((e instanceof Error ? e.message : String(e)) === _t) return {
@@ -1082,7 +1082,7 @@ function Ft(e) {
1082
1082
  return Q;
1083
1083
  }
1084
1084
  async function It(e, t, r = {}) {
1085
- let a = n(r), s = new u({
1085
+ let a = n(r), s = new d({
1086
1086
  enabled: a.debug || a.onResourceMetrics !== void 0,
1087
1087
  format: "xlsx",
1088
1088
  mode: "node",
@@ -1310,7 +1310,7 @@ function Gt(e, t = /* @__PURE__ */ new WeakSet()) {
1310
1310
  }
1311
1311
  function Kt(e) {
1312
1312
  try {
1313
- return d(e);
1313
+ return f(e);
1314
1314
  } catch (e) {
1315
1315
  if (String(e).includes("worksheet cursor usage is unavailable")) return;
1316
1316
  throw e;
@@ -1320,4 +1320,4 @@ function qt(e) {
1320
1320
  return e instanceof Uint8Array ? e : new Uint8Array(e);
1321
1321
  }
1322
1322
  //#endregion
1323
- export { ce as OoxmlDecodedImageLimitError, g as OoxmlResourceLimitError, Ee as installImageBitmapShim, we as installOffscreenCanvasShim, se as isOoxmlDecodedImageLimitError, ft as materializeDocxDocument, ze as materializePptxPresentation, Ut as materializeXlsxWorkbook, Vt as materializeXlsxWorkbookIndex, Ht as materializeXlsxWorksheet, dt as openDocxDocument, Ie as openPptxPresentation, $ as openXlsxWorkbook, Te as renderSlideNode };
1323
+ export { ce as OoxmlDecodedImageLimitError, m as OoxmlResourceLimitError, Ee as installImageBitmapShim, we as installOffscreenCanvasShim, se as isOoxmlDecodedImageLimitError, ft as materializeDocxDocument, ze as materializePptxPresentation, Ut as materializeXlsxWorkbook, Vt as materializeXlsxWorkbookIndex, Ht as materializeXlsxWorksheet, dt as openDocxDocument, Ie as openPptxPresentation, $ as openXlsxWorkbook, Te as renderSlideNode };
@@ -1,13 +1,13 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l, s as u, t as d, u as f } from "./slide-pull-client-8i8C4VyD.js";
3
- import { B as p, G as m, R as h, W as g, Xt as _, a as v, et as y, on as b, pt as x, qt as S, sn as C, tt as w, ut as ee, vt as te, z as ne } from "./line-metrics-u87yCAfV.js";
4
- import { C as re, D as ie, E as ae, S as oe, T as se, _ as ce, a as T, b as le, c as E, d as ue, f as de, g as fe, h as pe, i as D, l as O, m as me, n as he, o as ge, p as _e, r as ve, s as ye, t as be, v as xe, w as Se, x as Ce, y as we } from "./canvas-viewer-mechanics-CfRzOhz5.js";
2
+ import { a as t, c as n, d as r, f as i, i as a, l as o, n as s, o as c, r as l, s as u, t as d, u as f } from "./slide-pull-client-RTwQbJiy.js";
3
+ import { B as p, G as m, Jt as h, R as g, W as _, Zt as v, a as y, cn as b, et as x, pt as S, sn as C, tt as w, ut as ee, vt as te, z as ne } from "./line-metrics-BGtFM-ec.js";
4
+ import { C as re, D as ie, E as ae, S as oe, T as se, _ as ce, a as T, b as le, c as E, d as ue, f as de, g as fe, h as pe, i as D, l as O, m as me, n as he, o as ge, p as _e, r as ve, s as ye, t as be, v as xe, w as Se, x as Ce, y as we } from "./canvas-viewer-mechanics-CDNMJ-Yz.js";
5
5
  import { a as Te, i as k, n as Ee, t as De } from "./bounded-raw-part-cache-C6ro6Ezf.js";
6
- import { a as A, c as Oe, i as ke, l as j, n as Ae, r as je, t as Me } from "./dom-interaction-boundary-CMDDgICk.js";
6
+ import { a as A, c as Oe, i as ke, l as j, n as Ae, r as je, t as Me } from "./dom-interaction-boundary-CDGegIB5.js";
7
7
  import { l as Ne, s as Pe } from "./pixel-budget-Dgjw269h.js";
8
8
  import { i as M } from "./units-EJdC96r6.js";
9
- import { i as Fe, s as Ie } from "./raster-target-whZhvVMt.js";
10
- import { n as Le } from "./resource-measurement-6uR3Huao.js";
9
+ import { i as Fe, s as Ie } from "./raster-target-ojDdQizC.js";
10
+ import { n as Le } from "./resource-measurement-D41R-0Bl.js";
11
11
  import { n as Re } from "./renderer-module-contract-Cu-GKuPd.js";
12
12
  import { t as ze } from "./visible-index-DPoQYSDt.js";
13
13
  import { n as Be, t as N } from "./highlight-rect-DBcYVJDv.js";
@@ -559,7 +559,7 @@ var _t = class {
559
559
  }
560
560
  };
561
561
  function vt(e) {
562
- return e instanceof C ? e : m(e);
562
+ return e instanceof b ? e : m(e);
563
563
  }
564
564
  //#endregion
565
565
  //#region packages/pptx/src/embedded-fonts.ts
@@ -878,7 +878,7 @@ var J = class e {
878
878
  _slidePartIndex = null;
879
879
  _rawParts = new De({
880
880
  maxEntries: 64,
881
- maxBytes: _
881
+ maxBytes: v
882
882
  });
883
883
  _googleFontFaces = [];
884
884
  _embeddedFontFaces = [];
@@ -895,7 +895,7 @@ var J = class e {
895
895
  constructor(e, t, n) {
896
896
  this._worker = e, this._mode = t, this._bridge = new Se(this._worker, {
897
897
  correlate: (e) => "protocol" in e && e.protocol === "ooxml-pull-v1" ? e.requestId : "id" in e ? e.id : void 0,
898
- toError: (e) => !("protocol" in e) && e.kind === "error" ? g(e) : void 0,
898
+ toError: (e) => !("protocol" in e) && e.kind === "error" ? _(e) : void 0,
899
899
  onUnsolicited: (e) => this._onWorkerLayoutPush(e)
900
900
  });
901
901
  let r = new URL(n ?? Tt, location.href).href;
@@ -908,11 +908,11 @@ var J = class e {
908
908
  if (this._resourceFailure) throw this._resourceFailure;
909
909
  }
910
910
  _rethrowWithResourceFailure(e) {
911
- let t = e instanceof C ? e : m(e);
911
+ let t = e instanceof b ? e : m(e);
912
912
  throw t ? (this._resourceFailure ??= t, this._resourceFailure) : e;
913
913
  }
914
914
  static async load(t, r = {}) {
915
- let i = p(r), a = r.mode ?? "main", o = new h({
915
+ let i = p(r), a = r.mode ?? "main", o = new g({
916
916
  enabled: !0,
917
917
  format: "pptx",
918
918
  mode: a,
@@ -929,7 +929,7 @@ var J = class e {
929
929
  s = await e.arrayBuffer();
930
930
  } else s = t;
931
931
  s = ie(await ae(s, r.password)), o.setSourceBytes(s.byteLength), o.checkpoint("container ready");
932
- let c = a === "worker" ? (await import("./render-worker-host-XDMsyVsv.js")).createRenderWorker() : new wt(), l = a === "worker" ? Re(r) : void 0, u;
932
+ let c = a === "worker" ? (await import("./render-worker-host-CXTCU4PO.js")).createRenderWorker() : new wt(), l = a === "worker" ? Re(r) : void 0, u;
933
933
  try {
934
934
  u = new e(c, a, r.wasmUrl), u._metrics = o, r.math && a === "worker" && !l?.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."), r.threeD && a === "worker" && !l?.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."), u._math = a === "worker" ? void 0 : r.math, u._threeD = a === "worker" ? void 0 : r.threeD, r.regionMap && a === "worker" && !l?.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."), u._regionMap = a === "worker" ? void 0 : r.regionMap, r.chartEx && a === "worker" && !l?.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."), u._chartEx = a === "worker" ? void 0 : r.chartEx, r.tiff && a === "worker" && !l?.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."), u._tiff = a === "worker" ? void 0 : r.tiff;
935
935
  let t = r.progressiveLayout ? {
@@ -1004,7 +1004,7 @@ var J = class e {
1004
1004
  this._preflight = c(m.preflight), this._availableSlideCount = this._preflight.slideCount, this._slides = new _t({
1005
1005
  slideCount: this._preflight.slideCount,
1006
1006
  maxCachedSlides: 8,
1007
- maxCachedStructuralBytes: S,
1007
+ maxCachedStructuralBytes: h,
1008
1008
  loadSlide: async (e) => {
1009
1009
  let t = await this._slidePullClient?.load(e, !0, i);
1010
1010
  if (!t) throw Error("PPTX slide pull client is unavailable");
@@ -1027,7 +1027,7 @@ var J = class e {
1027
1027
  this._slidePullClient = this._createSlidePullClient(c.slideCount, a, o), this._slides = new _t({
1028
1028
  slideCount: c.slideCount,
1029
1029
  maxCachedSlides: 8,
1030
- maxCachedStructuralBytes: S,
1030
+ maxCachedStructuralBytes: h,
1031
1031
  loadSlide: async (e) => {
1032
1032
  let t = await this._slidePullClient?.load(e, !0, a);
1033
1033
  if (!t) throw Error("PPTX slide pull client is unavailable");
@@ -1223,7 +1223,7 @@ var J = class e {
1223
1223
  this._assertSlideIndex(t), await this._waitForSlide(t);
1224
1224
  let i = this._preflight, a = this._slides;
1225
1225
  if (!i || !a) throw Error("Presentation not loaded");
1226
- let o = n.dpr ?? y(), s = n.width ?? ((w(e) ? e.offsetWidth : 0) || 960);
1226
+ let o = n.dpr ?? x(), s = n.width ?? ((w(e) ? e.offsetWidth : 0) || 960);
1227
1227
  await a.withSlide(t, (t) => (this._assertResourceHealthy(), r(e, t, i.slideWidth, i.slideHeight, {
1228
1228
  width: s,
1229
1229
  dpr: o,
@@ -1252,7 +1252,7 @@ var J = class e {
1252
1252
  this._assertResourceHealthy();
1253
1253
  try {
1254
1254
  this._assertSlideIndex(e), await this._waitForSlide(e);
1255
- let n = t.width ?? 960, r = t.dpr ?? y();
1255
+ let n = t.width ?? 960, r = t.dpr ?? x();
1256
1256
  if (this._mode === "worker") {
1257
1257
  let i = await this._bridge.request((i) => ({
1258
1258
  kind: "renderSlide",
@@ -1405,7 +1405,7 @@ var J = class e {
1405
1405
  this._assertResourceHealthy();
1406
1406
  try {
1407
1407
  if (this._assertSlideIndex(t), await this._waitForSlide(t), !this._preflight) throw Error("Presentation not loaded");
1408
- let r = n.dpr ?? y(), i = n.width ?? (e.offsetWidth || 960), a = this.slideWidth > 0 ? i * this.slideHeight / this.slideWidth : 0;
1408
+ let r = n.dpr ?? x(), i = n.width ?? (e.offsetWidth || 960), a = this.slideWidth > 0 ? i * this.slideHeight / this.slideWidth : 0;
1409
1409
  e.style.width = `${Math.round(i)}px`, e.style.height = `${Math.round(a)}px`, e.style.display || (e.style.display = "block");
1410
1410
  let o = this._mode === "worker" ? async () => {
1411
1411
  let a = await this.renderSlideToBitmap(t, {
@@ -1446,7 +1446,7 @@ var J = class e {
1446
1446
  }
1447
1447
  }
1448
1448
  destroy() {
1449
- this._destroyed = !0, this._clearProgressiveWatchdog(), this._slidePullClient?.cancelAll(), this._bridge.terminate(), this._slides?.clear(), this._slides = null, this._slidePullClient = null, this._bootstrap = null, this._preflight = null, this._availableSlideCount = 0, this._layoutLifecycle.succeed(), this._layoutCompletion = null, this._progressive = null, this._parseRequestId = null, this._wakeLayoutWaiters(), this._resourceFailure = null, this._slidePartIndex = null, this._rawParts.clear(), this._googleFontFaces.length > 0 && (Te(this._googleFontFaces), this._googleFontFaces = []), this._embeddedFontFaces.length > 0 && (j(this._embeddedFontFaces), this._embeddedFontFaces = []), this._embeddedFontAliases = /* @__PURE__ */ new Map(), this._embeddedFontAuthoredFamilies = /* @__PURE__ */ new Map(), x(this._fetchImage), ee(this._fetchImage);
1449
+ this._destroyed = !0, this._clearProgressiveWatchdog(), this._slidePullClient?.cancelAll(), this._bridge.terminate(), this._slides?.clear(), this._slides = null, this._slidePullClient = null, this._bootstrap = null, this._preflight = null, this._availableSlideCount = 0, this._layoutLifecycle.succeed(), this._layoutCompletion = null, this._progressive = null, this._parseRequestId = null, this._wakeLayoutWaiters(), this._resourceFailure = null, this._slidePartIndex = null, this._rawParts.clear(), this._googleFontFaces.length > 0 && (Te(this._googleFontFaces), this._googleFontFaces = []), this._embeddedFontFaces.length > 0 && (j(this._embeddedFontFaces), this._embeddedFontFaces = []), this._embeddedFontAliases = /* @__PURE__ */ new Map(), this._embeddedFontAuthoredFamilies = /* @__PURE__ */ new Map(), S(this._fetchImage), ee(this._fetchImage);
1450
1450
  }
1451
1451
  };
1452
1452
  //#endregion
@@ -1938,7 +1938,7 @@ var Ut = Symbol("PptxViewer.borrowedPresentation"), Wt = {
1938
1938
  return;
1939
1939
  }
1940
1940
  if (t.kind === "external") {
1941
- v(t.url, void 0, this.hostWindow);
1941
+ y(t.url, void 0, this.hostWindow);
1942
1942
  return;
1943
1943
  }
1944
1944
  t.slideIndex !== void 0 && this.goToSlide(t.slideIndex).catch((e) => this._reportRenderError(e));
@@ -2875,7 +2875,7 @@ var $ = 440, Xt = 20, Zt = Symbol("PptxScrollViewer.borrowedPresentation"), Qt =
2875
2875
  return;
2876
2876
  }
2877
2877
  if (t.kind === "external") {
2878
- v(t.url);
2878
+ y(t.url);
2879
2879
  return;
2880
2880
  }
2881
2881
  t.slideIndex !== void 0 && this.scrollToSlide(t.slideIndex);
@@ -3026,8 +3026,8 @@ var $ = 440, Xt = 20, Zt = Symbol("PptxScrollViewer.borrowedPresentation"), Qt =
3026
3026
  }
3027
3027
  }, $t = /* @__PURE__ */ e({
3028
3028
  OoxmlDecodedImageLimitError: () => Pe,
3029
- OoxmlError: () => b,
3030
- OoxmlResourceLimitError: () => C,
3029
+ OoxmlError: () => C,
3030
+ OoxmlResourceLimitError: () => b,
3031
3031
  PptxPresentation: () => J,
3032
3032
  PptxScrollViewer: () => Qt,
3033
3033
  PptxViewer: () => Gt,
@@ -3037,7 +3037,7 @@ var $ = 440, Xt = 20, Zt = Symbol("PptxScrollViewer.borrowedPresentation"), Qt =
3037
3037
  buildPptxTextLayer: () => I,
3038
3038
  isOoxmlDecodedImageLimitError: () => Ne,
3039
3039
  isTiffDecodeError: () => Ie,
3040
- openExternalHyperlink: () => v,
3040
+ openExternalHyperlink: () => y,
3041
3041
  readPptxTextSelectionContext: () => X,
3042
3042
  renderSlide: () => f
3043
3043
  });
package/dist/pptx.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { u as e } from "./slide-pull-client-8i8C4VyD.js";
2
- import { a as t, on as n, sn as r } from "./line-metrics-u87yCAfV.js";
3
- import { T as i } from "./canvas-viewer-mechanics-CfRzOhz5.js";
1
+ import { u as e } from "./slide-pull-client-RTwQbJiy.js";
2
+ import { a as t, cn as n, sn as r } from "./line-metrics-BGtFM-ec.js";
3
+ import { T as i } from "./canvas-viewer-mechanics-CDNMJ-Yz.js";
4
4
  import { l as a, s as o } from "./pixel-budget-Dgjw269h.js";
5
- import { i as s, s as c } from "./raster-target-whZhvVMt.js";
6
- import { a as l, i as u, n as d, o as f, r as p, s as m } from "./pptx-WpBbS0mq.js";
7
- export { o as OoxmlDecodedImageLimitError, n as OoxmlError, r as OoxmlResourceLimitError, l as PptxPresentation, d as PptxScrollViewer, p as PptxViewer, s as TiffDecodeError, i as autoResize, f as buildPptxHighlightLayer, m as buildPptxTextLayer, a as isOoxmlDecodedImageLimitError, c as isTiffDecodeError, t as openExternalHyperlink, u as readPptxTextSelectionContext, e as renderSlide };
5
+ import { i as s, s as c } from "./raster-target-ojDdQizC.js";
6
+ import { a as l, i as u, n as d, o as f, r as p, s as m } from "./pptx-C4z96sAA.js";
7
+ export { o as OoxmlDecodedImageLimitError, r as OoxmlError, n as OoxmlResourceLimitError, l as PptxPresentation, d as PptxScrollViewer, p as PptxViewer, s as TiffDecodeError, i as autoResize, f as buildPptxHighlightLayer, m as buildPptxTextLayer, a as isOoxmlDecodedImageLimitError, c as isTiffDecodeError, t as openExternalHyperlink, u as readPptxTextSelectionContext, e as renderSlide };
Binary file
@@ -65,13 +65,16 @@ function o(e, t, n, r = !1) {
65
65
  } : null;
66
66
  }
67
67
  function s(e, t, n, r = !1) {
68
- let i = o(e, t, n, r);
69
- if (!i) return null;
70
- let a = i.width;
71
- return {
72
- width: a,
73
- height: Math.min(e.height, Math.max(1, Math.ceil(e.height * a / e.width)))
74
- };
68
+ if (!Number.isFinite(e.width) || !Number.isFinite(e.height) || !(e.width > 0) || !(e.height > 0)) return null;
69
+ let i = a(t), s = a(n);
70
+ if (i !== void 0 && s !== void 0) {
71
+ let t = Math.min(e.width, Math.max(1, Math.ceil(i))), n = Math.min(e.height, Math.max(1, Math.ceil(s)));
72
+ return t < e.width || n < e.height ? {
73
+ width: t,
74
+ height: n
75
+ } : null;
76
+ }
77
+ return o(e, i, s, r);
75
78
  }
76
79
  function c(e, t, n, r) {
77
80
  let i = s({
@@ -80,6 +83,7 @@ function c(e, t, n, r) {
80
83
  }, n, r, !0);
81
84
  return i ? {
82
85
  resizeWidth: i.width,
86
+ resizeHeight: i.height,
83
87
  resizeQuality: "high"
84
88
  } : void 0;
85
89
  }
@@ -46,7 +46,7 @@ function a(e, t) {
46
46
  return n = o.then(() => void 0, () => void 0), o;
47
47
  }
48
48
  async function o(e, t, n, r = {}) {
49
- let { renderSlide: i } = await import("./session-DoPwA4gv.js").then((e) => e.t), o = t.slides[n];
49
+ let { renderSlide: i } = await import("./session-BmP4lcEo.js").then((e) => e.t), o = t.slides[n];
50
50
  if (!o) throw Error(`Slide index ${n} out of range`);
51
51
  let s = r.width ?? 960, c = r.dpr ?? 2, l = r.fetchImage ?? (async () => new Blob([])), u = async () => {
52
52
  await i(e, o, t.slideWidth, t.slideHeight, {
@@ -1,5 +1,5 @@
1
1
  //#region packages/docx/src/render-worker.ts?worker&url
2
- var e = "" + new URL("assets/render-worker-CtLMFj9r.js", import.meta.url).href;
2
+ var e = "" + new URL("assets/render-worker-CV9Mg4j9.js", import.meta.url).href;
3
3
  //#endregion
4
4
  //#region packages/docx/src/render-worker-host.ts
5
5
  function t() {
@@ -1,5 +1,5 @@
1
1
  //#region packages/xlsx/src/render-worker.ts?worker&url
2
- var e = "" + new URL("assets/render-worker-BRKOyWVH.js", import.meta.url).href;
2
+ var e = "" + new URL("assets/render-worker-DHP0rgcW.js", import.meta.url).href;
3
3
  //#endregion
4
4
  //#region packages/xlsx/src/render-worker-host.ts
5
5
  function t() {
@@ -1,5 +1,5 @@
1
1
  //#region packages/pptx/src/render-worker.ts?worker&url
2
- var e = "" + new URL("assets/render-worker-NZPOUOTU.js", import.meta.url).href;
2
+ var e = "" + new URL("assets/render-worker-DdvOGyrn.js", import.meta.url).href;
3
3
  //#endregion
4
4
  //#region packages/pptx/src/render-worker-host.ts
5
5
  function t() {
@@ -1,7 +1,7 @@
1
- import { ft as e, ht as t, mt as n, ot as r, yt as i } from "./line-metrics-u87yCAfV.js";
1
+ import { ft as e, ht as t, mt as n, ot as r, yt as i } from "./line-metrics-BGtFM-ec.js";
2
2
  import { an as a } from "./plot-area-frame-D5hEOgkJ.js";
3
3
  import { i as o } from "./pixel-budget-Dgjw269h.js";
4
- import { r as s } from "./raster-target-whZhvVMt.js";
4
+ import { r as s } from "./raster-target-ojDdQizC.js";
5
5
  //#region packages/core/src/image/duotone-bitmap-by-path.ts
6
6
  function c(e, t) {
7
7
  return t ? `${e}|duo:${t.clr1}:${t.clr2}` : e;
@@ -17,8 +17,8 @@ async function u(u, d, f, p, m = {}) {
17
17
  targetHeightPx: void 0
18
18
  } : v, b = f ? e(p, l) : void 0, x = await n(u, d, p, y);
19
19
  if (!f || !x) return x;
20
- let S = await i(u, d, p, y, b, x), C = s(Number(x.width), Number(x.height), _.targetWidthPx, _.targetHeightPx);
21
- return t(l, `${c(S, f)}${C ? `|resize-width:${C.resizeWidth}` : ""}${g ? "|strict" : ""}`, p, async () => {
20
+ let S = await i(u, d, p, y, b, x), C = s(Number(x.width), Number(x.height), _.targetWidthPx, _.targetHeightPx), w = C ? `|resize:${C.resizeWidth}x${C.resizeHeight}` : "";
21
+ return t(l, `${c(S, f)}${w}${g ? "|strict" : ""}`, p, async () => {
22
22
  let { w: e, h: t } = a(x);
23
23
  if (e <= 0 || t <= 0) return {
24
24
  bitmap: g ? null : x,
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { a as t, u as n } from "./slide-pull-client-8i8C4VyD.js";
3
- import { B as r, F as i, G as a, H as o, I as s, K as c, P as l, Q as u, R as d, U as f, W as p, X as m, Y as h, Yt as g, Z as _, q as v, sn as y } from "./line-metrics-u87yCAfV.js";
2
+ import { a as t, u as n } from "./slide-pull-client-RTwQbJiy.js";
3
+ import { B as r, F as i, G as a, H as o, I as s, K as c, P as l, Q as u, R as d, U as f, W as p, X as m, Xt as h, Y as g, Z as _, cn as v, q as y } from "./line-metrics-BGtFM-ec.js";
4
4
  import { t as b } from "./transfer-mIj7E7NB.js";
5
5
  //#region packages/pptx/src/slide-cursor-operation.ts
6
6
  function x(e) {
@@ -68,7 +68,7 @@ var te = "ooxml-pull-resetting", ne = "ooxml-pull-reset-failed", re = class {
68
68
  if (n.canceled) throw Error("slide pull session open was canceled");
69
69
  let a, o = !1, s = new i({
70
70
  ...t,
71
- maxByteCredit: g,
71
+ maxByteCredit: h,
72
72
  coordinator: this.coordinator,
73
73
  driver: {
74
74
  pull: (n) => {
@@ -76,7 +76,7 @@ var te = "ooxml-pull-resetting", ne = "ooxml-pull-reset-failed", re = class {
76
76
  try {
77
77
  r = this.executeArchive((r) => r.pull_slide(e, t.operationId, t.generation, n));
78
78
  } catch (e) {
79
- throw v(e, n, g) || (this.latchResourceFailure(e), e);
79
+ throw y(e, n, h) || (this.latchResourceFailure(e), e);
80
80
  }
81
81
  let i = b(r);
82
82
  return this.acceptSlide && (a = JSON.parse(new TextDecoder().decode(new Uint8Array(i)))), o = !0, {
@@ -295,7 +295,7 @@ var te = "ooxml-pull-resetting", ne = "ooxml-pull-reset-failed", re = class {
295
295
  return x(this.executeArchive);
296
296
  }
297
297
  latchResourceFailure(e) {
298
- let t = e instanceof y ? e : a(e);
298
+ let t = e instanceof v ? e : a(e);
299
299
  t && (this.resourceFailure ??= t);
300
300
  }
301
301
  staleLifecycleResponse(e) {
@@ -325,7 +325,7 @@ function C(e, t) {
325
325
  //#endregion
326
326
  //#region packages/core/src/internal/wasm-runtime-generation.ts
327
327
  function ie(e) {
328
- return _(e) ? new h(`WASM parser trapped and was recycled: ${e instanceof Error ? e.message : String(e)}`) : null;
328
+ return _(e) ? new g(`WASM parser trapped and was recycled: ${e instanceof Error ? e.message : String(e)}`) : null;
329
329
  }
330
330
  var w = class {
331
331
  realm;