ooxml-core 0.22.0 → 0.22.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.
@@ -11855,7 +11855,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
11855
11855
  let nextId = Math.max(
11856
11856
  1,
11857
11857
  ...kept.flatMap(
11858
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
11858
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
11859
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
11860
+ return id ? [Number(id[1])] : [];
11861
+ })
11859
11862
  )
11860
11863
  ) + 1;
11861
11864
  let body = "";
@@ -12841,7 +12844,8 @@ function parseDay(text) {
12841
12844
  function parseDateTimeInput(text, date1904) {
12842
12845
  const time = parseTime(text);
12843
12846
  if (time) return { value: time.fraction, numFmt: time.format };
12844
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
12847
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
12848
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
12845
12849
  const dayText = split ? split[1] ?? "" : text;
12846
12850
  const day = parseDay(dayText);
12847
12851
  if (!day) return void 0;
@@ -12886,10 +12890,10 @@ function parseNumberInput(text) {
12886
12890
  s = s.slice(lead[0].length);
12887
12891
  if (!sign()) return void 0;
12888
12892
  } else {
12889
- const trail = /\s*([€£])$/.exec(s);
12890
- if (trail) {
12891
- currency = trail[1] ?? "";
12892
- s = s.slice(0, -trail[0].length);
12893
+ const last = s.slice(-1);
12894
+ if (last === "\u20AC" || last === "\xA3") {
12895
+ currency = last;
12896
+ s = s.slice(0, -1).trimEnd();
12893
12897
  }
12894
12898
  }
12895
12899
  let percent = false;
@@ -26731,7 +26735,9 @@ function decodeEntities(text) {
26731
26735
  }
26732
26736
  function parseAttributes(text) {
26733
26737
  const attrs2 = /* @__PURE__ */ new Map();
26734
- for (const m of text.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
26738
+ for (const m of text.matchAll(
26739
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
26740
+ ))
26735
26741
  attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
26736
26742
  return attrs2;
26737
26743
  }
@@ -26786,12 +26792,41 @@ function stylePatchFromCss(css, inner2) {
26786
26792
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
26787
26793
  return patch;
26788
26794
  }
26795
+ function removeComments(text) {
26796
+ let out = "";
26797
+ let from = 0;
26798
+ for (; ; ) {
26799
+ const open = text.indexOf("<!--", from);
26800
+ const close = open < 0 ? -1 : text.indexOf("-->", open + 4);
26801
+ if (close < 0) return out + text.slice(from);
26802
+ out += text.slice(from, open);
26803
+ from = close + 3;
26804
+ }
26805
+ }
26806
+ function removeTags(text) {
26807
+ let out = "";
26808
+ let i = 0;
26809
+ while (i < text.length) {
26810
+ const ch = text[i];
26811
+ if (ch === "<") {
26812
+ let j = i + 1;
26813
+ while (j < text.length && text[j] !== "<" && text[j] !== ">") j++;
26814
+ if (text[j] === ">") {
26815
+ i = j + 1;
26816
+ continue;
26817
+ }
26818
+ }
26819
+ out += ch;
26820
+ i++;
26821
+ }
26822
+ return out;
26823
+ }
26789
26824
  function stripTags(markup) {
26790
26825
  let previous;
26791
26826
  let text = markup;
26792
26827
  do {
26793
26828
  previous = text;
26794
- text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
26829
+ text = removeTags(removeComments(text));
26795
26830
  } while (text !== previous);
26796
26831
  return removeAll(text, ["<!--", "-->"]);
26797
26832
  }
@@ -26986,7 +27021,15 @@ function linearTrend(values2) {
26986
27021
  const slope = den ? num3 / den : 0;
26987
27022
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
26988
27023
  }
26989
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
27024
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
27025
+ function matchTextNumber(text) {
27026
+ let end = text.length;
27027
+ while (end > 0 && !isDigit3(text[end - 1])) end--;
27028
+ if (end === 0) return null;
27029
+ let start = end;
27030
+ while (start > 0 && isDigit3(text[start - 1])) start--;
27031
+ return [text, text.slice(0, start), text.slice(start, end), text.slice(end)];
27032
+ }
26990
27033
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
26991
27034
  function textSeries(texts) {
26992
27035
  const lists = texts.map(listMatch);
@@ -27008,7 +27051,7 @@ function textSeries(texts) {
27008
27051
  const step = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
27009
27052
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step * k, 4) + 1}` });
27010
27053
  }
27011
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
27054
+ const parts = texts.map(matchTextNumber);
27012
27055
  const p0 = parts[0];
27013
27056
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
27014
27057
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -11849,7 +11849,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
11849
11849
  let nextId = Math.max(
11850
11850
  1,
11851
11851
  ...kept.flatMap(
11852
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
11852
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
11853
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
11854
+ return id ? [Number(id[1])] : [];
11855
+ })
11853
11856
  )
11854
11857
  ) + 1;
11855
11858
  let body = "";
@@ -12835,7 +12838,8 @@ function parseDay(text) {
12835
12838
  function parseDateTimeInput(text, date1904) {
12836
12839
  const time = parseTime(text);
12837
12840
  if (time) return { value: time.fraction, numFmt: time.format };
12838
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
12841
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
12842
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
12839
12843
  const dayText = split ? split[1] ?? "" : text;
12840
12844
  const day = parseDay(dayText);
12841
12845
  if (!day) return void 0;
@@ -12880,10 +12884,10 @@ function parseNumberInput(text) {
12880
12884
  s = s.slice(lead[0].length);
12881
12885
  if (!sign()) return void 0;
12882
12886
  } else {
12883
- const trail = /\s*([€£])$/.exec(s);
12884
- if (trail) {
12885
- currency = trail[1] ?? "";
12886
- s = s.slice(0, -trail[0].length);
12887
+ const last = s.slice(-1);
12888
+ if (last === "\u20AC" || last === "\xA3") {
12889
+ currency = last;
12890
+ s = s.slice(0, -1).trimEnd();
12887
12891
  }
12888
12892
  }
12889
12893
  let percent = false;
@@ -26725,7 +26729,9 @@ function decodeEntities(text) {
26725
26729
  }
26726
26730
  function parseAttributes(text) {
26727
26731
  const attrs2 = /* @__PURE__ */ new Map();
26728
- for (const m of text.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
26732
+ for (const m of text.matchAll(
26733
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
26734
+ ))
26729
26735
  attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
26730
26736
  return attrs2;
26731
26737
  }
@@ -26780,12 +26786,41 @@ function stylePatchFromCss(css, inner2) {
26780
26786
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
26781
26787
  return patch;
26782
26788
  }
26789
+ function removeComments(text) {
26790
+ let out = "";
26791
+ let from = 0;
26792
+ for (; ; ) {
26793
+ const open = text.indexOf("<!--", from);
26794
+ const close = open < 0 ? -1 : text.indexOf("-->", open + 4);
26795
+ if (close < 0) return out + text.slice(from);
26796
+ out += text.slice(from, open);
26797
+ from = close + 3;
26798
+ }
26799
+ }
26800
+ function removeTags(text) {
26801
+ let out = "";
26802
+ let i = 0;
26803
+ while (i < text.length) {
26804
+ const ch = text[i];
26805
+ if (ch === "<") {
26806
+ let j = i + 1;
26807
+ while (j < text.length && text[j] !== "<" && text[j] !== ">") j++;
26808
+ if (text[j] === ">") {
26809
+ i = j + 1;
26810
+ continue;
26811
+ }
26812
+ }
26813
+ out += ch;
26814
+ i++;
26815
+ }
26816
+ return out;
26817
+ }
26783
26818
  function stripTags(markup) {
26784
26819
  let previous;
26785
26820
  let text = markup;
26786
26821
  do {
26787
26822
  previous = text;
26788
- text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
26823
+ text = removeTags(removeComments(text));
26789
26824
  } while (text !== previous);
26790
26825
  return removeAll(text, ["<!--", "-->"]);
26791
26826
  }
@@ -26980,7 +27015,15 @@ function linearTrend(values2) {
26980
27015
  const slope = den ? num3 / den : 0;
26981
27016
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
26982
27017
  }
26983
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
27018
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
27019
+ function matchTextNumber(text) {
27020
+ let end = text.length;
27021
+ while (end > 0 && !isDigit3(text[end - 1])) end--;
27022
+ if (end === 0) return null;
27023
+ let start = end;
27024
+ while (start > 0 && isDigit3(text[start - 1])) start--;
27025
+ return [text, text.slice(0, start), text.slice(start, end), text.slice(end)];
27026
+ }
26984
27027
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
26985
27028
  function textSeries(texts) {
26986
27029
  const lists = texts.map(listMatch);
@@ -27002,7 +27045,7 @@ function textSeries(texts) {
27002
27045
  const step = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
27003
27046
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step * k, 4) + 1}` });
27004
27047
  }
27005
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
27048
+ const parts = texts.map(matchTextNumber);
27006
27049
  const p0 = parts[0];
27007
27050
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
27008
27051
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -1 +1 @@
1
- {"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AAwGD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAoDxF"}
1
+ {"version":3,"file":"clipboard-html-parse.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/clipboard-html-parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,SAAS,EAET,KAAK,EAGL,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuBhE,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAkB7D;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnD;AA2ID;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,cAAc,GAAG,SAAS,CAoDxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI7D,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;AAIxD,eAAO,MAAM,GAAG,MAAO,MAAM,KAAK,MAAM,KAAG,MAA2B,CAAC;AAgJvE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,eAAe,CAa5F"}
1
+ {"version":3,"file":"fill-series.d.ts","sourceRoot":"","sources":["../../../xlsx/edit/fill-series.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI7D,6FAA6F;AAC7F,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,UAAU,CAAC;AAIxD,eAAO,MAAM,GAAG,MAAO,MAAM,KAAK,MAAM,KAAG,MAA2B,CAAC;AA0JvE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,eAAe,CAa5F"}
@@ -1804,7 +1804,8 @@ function parseDay(text2) {
1804
1804
  function parseDateTimeInput(text2, date1904) {
1805
1805
  const time = parseTime(text2);
1806
1806
  if (time) return { value: time.fraction, numFmt: time.format };
1807
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text2);
1807
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text2);
1808
+ const split = tail && tail.index > 0 ? [tail[0], text2.slice(0, tail.index), tail[1]] : null;
1808
1809
  const dayText = split ? split[1] ?? "" : text2;
1809
1810
  const day = parseDay(dayText);
1810
1811
  if (!day) return void 0;
@@ -1849,10 +1850,10 @@ function parseNumberInput(text2) {
1849
1850
  s = s.slice(lead[0].length);
1850
1851
  if (!sign()) return void 0;
1851
1852
  } else {
1852
- const trail = /\s*([€£])$/.exec(s);
1853
- if (trail) {
1854
- currency = trail[1] ?? "";
1855
- s = s.slice(0, -trail[0].length);
1853
+ const last = s.slice(-1);
1854
+ if (last === "\u20AC" || last === "\xA3") {
1855
+ currency = last;
1856
+ s = s.slice(0, -1).trimEnd();
1856
1857
  }
1857
1858
  }
1858
1859
  let percent = false;
@@ -17173,7 +17174,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
17173
17174
  let nextId = Math.max(
17174
17175
  1,
17175
17176
  ...kept.flatMap(
17176
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
17177
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
17178
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
17179
+ return id ? [Number(id[1])] : [];
17180
+ })
17177
17181
  )
17178
17182
  ) + 1;
17179
17183
  let body = "";
@@ -20511,7 +20515,9 @@ function decodeEntities(text2) {
20511
20515
  }
20512
20516
  function parseAttributes(text2) {
20513
20517
  const attrs2 = /* @__PURE__ */ new Map();
20514
- for (const m of text2.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
20518
+ for (const m of text2.matchAll(
20519
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
20520
+ ))
20515
20521
  attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
20516
20522
  return attrs2;
20517
20523
  }
@@ -20566,12 +20572,41 @@ function stylePatchFromCss(css, inner2) {
20566
20572
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
20567
20573
  return patch;
20568
20574
  }
20575
+ function removeComments(text2) {
20576
+ let out = "";
20577
+ let from = 0;
20578
+ for (; ; ) {
20579
+ const open = text2.indexOf("<!--", from);
20580
+ const close = open < 0 ? -1 : text2.indexOf("-->", open + 4);
20581
+ if (close < 0) return out + text2.slice(from);
20582
+ out += text2.slice(from, open);
20583
+ from = close + 3;
20584
+ }
20585
+ }
20586
+ function removeTags(text2) {
20587
+ let out = "";
20588
+ let i = 0;
20589
+ while (i < text2.length) {
20590
+ const ch = text2[i];
20591
+ if (ch === "<") {
20592
+ let j = i + 1;
20593
+ while (j < text2.length && text2[j] !== "<" && text2[j] !== ">") j++;
20594
+ if (text2[j] === ">") {
20595
+ i = j + 1;
20596
+ continue;
20597
+ }
20598
+ }
20599
+ out += ch;
20600
+ i++;
20601
+ }
20602
+ return out;
20603
+ }
20569
20604
  function stripTags(markup) {
20570
20605
  let previous;
20571
20606
  let text2 = markup;
20572
20607
  do {
20573
20608
  previous = text2;
20574
- text2 = text2.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
20609
+ text2 = removeTags(removeComments(text2));
20575
20610
  } while (text2 !== previous);
20576
20611
  return removeAll(text2, ["<!--", "-->"]);
20577
20612
  }
@@ -20766,7 +20801,15 @@ function linearTrend(values2) {
20766
20801
  const slope = den ? num3 / den : 0;
20767
20802
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
20768
20803
  }
20769
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
20804
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
20805
+ function matchTextNumber(text2) {
20806
+ let end = text2.length;
20807
+ while (end > 0 && !isDigit3(text2[end - 1])) end--;
20808
+ if (end === 0) return null;
20809
+ let start = end;
20810
+ while (start > 0 && isDigit3(text2[start - 1])) start--;
20811
+ return [text2, text2.slice(0, start), text2.slice(start, end), text2.slice(end)];
20812
+ }
20770
20813
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
20771
20814
  function textSeries(texts) {
20772
20815
  const lists = texts.map(listMatch);
@@ -20788,7 +20831,7 @@ function textSeries(texts) {
20788
20831
  const step2 = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
20789
20832
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step2 * k, 4) + 1}` });
20790
20833
  }
20791
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
20834
+ const parts = texts.map(matchTextNumber);
20792
20835
  const p0 = parts[0];
20793
20836
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
20794
20837
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -1798,7 +1798,8 @@ function parseDay(text2) {
1798
1798
  function parseDateTimeInput(text2, date1904) {
1799
1799
  const time = parseTime(text2);
1800
1800
  if (time) return { value: time.fraction, numFmt: time.format };
1801
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text2);
1801
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text2);
1802
+ const split = tail && tail.index > 0 ? [tail[0], text2.slice(0, tail.index), tail[1]] : null;
1802
1803
  const dayText = split ? split[1] ?? "" : text2;
1803
1804
  const day = parseDay(dayText);
1804
1805
  if (!day) return void 0;
@@ -1843,10 +1844,10 @@ function parseNumberInput(text2) {
1843
1844
  s = s.slice(lead[0].length);
1844
1845
  if (!sign()) return void 0;
1845
1846
  } else {
1846
- const trail = /\s*([€£])$/.exec(s);
1847
- if (trail) {
1848
- currency = trail[1] ?? "";
1849
- s = s.slice(0, -trail[0].length);
1847
+ const last = s.slice(-1);
1848
+ if (last === "\u20AC" || last === "\xA3") {
1849
+ currency = last;
1850
+ s = s.slice(0, -1).trimEnd();
1850
1851
  }
1851
1852
  }
1852
1853
  let percent = false;
@@ -17167,7 +17168,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
17167
17168
  let nextId = Math.max(
17168
17169
  1,
17169
17170
  ...kept.flatMap(
17170
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
17171
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
17172
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
17173
+ return id ? [Number(id[1])] : [];
17174
+ })
17171
17175
  )
17172
17176
  ) + 1;
17173
17177
  let body = "";
@@ -20505,7 +20509,9 @@ function decodeEntities(text2) {
20505
20509
  }
20506
20510
  function parseAttributes(text2) {
20507
20511
  const attrs2 = /* @__PURE__ */ new Map();
20508
- for (const m of text2.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
20512
+ for (const m of text2.matchAll(
20513
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
20514
+ ))
20509
20515
  attrs2.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
20510
20516
  return attrs2;
20511
20517
  }
@@ -20560,12 +20566,41 @@ function stylePatchFromCss(css, inner2) {
20560
20566
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
20561
20567
  return patch;
20562
20568
  }
20569
+ function removeComments(text2) {
20570
+ let out = "";
20571
+ let from = 0;
20572
+ for (; ; ) {
20573
+ const open = text2.indexOf("<!--", from);
20574
+ const close = open < 0 ? -1 : text2.indexOf("-->", open + 4);
20575
+ if (close < 0) return out + text2.slice(from);
20576
+ out += text2.slice(from, open);
20577
+ from = close + 3;
20578
+ }
20579
+ }
20580
+ function removeTags(text2) {
20581
+ let out = "";
20582
+ let i = 0;
20583
+ while (i < text2.length) {
20584
+ const ch = text2[i];
20585
+ if (ch === "<") {
20586
+ let j = i + 1;
20587
+ while (j < text2.length && text2[j] !== "<" && text2[j] !== ">") j++;
20588
+ if (text2[j] === ">") {
20589
+ i = j + 1;
20590
+ continue;
20591
+ }
20592
+ }
20593
+ out += ch;
20594
+ i++;
20595
+ }
20596
+ return out;
20597
+ }
20563
20598
  function stripTags(markup) {
20564
20599
  let previous;
20565
20600
  let text2 = markup;
20566
20601
  do {
20567
20602
  previous = text2;
20568
- text2 = text2.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
20603
+ text2 = removeTags(removeComments(text2));
20569
20604
  } while (text2 !== previous);
20570
20605
  return removeAll(text2, ["<!--", "-->"]);
20571
20606
  }
@@ -20760,7 +20795,15 @@ function linearTrend(values2) {
20760
20795
  const slope = den ? num3 / den : 0;
20761
20796
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
20762
20797
  }
20763
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
20798
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
20799
+ function matchTextNumber(text2) {
20800
+ let end = text2.length;
20801
+ while (end > 0 && !isDigit3(text2[end - 1])) end--;
20802
+ if (end === 0) return null;
20803
+ let start = end;
20804
+ while (start > 0 && isDigit3(text2[start - 1])) start--;
20805
+ return [text2, text2.slice(0, start), text2.slice(start, end), text2.slice(end)];
20806
+ }
20764
20807
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
20765
20808
  function textSeries(texts) {
20766
20809
  const lists = texts.map(listMatch);
@@ -20782,7 +20825,7 @@ function textSeries(texts) {
20782
20825
  const step2 = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
20783
20826
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step2 * k, 4) + 1}` });
20784
20827
  }
20785
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
20828
+ const parts = texts.map(matchTextNumber);
20786
20829
  const p0 = parts[0];
20787
20830
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
20788
20831
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -1 +1 @@
1
- {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../xlsx/load/csv.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKlD,MAAM,WAAW,UAAU;IAC1B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAepD;AAKD,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,MAAM,EAAE,EAAE,CA4C5E;AAKD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ1E;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,QAAQ,CAmCtF;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAMD;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,eAAoB,GAC3B,MAAM,CAwBR"}
1
+ {"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../../../xlsx/load/csv.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKlD,MAAM,WAAW,UAAU;IAC1B,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAyBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAepD;AAKD,4FAA4F;AAC5F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,MAAM,EAAE,EAAE,CA4C5E;AAKD,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU1E;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,QAAQ,CAmCtF;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IAClD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAMD;;;;GAIG;AACH,wBAAgB,UAAU,CACzB,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,eAAoB,GAC3B,MAAM,CAwBR"}
@@ -6823,7 +6823,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
6823
6823
  let nextId = Math.max(
6824
6824
  1,
6825
6825
  ...kept.flatMap(
6826
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
6826
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
6827
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
6828
+ return id ? [Number(id[1])] : [];
6829
+ })
6827
6830
  )
6828
6831
  ) + 1;
6829
6832
  let body = "";
@@ -7806,7 +7809,8 @@ function parseDay(text) {
7806
7809
  function parseDateTimeInput(text, date1904) {
7807
7810
  const time = parseTime(text);
7808
7811
  if (time) return { value: time.fraction, numFmt: time.format };
7809
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
7812
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
7813
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
7810
7814
  const dayText = split ? split[1] ?? "" : text;
7811
7815
  const day = parseDay(dayText);
7812
7816
  if (!day) return void 0;
@@ -7851,10 +7855,10 @@ function parseNumberInput(text) {
7851
7855
  s = s.slice(lead[0].length);
7852
7856
  if (!sign()) return void 0;
7853
7857
  } else {
7854
- const trail = /\s*([€£])$/.exec(s);
7855
- if (trail) {
7856
- currency = trail[1] ?? "";
7857
- s = s.slice(0, -trail[0].length);
7858
+ const last = s.slice(-1);
7859
+ if (last === "\u20AC" || last === "\xA3") {
7860
+ currency = last;
7861
+ s = s.slice(0, -1).trimEnd();
7858
7862
  }
7859
7863
  }
7860
7864
  let percent = false;
@@ -18674,8 +18678,13 @@ function parseCsv(input, options = {}) {
18674
18678
  var INVALID_SHEET_CHARS = /[\\/?*[\]:]/g;
18675
18679
  function sheetNameFromFileName(fileName) {
18676
18680
  const base = (fileName ?? "").split(/[\\/]/).pop() ?? "";
18677
- const stem = base.replace(/\.[^.]*$/, "").replace(INVALID_SHEET_CHARS, "_");
18678
- const trimmed = stem.replace(/^'+|'+$/g, "").slice(0, 31).trim();
18681
+ const dot = base.lastIndexOf(".");
18682
+ const stem = (dot < 0 ? base : base.slice(0, dot)).replace(INVALID_SHEET_CHARS, "_");
18683
+ let start = 0;
18684
+ let end = stem.length;
18685
+ while (start < end && stem[start] === "'") start++;
18686
+ while (end > start && stem[end - 1] === "'") end--;
18687
+ const trimmed = stem.slice(start, end).slice(0, 31).trim();
18679
18688
  return trimmed && trimmed.toLowerCase() !== "history" ? trimmed : "Sheet1";
18680
18689
  }
18681
18690
  function csvToWorkbook(text, options = {}) {
@@ -6817,7 +6817,10 @@ function writeDrawing(writer, partName, objects, sourceDrawing) {
6817
6817
  let nextId = Math.max(
6818
6818
  1,
6819
6819
  ...kept.flatMap(
6820
- (xml) => [...xml.matchAll(/cNvPr[^>]*\sid="(\d+)"/g)].map((m) => Number(m[1]))
6820
+ (xml) => [...xml.matchAll(/cNvPr([^>]*)/g)].flatMap((m) => {
6821
+ const id = /\sid="(\d+)"/.exec(m[1] ?? "");
6822
+ return id ? [Number(id[1])] : [];
6823
+ })
6821
6824
  )
6822
6825
  ) + 1;
6823
6826
  let body = "";
@@ -7800,7 +7803,8 @@ function parseDay(text) {
7800
7803
  function parseDateTimeInput(text, date1904) {
7801
7804
  const time = parseTime(text);
7802
7805
  if (time) return { value: time.fraction, numFmt: time.format };
7803
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
7806
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
7807
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
7804
7808
  const dayText = split ? split[1] ?? "" : text;
7805
7809
  const day = parseDay(dayText);
7806
7810
  if (!day) return void 0;
@@ -7845,10 +7849,10 @@ function parseNumberInput(text) {
7845
7849
  s = s.slice(lead[0].length);
7846
7850
  if (!sign()) return void 0;
7847
7851
  } else {
7848
- const trail = /\s*([€£])$/.exec(s);
7849
- if (trail) {
7850
- currency = trail[1] ?? "";
7851
- s = s.slice(0, -trail[0].length);
7852
+ const last = s.slice(-1);
7853
+ if (last === "\u20AC" || last === "\xA3") {
7854
+ currency = last;
7855
+ s = s.slice(0, -1).trimEnd();
7852
7856
  }
7853
7857
  }
7854
7858
  let percent = false;
@@ -18668,8 +18672,13 @@ function parseCsv(input, options = {}) {
18668
18672
  var INVALID_SHEET_CHARS = /[\\/?*[\]:]/g;
18669
18673
  function sheetNameFromFileName(fileName) {
18670
18674
  const base = (fileName ?? "").split(/[\\/]/).pop() ?? "";
18671
- const stem = base.replace(/\.[^.]*$/, "").replace(INVALID_SHEET_CHARS, "_");
18672
- const trimmed = stem.replace(/^'+|'+$/g, "").slice(0, 31).trim();
18675
+ const dot = base.lastIndexOf(".");
18676
+ const stem = (dot < 0 ? base : base.slice(0, dot)).replace(INVALID_SHEET_CHARS, "_");
18677
+ let start = 0;
18678
+ let end = stem.length;
18679
+ while (start < end && stem[start] === "'") start++;
18680
+ while (end > start && stem[end - 1] === "'") end--;
18681
+ const trimmed = stem.slice(start, end).slice(0, 31).trim();
18673
18682
  return trimmed && trimmed.toLowerCase() !== "history" ? trimmed : "Sheet1";
18674
18683
  }
18675
18684
  function csvToWorkbook(text, options = {}) {
@@ -1 +1 @@
1
- {"version":3,"file":"input-date.d.ts","sourceRoot":"","sources":["../../../xlsx/numfmt/input-date.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAiCD,wFAAwF;AACxF,wBAAgB,QAAQ,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,GACf,MAAM,GAAG,SAAS,CASpB;AAED,UAAU,SAAS;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAID,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA2B7D;AA0DD,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAczF"}
1
+ {"version":3,"file":"input-date.d.ts","sourceRoot":"","sources":["../../../xlsx/numfmt/input-date.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,SAAS;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf;AAiCD,wFAAwF;AACxF,wBAAgB,QAAQ,CACvB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,GACf,MAAM,GAAG,SAAS,CASpB;AAED,UAAU,SAAS;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAID,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CA2B7D;AA0DD,iFAAiF;AACjF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAezF"}
@@ -1737,7 +1737,8 @@ function parseDay(text) {
1737
1737
  function parseDateTimeInput(text, date1904) {
1738
1738
  const time = parseTime(text);
1739
1739
  if (time) return { value: time.fraction, numFmt: time.format };
1740
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
1740
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
1741
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
1741
1742
  const dayText = split ? split[1] ?? "" : text;
1742
1743
  const day = parseDay(dayText);
1743
1744
  if (!day) return void 0;
@@ -1782,10 +1783,10 @@ function parseNumberInput(text) {
1782
1783
  s = s.slice(lead[0].length);
1783
1784
  if (!sign2()) return void 0;
1784
1785
  } else {
1785
- const trail = /\s*([€£])$/.exec(s);
1786
- if (trail) {
1787
- currency = trail[1] ?? "";
1788
- s = s.slice(0, -trail[0].length);
1786
+ const last = s.slice(-1);
1787
+ if (last === "\u20AC" || last === "\xA3") {
1788
+ currency = last;
1789
+ s = s.slice(0, -1).trimEnd();
1789
1790
  }
1790
1791
  }
1791
1792
  let percent = false;
@@ -14024,7 +14025,9 @@ function decodeEntities(text) {
14024
14025
  }
14025
14026
  function parseAttributes(text) {
14026
14027
  const attrs = /* @__PURE__ */ new Map();
14027
- for (const m of text.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
14028
+ for (const m of text.matchAll(
14029
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
14030
+ ))
14028
14031
  attrs.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
14029
14032
  return attrs;
14030
14033
  }
@@ -14079,12 +14082,41 @@ function stylePatchFromCss(css, inner2) {
14079
14082
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
14080
14083
  return patch;
14081
14084
  }
14085
+ function removeComments(text) {
14086
+ let out = "";
14087
+ let from = 0;
14088
+ for (; ; ) {
14089
+ const open = text.indexOf("<!--", from);
14090
+ const close = open < 0 ? -1 : text.indexOf("-->", open + 4);
14091
+ if (close < 0) return out + text.slice(from);
14092
+ out += text.slice(from, open);
14093
+ from = close + 3;
14094
+ }
14095
+ }
14096
+ function removeTags(text) {
14097
+ let out = "";
14098
+ let i = 0;
14099
+ while (i < text.length) {
14100
+ const ch = text[i];
14101
+ if (ch === "<") {
14102
+ let j = i + 1;
14103
+ while (j < text.length && text[j] !== "<" && text[j] !== ">") j++;
14104
+ if (text[j] === ">") {
14105
+ i = j + 1;
14106
+ continue;
14107
+ }
14108
+ }
14109
+ out += ch;
14110
+ i++;
14111
+ }
14112
+ return out;
14113
+ }
14082
14114
  function stripTags(markup) {
14083
14115
  let previous;
14084
14116
  let text = markup;
14085
14117
  do {
14086
14118
  previous = text;
14087
- text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
14119
+ text = removeTags(removeComments(text));
14088
14120
  } while (text !== previous);
14089
14121
  return removeAll(text, ["<!--", "-->"]);
14090
14122
  }
@@ -14279,7 +14311,15 @@ function linearTrend(values2) {
14279
14311
  const slope = den ? num2 / den : 0;
14280
14312
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
14281
14313
  }
14282
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
14314
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
14315
+ function matchTextNumber(text) {
14316
+ let end = text.length;
14317
+ while (end > 0 && !isDigit3(text[end - 1])) end--;
14318
+ if (end === 0) return null;
14319
+ let start = end;
14320
+ while (start > 0 && isDigit3(text[start - 1])) start--;
14321
+ return [text, text.slice(0, start), text.slice(start, end), text.slice(end)];
14322
+ }
14283
14323
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
14284
14324
  function textSeries(texts) {
14285
14325
  const lists = texts.map(listMatch);
@@ -14301,7 +14341,7 @@ function textSeries(texts) {
14301
14341
  const step = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
14302
14342
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step * k, 4) + 1}` });
14303
14343
  }
14304
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
14344
+ const parts = texts.map(matchTextNumber);
14305
14345
  const p0 = parts[0];
14306
14346
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
14307
14347
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -27606,7 +27646,7 @@ var SheetSelections = class {
27606
27646
  };
27607
27647
  var isWholeRows2 = (range2) => range2.start.col === 0 && range2.end.col === MAX_COL;
27608
27648
  var isWholeCols = (range2) => range2.start.row === 0 && range2.end.row === MAX_ROW;
27609
- var columnPart = (address2) => formatAddress(address2).replace(/\d+$/u, "");
27649
+ var columnPart = (address2) => formatAddress(address2).replace(/\d{1,10}$/u, "");
27610
27650
  function rangeRef(range2) {
27611
27651
  if (isWholeRows2(range2) && isWholeCols(range2)) return `1:${MAX_ROW + 1}`;
27612
27652
  if (isWholeRows2(range2)) return `${range2.start.row + 1}:${range2.end.row + 1}`;
@@ -1735,7 +1735,8 @@ function parseDay(text) {
1735
1735
  function parseDateTimeInput(text, date1904) {
1736
1736
  const time = parseTime(text);
1737
1737
  if (time) return { value: time.fraction, numFmt: time.format };
1738
- const split = /^(.+?)(?:\s+|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s*(?:am|pm|a|p))?)$/i.exec(text);
1738
+ const tail = /(?:\s{1,8}|T)(\d{1,2}:\d{1,2}(?::\d{1,2})?(?:\s{0,8}(?:am|pm|a|p))?)$/i.exec(text);
1739
+ const split = tail && tail.index > 0 ? [tail[0], text.slice(0, tail.index), tail[1]] : null;
1739
1740
  const dayText = split ? split[1] ?? "" : text;
1740
1741
  const day = parseDay(dayText);
1741
1742
  if (!day) return void 0;
@@ -1780,10 +1781,10 @@ function parseNumberInput(text) {
1780
1781
  s = s.slice(lead[0].length);
1781
1782
  if (!sign2()) return void 0;
1782
1783
  } else {
1783
- const trail = /\s*([€£])$/.exec(s);
1784
- if (trail) {
1785
- currency = trail[1] ?? "";
1786
- s = s.slice(0, -trail[0].length);
1784
+ const last = s.slice(-1);
1785
+ if (last === "\u20AC" || last === "\xA3") {
1786
+ currency = last;
1787
+ s = s.slice(0, -1).trimEnd();
1787
1788
  }
1788
1789
  }
1789
1790
  let percent = false;
@@ -14022,7 +14023,9 @@ function decodeEntities(text) {
14022
14023
  }
14023
14024
  function parseAttributes(text) {
14024
14025
  const attrs = /* @__PURE__ */ new Map();
14025
- for (const m of text.matchAll(/([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g))
14026
+ for (const m of text.matchAll(
14027
+ /([\w:-]{1,64})\s{0,16}=\s{0,16}(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g
14028
+ ))
14026
14029
  attrs.set((m[1] ?? "").toLowerCase(), decodeEntities(m[2] ?? m[3] ?? m[4] ?? ""));
14027
14030
  return attrs;
14028
14031
  }
@@ -14077,12 +14080,41 @@ function stylePatchFromCss(css, inner2) {
14077
14080
  if (numFmt) patch.numFmt = decodeNumberFormat(numFmt);
14078
14081
  return patch;
14079
14082
  }
14083
+ function removeComments(text) {
14084
+ let out = "";
14085
+ let from = 0;
14086
+ for (; ; ) {
14087
+ const open = text.indexOf("<!--", from);
14088
+ const close = open < 0 ? -1 : text.indexOf("-->", open + 4);
14089
+ if (close < 0) return out + text.slice(from);
14090
+ out += text.slice(from, open);
14091
+ from = close + 3;
14092
+ }
14093
+ }
14094
+ function removeTags(text) {
14095
+ let out = "";
14096
+ let i = 0;
14097
+ while (i < text.length) {
14098
+ const ch = text[i];
14099
+ if (ch === "<") {
14100
+ let j = i + 1;
14101
+ while (j < text.length && text[j] !== "<" && text[j] !== ">") j++;
14102
+ if (text[j] === ">") {
14103
+ i = j + 1;
14104
+ continue;
14105
+ }
14106
+ }
14107
+ out += ch;
14108
+ i++;
14109
+ }
14110
+ return out;
14111
+ }
14080
14112
  function stripTags(markup) {
14081
14113
  let previous;
14082
14114
  let text = markup;
14083
14115
  do {
14084
14116
  previous = text;
14085
- text = text.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^<>]*>/g, "");
14117
+ text = removeTags(removeComments(text));
14086
14118
  } while (text !== previous);
14087
14119
  return removeAll(text, ["<!--", "-->"]);
14088
14120
  }
@@ -14277,7 +14309,15 @@ function linearTrend(values2) {
14277
14309
  const slope = den ? num2 / den : 0;
14278
14310
  return (k) => Number((meanY + slope * (k - meanX)).toPrecision(15));
14279
14311
  }
14280
- var TEXT_NUMBER = /^(.*?)(\d+)(\D*)$/;
14312
+ var isDigit3 = (ch) => ch !== void 0 && ch >= "0" && ch <= "9";
14313
+ function matchTextNumber(text) {
14314
+ let end = text.length;
14315
+ while (end > 0 && !isDigit3(text[end - 1])) end--;
14316
+ if (end === 0) return null;
14317
+ let start = end;
14318
+ while (start > 0 && isDigit3(text[start - 1])) start--;
14319
+ return [text, text.slice(0, start), text.slice(start, end), text.slice(end)];
14320
+ }
14281
14321
  var QUARTER = /^(q|qtr|quarter)(\s?)([1-4])$/i;
14282
14322
  function textSeries(texts) {
14283
14323
  const lists = texts.map(listMatch);
@@ -14299,7 +14339,7 @@ function textSeries(texts) {
14299
14339
  const step = q1 ? mod(Number(q1[3]) - 1 - start, 4) || 1 : 1;
14300
14340
  return (k) => ({ kind: "value", value: `${q0[1]}${q0[2]}${mod(start + step * k, 4) + 1}` });
14301
14341
  }
14302
- const parts = texts.map((t) => TEXT_NUMBER.exec(t));
14342
+ const parts = texts.map(matchTextNumber);
14303
14343
  const p0 = parts[0];
14304
14344
  if (!p0 || !parts.every((p) => p && p[1] === p0[1] && p[3] === p0[3])) return void 0;
14305
14345
  const numbers3 = parts.map((p) => Number(p?.[2]));
@@ -27604,7 +27644,7 @@ var SheetSelections = class {
27604
27644
  };
27605
27645
  var isWholeRows2 = (range2) => range2.start.col === 0 && range2.end.col === MAX_COL;
27606
27646
  var isWholeCols = (range2) => range2.start.row === 0 && range2.end.row === MAX_ROW;
27607
- var columnPart = (address2) => formatAddress(address2).replace(/\d+$/u, "");
27647
+ var columnPart = (address2) => formatAddress(address2).replace(/\d{1,10}$/u, "");
27608
27648
  function rangeRef(range2) {
27609
27649
  if (isWholeRows2(range2) && isWholeCols(range2)) return `1:${MAX_ROW + 1}`;
27610
27650
  if (isWholeRows2(range2)) return `${range2.start.row + 1}:${range2.end.row + 1}`;
@@ -1 +1 @@
1
- {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../xlsx/ui/selection.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAQN,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAK9E;AAID,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,SAA+B,GAAG,cAAc,CA+B7F;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAE7D,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAEjE;IAED,oFAAoF;IACpF,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAMhE;CACD;AAED,eAAO,MAAM,WAAW,UAAW,SAAS,KAAG,OACI,CAAC;AACpD,eAAO,MAAM,WAAW,UAAW,SAAS,KAAG,OACI,CAAC;AAGpD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAKjD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEzD;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,QAAQ,GACjB;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAA;CAAE,GAAG,SAAS,CAuBrD"}
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../xlsx/ui/selection.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAQN,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9D,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAK9E;AAID,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,SAA+B,GAAG,cAAc,CA+B7F;AAED;;;GAGG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAE7D,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAEjE;IAED,oFAAoF;IACpF,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAMhE;CACD;AAED,eAAO,MAAM,WAAW,UAAW,SAAS,KAAG,OACI,CAAC;AACpD,eAAO,MAAM,WAAW,UAAW,SAAS,KAAG,OACI,CAAC;AAIpD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAKjD;AAED,sEAAsE;AACtE,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEzD;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,QAAQ,GACjB;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAA;CAAE,GAAG,SAAS,CAuBrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../../xlsx/write/drawing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA8B,aAAa,EAAe,MAAM,aAAa,CAAC;AAI1F,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG1E,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAsFD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAa,SAAS,aAAa,EAAE,KAAG,OAAO,EAK3E,CAAC;AAEH;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAwET"}
1
+ {"version":3,"file":"drawing.d.ts","sourceRoot":"","sources":["../../../xlsx/write/drawing.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAA8B,aAAa,EAAe,MAAM,aAAa,CAAC;AAI1F,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAG1E,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAsFD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAa,SAAS,aAAa,EAAE,KAAG,OAAO,EAK3E,CAAC;AAEH;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,aAAa,EAAE,EACjC,aAAa,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CA2ET"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-core",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "Shared OOXML logic for the Word, PowerPoint and Excel viewers: everything except the UI",
5
5
  "keywords": [
6
6
  "charts",