ooxml-core 1.37.1 → 1.38.1

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 (135) hide show
  1. package/README.md +7 -0
  2. package/dist/{PptxHandler-3T5DTNKA.mjs → PptxHandler-EB2WFF7F.mjs} +2 -2
  3. package/dist/PptxHandler-GOCSIX7N.cjs +14 -0
  4. package/dist/PptxHandler-IAKU53YW.mjs +5 -0
  5. package/dist/{PresentationBuilder-XHKNDJMD.mjs → PresentationBuilder-T2B5PPZA.mjs} +2 -2
  6. package/dist/{PresentationBuilder-HCMXZQDK.cjs → PresentationBuilder-TS4MR6KG.cjs} +6 -6
  7. package/dist/{PresentationBuilder-D6ZICJWN.mjs → PresentationBuilder-VMUWJF2X.mjs} +3 -3
  8. package/dist/automation/index.cjs +213 -208
  9. package/dist/automation/index.mjs +213 -208
  10. package/dist/{chunk-J43V3QOA.mjs → chunk-6XLWR7R6.mjs} +126 -42
  11. package/dist/{chunk-4YBSHQ76.mjs → chunk-7YOCVZRH.mjs} +2 -2
  12. package/dist/{chunk-GZOYXHDF.cjs → chunk-JXNUXGX3.cjs} +1266 -1266
  13. package/dist/{chunk-2TQJHNVU.mjs → chunk-LWNNHK2S.mjs} +259 -175
  14. package/dist/{chunk-OEM2ECAJ.mjs → chunk-RDMUNMGT.mjs} +1 -1
  15. package/dist/{chunk-RHQQS6LJ.mjs → chunk-SN5R5YNF.mjs} +2 -2
  16. package/dist/{chunk-CNIKTXAV.mjs → chunk-U54ZCZKG.mjs} +1 -1
  17. package/dist/{chunk-H2Q42P6P.mjs → chunk-UOEYAYAH.mjs} +1 -1
  18. package/dist/{chunk-SNID2FDY.cjs → chunk-WF4USSCT.cjs} +259 -175
  19. package/dist/{chunk-M2DFN3SP.mjs → chunk-XFLXQUTC.mjs} +645 -58
  20. package/dist/{chunk-AFALJ5TA.cjs → chunk-ZTX5YCSW.cjs} +3 -3
  21. package/dist/collab/merge-values.d.ts +14 -0
  22. package/dist/collab/merge-values.d.ts.map +1 -0
  23. package/dist/docx/embedded.cjs +476 -474
  24. package/dist/docx/embedded.mjs +476 -474
  25. package/dist/docx/index.cjs +1094 -719
  26. package/dist/docx/index.d.ts +1 -0
  27. package/dist/docx/index.d.ts.map +1 -1
  28. package/dist/docx/index.mjs +1094 -720
  29. package/dist/docx/layout/index.cjs +4 -0
  30. package/dist/docx/layout/index.mjs +4 -0
  31. package/dist/docx/load/index.cjs +164 -164
  32. package/dist/docx/load/index.mjs +164 -164
  33. package/dist/docx/merge-snapshots.d.ts +9 -0
  34. package/dist/docx/merge-snapshots.d.ts.map +1 -0
  35. package/dist/docx/ui/index.cjs +155 -155
  36. package/dist/docx/ui/index.mjs +155 -155
  37. package/dist/embedding/index.cjs +207 -0
  38. package/dist/embedding/index.d.ts +3 -0
  39. package/dist/embedding/index.d.ts.map +1 -1
  40. package/dist/embedding/index.mjs +205 -1
  41. package/dist/embedding/onedrive/client.d.ts +4 -0
  42. package/dist/embedding/onedrive/client.d.ts.map +1 -0
  43. package/dist/embedding/onedrive/index.cjs +617 -0
  44. package/dist/embedding/onedrive/index.d.ts +6 -0
  45. package/dist/embedding/onedrive/index.d.ts.map +1 -0
  46. package/dist/embedding/onedrive/index.mjs +611 -0
  47. package/dist/embedding/onedrive/metadata.d.ts +6 -0
  48. package/dist/embedding/onedrive/metadata.d.ts.map +1 -0
  49. package/dist/embedding/onedrive/requests.d.ts +8 -0
  50. package/dist/embedding/onedrive/requests.d.ts.map +1 -0
  51. package/dist/embedding/onedrive/session.d.ts +4 -0
  52. package/dist/embedding/onedrive/session.d.ts.map +1 -0
  53. package/dist/embedding/onedrive/transport.d.ts +9 -0
  54. package/dist/embedding/onedrive/transport.d.ts.map +1 -0
  55. package/dist/embedding/onedrive/types.d.ts +86 -0
  56. package/dist/embedding/onedrive/types.d.ts.map +1 -0
  57. package/dist/embedding/onedrive/upload.d.ts +3 -0
  58. package/dist/embedding/onedrive/upload.d.ts.map +1 -0
  59. package/dist/embedding/storage-merge.d.ts +8 -0
  60. package/dist/embedding/storage-merge.d.ts.map +1 -0
  61. package/dist/embedding/storage-session.d.ts +7 -0
  62. package/dist/embedding/storage-session.d.ts.map +1 -0
  63. package/dist/embedding/versioned-storage.d.ts +67 -0
  64. package/dist/embedding/versioned-storage.d.ts.map +1 -0
  65. package/dist/index.cjs +1032 -340
  66. package/dist/index.mjs +1032 -340
  67. package/dist/opc/index.cjs +699 -216
  68. package/dist/opc/index.d.ts +1 -0
  69. package/dist/opc/index.d.ts.map +1 -1
  70. package/dist/opc/index.mjs +699 -217
  71. package/dist/opc/merge-snapshots.d.ts +26 -0
  72. package/dist/opc/merge-snapshots.d.ts.map +1 -0
  73. package/dist/pptx/automation/index.cjs +165 -47
  74. package/dist/pptx/automation/index.d.ts +1 -1
  75. package/dist/pptx/automation/index.mjs +5 -5
  76. package/dist/pptx/chunks/{index-DC5m1m_8.d.ts → index-uDL5LUSK.d.ts} +20 -6
  77. package/dist/pptx/chunks/index-uDL5LUSK.d.ts.map +1 -0
  78. package/dist/pptx/cli/index.cjs +165 -47
  79. package/dist/pptx/cli/index.mjs +4 -4
  80. package/dist/pptx/converter/index.cjs +7 -0
  81. package/dist/pptx/converter/index.mjs +2 -2
  82. package/dist/pptx/editor/render/custom-show-operations.cjs +2 -2
  83. package/dist/pptx/editor/render/custom-show-operations.mjs +1 -1
  84. package/dist/pptx/editor/render/find-replace.cjs +15 -15
  85. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  86. package/dist/pptx/editor/render/find-replace.mjs +2 -2
  87. package/dist/pptx/editor/render/slide-operations.cjs +9 -9
  88. package/dist/pptx/editor/render/slide-operations.mjs +3 -3
  89. package/dist/pptx/index.cjs +6156 -5428
  90. package/dist/pptx/index.d.ts +2 -2
  91. package/dist/pptx/index.mjs +5 -5
  92. package/dist/teams/index.cjs +215 -201
  93. package/dist/teams/index.mjs +215 -201
  94. package/dist/text/index.cjs +193 -0
  95. package/dist/text/index.d.ts +1 -0
  96. package/dist/text/index.d.ts.map +1 -1
  97. package/dist/text/index.mjs +193 -1
  98. package/dist/text/merge-three-way.d.ts +9 -0
  99. package/dist/text/merge-three-way.d.ts.map +1 -0
  100. package/dist/visio/collab/index.cjs +226 -7
  101. package/dist/visio/collab/index.d.ts +1 -0
  102. package/dist/visio/collab/index.d.ts.map +1 -1
  103. package/dist/visio/collab/index.mjs +225 -7
  104. package/dist/visio/collab/merge-snapshots.d.ts +14 -0
  105. package/dist/visio/collab/merge-snapshots.d.ts.map +1 -0
  106. package/dist/visio/edit-shape-data-commands.d.ts.map +1 -1
  107. package/dist/visio/index.cjs +15 -10
  108. package/dist/visio/index.mjs +15 -10
  109. package/dist/visio/ui/index.cjs +19 -12
  110. package/dist/visio/ui/index.mjs +19 -12
  111. package/dist/visio/ui/text-dialog.d.ts.map +1 -1
  112. package/dist/xlsx/collab/index.cjs +49985 -507
  113. package/dist/xlsx/collab/index.d.ts +1 -0
  114. package/dist/xlsx/collab/index.d.ts.map +1 -1
  115. package/dist/xlsx/collab/index.mjs +49980 -507
  116. package/dist/xlsx/collab/merge-residual.d.ts +16 -0
  117. package/dist/xlsx/collab/merge-residual.d.ts.map +1 -0
  118. package/dist/xlsx/collab/merge-snapshots.d.ts +8 -0
  119. package/dist/xlsx/collab/merge-snapshots.d.ts.map +1 -0
  120. package/dist/xlsx/index.cjs +202 -202
  121. package/dist/xlsx/index.mjs +202 -202
  122. package/dist/xlsx/load/index.cjs +155 -155
  123. package/dist/xlsx/load/index.mjs +155 -155
  124. package/dist/xlsx/ui/index.cjs +202 -202
  125. package/dist/xlsx/ui/index.mjs +202 -202
  126. package/dist/xml/index.cjs +406 -22
  127. package/dist/xml/index.d.ts +1 -0
  128. package/dist/xml/index.d.ts.map +1 -1
  129. package/dist/xml/index.mjs +406 -23
  130. package/dist/xml/merge-three-way.d.ts +18 -0
  131. package/dist/xml/merge-three-way.d.ts.map +1 -0
  132. package/package.json +6 -1
  133. package/dist/PptxHandler-2JSQ22VD.cjs +0 -14
  134. package/dist/PptxHandler-7T7ZS7IK.mjs +0 -5
  135. package/dist/pptx/chunks/index-DC5m1m_8.d.ts.map +0 -1
@@ -0,0 +1,16 @@
1
+ import type * as Y from 'yjs';
2
+ import type { Workbook } from '../model.js';
3
+ export declare function workbookResidual(workbook: Workbook, doc: Y.Doc): {
4
+ book: {
5
+ properties: {
6
+ [k: string]: any;
7
+ };
8
+ };
9
+ sheets: any;
10
+ };
11
+ export declare function applyWorkbookResidual(workbook: Workbook, doc: Y.Doc, value: ReturnType<typeof workbookResidual>): void;
12
+ /** Formula result caches are derived, not user edits. The combined workbook asks Excel to recalc. */
13
+ export declare function stripFormulaCaches(doc: Y.Doc): boolean;
14
+ /** Unknown source fragments of regenerated parts must not silently take the remote branch. */
15
+ export declare function unsupportedSourceChanges(workbooks: Workbook[]): string[];
16
+ //# sourceMappingURL=merge-residual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-residual.d.ts","sourceRoot":"","sources":["../../../xlsx/collab/merge-residual.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAG9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AA2CzC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG;;;;;;;EAqB9D;AAED,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,CAAC,CAAC,GAAG,EACV,KAAK,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,QAgB1C;AAED,qGAAqG;AACrG,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,OAAO,CActD;AAED,8FAA8F;AAC9F,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CA+DxE"}
@@ -0,0 +1,8 @@
1
+ import { type SnapshotMergeResult } from '../../opc/merge-snapshots.js';
2
+ /**
3
+ * Reconciles saved XLSX files by logical sheet/cell/style identity using a common Yjs baseline.
4
+ * This is a three-way merge of snapshots, not recovery of missing collaboration operations.
5
+ * Arrays outside the stable mapping and changes to the same field remain unresolved.
6
+ */
7
+ export declare function mergeWorkbookSnapshots(base: Uint8Array, local: Uint8Array, remote: Uint8Array): Promise<SnapshotMergeResult>;
8
+ //# sourceMappingURL=merge-snapshots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merge-snapshots.d.ts","sourceRoot":"","sources":["../../../xlsx/collab/merge-snapshots.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAYxF;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC3C,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,GAChB,OAAO,CAAC,mBAAmB,CAAC,CA4E9B"}
@@ -244,6 +244,161 @@ function attr(element3, local, ns, prefix) {
244
244
  }
245
245
  var relAttr = (element3, local) => attr(element3, local, NS.r, "r");
246
246
 
247
+ // text/text-diff.ts
248
+ var isLowSurrogate = (text3, at2) => {
249
+ const code = text3.charCodeAt(at2);
250
+ return code >= 56320 && code <= 57343;
251
+ };
252
+ function shortestEdit(n2, m, same11, maxEdits) {
253
+ const max = Math.min(n2 + m, maxEdits);
254
+ const offset2 = max + 1;
255
+ const v = new Int32Array(2 * max + 3);
256
+ const trace = [];
257
+ for (let d = 0; d <= max; d++) {
258
+ for (let k = -d; k <= d; k += 2) {
259
+ const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
260
+ let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
261
+ let y = x - k;
262
+ while (x < n2 && y < m && same11(x, y)) {
263
+ x++;
264
+ y++;
265
+ }
266
+ v[offset2 + k] = x;
267
+ if (x >= n2 && y >= m) return backtrack(trace, n2, m, d);
268
+ }
269
+ trace.push(v.slice(offset2 - d, offset2 + d + 1));
270
+ }
271
+ return void 0;
272
+ }
273
+ function backtrack(trace, n2, m, d) {
274
+ const edits = [];
275
+ let x = n2;
276
+ let y = m;
277
+ for (let step2 = d; step2 > 0; step2--) {
278
+ const previous = trace[step2 - 1];
279
+ const at2 = (k2) => previous[k2 + step2 - 1];
280
+ const k = x - y;
281
+ const down = k === -step2 || k !== step2 && at2(k - 1) < at2(k + 1);
282
+ const before = down ? k + 1 : k - 1;
283
+ const startX = at2(before);
284
+ const startY = startX - before;
285
+ edits.push(down ? [startX, startY, true] : [startX, startY, false]);
286
+ x = startX;
287
+ y = startY;
288
+ }
289
+ return edits.reverse();
290
+ }
291
+ function changesOf(edits) {
292
+ const changes = [];
293
+ for (const [x, y, inserts] of edits) {
294
+ const last = changes.at(-1);
295
+ if (last && last.fromEnd === x && last.toEnd === y) {
296
+ if (inserts) last.toEnd++;
297
+ else last.fromEnd++;
298
+ } else
299
+ changes.push({
300
+ fromStart: x,
301
+ fromEnd: inserts ? x : x + 1,
302
+ toStart: y,
303
+ toEnd: inserts ? y + 1 : y
304
+ });
305
+ }
306
+ return changes;
307
+ }
308
+ function characterChanges(a2, b, maxEdits) {
309
+ const edits = shortestEdit(
310
+ a2.length,
311
+ b.length,
312
+ (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
313
+ maxEdits
314
+ );
315
+ return edits && changesOf(edits);
316
+ }
317
+ var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
318
+ function tokensOf(text3, ids) {
319
+ const tokens2 = [];
320
+ const starts = [];
321
+ for (const match2 of text3.matchAll(TOKEN)) {
322
+ let id = ids.get(match2[0]);
323
+ if (id === void 0) ids.set(match2[0], id = ids.size);
324
+ tokens2.push(id);
325
+ starts.push(match2.index);
326
+ }
327
+ starts.push(text3.length);
328
+ return { tokens: tokens2, starts };
329
+ }
330
+ function tokenChanges(a2, b, maxEdits) {
331
+ const ids = /* @__PURE__ */ new Map();
332
+ const from = tokensOf(a2, ids);
333
+ const to = tokensOf(b, ids);
334
+ const edits = shortestEdit(
335
+ from.tokens.length,
336
+ to.tokens.length,
337
+ (x, y) => from.tokens[x] === to.tokens[y],
338
+ maxEdits
339
+ );
340
+ if (!edits) return void 0;
341
+ let budget = maxEdits;
342
+ return changesOf(edits).flatMap((stretch) => {
343
+ const change = {
344
+ fromStart: from.starts[stretch.fromStart],
345
+ fromEnd: from.starts[stretch.fromEnd],
346
+ toStart: to.starts[stretch.toStart],
347
+ toEnd: to.starts[stretch.toEnd]
348
+ };
349
+ const inner2 = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
350
+ a2.slice(change.fromStart, change.fromEnd),
351
+ b.slice(change.toStart, change.toEnd),
352
+ budget
353
+ ) : void 0;
354
+ if (!inner2) return [change];
355
+ for (const found of inner2)
356
+ budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
357
+ return inner2.map((found) => ({
358
+ fromStart: found.fromStart + change.fromStart,
359
+ fromEnd: found.fromEnd + change.fromStart,
360
+ toStart: found.toStart + change.toStart,
361
+ toEnd: found.toEnd + change.toStart
362
+ }));
363
+ });
364
+ }
365
+ function diffText(from, to, maxEdits = 500) {
366
+ let start = 0;
367
+ while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
368
+ start++;
369
+ let end = 0;
370
+ while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
371
+ end++;
372
+ const a2 = from.slice(start, from.length - end);
373
+ const b = to.slice(start, to.length - end);
374
+ if (!a2.length && !b.length) return [];
375
+ const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
376
+ const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
377
+ const result2 = [];
378
+ for (const change of changes) {
379
+ const placed = {
380
+ fromStart: change.fromStart + start,
381
+ fromEnd: change.fromEnd + start,
382
+ toStart: change.toStart + start,
383
+ toEnd: change.toEnd + start
384
+ };
385
+ if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
386
+ placed.fromStart--;
387
+ placed.toStart--;
388
+ }
389
+ if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
390
+ placed.fromEnd++;
391
+ placed.toEnd++;
392
+ }
393
+ const last = result2.at(-1);
394
+ if (last && placed.fromStart <= last.fromEnd) {
395
+ last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
396
+ last.toEnd = Math.max(last.toEnd, placed.toEnd);
397
+ } else result2.push(placed);
398
+ }
399
+ return result2;
400
+ }
401
+
247
402
  // xml/lite.ts
248
403
  var LiteElement = class {
249
404
  constructor(tagName, localName3, namespaceURI) {
@@ -20505,53 +20660,6 @@ function buildContentTypesXml(types) {
20505
20660
  ).join("");
20506
20661
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="${NS.contentTypes}">${defaults}${overrides}</Types>`;
20507
20662
  }
20508
-
20509
- // opc/safe-href.ts
20510
- var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
20511
- var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
20512
- var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
20513
- "javascript",
20514
- "vbscript",
20515
- "livescript",
20516
- "jscript",
20517
- "mocha",
20518
- "data",
20519
- "mhtml",
20520
- "ms-its",
20521
- "mk",
20522
- "x-javascript",
20523
- "blob"
20524
- ]);
20525
- var IGNORABLE = new RegExp(
20526
- "[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
20527
- "gu"
20528
- );
20529
- var CONTROL2 = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
20530
- var SCHEME = /^([a-z][a-z0-9+.-]*):/;
20531
- var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
20532
- var reject = (reason) => ({
20533
- store: false,
20534
- open: false,
20535
- reason
20536
- });
20537
- function hyperlinkPolicy(href, options2 = {}) {
20538
- if (typeof href !== "string") return reject("empty");
20539
- const trimmed2 = href.trim();
20540
- const normalized = trimmed2.replace(IGNORABLE, "").toLowerCase();
20541
- if (normalized.length === 0) return reject("empty");
20542
- const scheme2 = SCHEME.exec(normalized)?.[1];
20543
- if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
20544
- if (scheme2 !== void 0 && !trimmed2.toLowerCase().startsWith(`${scheme2}:`))
20545
- return reject("obfuscated-scheme");
20546
- if (CONTROL2.test(trimmed2)) return reject("control-characters");
20547
- if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
20548
- if (scheme2.length === 1) return STORE_ONLY;
20549
- if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
20550
- if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
20551
- return { store: true, open: true };
20552
- if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
20553
- return reject("unsupported-scheme");
20554
- }
20555
20663
  var DEFAULT_ZIP_LIMITS = {
20556
20664
  maxEntries: 1e4,
20557
20665
  maxEntryBytes: 100 * 1024 * 1024,
@@ -20760,6 +20868,53 @@ function guardZip(zip, limits = {}) {
20760
20868
  return zip;
20761
20869
  }
20762
20870
 
20871
+ // opc/safe-href.ts
20872
+ var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
20873
+ var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
20874
+ var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
20875
+ "javascript",
20876
+ "vbscript",
20877
+ "livescript",
20878
+ "jscript",
20879
+ "mocha",
20880
+ "data",
20881
+ "mhtml",
20882
+ "ms-its",
20883
+ "mk",
20884
+ "x-javascript",
20885
+ "blob"
20886
+ ]);
20887
+ var IGNORABLE = new RegExp(
20888
+ "[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
20889
+ "gu"
20890
+ );
20891
+ var CONTROL2 = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
20892
+ var SCHEME = /^([a-z][a-z0-9+.-]*):/;
20893
+ var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
20894
+ var reject = (reason) => ({
20895
+ store: false,
20896
+ open: false,
20897
+ reason
20898
+ });
20899
+ function hyperlinkPolicy(href, options2 = {}) {
20900
+ if (typeof href !== "string") return reject("empty");
20901
+ const trimmed2 = href.trim();
20902
+ const normalized = trimmed2.replace(IGNORABLE, "").toLowerCase();
20903
+ if (normalized.length === 0) return reject("empty");
20904
+ const scheme2 = SCHEME.exec(normalized)?.[1];
20905
+ if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
20906
+ if (scheme2 !== void 0 && !trimmed2.toLowerCase().startsWith(`${scheme2}:`))
20907
+ return reject("obfuscated-scheme");
20908
+ if (CONTROL2.test(trimmed2)) return reject("control-characters");
20909
+ if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
20910
+ if (scheme2.length === 1) return STORE_ONLY;
20911
+ if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
20912
+ if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
20913
+ return { store: true, open: true };
20914
+ if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
20915
+ return reject("unsupported-scheme");
20916
+ }
20917
+
20763
20918
  // opc/properties/types.ts
20764
20919
  var CUSTOM_PROPERTIES_FMTID = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
20765
20920
  var PROPERTY_PART_NAMES = {
@@ -49633,161 +49788,6 @@ var CommentIds = class {
49633
49788
  }
49634
49789
  };
49635
49790
 
49636
- // text/text-diff.ts
49637
- var isLowSurrogate = (text3, at2) => {
49638
- const code = text3.charCodeAt(at2);
49639
- return code >= 56320 && code <= 57343;
49640
- };
49641
- function shortestEdit(n2, m, same11, maxEdits) {
49642
- const max = Math.min(n2 + m, maxEdits);
49643
- const offset2 = max + 1;
49644
- const v = new Int32Array(2 * max + 3);
49645
- const trace = [];
49646
- for (let d = 0; d <= max; d++) {
49647
- for (let k = -d; k <= d; k += 2) {
49648
- const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
49649
- let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
49650
- let y = x - k;
49651
- while (x < n2 && y < m && same11(x, y)) {
49652
- x++;
49653
- y++;
49654
- }
49655
- v[offset2 + k] = x;
49656
- if (x >= n2 && y >= m) return backtrack(trace, n2, m, d);
49657
- }
49658
- trace.push(v.slice(offset2 - d, offset2 + d + 1));
49659
- }
49660
- return void 0;
49661
- }
49662
- function backtrack(trace, n2, m, d) {
49663
- const edits = [];
49664
- let x = n2;
49665
- let y = m;
49666
- for (let step2 = d; step2 > 0; step2--) {
49667
- const previous = trace[step2 - 1];
49668
- const at2 = (k2) => previous[k2 + step2 - 1];
49669
- const k = x - y;
49670
- const down = k === -step2 || k !== step2 && at2(k - 1) < at2(k + 1);
49671
- const before = down ? k + 1 : k - 1;
49672
- const startX = at2(before);
49673
- const startY = startX - before;
49674
- edits.push(down ? [startX, startY, true] : [startX, startY, false]);
49675
- x = startX;
49676
- y = startY;
49677
- }
49678
- return edits.reverse();
49679
- }
49680
- function changesOf(edits) {
49681
- const changes = [];
49682
- for (const [x, y, inserts] of edits) {
49683
- const last = changes.at(-1);
49684
- if (last && last.fromEnd === x && last.toEnd === y) {
49685
- if (inserts) last.toEnd++;
49686
- else last.fromEnd++;
49687
- } else
49688
- changes.push({
49689
- fromStart: x,
49690
- fromEnd: inserts ? x : x + 1,
49691
- toStart: y,
49692
- toEnd: inserts ? y + 1 : y
49693
- });
49694
- }
49695
- return changes;
49696
- }
49697
- function characterChanges(a2, b, maxEdits) {
49698
- const edits = shortestEdit(
49699
- a2.length,
49700
- b.length,
49701
- (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
49702
- maxEdits
49703
- );
49704
- return edits && changesOf(edits);
49705
- }
49706
- var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
49707
- function tokensOf(text3, ids) {
49708
- const tokens2 = [];
49709
- const starts = [];
49710
- for (const match2 of text3.matchAll(TOKEN)) {
49711
- let id = ids.get(match2[0]);
49712
- if (id === void 0) ids.set(match2[0], id = ids.size);
49713
- tokens2.push(id);
49714
- starts.push(match2.index);
49715
- }
49716
- starts.push(text3.length);
49717
- return { tokens: tokens2, starts };
49718
- }
49719
- function tokenChanges(a2, b, maxEdits) {
49720
- const ids = /* @__PURE__ */ new Map();
49721
- const from = tokensOf(a2, ids);
49722
- const to = tokensOf(b, ids);
49723
- const edits = shortestEdit(
49724
- from.tokens.length,
49725
- to.tokens.length,
49726
- (x, y) => from.tokens[x] === to.tokens[y],
49727
- maxEdits
49728
- );
49729
- if (!edits) return void 0;
49730
- let budget = maxEdits;
49731
- return changesOf(edits).flatMap((stretch) => {
49732
- const change = {
49733
- fromStart: from.starts[stretch.fromStart],
49734
- fromEnd: from.starts[stretch.fromEnd],
49735
- toStart: to.starts[stretch.toStart],
49736
- toEnd: to.starts[stretch.toEnd]
49737
- };
49738
- const inner2 = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
49739
- a2.slice(change.fromStart, change.fromEnd),
49740
- b.slice(change.toStart, change.toEnd),
49741
- budget
49742
- ) : void 0;
49743
- if (!inner2) return [change];
49744
- for (const found of inner2)
49745
- budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
49746
- return inner2.map((found) => ({
49747
- fromStart: found.fromStart + change.fromStart,
49748
- fromEnd: found.fromEnd + change.fromStart,
49749
- toStart: found.toStart + change.toStart,
49750
- toEnd: found.toEnd + change.toStart
49751
- }));
49752
- });
49753
- }
49754
- function diffText(from, to, maxEdits = 500) {
49755
- let start = 0;
49756
- while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
49757
- start++;
49758
- let end = 0;
49759
- while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
49760
- end++;
49761
- const a2 = from.slice(start, from.length - end);
49762
- const b = to.slice(start, to.length - end);
49763
- if (!a2.length && !b.length) return [];
49764
- const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
49765
- const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
49766
- const result2 = [];
49767
- for (const change of changes) {
49768
- const placed = {
49769
- fromStart: change.fromStart + start,
49770
- fromEnd: change.fromEnd + start,
49771
- toStart: change.toStart + start,
49772
- toEnd: change.toEnd + start
49773
- };
49774
- if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
49775
- placed.fromStart--;
49776
- placed.toStart--;
49777
- }
49778
- if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
49779
- placed.fromEnd++;
49780
- placed.toEnd++;
49781
- }
49782
- const last = result2.at(-1);
49783
- if (last && placed.fromStart <= last.fromEnd) {
49784
- last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
49785
- last.toEnd = Math.max(last.toEnd, placed.toEnd);
49786
- } else result2.push(placed);
49787
- }
49788
- return result2;
49789
- }
49790
-
49791
49791
  // xlsx/write/comment-mentions.ts
49792
49792
  function patchCommentMentions(node2, before, message, ids, commentId, preserveIds) {
49793
49793
  const container = first(node2, "mentions", NS.tc);