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
package/README.md CHANGED
@@ -24,6 +24,13 @@ Part of [ooxml](https://github.com/ChristopherVR/ooxml#readme): [Office](https:/
24
24
 
25
25
  ## Why ooxml-core?
26
26
 
27
+ Hosts can connect native DOCX, XLSX, PPTX and VSDX storage through the optional
28
+ [`ooxml-core/embedding/onedrive`](../../docs/onedrive-integration.md) subpath. It exposes the
29
+ shared Graph client, session storage adapter, cloud copies, sharing and retained conflict versions;
30
+ the host supplies Microsoft authentication and item permissions. See the
31
+ [package reference](../../docs/onedrive-integration.md#package-reference) and
32
+ [test/acceptance guide](../../docs/onedrive-testing.md). No public mock service or simulation UI ships.
33
+
27
34
  - **No UI, no framework.** Everything runs in browsers, Node.js, Bun, workers and serverless functions. The viewer apps ([docx](https://christophervr.github.io/ooxml/docx/), [xlsx](https://christophervr.github.io/ooxml/xlsx/), [visio](https://christophervr.github.io/ooxml/visio/), [teams](https://christophervr.github.io/ooxml/teams/) and [pptx](https://christophervr.github.io/ooxml/pptx/)) are thin interfaces on top of it, and so can your application be.
28
35
  - **One package, one structure.** All formats share the same XML model, packaging layer, units, colours and geometry. Each format is an _area_ of this one package, not a separate dependency to keep in step.
29
36
  - **Round-trips without losing what it does not understand.** Documents are loaded into a model, edited, and written back. Untouched parts stay byte-for-byte, unknown markup is preserved, and edits that would damage unsupported content are rejected instead of silently dropped.
@@ -1,5 +1,5 @@
1
- export { PptxHandler } from './chunk-RHQQS6LJ.mjs';
2
- import './chunk-J43V3QOA.mjs';
1
+ export { PptxHandler } from './chunk-SN5R5YNF.mjs';
2
+ import './chunk-6XLWR7R6.mjs';
3
3
  import './chunk-EYCM7RVL.mjs';
4
4
  import './chunk-2N7RZQLC.mjs';
5
5
  import './chunk-VDUNZTJC.mjs';
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var chunkJXNUXGX3_cjs = require('./chunk-JXNUXGX3.cjs');
4
+ require('./chunk-ZTX5YCSW.cjs');
5
+ require('./chunk-WF4USSCT.cjs');
6
+ require('./chunk-XZPZHXV4.cjs');
7
+ require('./chunk-5W2QL4SB.cjs');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "PptxHandler", {
12
+ enumerable: true,
13
+ get: function () { return chunkJXNUXGX3_cjs.PptxHandler; }
14
+ });
@@ -0,0 +1,5 @@
1
+ export { PptxHandler } from './chunk-7YOCVZRH.mjs';
2
+ import './chunk-UOEYAYAH.mjs';
3
+ import './chunk-LWNNHK2S.mjs';
4
+ import './chunk-GXHKNSZX.mjs';
5
+ import './chunk-CA7KCNL3.mjs';
@@ -1,5 +1,5 @@
1
- export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-RHQQS6LJ.mjs';
2
- import './chunk-J43V3QOA.mjs';
1
+ export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-SN5R5YNF.mjs';
2
+ import './chunk-6XLWR7R6.mjs';
3
3
  import './chunk-EYCM7RVL.mjs';
4
4
  import './chunk-2N7RZQLC.mjs';
5
5
  import './chunk-VDUNZTJC.mjs';
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunkGZOYXHDF_cjs = require('./chunk-GZOYXHDF.cjs');
4
- require('./chunk-AFALJ5TA.cjs');
5
- require('./chunk-SNID2FDY.cjs');
3
+ var chunkJXNUXGX3_cjs = require('./chunk-JXNUXGX3.cjs');
4
+ require('./chunk-ZTX5YCSW.cjs');
5
+ require('./chunk-WF4USSCT.cjs');
6
6
  require('./chunk-XZPZHXV4.cjs');
7
7
  require('./chunk-5W2QL4SB.cjs');
8
8
 
@@ -10,13 +10,13 @@ require('./chunk-5W2QL4SB.cjs');
10
10
 
11
11
  Object.defineProperty(exports, "PresentationBuilder", {
12
12
  enumerable: true,
13
- get: function () { return chunkGZOYXHDF_cjs.PresentationBuilder; }
13
+ get: function () { return chunkJXNUXGX3_cjs.PresentationBuilder; }
14
14
  });
15
15
  Object.defineProperty(exports, "STANDARD_LAYOUTS", {
16
16
  enumerable: true,
17
- get: function () { return chunkGZOYXHDF_cjs.STANDARD_LAYOUTS; }
17
+ get: function () { return chunkJXNUXGX3_cjs.STANDARD_LAYOUTS; }
18
18
  });
19
19
  Object.defineProperty(exports, "buildBlankPresentationArchive", {
20
20
  enumerable: true,
21
- get: function () { return chunkGZOYXHDF_cjs.buildBlankPresentationArchive; }
21
+ get: function () { return chunkJXNUXGX3_cjs.buildBlankPresentationArchive; }
22
22
  });
@@ -1,5 +1,5 @@
1
- export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-4YBSHQ76.mjs';
2
- import './chunk-H2Q42P6P.mjs';
3
- import './chunk-2TQJHNVU.mjs';
1
+ export { PresentationBuilder, STANDARD_LAYOUTS, buildBlankPresentationArchive } from './chunk-7YOCVZRH.mjs';
2
+ import './chunk-UOEYAYAH.mjs';
3
+ import './chunk-LWNNHK2S.mjs';
4
4
  import './chunk-GXHKNSZX.mjs';
5
5
  import './chunk-CA7KCNL3.mjs';
@@ -211,6 +211,161 @@ function attr(element5, local, ns, prefix3) {
211
211
  }
212
212
  var relAttr = (element5, local) => attr(element5, local, NS.r, "r");
213
213
 
214
+ // text/text-diff.ts
215
+ var isLowSurrogate = (text9, at3) => {
216
+ const code = text9.charCodeAt(at3);
217
+ return code >= 56320 && code <= 57343;
218
+ };
219
+ function shortestEdit(n, m, same17, maxEdits) {
220
+ const max = Math.min(n + m, maxEdits);
221
+ const offset2 = max + 1;
222
+ const v = new Int32Array(2 * max + 3);
223
+ const trace = [];
224
+ for (let d = 0; d <= max; d++) {
225
+ for (let k = -d; k <= d; k += 2) {
226
+ const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
227
+ let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
228
+ let y = x - k;
229
+ while (x < n && y < m && same17(x, y)) {
230
+ x++;
231
+ y++;
232
+ }
233
+ v[offset2 + k] = x;
234
+ if (x >= n && y >= m) return backtrack(trace, n, m, d);
235
+ }
236
+ trace.push(v.slice(offset2 - d, offset2 + d + 1));
237
+ }
238
+ return void 0;
239
+ }
240
+ function backtrack(trace, n, m, d) {
241
+ const edits2 = [];
242
+ let x = n;
243
+ let y = m;
244
+ for (let step2 = d; step2 > 0; step2--) {
245
+ const previous = trace[step2 - 1];
246
+ const at3 = (k2) => previous[k2 + step2 - 1];
247
+ const k = x - y;
248
+ const down = k === -step2 || k !== step2 && at3(k - 1) < at3(k + 1);
249
+ const before = down ? k + 1 : k - 1;
250
+ const startX = at3(before);
251
+ const startY = startX - before;
252
+ edits2.push(down ? [startX, startY, true] : [startX, startY, false]);
253
+ x = startX;
254
+ y = startY;
255
+ }
256
+ return edits2.reverse();
257
+ }
258
+ function changesOf(edits2) {
259
+ const changes = [];
260
+ for (const [x, y, inserts] of edits2) {
261
+ const last = changes.at(-1);
262
+ if (last && last.fromEnd === x && last.toEnd === y) {
263
+ if (inserts) last.toEnd++;
264
+ else last.fromEnd++;
265
+ } else
266
+ changes.push({
267
+ fromStart: x,
268
+ fromEnd: inserts ? x : x + 1,
269
+ toStart: y,
270
+ toEnd: inserts ? y + 1 : y
271
+ });
272
+ }
273
+ return changes;
274
+ }
275
+ function characterChanges(a2, b, maxEdits) {
276
+ const edits2 = shortestEdit(
277
+ a2.length,
278
+ b.length,
279
+ (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
280
+ maxEdits
281
+ );
282
+ return edits2 && changesOf(edits2);
283
+ }
284
+ var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
285
+ function tokensOf(text9, ids) {
286
+ const tokens3 = [];
287
+ const starts = [];
288
+ for (const match2 of text9.matchAll(TOKEN)) {
289
+ let id5 = ids.get(match2[0]);
290
+ if (id5 === void 0) ids.set(match2[0], id5 = ids.size);
291
+ tokens3.push(id5);
292
+ starts.push(match2.index);
293
+ }
294
+ starts.push(text9.length);
295
+ return { tokens: tokens3, starts };
296
+ }
297
+ function tokenChanges(a2, b, maxEdits) {
298
+ const ids = /* @__PURE__ */ new Map();
299
+ const from = tokensOf(a2, ids);
300
+ const to = tokensOf(b, ids);
301
+ const edits2 = shortestEdit(
302
+ from.tokens.length,
303
+ to.tokens.length,
304
+ (x, y) => from.tokens[x] === to.tokens[y],
305
+ maxEdits
306
+ );
307
+ if (!edits2) return void 0;
308
+ let budget = maxEdits;
309
+ return changesOf(edits2).flatMap((stretch) => {
310
+ const change = {
311
+ fromStart: from.starts[stretch.fromStart],
312
+ fromEnd: from.starts[stretch.fromEnd],
313
+ toStart: to.starts[stretch.toStart],
314
+ toEnd: to.starts[stretch.toEnd]
315
+ };
316
+ const inner2 = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
317
+ a2.slice(change.fromStart, change.fromEnd),
318
+ b.slice(change.toStart, change.toEnd),
319
+ budget
320
+ ) : void 0;
321
+ if (!inner2) return [change];
322
+ for (const found of inner2)
323
+ budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
324
+ return inner2.map((found) => ({
325
+ fromStart: found.fromStart + change.fromStart,
326
+ fromEnd: found.fromEnd + change.fromStart,
327
+ toStart: found.toStart + change.toStart,
328
+ toEnd: found.toEnd + change.toStart
329
+ }));
330
+ });
331
+ }
332
+ function diffText(from, to, maxEdits = 500) {
333
+ let start = 0;
334
+ while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
335
+ start++;
336
+ let end = 0;
337
+ while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
338
+ end++;
339
+ const a2 = from.slice(start, from.length - end);
340
+ const b = to.slice(start, to.length - end);
341
+ if (!a2.length && !b.length) return [];
342
+ const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
343
+ const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
344
+ const result2 = [];
345
+ for (const change of changes) {
346
+ const placed = {
347
+ fromStart: change.fromStart + start,
348
+ fromEnd: change.fromEnd + start,
349
+ toStart: change.toStart + start,
350
+ toEnd: change.toEnd + start
351
+ };
352
+ if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
353
+ placed.fromStart--;
354
+ placed.toStart--;
355
+ }
356
+ if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
357
+ placed.fromEnd++;
358
+ placed.toEnd++;
359
+ }
360
+ const last = result2.at(-1);
361
+ if (last && placed.fromStart <= last.fromEnd) {
362
+ last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
363
+ last.toEnd = Math.max(last.toEnd, placed.toEnd);
364
+ } else result2.push(placed);
365
+ }
366
+ return result2;
367
+ }
368
+
214
369
  // xml/lite.ts
215
370
  var LiteElement = class {
216
371
  constructor(tagName2, localName3, namespaceURI) {
@@ -1472,58 +1627,6 @@ async function ensureRelationship(zip, relsPath, type, target3) {
1472
1627
  zip.file(relsPath, xml.replace("</Relationships>", `${insertion}</Relationships>`));
1473
1628
  return id5;
1474
1629
  }
1475
-
1476
- // opc/safe-href.ts
1477
- var SAFE_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
1478
- function isSafeHyperlinkHref(href) {
1479
- const scheme2 = /^([a-z][a-z0-9+.-]*:)/i.exec(href.trim())?.[1];
1480
- return scheme2 !== void 0 && SAFE_SCHEMES.has(scheme2.toLowerCase());
1481
- }
1482
- var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
1483
- var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
1484
- var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
1485
- "javascript",
1486
- "vbscript",
1487
- "livescript",
1488
- "jscript",
1489
- "mocha",
1490
- "data",
1491
- "mhtml",
1492
- "ms-its",
1493
- "mk",
1494
- "x-javascript",
1495
- "blob"
1496
- ]);
1497
- var IGNORABLE = new RegExp(
1498
- "[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
1499
- "gu"
1500
- );
1501
- var CONTROL = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
1502
- var SCHEME = /^([a-z][a-z0-9+.-]*):/;
1503
- var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
1504
- var reject = (reason) => ({
1505
- store: false,
1506
- open: false,
1507
- reason
1508
- });
1509
- function hyperlinkPolicy(href, options2 = {}) {
1510
- if (typeof href !== "string") return reject("empty");
1511
- const trimmed2 = href.trim();
1512
- const normalized = trimmed2.replace(IGNORABLE, "").toLowerCase();
1513
- if (normalized.length === 0) return reject("empty");
1514
- const scheme2 = SCHEME.exec(normalized)?.[1];
1515
- if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
1516
- if (scheme2 !== void 0 && !trimmed2.toLowerCase().startsWith(`${scheme2}:`))
1517
- return reject("obfuscated-scheme");
1518
- if (CONTROL.test(trimmed2)) return reject("control-characters");
1519
- if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
1520
- if (scheme2.length === 1) return STORE_ONLY;
1521
- if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
1522
- if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
1523
- return { store: true, open: true };
1524
- if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
1525
- return reject("unsupported-scheme");
1526
- }
1527
1630
  var DEFAULT_ZIP_LIMITS = {
1528
1631
  maxInputBytes: 100 * 1024 * 1024,
1529
1632
  maxEntries: 1e4,
@@ -1746,6 +1849,58 @@ async function openZip(input2, limits = {}) {
1746
1849
  return guardZip(await JSZip__default.default.loadAsync(bytes), limits);
1747
1850
  }
1748
1851
 
1852
+ // opc/safe-href.ts
1853
+ var SAFE_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:", "mailto:"]);
1854
+ function isSafeHyperlinkHref(href) {
1855
+ const scheme2 = /^([a-z][a-z0-9+.-]*:)/i.exec(href.trim())?.[1];
1856
+ return scheme2 !== void 0 && SAFE_SCHEMES.has(scheme2.toLowerCase());
1857
+ }
1858
+ var OPEN_SCHEMES = /* @__PURE__ */ new Set(["http", "https", "mailto"]);
1859
+ var STORE_SCHEMES = /* @__PURE__ */ new Set([...OPEN_SCHEMES, "ftp", "file"]);
1860
+ var SCRIPT_SCHEMES = /* @__PURE__ */ new Set([
1861
+ "javascript",
1862
+ "vbscript",
1863
+ "livescript",
1864
+ "jscript",
1865
+ "mocha",
1866
+ "data",
1867
+ "mhtml",
1868
+ "ms-its",
1869
+ "mk",
1870
+ "x-javascript",
1871
+ "blob"
1872
+ ]);
1873
+ var IGNORABLE = new RegExp(
1874
+ "[\\u0000-\\u0020\\u007f\\u00ad\\u200b-\\u200f\\u202a-\\u202e\\u2060-\\u2064\\ufeff]",
1875
+ "gu"
1876
+ );
1877
+ var CONTROL = new RegExp("[\\u0000-\\u001f\\u007f]", "u");
1878
+ var SCHEME = /^([a-z][a-z0-9+.-]*):/;
1879
+ var STORE_ONLY = { store: true, open: false, reason: "not-openable" };
1880
+ var reject = (reason) => ({
1881
+ store: false,
1882
+ open: false,
1883
+ reason
1884
+ });
1885
+ function hyperlinkPolicy(href, options2 = {}) {
1886
+ if (typeof href !== "string") return reject("empty");
1887
+ const trimmed2 = href.trim();
1888
+ const normalized = trimmed2.replace(IGNORABLE, "").toLowerCase();
1889
+ if (normalized.length === 0) return reject("empty");
1890
+ const scheme2 = SCHEME.exec(normalized)?.[1];
1891
+ if (scheme2 !== void 0 && SCRIPT_SCHEMES.has(scheme2)) return reject("script-scheme");
1892
+ if (scheme2 !== void 0 && !trimmed2.toLowerCase().startsWith(`${scheme2}:`))
1893
+ return reject("obfuscated-scheme");
1894
+ if (CONTROL.test(trimmed2)) return reject("control-characters");
1895
+ if (scheme2 === void 0) return options2.openRelative ? { store: true, open: true } : STORE_ONLY;
1896
+ if (scheme2.length === 1) return STORE_ONLY;
1897
+ if (OPEN_SCHEMES.has(scheme2)) return { store: true, open: true };
1898
+ if (options2.additionalOpenSchemes?.some((allowed) => allowed.toLowerCase() === scheme2))
1899
+ return { store: true, open: true };
1900
+ if (STORE_SCHEMES.has(scheme2)) return STORE_ONLY;
1901
+ return reject("unsupported-scheme");
1902
+ }
1903
+
1749
1904
  // opc/properties/types.ts
1750
1905
  var CUSTOM_PROPERTIES_FMTID = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}";
1751
1906
  var PROPERTY_PART_NAMES = {
@@ -4041,161 +4196,6 @@ function patchCommentMetadata(parts, identities) {
4041
4196
  return result2;
4042
4197
  }
4043
4198
 
4044
- // text/text-diff.ts
4045
- var isLowSurrogate = (text9, at3) => {
4046
- const code = text9.charCodeAt(at3);
4047
- return code >= 56320 && code <= 57343;
4048
- };
4049
- function shortestEdit(n, m, same17, maxEdits) {
4050
- const max = Math.min(n + m, maxEdits);
4051
- const offset2 = max + 1;
4052
- const v = new Int32Array(2 * max + 3);
4053
- const trace = [];
4054
- for (let d = 0; d <= max; d++) {
4055
- for (let k = -d; k <= d; k += 2) {
4056
- const down = k === -d || k !== d && v[offset2 + k - 1] < v[offset2 + k + 1];
4057
- let x = down ? v[offset2 + k + 1] : v[offset2 + k - 1] + 1;
4058
- let y = x - k;
4059
- while (x < n && y < m && same17(x, y)) {
4060
- x++;
4061
- y++;
4062
- }
4063
- v[offset2 + k] = x;
4064
- if (x >= n && y >= m) return backtrack(trace, n, m, d);
4065
- }
4066
- trace.push(v.slice(offset2 - d, offset2 + d + 1));
4067
- }
4068
- return void 0;
4069
- }
4070
- function backtrack(trace, n, m, d) {
4071
- const edits2 = [];
4072
- let x = n;
4073
- let y = m;
4074
- for (let step2 = d; step2 > 0; step2--) {
4075
- const previous = trace[step2 - 1];
4076
- const at3 = (k2) => previous[k2 + step2 - 1];
4077
- const k = x - y;
4078
- const down = k === -step2 || k !== step2 && at3(k - 1) < at3(k + 1);
4079
- const before = down ? k + 1 : k - 1;
4080
- const startX = at3(before);
4081
- const startY = startX - before;
4082
- edits2.push(down ? [startX, startY, true] : [startX, startY, false]);
4083
- x = startX;
4084
- y = startY;
4085
- }
4086
- return edits2.reverse();
4087
- }
4088
- function changesOf(edits2) {
4089
- const changes = [];
4090
- for (const [x, y, inserts] of edits2) {
4091
- const last = changes.at(-1);
4092
- if (last && last.fromEnd === x && last.toEnd === y) {
4093
- if (inserts) last.toEnd++;
4094
- else last.fromEnd++;
4095
- } else
4096
- changes.push({
4097
- fromStart: x,
4098
- fromEnd: inserts ? x : x + 1,
4099
- toStart: y,
4100
- toEnd: inserts ? y + 1 : y
4101
- });
4102
- }
4103
- return changes;
4104
- }
4105
- function characterChanges(a2, b, maxEdits) {
4106
- const edits2 = shortestEdit(
4107
- a2.length,
4108
- b.length,
4109
- (x, y) => a2.charCodeAt(x) === b.charCodeAt(y),
4110
- maxEdits
4111
- );
4112
- return edits2 && changesOf(edits2);
4113
- }
4114
- var TOKEN = /[\p{L}\p{N}\p{M}]+|\s+|[\s\S]/gu;
4115
- function tokensOf(text9, ids) {
4116
- const tokens3 = [];
4117
- const starts = [];
4118
- for (const match2 of text9.matchAll(TOKEN)) {
4119
- let id5 = ids.get(match2[0]);
4120
- if (id5 === void 0) ids.set(match2[0], id5 = ids.size);
4121
- tokens3.push(id5);
4122
- starts.push(match2.index);
4123
- }
4124
- starts.push(text9.length);
4125
- return { tokens: tokens3, starts };
4126
- }
4127
- function tokenChanges(a2, b, maxEdits) {
4128
- const ids = /* @__PURE__ */ new Map();
4129
- const from = tokensOf(a2, ids);
4130
- const to = tokensOf(b, ids);
4131
- const edits2 = shortestEdit(
4132
- from.tokens.length,
4133
- to.tokens.length,
4134
- (x, y) => from.tokens[x] === to.tokens[y],
4135
- maxEdits
4136
- );
4137
- if (!edits2) return void 0;
4138
- let budget = maxEdits;
4139
- return changesOf(edits2).flatMap((stretch) => {
4140
- const change = {
4141
- fromStart: from.starts[stretch.fromStart],
4142
- fromEnd: from.starts[stretch.fromEnd],
4143
- toStart: to.starts[stretch.toStart],
4144
- toEnd: to.starts[stretch.toEnd]
4145
- };
4146
- const inner2 = change.fromEnd > change.fromStart && change.toEnd > change.toStart ? characterChanges(
4147
- a2.slice(change.fromStart, change.fromEnd),
4148
- b.slice(change.toStart, change.toEnd),
4149
- budget
4150
- ) : void 0;
4151
- if (!inner2) return [change];
4152
- for (const found of inner2)
4153
- budget -= found.fromEnd - found.fromStart + found.toEnd - found.toStart;
4154
- return inner2.map((found) => ({
4155
- fromStart: found.fromStart + change.fromStart,
4156
- fromEnd: found.fromEnd + change.fromStart,
4157
- toStart: found.toStart + change.toStart,
4158
- toEnd: found.toEnd + change.toStart
4159
- }));
4160
- });
4161
- }
4162
- function diffText(from, to, maxEdits = 500) {
4163
- let start = 0;
4164
- while (start < from.length && start < to.length && from.charCodeAt(start) === to.charCodeAt(start))
4165
- start++;
4166
- let end = 0;
4167
- while (end < from.length - start && end < to.length - start && from.charCodeAt(from.length - 1 - end) === to.charCodeAt(to.length - 1 - end))
4168
- end++;
4169
- const a2 = from.slice(start, from.length - end);
4170
- const b = to.slice(start, to.length - end);
4171
- if (!a2.length && !b.length) return [];
4172
- const found = a2.length && b.length ? characterChanges(a2, b, maxEdits) ?? tokenChanges(a2, b, maxEdits) : void 0;
4173
- const changes = found ?? [{ fromStart: 0, fromEnd: a2.length, toStart: 0, toEnd: b.length }];
4174
- const result2 = [];
4175
- for (const change of changes) {
4176
- const placed = {
4177
- fromStart: change.fromStart + start,
4178
- fromEnd: change.fromEnd + start,
4179
- toStart: change.toStart + start,
4180
- toEnd: change.toEnd + start
4181
- };
4182
- if (placed.fromStart > 0 && placed.toStart > 0 && (isLowSurrogate(from, placed.fromStart) || isLowSurrogate(to, placed.toStart))) {
4183
- placed.fromStart--;
4184
- placed.toStart--;
4185
- }
4186
- if (isLowSurrogate(from, placed.fromEnd) || isLowSurrogate(to, placed.toEnd)) {
4187
- placed.fromEnd++;
4188
- placed.toEnd++;
4189
- }
4190
- const last = result2.at(-1);
4191
- if (last && placed.fromStart <= last.fromEnd) {
4192
- last.fromEnd = Math.max(last.fromEnd, placed.fromEnd);
4193
- last.toEnd = Math.max(last.toEnd, placed.toEnd);
4194
- } else result2.push(placed);
4195
- }
4196
- return result2;
4197
- }
4198
-
4199
4199
  // color/color-primitives.ts
4200
4200
  function clampUnitInterval(value3) {
4201
4201
  return Math.min(1, Math.max(0, value3));
@@ -103413,7 +103413,12 @@ function shapeDataRowName(value3) {
103413
103413
  }
103414
103414
  function visioShapeDataRowName(label2, taken = []) {
103415
103415
  const used = new Set([...taken].map((name4) => name4.toLowerCase()));
103416
- let base3 = label2.normalize("NFKD").replace(/[^\w]+/g, "_").replace(/^_+|_+$/g, "").slice(0, 48);
103416
+ let base3 = label2.normalize("NFKD").replace(/[^\w]+/g, "_");
103417
+ let start = 0;
103418
+ let end = base3.length;
103419
+ while (start < end && base3[start] === "_") start++;
103420
+ while (end > start && base3[end - 1] === "_") end--;
103421
+ base3 = base3.slice(start, end).slice(0, 48);
103417
103422
  if (!base3) base3 = "Property";
103418
103423
  if (/^\d/.test(base3)) base3 = `_${base3}`;
103419
103424
  let name3 = base3;