@cj-tech-master/excelts 9.5.7 → 9.5.8

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v9.5.7
2
+ * @cj-tech-master/excelts v9.5.8
3
3
  * Zero-dependency TypeScript toolkit — Excel (XLSX), PDF, CSV, Markdown, XML, ZIP/TAR, and streaming.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
@@ -12000,7 +12000,7 @@ var ExcelTS = (function(exports) {
12000
12000
  for (let i = 280; i <= 287; i++) t[i] = 8;
12001
12001
  return t;
12002
12002
  })();
12003
- FIXED_DISTANCE_LENGTHS = new Uint8Array(32).fill(5);
12003
+ FIXED_DISTANCE_LENGTHS = /* @__PURE__ */ (() => new Uint8Array(32).fill(5))();
12004
12004
  LENGTH_BASE = [
12005
12005
  3,
12006
12006
  4,
@@ -12965,7 +12965,7 @@ var ExcelTS = (function(exports) {
12965
12965
  const ctime = extra?.ctime ?? modTime;
12966
12966
  const btime = extra?.birthTime ?? modTime;
12967
12967
  const dataSize = 40;
12968
- const out = new Uint8Array(4 + dataSize);
12968
+ const out = new Uint8Array(44);
12969
12969
  const view = new DataView(out.buffer);
12970
12970
  view.setUint16(0, 10, true);
12971
12971
  view.setUint16(2, dataSize, true);
@@ -21457,7 +21457,12 @@ onmessage = async (ev) => {
21457
21457
  const state = raw || "visible";
21458
21458
  return VALID_STATES.has(state) ? state : "visible";
21459
21459
  }
21460
- var VALID_STATES, WorksheetXform;
21460
+ function parseSheetId(raw) {
21461
+ if (raw === void 0) return;
21462
+ const id = parseInt(raw, 10);
21463
+ return Number.isInteger(id) && id > 0 ? id : void 0;
21464
+ }
21465
+ var VALID_STATES, RELATIONSHIPS_NS, WorksheetXform;
21461
21466
  var init_sheet_xform = __esmMin((() => {
21462
21467
  init_base_xform();
21463
21468
  VALID_STATES = new Set([
@@ -21465,7 +21470,12 @@ onmessage = async (ev) => {
21465
21470
  "hidden",
21466
21471
  "veryHidden"
21467
21472
  ]);
21473
+ RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
21468
21474
  WorksheetXform = class extends BaseXform {
21475
+ constructor(..._args) {
21476
+ super(..._args);
21477
+ this.relationshipsPrefixes = ["r"];
21478
+ }
21469
21479
  render(xmlStream, model) {
21470
21480
  xmlStream.leafNode("sheet", {
21471
21481
  name: model.name,
@@ -21478,14 +21488,33 @@ onmessage = async (ev) => {
21478
21488
  if (node.name === "sheet") {
21479
21489
  this.model = {
21480
21490
  name: node.attributes.name,
21481
- id: parseInt(node.attributes.sheetId, 10),
21491
+ id: parseSheetId(node.attributes.sheetId),
21482
21492
  state: parseWorksheetState(node.attributes.state),
21483
- rId: node.attributes["r:id"]
21493
+ rId: this._extractRelId(node)
21484
21494
  };
21485
21495
  return true;
21486
21496
  }
21487
21497
  return false;
21488
21498
  }
21499
+ /**
21500
+ * Locate the relationship id on a `<sheet>` element. Tries every
21501
+ * prefix the workbook root bound to the relationships namespace,
21502
+ * then any prefix the `<sheet>` element itself rebinds locally.
21503
+ * Returns `undefined` if no relationship id is present — callers
21504
+ * (the workbook reconciler) will treat such a `<sheet>` as a
21505
+ * half-broken declaration that can't be bound to a worksheet part.
21506
+ */
21507
+ _extractRelId(node) {
21508
+ const attrs = node.attributes ?? {};
21509
+ for (const prefix of this.relationshipsPrefixes) {
21510
+ const value = attrs[`${prefix}:id`];
21511
+ if (value !== void 0) return value;
21512
+ }
21513
+ for (const attrName of Object.keys(attrs)) if (attrName.startsWith("xmlns:") && attrs[attrName] === RELATIONSHIPS_NS) {
21514
+ const candidate = attrs[`${attrName.slice(6)}:id`];
21515
+ if (candidate !== void 0) return candidate;
21516
+ }
21517
+ }
21489
21518
  parseText() {}
21490
21519
  parseClose() {
21491
21520
  return false;
@@ -21800,6 +21829,7 @@ onmessage = async (ev) => {
21800
21829
  var WorkbookXform;
21801
21830
  var init_workbook_xform = __esmMin((() => {
21802
21831
  init_col_cache();
21832
+ init_ooxml_paths();
21803
21833
  init_base_xform();
21804
21834
  init_defined_name_xform();
21805
21835
  init_external_reference_xform();
@@ -21815,6 +21845,7 @@ onmessage = async (ev) => {
21815
21845
  WorkbookXform = class WorkbookXform extends BaseXform {
21816
21846
  constructor() {
21817
21847
  super();
21848
+ this._sheetXform = new WorksheetXform();
21818
21849
  this.map = {
21819
21850
  fileVersion: WorkbookXform.STATIC_XFORMS.fileVersion,
21820
21851
  workbookPr: new WorkbookPropertiesXform(),
@@ -21827,7 +21858,7 @@ onmessage = async (ev) => {
21827
21858
  sheets: new ListXform({
21828
21859
  tag: "sheets",
21829
21860
  count: false,
21830
- childXform: new WorksheetXform()
21861
+ childXform: this._sheetXform
21831
21862
  }),
21832
21863
  definedNames: new ListXform({
21833
21864
  tag: "definedNames",
@@ -21937,13 +21968,22 @@ onmessage = async (ev) => {
21937
21968
  return true;
21938
21969
  }
21939
21970
  switch (node.name) {
21940
- case "workbook": return true;
21971
+ case "workbook":
21972
+ this._sheetXform.relationshipsPrefixes = WorkbookXform._findRelationshipsPrefixes(node);
21973
+ return true;
21941
21974
  default:
21942
21975
  this.parser = this.map[node.name];
21943
21976
  if (this.parser) this.parser.parseOpen(node);
21944
21977
  return true;
21945
21978
  }
21946
21979
  }
21980
+ static _findRelationshipsPrefixes(node) {
21981
+ const RELATIONSHIPS_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
21982
+ const attrs = node.attributes ?? {};
21983
+ const prefixes = [];
21984
+ for (const attrName of Object.keys(attrs)) if (attrName.startsWith("xmlns:") && attrs[attrName] === RELATIONSHIPS_NS) prefixes.push(attrName.slice(6));
21985
+ return prefixes.length > 0 ? prefixes : ["r"];
21986
+ }
21947
21987
  parseText(text) {
21948
21988
  if (this.parser) this.parser.parseText(text);
21949
21989
  }
@@ -21983,7 +22023,7 @@ onmessage = async (ev) => {
21983
22023
  sheetPosition += 1;
21984
22024
  return;
21985
22025
  }
21986
- const target = `xl/${rel.Target.replace(/^(\s|\/xl\/)+/, "")}`;
22026
+ const target = resolveRelTarget$1("xl", rel.Target);
21987
22027
  const chartsheetMatch = /xl\/chartsheets\/sheet(\d+)\.xml/.exec(target);
21988
22028
  if (chartsheetMatch) {
21989
22029
  const csNo = parseInt(chartsheetMatch[1], 10);
@@ -22010,6 +22050,7 @@ onmessage = async (ev) => {
22010
22050
  sheetPosition += 1;
22011
22051
  });
22012
22052
  model.chartsheetsList = chartsheetsList;
22053
+ if (Array.isArray(model.worksheets)) model.worksheets = model.worksheets.filter((ws) => ws && Number.isInteger(ws.id) && ws.id > 0);
22013
22054
  const definedNames = [];
22014
22055
  if (model.definedNames) model.definedNames.forEach((definedName) => {
22015
22056
  const effectiveRanges = definedName.ranges?.length > 0 ? definedName.ranges : definedName.rawText ? [definedName.rawText] : [];
@@ -25899,7 +25940,6 @@ self.onmessage = async function(event) {
25899
25940
  var WRITE_AFTER_END_ERROR, AsyncStreamCodec, BufferedCodec;
25900
25941
  var init_streaming_compress_browser = __esmMin((() => {
25901
25942
  init_compress_base();
25902
- init_compress_browser();
25903
25943
  init_deflate_fallback();
25904
25944
  init_index_browser();
25905
25945
  init_defaults();
@@ -42908,7 +42948,7 @@ self.onmessage = async function(event) {
42908
42948
  comment
42909
42949
  };
42910
42950
  }
42911
- var MAX_SAFE, EOCD_MAX_COMMENT_SIZE;
42951
+ var MAX_SAFE;
42912
42952
  var init_zip_parser_core = __esmMin((() => {
42913
42953
  init_text();
42914
42954
  init_binary();
@@ -42917,8 +42957,6 @@ self.onmessage = async function(event) {
42917
42957
  init_binary$1();
42918
42958
  init_zip_records();
42919
42959
  MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
42920
- EOCD_MAX_COMMENT_SIZE = 65535;
42921
- 22 + EOCD_MAX_COMMENT_SIZE;
42922
42960
  }));
42923
42961
  //#endregion
42924
42962
  //#region src/modules/archive/unzip/zip-extract-core.ts
@@ -58377,6 +58415,7 @@ self.onmessage = async function(event) {
58377
58415
  this._tableNames.clear();
58378
58416
  value.worksheets.forEach((worksheetModel) => {
58379
58417
  const { id, name, state } = worksheetModel;
58418
+ if (!Number.isInteger(id) || id <= 0) return;
58380
58419
  const orderNo = value.sheets && value.sheets.findIndex((ws) => ws.id === id);
58381
58420
  const worksheet = this._worksheets[id] = new Worksheet({
58382
58421
  id,
@@ -61970,32 +62009,32 @@ self.onmessage = async function(event) {
61970
62009
  p.M(0, 250 - g);
61971
62010
  p.L(300, 250 - g);
61972
62011
  p.stroke();
61973
- p.M(0, 250 + g);
61974
- p.L(300, 250 + g);
62012
+ p.M(0, 280);
62013
+ p.L(300, 280);
61975
62014
  p.stroke();
61976
62015
  }
61977
62016
  if (rightD) {
61978
62017
  p.M(300, 250 - g);
61979
62018
  p.L(600, 250 - g);
61980
62019
  p.stroke();
61981
- p.M(300, 250 + g);
61982
- p.L(600, 250 + g);
62020
+ p.M(300, 280);
62021
+ p.L(600, 280);
61983
62022
  p.stroke();
61984
62023
  }
61985
62024
  if (upD) {
61986
62025
  p.M(300 - g, 250);
61987
62026
  p.L(300 - g, 500);
61988
62027
  p.stroke();
61989
- p.M(300 + g, 250);
61990
- p.L(300 + g, 500);
62028
+ p.M(330, 250);
62029
+ p.L(330, 500);
61991
62030
  p.stroke();
61992
62031
  }
61993
62032
  if (downD) {
61994
62033
  p.M(300 - g, 250);
61995
62034
  p.L(300 - g, 0);
61996
62035
  p.stroke();
61997
- p.M(300 + g, 250);
61998
- p.L(300 + g, 0);
62036
+ p.M(330, 250);
62037
+ p.L(330, 0);
61999
62038
  p.stroke();
62000
62039
  }
62001
62040
  }
@@ -62146,11 +62185,11 @@ self.onmessage = async function(event) {
62146
62185
  } else if (value === 1e3) {
62147
62186
  romanI(p, 100, bot, top);
62148
62187
  p.M(100, top);
62149
- p.L(230, bot + 200);
62188
+ p.L(230, 200);
62150
62189
  p.L(300, top);
62151
62190
  p.stroke();
62152
62191
  p.M(300, top);
62153
- p.L(370, bot + 200);
62192
+ p.L(370, 200);
62154
62193
  p.L(500, top);
62155
62194
  p.stroke();
62156
62195
  romanI(p, 500, bot, top);
@@ -62213,11 +62252,11 @@ self.onmessage = async function(event) {
62213
62252
  } else if (value === 1e3) {
62214
62253
  romanI(p, 100, bot, top);
62215
62254
  p.M(100, top);
62216
- p.L(230, bot + 140);
62255
+ p.L(230, 140);
62217
62256
  p.L(300, top);
62218
62257
  p.stroke();
62219
62258
  p.M(300, top);
62220
- p.L(370, bot + 140);
62259
+ p.L(370, 140);
62221
62260
  p.L(500, top);
62222
62261
  p.stroke();
62223
62262
  romanI(p, 500, bot, top);
@@ -64794,8 +64833,8 @@ self.onmessage = async function(event) {
64794
64833
  SQ_Y = 50;
64795
64834
  SQ_W = 400;
64796
64835
  SQ_H = 400;
64797
- SQ_R = SQ_X + SQ_W;
64798
- SQ_T = SQ_Y + SQ_H;
64836
+ SQ_R = 500;
64837
+ SQ_T = 450;
64799
64838
  GEOMETRIC_EXT = {
64800
64839
  [9639]: {
64801
64840
  width: W$4,
@@ -64973,7 +65012,7 @@ self.onmessage = async function(event) {
64973
65012
  p.lineWidth(35);
64974
65013
  p.rect(SQ_X, SQ_Y, SQ_W, SQ_H);
64975
65014
  p.stroke();
64976
- p.rect(SQ_X + SQ_W / 2, SQ_Y, SQ_W / 2, SQ_H);
65015
+ p.rect(300, SQ_Y, SQ_W / 2, SQ_H);
64977
65016
  p.fill();
64978
65017
  }
64979
65018
  },
@@ -65065,7 +65104,7 @@ self.onmessage = async function(event) {
65065
65104
  p.lineWidth(35);
65066
65105
  p.rect(SQ_X, SQ_Y, SQ_W, SQ_H);
65067
65106
  p.stroke();
65068
- p.rect(SQ_X, SQ_Y + SQ_H / 2, SQ_W / 2, SQ_H / 2);
65107
+ p.rect(SQ_X, 250, SQ_W / 2, SQ_H / 2);
65069
65108
  p.fill();
65070
65109
  }
65071
65110
  },
@@ -65085,7 +65124,7 @@ self.onmessage = async function(event) {
65085
65124
  p.lineWidth(35);
65086
65125
  p.rect(SQ_X, SQ_Y, SQ_W, SQ_H);
65087
65126
  p.stroke();
65088
- p.rect(SQ_X + SQ_W / 2, SQ_Y, SQ_W / 2, SQ_H / 2);
65127
+ p.rect(300, SQ_Y, SQ_W / 2, SQ_H / 2);
65089
65128
  p.fill();
65090
65129
  }
65091
65130
  },
@@ -65095,7 +65134,7 @@ self.onmessage = async function(event) {
65095
65134
  p.lineWidth(35);
65096
65135
  p.rect(SQ_X, SQ_Y, SQ_W, SQ_H);
65097
65136
  p.stroke();
65098
- p.rect(SQ_X + SQ_W / 2, SQ_Y + SQ_H / 2, SQ_W / 2, SQ_H / 2);
65137
+ p.rect(300, 250, SQ_W / 2, SQ_H / 2);
65099
65138
  p.fill();
65100
65139
  }
65101
65140
  },
@@ -90626,9 +90665,7 @@ self.onmessage = async function(event) {
90626
90665
  };
90627
90666
  }
90628
90667
  var PAPER_SIZE_MAP;
90629
- //#endregion
90630
- //#region src/modules/pdf/pdf.ts
90631
- __esmMin((() => {
90668
+ var init_pdf_exporter = __esmMin((() => {
90632
90669
  init_utils_base();
90633
90670
  init_image_utils();
90634
90671
  init_encryption();
@@ -90652,7 +90689,10 @@ self.onmessage = async function(event) {
90652
90689
  11: PageSizes.A5,
90653
90690
  17: PageSizes.TABLOID
90654
90691
  };
90655
- }))();
90692
+ }));
90693
+ //#endregion
90694
+ //#region src/modules/pdf/pdf.ts
90695
+ init_pdf_exporter();
90656
90696
  init_types();
90657
90697
  /**
90658
90698
  * Generate a PDF.
@@ -91597,6 +91637,18 @@ self.onmessage = async function(event) {
91597
91637
  };
91598
91638
  }
91599
91639
  var CHARTSHEET_RASTER_PX;
91640
+ var init_excel_bridge = __esmMin((() => {
91641
+ init_chart_host_registry();
91642
+ init_cell_format();
91643
+ init_host_registry();
91644
+ init_utils_base();
91645
+ init_pdf_exporter();
91646
+ init_types();
91647
+ CHARTSHEET_RASTER_PX = {
91648
+ width: 1280,
91649
+ height: 720
91650
+ };
91651
+ }));
91600
91652
  //#endregion
91601
91653
  //#region src/index.browser.ts
91602
91654
  init_worksheet();
@@ -91625,6 +91677,7 @@ self.onmessage = async function(event) {
91625
91677
  init_datetime();
91626
91678
  init_errors$7();
91627
91679
  init_binary$1();
91680
+ init_excel_bridge(), init_types(), init_errors();
91628
91681
  init_errors$4();
91629
91682
  init_errors$1();
91630
91683
  //#endregion