ooxml-core 1.16.0 → 1.16.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 (76) hide show
  1. package/dist/PptxHandler-7RNEJ2IO.mjs +4 -0
  2. package/dist/{PptxHandler-3A7VEXVK.cjs → PptxHandler-MK665E6Z.cjs} +3 -3
  3. package/dist/{PptxHandler-M35YFCUC.mjs → PptxHandler-ZF4G56V3.mjs} +2 -2
  4. package/dist/{PresentationBuilder-C7NPM7OQ.mjs → PresentationBuilder-HPHJTMIB.mjs} +2 -2
  5. package/dist/{PresentationBuilder-Y6DJK6H2.mjs → PresentationBuilder-J7HAJGMB.mjs} +2 -2
  6. package/dist/{PresentationBuilder-XVRTITYR.cjs → PresentationBuilder-JGYSF25G.cjs} +5 -5
  7. package/dist/automation/index.cjs +36 -9
  8. package/dist/automation/index.mjs +36 -9
  9. package/dist/chart/index.cjs +23 -4
  10. package/dist/chart/index.mjs +23 -4
  11. package/dist/{chunk-LM6VBPQJ.mjs → chunk-5ROLXCIY.mjs} +24 -5
  12. package/dist/{chunk-KOX5Y5E5.mjs → chunk-HMZFUT65.mjs} +1 -1
  13. package/dist/{chunk-WBCV52YV.mjs → chunk-IBFHMYJD.mjs} +1 -1
  14. package/dist/{chunk-UGWY72WC.cjs → chunk-K7Z2EDI5.cjs} +23 -4
  15. package/dist/{chunk-B37EVUMG.mjs → chunk-MVS2PT2Q.mjs} +1 -1
  16. package/dist/{chunk-AHRFBMLK.cjs → chunk-THEWZNWS.cjs} +1007 -1007
  17. package/dist/{chunk-WEFFRYXN.mjs → chunk-TWXBU7RE.mjs} +23 -4
  18. package/dist/{chunk-OKGQ2X7D.mjs → chunk-YQ7HJOEZ.mjs} +1 -1
  19. package/dist/{chunk-C2Y6SZDN.mjs → chunk-ZBCNC5RI.mjs} +4 -4
  20. package/dist/collab/broadcast-transport.d.ts.map +1 -1
  21. package/dist/collab/identity.d.ts +2 -0
  22. package/dist/collab/identity.d.ts.map +1 -1
  23. package/dist/collab/index.cjs +11 -2
  24. package/dist/collab/index.mjs +11 -3
  25. package/dist/crypto/index.cjs +23 -4
  26. package/dist/crypto/index.mjs +23 -4
  27. package/dist/diagram/index.cjs +23 -4
  28. package/dist/diagram/index.mjs +23 -4
  29. package/dist/docx/embedded.cjs +23 -4
  30. package/dist/docx/embedded.mjs +23 -4
  31. package/dist/docx/index.cjs +24 -5
  32. package/dist/docx/index.mjs +24 -5
  33. package/dist/docx/layout/index.cjs +24 -5
  34. package/dist/docx/layout/index.mjs +24 -5
  35. package/dist/docx/load/index.cjs +23 -4
  36. package/dist/docx/load/index.mjs +23 -4
  37. package/dist/docx/ui/index.cjs +32 -5
  38. package/dist/docx/ui/index.mjs +32 -5
  39. package/dist/drawingml/index.cjs +23 -4
  40. package/dist/drawingml/index.mjs +23 -4
  41. package/dist/index.cjs +23 -4
  42. package/dist/index.mjs +23 -4
  43. package/dist/math/index.cjs +23 -4
  44. package/dist/math/index.mjs +23 -4
  45. package/dist/opc/index.cjs +23 -4
  46. package/dist/opc/index.mjs +23 -4
  47. package/dist/pptx/automation/index.cjs +28 -9
  48. package/dist/pptx/automation/index.mjs +5 -5
  49. package/dist/pptx/cli/index.cjs +28 -9
  50. package/dist/pptx/cli/index.mjs +4 -4
  51. package/dist/pptx/converter/index.mjs +2 -2
  52. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  53. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  54. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  55. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  56. package/dist/pptx/index.cjs +28 -9
  57. package/dist/pptx/index.mjs +5 -5
  58. package/dist/teams/index.cjs +38 -9
  59. package/dist/teams/index.mjs +38 -9
  60. package/dist/visio/index.cjs +23 -4
  61. package/dist/visio/index.mjs +23 -4
  62. package/dist/visio/ui/index.cjs +23 -4
  63. package/dist/visio/ui/index.mjs +23 -4
  64. package/dist/xlsx/edit/slicers.d.ts.map +1 -1
  65. package/dist/xlsx/edit/timelines.d.ts.map +1 -1
  66. package/dist/xlsx/index.cjs +36 -9
  67. package/dist/xlsx/index.mjs +36 -9
  68. package/dist/xlsx/load/index.cjs +26 -5
  69. package/dist/xlsx/load/index.mjs +26 -5
  70. package/dist/xlsx/ui/index.cjs +33 -8
  71. package/dist/xlsx/ui/index.mjs +33 -8
  72. package/dist/xml/index.cjs +23 -4
  73. package/dist/xml/index.mjs +23 -4
  74. package/dist/xml/xml.d.ts.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/PptxHandler-7POULDRL.mjs +0 -4
@@ -267,9 +267,23 @@ function checkXmlLimits(xml, label2, limits = {}) {
267
267
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
268
268
  let depth = 0;
269
269
  let nodes = 0;
270
- for (const match2 of xml.matchAll(MARKUP_RE)) {
271
- const [, closing, name2, selfClosing] = match2;
272
- if (name2 === void 0) continue;
270
+ let at = xml.indexOf("<");
271
+ while (at !== -1) {
272
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
273
+ if (skip) {
274
+ const end = xml.indexOf(skip[1], at + skip[0].length);
275
+ if (end === -1) return;
276
+ at = xml.indexOf("<", end + skip[1].length);
277
+ continue;
278
+ }
279
+ TAG_RE.lastIndex = at;
280
+ const match2 = TAG_RE.exec(xml);
281
+ if (!match2) {
282
+ at = xml.indexOf("<", at + 1);
283
+ continue;
284
+ }
285
+ const [, closing, , selfClosing] = match2;
286
+ at = xml.indexOf("<", at + match2[0].length);
273
287
  if (closing) {
274
288
  depth--;
275
289
  continue;
@@ -310,7 +324,7 @@ function named(element2, local, ns, lenient = true) {
310
324
  function attr(element2, local, ns, prefix) {
311
325
  return element2?.getAttributeNS(ns, local) ?? element2?.getAttribute(`${prefix}:${local}`) ?? void 0;
312
326
  }
313
- var DEFAULT_XML_LIMITS, MARKUP_RE, buildXml, isElement, elements, children, first, relAttr;
327
+ var DEFAULT_XML_LIMITS, TAG_RE, MARKUP_SKIPS, buildXml, isElement, elements, children, first, relAttr;
314
328
  var init_xml = __esm({
315
329
  "xml/xml.ts"() {
316
330
  init_namespaces();
@@ -318,7 +332,12 @@ var init_xml = __esm({
318
332
  maxDepth: 512,
319
333
  maxNodes: 5e6
320
334
  };
321
- MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
335
+ TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
336
+ MARKUP_SKIPS = [
337
+ ["<!--", "-->"],
338
+ ["<![CDATA[", "]]>"],
339
+ ["<?", "?>"]
340
+ ];
322
341
  buildXml = (node2) => new XMLSerializer().serializeToString(node2);
323
342
  isElement = (node2) => node2.nodeType === 1;
324
343
  elements = (parent) => Array.from(parent.childNodes).filter(isElement);
@@ -22975,7 +22994,9 @@ function pivotTableXml(source2, cacheId, cache3) {
22975
22994
  }
22976
22995
  function dateFilterXml(pivot, filter2) {
22977
22996
  const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
22978
- const id = Number(/<filter [^>]*\bid="(\d+)"/.exec(pivot.sourceXml ?? "")?.[1] ?? 1);
22997
+ const id = Number(
22998
+ /\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
22999
+ );
22979
23000
  return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
22980
23001
  }
22981
23002
  var X14;
@@ -25144,10 +25165,18 @@ function assignUserColor(seed, palette = CURSOR_PALETTE) {
25144
25165
  for (let i = 0; i < text2.length; i++) hash = hash * 31 + text2.charCodeAt(i) | 0;
25145
25166
  return palette[Math.abs(hash) % palette.length] ?? DEFAULT_COLOR;
25146
25167
  }
25168
+ function randomToken() {
25169
+ const cryptoApi = globalThis.crypto;
25170
+ if (cryptoApi?.getRandomValues) {
25171
+ return cryptoApi.getRandomValues(new Uint32Array(2)).reduce((s, n) => s + n.toString(36), "").slice(0, 8);
25172
+ }
25173
+ return (fallbackCounter++).toString(36).padStart(8, "0");
25174
+ }
25175
+ var fallbackCounter = 0;
25147
25176
  function createClientId() {
25148
25177
  const cryptoApi = globalThis.crypto;
25149
25178
  if (cryptoApi?.randomUUID) return cryptoApi.randomUUID();
25150
- return `c${Date.now().toString(36)}${Math.random().toString(36).slice(2, 10)}`;
25179
+ return `c${Date.now().toString(36)}${randomToken()}`;
25151
25180
  }
25152
25181
  function clientKey(clientId) {
25153
25182
  if (!isValidId(clientId)) throw new Error("Invalid collaboration client ID");
@@ -26387,7 +26416,7 @@ function meetingToIcs(meeting, options = {}) {
26387
26416
  return `${lines.flatMap(icsFold).join("\r\n")}\r
26388
26417
  `;
26389
26418
  }
26390
- var icsFileName = (meeting) => `${meeting.title.replace(/[^\w.-]+/gu, "-").replace(/^-+|-+$/gu, "").slice(0, 60) || "meeting"}.ics`;
26419
+ var icsFileName = (meeting) => `${meeting.title.replace(/[^\w.-]+/gu, "-").replace(/^-|-$/gu, "").slice(0, 60) || "meeting"}.ics`;
26391
26420
  var MAX_EXCEPTIONS = 400;
26392
26421
  var MAX_SPAN = 24 * 36e5;
26393
26422
  var time = (v) => typeof v === "number" && Number.isFinite(v) && v > 0 && v < 864e13 ? Math.floor(v) : null;
@@ -27723,7 +27752,7 @@ var isEnvelope = (value) => {
27723
27752
  function createBroadcastTransport(options) {
27724
27753
  const roomId = validateRoomId(options.roomId);
27725
27754
  const Channel = options.BroadcastChannel ?? globalThis.BroadcastChannel;
27726
- const self = Math.random().toString(36).slice(2) + Date.now().toString(36);
27755
+ const self = randomToken() + Date.now().toString(36);
27727
27756
  let channel = null;
27728
27757
  let handlers = null;
27729
27758
  const close = () => {
@@ -80,15 +80,34 @@ var DEFAULT_XML_LIMITS = {
80
80
  maxDepth: 512,
81
81
  maxNodes: 5e6
82
82
  };
83
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
83
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
84
+ var MARKUP_SKIPS = [
85
+ ["<!--", "-->"],
86
+ ["<![CDATA[", "]]>"],
87
+ ["<?", "?>"]
88
+ ];
84
89
  function checkXmlLimits(xml, label, limits = {}) {
85
90
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
86
91
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
87
92
  let depth = 0;
88
93
  let nodes = 0;
89
- for (const match of xml.matchAll(MARKUP_RE)) {
90
- const [, closing, name3, selfClosing] = match;
91
- if (name3 === void 0) continue;
94
+ let at2 = xml.indexOf("<");
95
+ while (at2 !== -1) {
96
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at2));
97
+ if (skip) {
98
+ const end = xml.indexOf(skip[1], at2 + skip[0].length);
99
+ if (end === -1) return;
100
+ at2 = xml.indexOf("<", end + skip[1].length);
101
+ continue;
102
+ }
103
+ TAG_RE.lastIndex = at2;
104
+ const match = TAG_RE.exec(xml);
105
+ if (!match) {
106
+ at2 = xml.indexOf("<", at2 + 1);
107
+ continue;
108
+ }
109
+ const [, closing, , selfClosing] = match;
110
+ at2 = xml.indexOf("<", at2 + match[0].length);
92
111
  if (closing) {
93
112
  depth--;
94
113
  continue;
@@ -74,15 +74,34 @@ var DEFAULT_XML_LIMITS = {
74
74
  maxDepth: 512,
75
75
  maxNodes: 5e6
76
76
  };
77
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
77
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
78
+ var MARKUP_SKIPS = [
79
+ ["<!--", "-->"],
80
+ ["<![CDATA[", "]]>"],
81
+ ["<?", "?>"]
82
+ ];
78
83
  function checkXmlLimits(xml, label, limits = {}) {
79
84
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
80
85
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
81
86
  let depth = 0;
82
87
  let nodes = 0;
83
- for (const match of xml.matchAll(MARKUP_RE)) {
84
- const [, closing, name3, selfClosing] = match;
85
- if (name3 === void 0) continue;
88
+ let at2 = xml.indexOf("<");
89
+ while (at2 !== -1) {
90
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at2));
91
+ if (skip) {
92
+ const end = xml.indexOf(skip[1], at2 + skip[0].length);
93
+ if (end === -1) return;
94
+ at2 = xml.indexOf("<", end + skip[1].length);
95
+ continue;
96
+ }
97
+ TAG_RE.lastIndex = at2;
98
+ const match = TAG_RE.exec(xml);
99
+ if (!match) {
100
+ at2 = xml.indexOf("<", at2 + 1);
101
+ continue;
102
+ }
103
+ const [, closing, , selfClosing] = match;
104
+ at2 = xml.indexOf("<", at2 + match[0].length);
86
105
  if (closing) {
87
106
  depth--;
88
107
  continue;
@@ -1366,15 +1366,34 @@ var DEFAULT_XML_LIMITS = {
1366
1366
  maxDepth: 512,
1367
1367
  maxNodes: 5e6
1368
1368
  };
1369
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
1369
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
1370
+ var MARKUP_SKIPS = [
1371
+ ["<!--", "-->"],
1372
+ ["<![CDATA[", "]]>"],
1373
+ ["<?", "?>"]
1374
+ ];
1370
1375
  function checkXmlLimits(xml, label2, limits = {}) {
1371
1376
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
1372
1377
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
1373
1378
  let depth = 0;
1374
1379
  let nodes = 0;
1375
- for (const match of xml.matchAll(MARKUP_RE)) {
1376
- const [, closing, name3, selfClosing] = match;
1377
- if (name3 === void 0) continue;
1380
+ let at2 = xml.indexOf("<");
1381
+ while (at2 !== -1) {
1382
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at2));
1383
+ if (skip) {
1384
+ const end = xml.indexOf(skip[1], at2 + skip[0].length);
1385
+ if (end === -1) return;
1386
+ at2 = xml.indexOf("<", end + skip[1].length);
1387
+ continue;
1388
+ }
1389
+ TAG_RE.lastIndex = at2;
1390
+ const match = TAG_RE.exec(xml);
1391
+ if (!match) {
1392
+ at2 = xml.indexOf("<", at2 + 1);
1393
+ continue;
1394
+ }
1395
+ const [, closing, , selfClosing] = match;
1396
+ at2 = xml.indexOf("<", at2 + match[0].length);
1378
1397
  if (closing) {
1379
1398
  depth--;
1380
1399
  continue;
@@ -1360,15 +1360,34 @@ var DEFAULT_XML_LIMITS = {
1360
1360
  maxDepth: 512,
1361
1361
  maxNodes: 5e6
1362
1362
  };
1363
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
1363
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
1364
+ var MARKUP_SKIPS = [
1365
+ ["<!--", "-->"],
1366
+ ["<![CDATA[", "]]>"],
1367
+ ["<?", "?>"]
1368
+ ];
1364
1369
  function checkXmlLimits(xml, label2, limits = {}) {
1365
1370
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
1366
1371
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
1367
1372
  let depth = 0;
1368
1373
  let nodes = 0;
1369
- for (const match of xml.matchAll(MARKUP_RE)) {
1370
- const [, closing, name3, selfClosing] = match;
1371
- if (name3 === void 0) continue;
1374
+ let at2 = xml.indexOf("<");
1375
+ while (at2 !== -1) {
1376
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at2));
1377
+ if (skip) {
1378
+ const end = xml.indexOf(skip[1], at2 + skip[0].length);
1379
+ if (end === -1) return;
1380
+ at2 = xml.indexOf("<", end + skip[1].length);
1381
+ continue;
1382
+ }
1383
+ TAG_RE.lastIndex = at2;
1384
+ const match = TAG_RE.exec(xml);
1385
+ if (!match) {
1386
+ at2 = xml.indexOf("<", at2 + 1);
1387
+ continue;
1388
+ }
1389
+ const [, closing, , selfClosing] = match;
1390
+ at2 = xml.indexOf("<", at2 + match[0].length);
1372
1391
  if (closing) {
1373
1392
  depth--;
1374
1393
  continue;
@@ -1 +1 @@
1
- {"version":3,"file":"slicers.d.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file":"timelines.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/timelines.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpG,OAAO,EAAE,KAAK,WAAW,EAAW,MAAM,WAAW,CAAC;AAWtD;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,iBAAiB,GAAG,IAAI,GACjC,IAAI,CAiCN;AAED,MAAM,WAAW,aAAa;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CAmCzF;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAC7B,GAAG,EAAE,WAAW,EAChB,CAAC,EAAE,MAAM,EACT,GAAG,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnC,MAAM,CA4GR;AAED,2FAA2F;AAC3F,wBAAgB,cAAc,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAgBnE"}
@@ -11736,15 +11736,34 @@ var DEFAULT_XML_LIMITS = {
11736
11736
  maxDepth: 512,
11737
11737
  maxNodes: 5e6
11738
11738
  };
11739
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
11739
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
11740
+ var MARKUP_SKIPS = [
11741
+ ["<!--", "-->"],
11742
+ ["<![CDATA[", "]]>"],
11743
+ ["<?", "?>"]
11744
+ ];
11740
11745
  function checkXmlLimits(xml, label2, limits = {}) {
11741
11746
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
11742
11747
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
11743
11748
  let depth = 0;
11744
11749
  let nodes = 0;
11745
- for (const match2 of xml.matchAll(MARKUP_RE)) {
11746
- const [, closing, name, selfClosing] = match2;
11747
- if (name === void 0) continue;
11750
+ let at = xml.indexOf("<");
11751
+ while (at !== -1) {
11752
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
11753
+ if (skip) {
11754
+ const end = xml.indexOf(skip[1], at + skip[0].length);
11755
+ if (end === -1) return;
11756
+ at = xml.indexOf("<", end + skip[1].length);
11757
+ continue;
11758
+ }
11759
+ TAG_RE.lastIndex = at;
11760
+ const match2 = TAG_RE.exec(xml);
11761
+ if (!match2) {
11762
+ at = xml.indexOf("<", at + 1);
11763
+ continue;
11764
+ }
11765
+ const [, closing, , selfClosing] = match2;
11766
+ at = xml.indexOf("<", at + match2[0].length);
11748
11767
  if (closing) {
11749
11768
  depth--;
11750
11769
  continue;
@@ -29519,7 +29538,9 @@ function pivotTableXml(source2, cacheId, cache3) {
29519
29538
  }
29520
29539
  function dateFilterXml(pivot, filter2) {
29521
29540
  const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
29522
- const id = Number(/<filter [^>]*\bid="(\d+)"/.exec(pivot.sourceXml ?? "")?.[1] ?? 1);
29541
+ const id = Number(
29542
+ /\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
29543
+ );
29523
29544
  return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
29524
29545
  }
29525
29546
 
@@ -34378,7 +34399,7 @@ function addScenario(ctx, s, draft) {
34378
34399
  }
34379
34400
  function editScenario(ctx, s, index3, draft) {
34380
34401
  const sheet = sheetAt(ctx.workbook, s);
34381
- const existing = scenariosOf(sheet)[index3];
34402
+ const existing = Number.isInteger(index3) ? scenariosOf(sheet)[index3] : void 0;
34382
34403
  if (!existing) throw new ScenarioError("missing");
34383
34404
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
34384
34405
  const name = checkName(sheet, draft.name, index3);
@@ -34389,7 +34410,7 @@ function editScenario(ctx, s, index3, draft) {
34389
34410
  }
34390
34411
  function deleteScenario(ctx, s, index3) {
34391
34412
  const sheet = sheetAt(ctx.workbook, s);
34392
- const existing = scenariosOf(sheet)[index3];
34413
+ const existing = Number.isInteger(index3) ? scenariosOf(sheet)[index3] : void 0;
34393
34414
  if (!existing) throw new ScenarioError("missing");
34394
34415
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
34395
34416
  ctx.run("Delete scenario", "view", PARTS(s), () => {
@@ -35188,7 +35209,10 @@ function insertTimeline(ctx, s, ref) {
35188
35209
  const id = Math.max(
35189
35210
  1,
35190
35211
  ...sheet.drawings.flatMap(
35191
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
35212
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
35213
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
35214
+ return id2 ? [Number(id2)] : [];
35215
+ }) : []
35192
35216
  )
35193
35217
  ) + 1;
35194
35218
  ctx.run(
@@ -35726,7 +35750,10 @@ function insertSlicer(ctx, s, ref) {
35726
35750
  const id = Math.max(
35727
35751
  1,
35728
35752
  ...sheet.drawings.flatMap(
35729
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
35753
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
35754
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
35755
+ return id2 ? [Number(id2)] : [];
35756
+ }) : []
35730
35757
  )
35731
35758
  ) + 1;
35732
35759
  ctx.run(
@@ -11730,15 +11730,34 @@ var DEFAULT_XML_LIMITS = {
11730
11730
  maxDepth: 512,
11731
11731
  maxNodes: 5e6
11732
11732
  };
11733
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
11733
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
11734
+ var MARKUP_SKIPS = [
11735
+ ["<!--", "-->"],
11736
+ ["<![CDATA[", "]]>"],
11737
+ ["<?", "?>"]
11738
+ ];
11734
11739
  function checkXmlLimits(xml, label2, limits = {}) {
11735
11740
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
11736
11741
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
11737
11742
  let depth = 0;
11738
11743
  let nodes = 0;
11739
- for (const match2 of xml.matchAll(MARKUP_RE)) {
11740
- const [, closing, name, selfClosing] = match2;
11741
- if (name === void 0) continue;
11744
+ let at = xml.indexOf("<");
11745
+ while (at !== -1) {
11746
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
11747
+ if (skip) {
11748
+ const end = xml.indexOf(skip[1], at + skip[0].length);
11749
+ if (end === -1) return;
11750
+ at = xml.indexOf("<", end + skip[1].length);
11751
+ continue;
11752
+ }
11753
+ TAG_RE.lastIndex = at;
11754
+ const match2 = TAG_RE.exec(xml);
11755
+ if (!match2) {
11756
+ at = xml.indexOf("<", at + 1);
11757
+ continue;
11758
+ }
11759
+ const [, closing, , selfClosing] = match2;
11760
+ at = xml.indexOf("<", at + match2[0].length);
11742
11761
  if (closing) {
11743
11762
  depth--;
11744
11763
  continue;
@@ -29513,7 +29532,9 @@ function pivotTableXml(source2, cacheId, cache3) {
29513
29532
  }
29514
29533
  function dateFilterXml(pivot, filter2) {
29515
29534
  const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
29516
- const id = Number(/<filter [^>]*\bid="(\d+)"/.exec(pivot.sourceXml ?? "")?.[1] ?? 1);
29535
+ const id = Number(
29536
+ /\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
29537
+ );
29517
29538
  return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
29518
29539
  }
29519
29540
 
@@ -34372,7 +34393,7 @@ function addScenario(ctx, s, draft) {
34372
34393
  }
34373
34394
  function editScenario(ctx, s, index3, draft) {
34374
34395
  const sheet = sheetAt(ctx.workbook, s);
34375
- const existing = scenariosOf(sheet)[index3];
34396
+ const existing = Number.isInteger(index3) ? scenariosOf(sheet)[index3] : void 0;
34376
34397
  if (!existing) throw new ScenarioError("missing");
34377
34398
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
34378
34399
  const name = checkName(sheet, draft.name, index3);
@@ -34383,7 +34404,7 @@ function editScenario(ctx, s, index3, draft) {
34383
34404
  }
34384
34405
  function deleteScenario(ctx, s, index3) {
34385
34406
  const sheet = sheetAt(ctx.workbook, s);
34386
- const existing = scenariosOf(sheet)[index3];
34407
+ const existing = Number.isInteger(index3) ? scenariosOf(sheet)[index3] : void 0;
34387
34408
  if (!existing) throw new ScenarioError("missing");
34388
34409
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
34389
34410
  ctx.run("Delete scenario", "view", PARTS(s), () => {
@@ -35182,7 +35203,10 @@ function insertTimeline(ctx, s, ref) {
35182
35203
  const id = Math.max(
35183
35204
  1,
35184
35205
  ...sheet.drawings.flatMap(
35185
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
35206
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
35207
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
35208
+ return id2 ? [Number(id2)] : [];
35209
+ }) : []
35186
35210
  )
35187
35211
  ) + 1;
35188
35212
  ctx.run(
@@ -35720,7 +35744,10 @@ function insertSlicer(ctx, s, ref) {
35720
35744
  const id = Math.max(
35721
35745
  1,
35722
35746
  ...sheet.drawings.flatMap(
35723
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
35747
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
35748
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
35749
+ return id2 ? [Number(id2)] : [];
35750
+ }) : []
35724
35751
  )
35725
35752
  ) + 1;
35726
35753
  ctx.run(
@@ -3254,15 +3254,34 @@ var DEFAULT_XML_LIMITS = {
3254
3254
  maxDepth: 512,
3255
3255
  maxNodes: 5e6
3256
3256
  };
3257
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
3257
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
3258
+ var MARKUP_SKIPS = [
3259
+ ["<!--", "-->"],
3260
+ ["<![CDATA[", "]]>"],
3261
+ ["<?", "?>"]
3262
+ ];
3258
3263
  function checkXmlLimits(xml, label2, limits = {}) {
3259
3264
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
3260
3265
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
3261
3266
  let depth = 0;
3262
3267
  let nodes = 0;
3263
- for (const match2 of xml.matchAll(MARKUP_RE)) {
3264
- const [, closing, name, selfClosing] = match2;
3265
- if (name === void 0) continue;
3268
+ let at = xml.indexOf("<");
3269
+ while (at !== -1) {
3270
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
3271
+ if (skip) {
3272
+ const end = xml.indexOf(skip[1], at + skip[0].length);
3273
+ if (end === -1) return;
3274
+ at = xml.indexOf("<", end + skip[1].length);
3275
+ continue;
3276
+ }
3277
+ TAG_RE.lastIndex = at;
3278
+ const match2 = TAG_RE.exec(xml);
3279
+ if (!match2) {
3280
+ at = xml.indexOf("<", at + 1);
3281
+ continue;
3282
+ }
3283
+ const [, closing, , selfClosing] = match2;
3284
+ at = xml.indexOf("<", at + match2[0].length);
3266
3285
  if (closing) {
3267
3286
  depth--;
3268
3287
  continue;
@@ -27524,7 +27543,9 @@ function pivotTableXml(source2, cacheId, cache2) {
27524
27543
  }
27525
27544
  function dateFilterXml(pivot, filter2) {
27526
27545
  const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
27527
- const id = Number(/<filter [^>]*\bid="(\d+)"/.exec(pivot.sourceXml ?? "")?.[1] ?? 1);
27546
+ const id = Number(
27547
+ /\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
27548
+ );
27528
27549
  return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
27529
27550
  }
27530
27551
 
@@ -3248,15 +3248,34 @@ var DEFAULT_XML_LIMITS = {
3248
3248
  maxDepth: 512,
3249
3249
  maxNodes: 5e6
3250
3250
  };
3251
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
3251
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
3252
+ var MARKUP_SKIPS = [
3253
+ ["<!--", "-->"],
3254
+ ["<![CDATA[", "]]>"],
3255
+ ["<?", "?>"]
3256
+ ];
3252
3257
  function checkXmlLimits(xml, label2, limits = {}) {
3253
3258
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
3254
3259
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
3255
3260
  let depth = 0;
3256
3261
  let nodes = 0;
3257
- for (const match2 of xml.matchAll(MARKUP_RE)) {
3258
- const [, closing, name, selfClosing] = match2;
3259
- if (name === void 0) continue;
3262
+ let at = xml.indexOf("<");
3263
+ while (at !== -1) {
3264
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
3265
+ if (skip) {
3266
+ const end = xml.indexOf(skip[1], at + skip[0].length);
3267
+ if (end === -1) return;
3268
+ at = xml.indexOf("<", end + skip[1].length);
3269
+ continue;
3270
+ }
3271
+ TAG_RE.lastIndex = at;
3272
+ const match2 = TAG_RE.exec(xml);
3273
+ if (!match2) {
3274
+ at = xml.indexOf("<", at + 1);
3275
+ continue;
3276
+ }
3277
+ const [, closing, , selfClosing] = match2;
3278
+ at = xml.indexOf("<", at + match2[0].length);
3260
3279
  if (closing) {
3261
3280
  depth--;
3262
3281
  continue;
@@ -27518,7 +27537,9 @@ function pivotTableXml(source2, cacheId, cache2) {
27518
27537
  }
27519
27538
  function dateFilterXml(pivot, filter2) {
27520
27539
  const x15 = "http://schemas.microsoft.com/office/spreadsheetml/2010/11/main";
27521
- const id = Number(/<filter [^>]*\bid="(\d+)"/.exec(pivot.sourceXml ?? "")?.[1] ?? 1);
27540
+ const id = Number(
27541
+ /\bid="(\d+)"/.exec(/<filter\s[^>]*>/.exec(pivot.sourceXml ?? "")?.[0] ?? "")?.[1] ?? 1
27542
+ );
27522
27543
  return `<filters count="1"><filter${attrs({ fld: pivot.fields.indexOf(filter2.field), type: "dateBetween", evalOrder: -1, id, name: filter2.field })}><autoFilter ref="A1"><filterColumn colId="0"><customFilters and="1"><customFilter operator="greaterThanOrEqual" val="${Math.floor(filter2.start)}"/><customFilter operator="lessThanOrEqual" val="${Math.floor(filter2.end)}"/></customFilters></filterColumn></autoFilter><extLst><ext uri="{0605FD5F-26C8-4aeb-8148-2DB25E43C511}" xmlns:x15="${x15}"><x15:pivotFilter useWholeDay="1"/></ext></extLst></filter></filters>`;
27523
27544
  }
27524
27545
 
@@ -11608,15 +11608,34 @@ var DEFAULT_XML_LIMITS = {
11608
11608
  maxDepth: 512,
11609
11609
  maxNodes: 5e6
11610
11610
  };
11611
- var MARKUP_RE = /<!--[\s\S]*?-->|<!\[CDATA\[[\s\S]*?\]\]>|<\?[\s\S]*?\?>|<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/g;
11611
+ var TAG_RE = /<(\/?)([^\s\/>]+)(?:\s+[^\s=\/>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\s*(\/?)>/y;
11612
+ var MARKUP_SKIPS = [
11613
+ ["<!--", "-->"],
11614
+ ["<![CDATA[", "]]>"],
11615
+ ["<?", "?>"]
11616
+ ];
11612
11617
  function checkXmlLimits(xml, label2, limits = {}) {
11613
11618
  const maxDepth = limits.maxDepth ?? DEFAULT_XML_LIMITS.maxDepth;
11614
11619
  const maxNodes = limits.maxNodes ?? DEFAULT_XML_LIMITS.maxNodes;
11615
11620
  let depth = 0;
11616
11621
  let nodes = 0;
11617
- for (const match2 of xml.matchAll(MARKUP_RE)) {
11618
- const [, closing, name, selfClosing] = match2;
11619
- if (name === void 0) continue;
11622
+ let at = xml.indexOf("<");
11623
+ while (at !== -1) {
11624
+ const skip = MARKUP_SKIPS.find(([open]) => xml.startsWith(open, at));
11625
+ if (skip) {
11626
+ const end = xml.indexOf(skip[1], at + skip[0].length);
11627
+ if (end === -1) return;
11628
+ at = xml.indexOf("<", end + skip[1].length);
11629
+ continue;
11630
+ }
11631
+ TAG_RE.lastIndex = at;
11632
+ const match2 = TAG_RE.exec(xml);
11633
+ if (!match2) {
11634
+ at = xml.indexOf("<", at + 1);
11635
+ continue;
11636
+ }
11637
+ const [, closing, , selfClosing] = match2;
11638
+ at = xml.indexOf("<", at + match2[0].length);
11620
11639
  if (closing) {
11621
11640
  depth--;
11622
11641
  continue;
@@ -21081,7 +21100,7 @@ function addScenario(ctx, s, draft) {
21081
21100
  }
21082
21101
  function editScenario(ctx, s, index2, draft) {
21083
21102
  const sheet = sheetAt(ctx.workbook, s);
21084
- const existing = scenariosOf(sheet)[index2];
21103
+ const existing = Number.isInteger(index2) ? scenariosOf(sheet)[index2] : void 0;
21085
21104
  if (!existing) throw new ScenarioError("missing");
21086
21105
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
21087
21106
  const name = checkName(sheet, draft.name, index2);
@@ -21092,7 +21111,7 @@ function editScenario(ctx, s, index2, draft) {
21092
21111
  }
21093
21112
  function deleteScenario(ctx, s, index2) {
21094
21113
  const sheet = sheetAt(ctx.workbook, s);
21095
- const existing = scenariosOf(sheet)[index2];
21114
+ const existing = Number.isInteger(index2) ? scenariosOf(sheet)[index2] : void 0;
21096
21115
  if (!existing) throw new ScenarioError("missing");
21097
21116
  if (existing.locked && sheet.protection) throw new ScenarioError("locked");
21098
21117
  ctx.run("Delete scenario", "view", PARTS(s), () => {
@@ -21870,7 +21889,10 @@ function insertTimeline(ctx, s, ref) {
21870
21889
  const id = Math.max(
21871
21890
  1,
21872
21891
  ...sheet.drawings.flatMap(
21873
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
21892
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
21893
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
21894
+ return id2 ? [Number(id2)] : [];
21895
+ }) : []
21874
21896
  )
21875
21897
  ) + 1;
21876
21898
  ctx.run(
@@ -22408,7 +22430,10 @@ function insertSlicer(ctx, s, ref) {
22408
22430
  const id = Math.max(
22409
22431
  1,
22410
22432
  ...sheet.drawings.flatMap(
22411
- (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1])) : []
22433
+ (d) => "sourceXml" in d && d.sourceXml ? [...d.sourceXml.matchAll(/<[\w:]*cNvPr\b[^>]*>/g)].flatMap((m) => {
22434
+ const id2 = /\sid="(\d+)"/.exec(m[0])?.[1];
22435
+ return id2 ? [Number(id2)] : [];
22436
+ }) : []
22412
22437
  )
22413
22438
  ) + 1;
22414
22439
  ctx.run(