visio-react-viewer 0.2.0 → 0.3.0

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.
@@ -49653,17 +49653,17 @@ function safePath(path, directory = false) {
49653
49653
  return path;
49654
49654
  }
49655
49655
  function inspectZip(bytes, limits, check) {
49656
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
49657
- const bounds = (start, length) => {
49656
+ const view2 = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
49657
+ const bounds2 = (start, length) => {
49658
49658
  if (start < 0 || length < 0 || start + length > bytes.length) fail("INVALID_ZIP", "Truncated ZIP record");
49659
49659
  };
49660
49660
  const u16 = (offset2) => {
49661
- bounds(offset2, 2);
49662
- return view.getUint16(offset2, true);
49661
+ bounds2(offset2, 2);
49662
+ return view2.getUint16(offset2, true);
49663
49663
  };
49664
49664
  const u32 = (offset2) => {
49665
- bounds(offset2, 4);
49666
- return view.getUint32(offset2, true);
49665
+ bounds2(offset2, 4);
49666
+ return view2.getUint32(offset2, true);
49667
49667
  };
49668
49668
  let end = -1;
49669
49669
  for (let i = bytes.length - 22; i >= Math.max(0, bytes.length - 65557); i--) if (u32(i) === 101010256 && i + 22 + u16(i + 20) === bytes.length) {
@@ -49692,7 +49692,7 @@ function inspectZip(bytes, limits, check) {
49692
49692
  };
49693
49693
  for (let i = 0; i < count; i++) {
49694
49694
  check();
49695
- bounds(offset, 46);
49695
+ bounds2(offset, 46);
49696
49696
  if (u32(offset) !== 33639248) fail("INVALID_ZIP", "Invalid central directory entry");
49697
49697
  const flags = u16(offset + 8), method = u16(offset + 10), crc = u32(offset + 16);
49698
49698
  const compressed = u32(offset + 20), size = u32(offset + 24);
@@ -49700,7 +49700,7 @@ function inspectZip(bytes, limits, check) {
49700
49700
  const local = u32(offset + 42);
49701
49701
  if (flags & -2063 || method !== 0 && method !== 8 || u16(offset + 34)) fail("UNSUPPORTED_ZIP", "Encrypted, multidisk, or unsupported ZIP entry");
49702
49702
  if (compressed === 4294967295 || size === 4294967295 || local === 4294967295) fail("UNSUPPORTED_ZIP", "ZIP64 entries are unsupported");
49703
- bounds(offset + 46, nameLength + extraLength + commentLength);
49703
+ bounds2(offset + 46, nameLength + extraLength + commentLength);
49704
49704
  const name = utf8.decode(bytes.subarray(offset + 46, offset + 46 + nameLength));
49705
49705
  const directory = name.endsWith("/");
49706
49706
  safePath(name, directory);
@@ -49713,10 +49713,10 @@ function inspectZip(bytes, limits, check) {
49713
49713
  if (total > limits.maxTotalBytes) fail("LIMIT_TOTAL", "Inflated ZIP total exceeds limit");
49714
49714
  if (size > Math.max(1, compressed) * limits.maxCompressionRatio) fail("LIMIT_RATIO", `ZIP compression ratio exceeds limit: ${name}`);
49715
49715
  if (method === 0 && compressed !== size || directory && (compressed || size)) fail("ZIP_MISMATCH", "Invalid stored entry size");
49716
- bounds(local, 30);
49716
+ bounds2(local, 30);
49717
49717
  if (u32(local) !== 67324752 || u16(local + 6) !== flags || u16(local + 8) !== method || u16(local + 26) !== nameLength) fail("ZIP_MISMATCH", "Local and central ZIP headers differ");
49718
49718
  const localExtra = u16(local + 28), dataStart = local + 30 + nameLength + localExtra;
49719
- bounds(local + 30, nameLength + localExtra);
49719
+ bounds2(local + 30, nameLength + localExtra);
49720
49720
  if (!bytes.subarray(local + 30, local + 30 + nameLength).every((byte, index) => byte === bytes[offset + 46 + index])) fail("ZIP_MISMATCH", "Local and central ZIP filenames differ");
49721
49721
  extras(local + 30 + nameLength, localExtra, name);
49722
49722
  for (const [relative, expected] of [
@@ -49728,7 +49728,7 @@ function inspectZip(bytes, limits, check) {
49728
49728
  if (actual !== expected && (!(flags & 8) || actual !== 0)) fail("ZIP_MISMATCH", "Local and central ZIP sizes or CRC differ");
49729
49729
  }
49730
49730
  let dataEnd = dataStart + compressed;
49731
- bounds(dataStart, compressed);
49731
+ bounds2(dataStart, compressed);
49732
49732
  if (flags & 8) {
49733
49733
  if (u32(dataEnd) === 134695760) dataEnd += 4;
49734
49734
  if (u32(dataEnd) !== crc || u32(dataEnd + 4) !== compressed || u32(dataEnd + 8) !== size) fail("ZIP_MISMATCH", "Invalid ZIP data descriptor");
@@ -50013,7 +50013,7 @@ var VisioPackage = class _VisioPackage {
50013
50013
  async loadBytes(path) {
50014
50014
  const entry = this.entries.get(path), file = this.zip.file(path);
50015
50015
  if (!entry || entry.directory || !file) return fail("MISSING_PART", `Missing package part: ${path}`);
50016
- return new Promise((resolve, reject) => {
50016
+ return new Promise((resolve, reject2) => {
50017
50017
  const stream = file.internalStream("uint8array");
50018
50018
  let chunks = [], size = 0, crc = 4294967295, settled = false;
50019
50019
  const abort = (error) => {
@@ -50022,7 +50022,7 @@ var VisioPackage = class _VisioPackage {
50022
50022
  stream.pause();
50023
50023
  chunks = [];
50024
50024
  clearTimeout(timer);
50025
- reject(error instanceof VisioPackageError ? error : new VisioPackageError("INVALID_ZIP", `Cannot inflate ${path}: ${String(error)}`));
50025
+ reject2(error instanceof VisioPackageError ? error : new VisioPackageError("INVALID_ZIP", `Cannot inflate ${path}: ${String(error)}`));
50026
50026
  };
50027
50027
  const timer = setTimeout(() => abort(new VisioPackageError("LIMIT_RUNTIME", "Visio package processing deadline exceeded")), Math.max(1, this.deadline - Date.now()));
50028
50028
  stream.on("data", (chunk) => {
@@ -50379,7 +50379,7 @@ function emfInputOptions(options) {
50379
50379
  try {
50380
50380
  const prototype = Object.getPrototypeOf(options);
50381
50381
  if (prototype !== null && prototype !== Object.prototype) return null;
50382
- const snapshot = {};
50382
+ const snapshot2 = {};
50383
50383
  for (const key2 of Object.keys(VISIO_EMF_ADMISSION_LIMITS)) {
50384
50384
  const descriptor = Object.getOwnPropertyDescriptor(options, key2);
50385
50385
  if (!descriptor) continue;
@@ -50387,16 +50387,16 @@ function emfInputOptions(options) {
50387
50387
  const value = descriptor.value;
50388
50388
  if (value === void 0) continue;
50389
50389
  if (typeof value !== "number") return null;
50390
- snapshot[key2] = value;
50390
+ snapshot2[key2] = value;
50391
50391
  }
50392
- return snapshot;
50392
+ return snapshot2;
50393
50393
  } catch {
50394
50394
  return null;
50395
50395
  }
50396
50396
  }
50397
50397
  var EmfAdmissionContext = class {
50398
- constructor(view, options) {
50399
- this.view = view;
50398
+ constructor(view2, options) {
50399
+ this.view = view2;
50400
50400
  this.limits = { ...VISIO_EMF_ADMISSION_LIMITS };
50401
50401
  if (!options || typeof options !== "object") {
50402
50402
  this.emit("invalid", "limits", "Expected an options object.");
@@ -50469,7 +50469,7 @@ var EmfAdmissionContext = class {
50469
50469
  i16(at) {
50470
50470
  return this.view.getInt16(this.offset + at, true);
50471
50471
  }
50472
- emit(kind, code, message, limit2) {
50472
+ emit(kind, code, message, limit3) {
50473
50473
  if (kind === "invalid") this.invalid = true;
50474
50474
  if (kind === "unsupported") this.unsupported = true;
50475
50475
  if (kind === "budget-exceeded") this.budgetExceeded = true;
@@ -50479,7 +50479,7 @@ var EmfAdmissionContext = class {
50479
50479
  offset: this.offset,
50480
50480
  recordType: this.type,
50481
50481
  message,
50482
- ...limit2 === void 0 ? {} : { limit: limit2 }
50482
+ ...limit3 === void 0 ? {} : { limit: limit3 }
50483
50483
  });
50484
50484
  else this.omittedDiagnostics++;
50485
50485
  }
@@ -50487,9 +50487,9 @@ var EmfAdmissionContext = class {
50487
50487
  this.metrics.allocationUnits += units2;
50488
50488
  return this.bound(this.metrics.allocationUnits, this.limits.maxAllocationUnits, "allocation-limit", "Aggregate abstract allocation/work budget exceeded.");
50489
50489
  }
50490
- bound(value, limit2, code, message) {
50491
- if (Number.isFinite(value) && Math.abs(value) <= limit2) return true;
50492
- this.emit("budget-exceeded", code, message, limit2);
50490
+ bound(value, limit3, code, message) {
50491
+ if (Number.isFinite(value) && Math.abs(value) <= limit3) return true;
50492
+ this.emit("budget-exceeded", code, message, limit3);
50493
50493
  return false;
50494
50494
  }
50495
50495
  coordinate(value) {
@@ -50799,38 +50799,38 @@ function inspectEmfObjectRecord(c) {
50799
50799
  return true;
50800
50800
  }
50801
50801
  function inspectVisioEmfAdmission(input, options = {}) {
50802
- const snapshot = emfInputOptions(options);
50803
- const view = snapshot === null ? null : emfInputView(input);
50804
- const c = new EmfAdmissionContext(view ?? /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(0)), snapshot ?? {});
50805
- if (snapshot === null) {
50802
+ const snapshot2 = emfInputOptions(options);
50803
+ const view2 = snapshot2 === null ? null : emfInputView(input);
50804
+ const c = new EmfAdmissionContext(view2 ?? /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(0)), snapshot2 ?? {});
50805
+ if (snapshot2 === null) {
50806
50806
  c.emit("invalid", "limits", "Options must contain only plain own numeric data properties.");
50807
50807
  return c.result();
50808
50808
  }
50809
50809
  if (c.invalid) return c.result();
50810
- if (view === null) {
50810
+ if (view2 === null) {
50811
50811
  c.emit("invalid", "input", "Expected a Uint8Array backed by an unshared, fixed, attached ArrayBuffer.");
50812
50812
  return c.result();
50813
50813
  }
50814
- if (!c.bound(view.byteLength, c.limits.maxInputBytes, "allocation-limit", "Encoded input exceeds byte budget.")) return c.result();
50815
- if (view.byteLength < 88 || view.byteLength % 4 !== 0) {
50814
+ if (!c.bound(view2.byteLength, c.limits.maxInputBytes, "allocation-limit", "Encoded input exceeds byte budget.")) return c.result();
50815
+ if (view2.byteLength < 88 || view2.byteLength % 4 !== 0) {
50816
50816
  c.emit("invalid", "header", "Input must contain an aligned complete EMF header.");
50817
50817
  return c.result();
50818
50818
  }
50819
50819
  const headerSize = c.u32(4);
50820
50820
  if (!inspectHeader(c, headerSize)) return c.result();
50821
50821
  let eof = false;
50822
- while (c.offset < view.byteLength && !c.budgetExceeded) {
50822
+ while (c.offset < view2.byteLength && !c.budgetExceeded) {
50823
50823
  if (++c.metrics.records > c.limits.maxRecords) {
50824
50824
  c.emit("budget-exceeded", "record-limit", "Aggregate record budget exceeded.", c.limits.maxRecords);
50825
50825
  break;
50826
50826
  }
50827
- if (view.byteLength - c.offset < 8) {
50827
+ if (view2.byteLength - c.offset < 8) {
50828
50828
  c.emit("invalid", "record-size", "Truncated record header.");
50829
50829
  break;
50830
50830
  }
50831
50831
  c.type = c.u32(0);
50832
50832
  const size = c.u32(4);
50833
- if (size < 8 || size % 4 || size > view.byteLength - c.offset) {
50833
+ if (size < 8 || size % 4 || size > view2.byteLength - c.offset) {
50834
50834
  c.emit("invalid", "record-size", "Record must progress, align, and fit entirely within input.");
50835
50835
  break;
50836
50836
  }
@@ -50849,7 +50849,7 @@ function inspectVisioEmfAdmission(input, options = {}) {
50849
50849
  } else if (c.type === 14) {
50850
50850
  inspectEof(c, size);
50851
50851
  eof = true;
50852
- if (c.offset + size !== view.byteLength) c.emit("invalid", "trailing-data", "Data follows EOF.");
50852
+ if (c.offset + size !== view2.byteLength) c.emit("invalid", "trailing-data", "Data follows EOF.");
50853
50853
  else c.scanComplete = true;
50854
50854
  break;
50855
50855
  } else if (c.type === 70) inspectEmfComment(c, size, headerSize);
@@ -50889,13 +50889,13 @@ function inspectHeader(c, size) {
50889
50889
  if ((size === 100 || size === 108) && (c.u32(88) || c.u32(92) || c.u32(96))) c.emit("unsupported", "header", "Pixel format and OpenGL header extensions are excluded.");
50890
50890
  c.rect(8, false);
50891
50891
  c.rect(24, false);
50892
- const bounds = [
50892
+ const bounds2 = [
50893
50893
  c.i32(8),
50894
50894
  c.i32(12),
50895
50895
  c.i32(16),
50896
50896
  c.i32(20)
50897
50897
  ];
50898
- const width = bounds[2] - bounds[0] + 1, height = bounds[3] - bounds[1] + 1;
50898
+ const width = bounds2[2] - bounds2[0] + 1, height = bounds2[3] - bounds2[1] + 1;
50899
50899
  if (width <= 0 || height <= 0) c.emit("invalid", "header", "Inclusive header bounds must be nonempty.");
50900
50900
  for (const offset of [
50901
50901
  72,
@@ -50912,7 +50912,7 @@ function inspectHeader(c, size) {
50912
50912
  c.bound(c.headerPaletteEntries, c.limits.maxPaletteEntries, "palette-limit", "Declared palette exceeds budget.");
50913
50913
  if (c.headerPaletteEntries) c.emit("unsupported", "palette", "Header/EOF palettes are outside this subset.");
50914
50914
  c.header = {
50915
- bounds,
50915
+ bounds: bounds2,
50916
50916
  pixelWidth: width,
50917
50917
  pixelHeight: height,
50918
50918
  declaredRecords: c.u32(52),
@@ -51431,7 +51431,7 @@ function sanitize(root, limits) {
51431
51431
  children: data2.children
51432
51432
  };
51433
51433
  }
51434
- function children2(value, optional = false) {
51434
+ function children3(value, optional = false) {
51435
51435
  if (value === void 0 && optional) return [];
51436
51436
  if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype) unsafe("Expected plain child array.");
51437
51437
  if (value.length > limits.maxNodes - nodes) limit("Child array node limit exceeded.");
@@ -51460,7 +51460,7 @@ function sanitize(root, limits) {
51460
51460
  return target;
51461
51461
  }
51462
51462
  function leaf(data2) {
51463
- if (children2(data2.children, true).length !== 0) unsafe("Path cannot contain child elements.");
51463
+ if (children3(data2.children, true).length !== 0) unsafe("Path cannot contain child elements.");
51464
51464
  return pathCommands(data2.attrs.d, limits, pathBudget);
51465
51465
  }
51466
51466
  function item(value, depth) {
@@ -51473,7 +51473,7 @@ function sanitize(root, limits) {
51473
51473
  paint: paint(data2.attrs)
51474
51474
  }) : Object.assign(target, {
51475
51475
  kind: "group",
51476
- items: Object.freeze(children2(data2.children).map((child2) => item(child2, depth + 1)))
51476
+ items: Object.freeze(children3(data2.children).map((child2) => item(child2, depth + 1)))
51477
51477
  });
51478
51478
  freezeLater.push(result);
51479
51479
  return result;
@@ -51488,7 +51488,7 @@ function sanitize(root, limits) {
51488
51488
  ids.set(id, clips.length);
51489
51489
  const target = base(data2.attrs);
51490
51490
  const paths = [];
51491
- for (const child2 of children2(data2.children)) {
51491
+ for (const child2 of children3(data2.children)) {
51492
51492
  const part = node(child2, depth + 1, true);
51493
51493
  if (part.tag !== "path") unsafe("Clip content must be a path.");
51494
51494
  const path = Object.assign(base(part.attrs), {
@@ -51510,13 +51510,13 @@ function sanitize(root, limits) {
51510
51510
  const viewBox = numberList(data.attrs.viewBox, 4, limits.maxDimension);
51511
51511
  if (viewBox[0] !== 0 || viewBox[1] !== 0 || viewBox[2] !== width || viewBox[3] !== height) unsafe("Viewport differs from dimensions.");
51512
51512
  const items = [];
51513
- for (const child2 of children2(data.children)) if (record(child2, [
51513
+ for (const child2 of children3(data.children)) if (record(child2, [
51514
51514
  "tag",
51515
51515
  "attrs",
51516
51516
  "children"
51517
51517
  ]).tag === "defs") {
51518
51518
  const defs = node(child2, 1);
51519
- for (const value of children2(defs.children)) definition(value, 2);
51519
+ for (const value of children3(defs.children)) definition(value, 2);
51520
51520
  } else items.push(item(child2, 1));
51521
51521
  for (const { target, id } of pending) {
51522
51522
  const index = ids.get(id);
@@ -51751,9 +51751,9 @@ function dimensions(width, height, limits) {
51751
51751
  }
51752
51752
  var ascii = (bytes, start, length) => String.fromCharCode(...bytes.subarray(start, start + length));
51753
51753
  function png(bytes, limits) {
51754
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51755
- if (bytes.length < 33 || view.getUint32(8) !== 13 || ascii(bytes, 12, 4) !== "IHDR") return invalid("PNG is missing a complete IHDR header.");
51756
- const width = view.getUint32(16), height = view.getUint32(20);
51754
+ const view2 = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51755
+ if (bytes.length < 33 || view2.getUint32(8) !== 13 || ascii(bytes, 12, 4) !== "IHDR") return invalid("PNG is missing a complete IHDR header.");
51756
+ const width = view2.getUint32(16), height = view2.getUint32(20);
51757
51757
  dimensions(width, height, limits);
51758
51758
  const depth = bytes[24];
51759
51759
  if (!{
@@ -51777,9 +51777,9 @@ function png(bytes, limits) {
51777
51777
  let data = false;
51778
51778
  for (let at = 8; at < bytes.length;) {
51779
51779
  if (at + 12 > bytes.length) invalid("Truncated PNG chunk.");
51780
- const length = view.getUint32(at), type = ascii(bytes, at + 4, 4), end = at + length + 12;
51780
+ const length = view2.getUint32(at), type = ascii(bytes, at + 4, 4), end = at + length + 12;
51781
51781
  if (end > bytes.length) invalid("Truncated PNG chunk payload.");
51782
- if ((crc32(bytes.subarray(at + 4, end - 4)) ^ 4294967295) >>> 0 !== view.getUint32(end - 4)) invalid("PNG chunk checksum mismatch.");
51782
+ if ((crc32(bytes.subarray(at + 4, end - 4)) ^ 4294967295) >>> 0 !== view2.getUint32(end - 4)) invalid("PNG chunk checksum mismatch.");
51783
51783
  if (type === "acTL") unsupported("Animated PNG is not supported.");
51784
51784
  if (type === "IHDR" && at !== 8) invalid("PNG contains multiple image headers.");
51785
51785
  if (type === "IDAT" && length) data = true;
@@ -51793,8 +51793,8 @@ function png(bytes, limits) {
51793
51793
  }
51794
51794
  function gif(bytes, limits) {
51795
51795
  if (bytes.length < 13) return invalid("GIF is missing a complete screen descriptor.");
51796
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51797
- const width = view.getUint16(6, true), height = view.getUint16(8, true);
51796
+ const view2 = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51797
+ const width = view2.getUint16(6, true), height = view2.getUint16(8, true);
51798
51798
  dimensions(width, height, limits);
51799
51799
  let at = 13 + (bytes[10] & 128 ? 3 * 2 ** ((bytes[10] & 7) + 1) : 0);
51800
51800
  let frames = 0, pixels = 0;
@@ -51820,8 +51820,8 @@ function gif(bytes, limits) {
51820
51820
  continue;
51821
51821
  }
51822
51822
  if (marker2 !== 44 || at + 9 > bytes.length) invalid("GIF has an invalid image descriptor.");
51823
- const left = view.getUint16(at, true), top = view.getUint16(at + 2, true);
51824
- const frameWidth = view.getUint16(at + 4, true), frameHeight = view.getUint16(at + 6, true);
51823
+ const left = view2.getUint16(at, true), top = view2.getUint16(at + 2, true);
51824
+ const frameWidth = view2.getUint16(at + 4, true), frameHeight = view2.getUint16(at + 6, true);
51825
51825
  dimensions(frameWidth, frameHeight, limits);
51826
51826
  if (left + frameWidth > width || top + frameHeight > height) invalid("GIF frame exceeds its screen.");
51827
51827
  pixels += width * height;
@@ -51836,7 +51836,7 @@ function gif(bytes, limits) {
51836
51836
  return invalid("GIF has no image terminator.");
51837
51837
  }
51838
51838
  function jpeg(bytes, limits) {
51839
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51839
+ const view2 = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
51840
51840
  let at = 2, width = 0, height = 0, scan = false;
51841
51841
  while (at < bytes.length) {
51842
51842
  if (bytes[at++] !== 255) invalid("JPEG has an invalid segment marker.");
@@ -51848,7 +51848,7 @@ function jpeg(bytes, limits) {
51848
51848
  }
51849
51849
  if (marker2 === void 0 || marker2 === 0 || marker2 === 216 || marker2 === 1 || marker2 >= 208 && marker2 <= 215) invalid("JPEG has an unexpected standalone marker.");
51850
51850
  if (at + 2 > bytes.length) invalid("JPEG has a truncated segment header.");
51851
- const length = view.getUint16(at), end = at + length;
51851
+ const length = view2.getUint16(at), end = at + length;
51852
51852
  if (length < 2 || end > bytes.length) invalid("JPEG has a truncated segment.");
51853
51853
  if (marker2 >= 192 && marker2 <= 207 && ![
51854
51854
  196,
@@ -51861,8 +51861,8 @@ function jpeg(bytes, limits) {
51861
51861
  194
51862
51862
  ].includes(marker2)) unsupported("This JPEG frame coding is unsupported.");
51863
51863
  if (width || length < 11 || bytes[at + 2] !== 8 || length !== 8 + 3 * bytes[at + 7]) invalid("JPEG has an invalid frame header.");
51864
- height = view.getUint16(at + 3);
51865
- width = view.getUint16(at + 5);
51864
+ height = view2.getUint16(at + 3);
51865
+ width = view2.getUint16(at + 5);
51866
51866
  dimensions(width, height, limits);
51867
51867
  }
51868
51868
  if (marker2 === 220) unsupported("JPEG deferred dimensions are unsupported.");
@@ -52141,17 +52141,17 @@ function themeLinearGradient(sheet, resources, width, height, report) {
52141
52141
  if (enabled && enabled.value !== "Themed" && number(cells3, "FillGradientEnabled", 0) !== 1) return void 0;
52142
52142
  const context = themePaintContext(cells3, "Fill", resources, report);
52143
52143
  if (!context || context.selected.localName !== "gradFill") return void 0;
52144
- const reject = () => {
52144
+ const reject2 = () => {
52145
52145
  report("unsupported-theme-gradient", "The theme gradient has unsupported settings or overrides; its base color is used.");
52146
52146
  };
52147
- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return reject();
52147
+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return reject2();
52148
52148
  if ([
52149
52149
  "FillGradientDir",
52150
52150
  "FillGradientAngle",
52151
52151
  "RotateGradientWithShape",
52152
52152
  "UseGroupGradient"
52153
- ].some((key2) => cells3.has(key2) && cells3.get(key2)?.value !== "Themed")) return reject();
52154
- if (sectionRows(sheet, "FillGradient").some((row) => [...row.cells.values()].some((cell) => cell.value !== "Themed"))) return reject();
52153
+ ].some((key2) => cells3.has(key2) && cells3.get(key2)?.value !== "Themed")) return reject2();
52154
+ if (sectionRows(sheet, "FillGradient").some((row) => [...row.cells.values()].some((cell) => cell.value !== "Themed"))) return reject2();
52155
52155
  const fill = context.selected;
52156
52156
  const lin = themeChild(fill, "lin");
52157
52157
  const rawAngle = lin?.getAttribute("ang") ?? "0";
@@ -52160,14 +52160,14 @@ function themeLinearGradient(sheet, resources, width, height, report) {
52160
52160
  "gsLst",
52161
52161
  "lin",
52162
52162
  "tileRect"
52163
- ].includes(node.localName)) || themeChildren(fill, "lin").length !== 1 || themeChildren(fill, "gsLst").length !== 1) return reject();
52163
+ ].includes(node.localName)) || themeChildren(fill, "lin").length !== 1 || themeChildren(fill, "gsLst").length !== 1) return reject2();
52164
52164
  const nodes = themeChildren(themeChild(fill, "gsLst"), "gs");
52165
- if (nodes.length < 2 || nodes.length > 32 || elements(themeChild(fill, "gsLst")).length !== nodes.length) return reject();
52165
+ if (nodes.length < 2 || nodes.length > 32 || elements(themeChild(fill, "gsLst")).length !== nodes.length) return reject2();
52166
52166
  const stops = [];
52167
52167
  for (const node of nodes) {
52168
52168
  const position = integer(node.getAttribute("pos"));
52169
52169
  const paint2 = drawingPaint(colorChoice(node), context.colors, context.base);
52170
- if (position === void 0 || position > 1e5 || !paint2 || position / 1e5 < (stops.at(-1)?.offset ?? 0)) return reject();
52170
+ if (position === void 0 || position > 1e5 || !paint2 || position / 1e5 < (stops.at(-1)?.offset ?? 0)) return reject2();
52171
52171
  stops.push({
52172
52172
  offset: position / 1e5,
52173
52173
  ...paint2
@@ -52184,21 +52184,21 @@ function savedFillGradient(sheet, width, height, resolveColor, report) {
52184
52184
  if (number(cells3, "FillGradientEnabled", NaN) !== 1) return void 0;
52185
52185
  const rows = sectionRows(sheet, "FillGradient").slice(0, 10);
52186
52186
  if (!rows.some((row) => [...row.cells.values()].some((cell) => cell.value !== "Themed"))) return void 0;
52187
- const reject = () => {
52187
+ const reject2 = () => {
52188
52188
  report("unsupported-saved-fill-gradient", "The saved fill gradient has incomplete or unsupported settings; its foreground color is used.");
52189
52189
  };
52190
52190
  const wrapped = (number(cells3, "FillGradientAngle", NaN) % (2 * Math.PI) + 2 * Math.PI) % (2 * Math.PI);
52191
52191
  const horizontal = Math.min(wrapped, 2 * Math.PI - wrapped) < 1e-12 ? 0 : Math.abs(wrapped - Math.PI) < 1e-12 ? Math.PI : void 0;
52192
- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0 || horizontal === void 0 || number(cells3, "FillGradientDir", NaN) !== 0 || number(cells3, "RotateGradientWithShape", NaN) !== 1 || number(cells3, "UseGroupGradient", NaN) !== 0) return reject();
52193
- if (rows.length < 2) return reject();
52192
+ if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0 || horizontal === void 0 || number(cells3, "FillGradientDir", NaN) !== 0 || number(cells3, "RotateGradientWithShape", NaN) !== 1 || number(cells3, "UseGroupGradient", NaN) !== 0) return reject2();
52193
+ if (rows.length < 2) return reject2();
52194
52194
  const stops = [];
52195
52195
  for (const row of rows) {
52196
52196
  const offset = number(row.cells, "GradientStopPosition", NaN);
52197
52197
  const transparency = number(row.cells, "GradientStopColorTrans", NaN);
52198
52198
  const value = row.cells.get("GradientStopColor")?.value;
52199
- if (!Number.isFinite(offset) || offset < 0 || offset > 1 || offset < (stops.at(-1)?.offset ?? 0) || !Number.isFinite(transparency) || transparency < 0 || transparency > 1 || !value || value === "Themed") return reject();
52199
+ if (!Number.isFinite(offset) || offset < 0 || offset > 1 || offset < (stops.at(-1)?.offset ?? 0) || !Number.isFinite(transparency) || transparency < 0 || transparency > 1 || !value || value === "Themed") return reject2();
52200
52200
  const color2 = resolveColor(row.cells);
52201
- if (!color2) return reject();
52201
+ if (!color2) return reject2();
52202
52202
  stops.push({
52203
52203
  offset,
52204
52204
  color: color2,
@@ -53227,7 +53227,7 @@ var marker = {
53227
53227
  function diagnosticCollector(maxCount) {
53228
53228
  const diagnostics = [], keys = /* @__PURE__ */ new Set();
53229
53229
  let characters = 0, truncated = false;
53230
- const bounded4 = (value, max) => {
53230
+ const bounded5 = (value, max) => {
53231
53231
  if (value.length <= max) return value;
53232
53232
  truncated = true;
53233
53233
  return value.slice(0, max - 1) + "…";
@@ -53238,12 +53238,12 @@ function diagnosticCollector(maxCount) {
53238
53238
  return;
53239
53239
  }
53240
53240
  const item = {
53241
- code: bounded4(code, 64),
53241
+ code: bounded5(code, 64),
53242
53242
  severity: context.severity ?? "warning",
53243
- message: bounded4(message, 2048),
53244
- ...context.part === void 0 ? {} : { part: bounded4(context.part, 1024) },
53245
- ...context.pageId === void 0 ? {} : { pageId: bounded4(context.pageId, 256) },
53246
- ...context.shapeId === void 0 ? {} : { shapeId: bounded4(context.shapeId, 1024) }
53243
+ message: bounded5(message, 2048),
53244
+ ...context.part === void 0 ? {} : { part: bounded5(context.part, 1024) },
53245
+ ...context.pageId === void 0 ? {} : { pageId: bounded5(context.pageId, 256) },
53246
+ ...context.shapeId === void 0 ? {} : { shapeId: bounded5(context.shapeId, 1024) }
53247
53247
  };
53248
53248
  const key2 = JSON.stringify(item);
53249
53249
  if (keys.has(key2)) return;
@@ -53935,6 +53935,170 @@ async function parseVsdx(input, options = {}) {
53935
53935
  diagnostics: diagnosticState.finish()
53936
53936
  };
53937
53937
  }
53938
+ new Uint8Array([
53939
+ 208,
53940
+ 207,
53941
+ 17,
53942
+ 224,
53943
+ 161,
53944
+ 177,
53945
+ 26,
53946
+ 225
53947
+ ]);
53948
+ new Map([
53949
+ 8364,
53950
+ 129,
53951
+ 8218,
53952
+ 402,
53953
+ 8222,
53954
+ 8230,
53955
+ 8224,
53956
+ 8225,
53957
+ 710,
53958
+ 8240,
53959
+ 352,
53960
+ 8249,
53961
+ 338,
53962
+ 141,
53963
+ 381,
53964
+ 143,
53965
+ 144,
53966
+ 8216,
53967
+ 8217,
53968
+ 8220,
53969
+ 8221,
53970
+ 8226,
53971
+ 8211,
53972
+ 8212,
53973
+ 732,
53974
+ 8482,
53975
+ 353,
53976
+ 8250,
53977
+ 339,
53978
+ 157,
53979
+ 382,
53980
+ 376
53981
+ ].map((codePoint, i) => [codePoint, 128 + i]));
53982
+ Object.freeze({
53983
+ maxCharacters: 16777216,
53984
+ maxPieces: 65536,
53985
+ maxFieldRecords: 65536
53986
+ });
53987
+ Object.freeze({
53988
+ read: Object.freeze([
53989
+ "paragraph-text",
53990
+ "character-runs",
53991
+ "direct-character-formatting",
53992
+ "paragraph-style-index",
53993
+ "compound-streams"
53994
+ ]),
53995
+ write: Object.freeze(["paragraph-text", "existing-direct-bold-italic"]),
53996
+ limitations: Object.freeze([
53997
+ "Paragraph insertion, removal and embedded paragraph breaks are unsupported.",
53998
+ "Character formatting reports direct CHPX exceptions, without resolving styles or piece PRMs.",
53999
+ "Bold/italic setters force an absolute value in an existing exclusive understood CHPX run. Run handles expire after edits.",
54000
+ "Fields, tables, objects and inherited styles are preserved where supported; their models are not editable.",
54001
+ "Unsupported edits and processing limits throw without changing the document.",
54002
+ "Text uses the bounded DOC codec defaults: 16,777,216 main-story characters and 65,536 pieces or field records.",
54003
+ "Rich formatting is bounded to 65,536 physical/mapped runs and paragraph style records."
54004
+ ])
54005
+ });
54006
+ new Map(`0 COUNT -1|1 IF -1|2 ISNA 1|3 ISERROR 1|4 SUM -1|5 AVERAGE -1|6 MIN -1|7 MAX -1|8 ROW -1|9 COLUMN -1|10 NA 0|11 NPV -1|12 STDEV -1|13 DOLLAR -1|14 FIXED -1|15 SIN 1|16 COS 1|17 TAN 1|18 ATAN 1|19 PI 0|20 SQRT 1|21 EXP 1|22 LN 1|23 LOG10 1|24 ABS 1|25 INT 1|26 SIGN 1|27 ROUND 2|28 LOOKUP -1|29 INDEX -1|30 REPT 2|31 MID 3|32 LEN 1|33 VALUE 1|34 TRUE 0|35 FALSE 0|36 AND -1|37 OR -1|38 NOT 1|39 MOD 2|40 DCOUNT 3|41 DSUM 3|42 DAVERAGE 3|43 DMIN 3|44 DMAX 3|45 DSTDEV 3|46 VAR -1|47 DVAR 3|48 TEXT 2|49 LINEST -1|50 TREND -1|51 LOGEST -1|52 GROWTH -1|56 PV -1|57 FV -1|58 NPER -1|59 PMT -1|60 RATE -1|61 MIRR 3|62 IRR -1|63 RAND 0|64 MATCH -1|65 DATE 3|66 TIME 3|67 DAY 1|68 MONTH 1|69 YEAR 1|70 WEEKDAY -1|71 HOUR 1|72 MINUTE 1|73 SECOND 1|74 NOW 0|75 AREAS 1|76 ROWS 1|77 COLUMNS 1|78 OFFSET -1|82 SEARCH -1|83 TRANSPOSE 1|86 TYPE 1|97 ATAN2 2|98 ASIN 1|99 ACOS 1|100 CHOOSE -1|101 HLOOKUP -1|102 VLOOKUP -1|105 ISREF 1|109 LOG -1|111 CHAR 1|112 LOWER 1|113 UPPER 1|114 PROPER 1|115 LEFT -1|116 RIGHT -1|117 EXACT 2|118 TRIM 1|119 REPLACE 4|120 SUBSTITUTE -1|121 CODE 1|124 FIND -1|125 CELL -1|126 ISERR 1|127 ISTEXT 1|128 ISNUMBER 1|129 ISBLANK 1|130 T 1|131 N 1|140 DATEVALUE 1|141 TIMEVALUE 1|142 SLN 3|143 SYD 4|144 DDB -1|148 INDIRECT -1|150 CALL -1|162 CLEAN 1|163 MDETERM 1|164 MINVERSE 1|165 MMULT 2|167 IPMT -1|168 PPMT -1|169 COUNTA -1|183 PRODUCT -1|184 FACT 1|189 DPRODUCT 3|190 ISNONTEXT 1|193 STDEVP -1|194 VARP -1|195 DSTDEVP 3|196 DVARP 3|197 TRUNC -1|198 ISLOGICAL 1|199 DCOUNTA 3|204 USDOLLAR -1|205 FINDB -1|206 SEARCHB -1|207 REPLACEB 4|208 LEFTB -1|209 RIGHTB -1|210 MIDB 3|211 LENB 1|212 ROUNDUP 2|213 ROUNDDOWN 2|214 ASC 1|215 DBCS 1|216 RANK -1|219 ADDRESS -1|220 DAYS360 -1|221 TODAY 0|222 VDB -1|227 MEDIAN -1|228 SUMPRODUCT -1|229 SINH 1|230 COSH 1|231 TANH 1|232 ASINH 1|233 ACOSH 1|234 ATANH 1|235 DGET 3|244 INFO 1|247 DB -1|252 FREQUENCY 2|261 ERROR.TYPE 1|269 AVEDEV -1|270 BETADIST -1|271 GAMMALN 1|272 BETAINV -1|273 BINOMDIST 4|274 CHIDIST 2|275 CHIINV 2|276 COMBIN 2|277 CONFIDENCE 3|278 CRITBINOM 3|279 EVEN 1|280 EXPONDIST 3|281 FDIST 3|282 FINV 3|283 FISHER 1|284 FISHERINV 1|285 FLOOR 2|286 GAMMADIST 4|287 GAMMAINV 3|288 CEILING 2|289 HYPGEOMDIST 4|290 LOGNORMDIST 3|291 LOGINV 3|292 NEGBINOMDIST 3|293 NORMDIST 4|294 NORMSDIST 1|295 NORMINV 3|296 NORMSINV 1|297 STANDARDIZE 3|298 ODD 1|299 PERMUT 2|300 POISSON 3|301 TDIST 3|302 WEIBULL 4|303 SUMXMY2 2|304 SUMX2MY2 2|305 SUMX2PY2 2|306 CHITEST 2|307 CORREL 2|308 COVAR 2|309 FORECAST 3|310 FTEST 2|311 INTERCEPT 2|312 PEARSON 2|313 RSQ 2|314 STEYX 2|315 SLOPE 2|316 TTEST 4|317 PROB -1|318 DEVSQ -1|319 GEOMEAN -1|320 HARMEAN -1|321 SUMSQ -1|322 KURT -1|323 SKEW -1|324 ZTEST -1|325 LARGE 2|326 SMALL 2|327 QUARTILE 2|328 PERCENTILE 2|329 PERCENTRANK -1|330 MODE -1|331 TRIMMEAN 2|332 TINV 2|336 CONCATENATE -1|337 POWER 2|342 RADIANS 1|343 DEGREES 1|344 SUBTOTAL -1|345 SUMIF -1|346 COUNTIF 2|347 COUNTBLANK 1|350 ISPMT 4|351 DATEDIF 3|352 DATESTRING 1|353 NUMBERSTRING 2|354 ROMAN -1|358 GETPIVOTDATA -1|359 HYPERLINK -1|360 PHONETIC 1|361 AVERAGEA -1|362 MAXA -1|363 MINA -1|364 STDEVPA -1|365 VARPA -1|366 STDEVA -1|367 VARA -1|368 BAHTTEXT 1`.split("|").map((entry) => {
54007
+ const [id, name, argc] = entry.split(" ");
54008
+ return [Number(id), {
54009
+ name: name ?? "",
54010
+ argc: Number(argc)
54011
+ }];
54012
+ }));
54013
+ "000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 000000 FFFFFF FF0000 00FF00 0000FF FFFF00 FF00FF 00FFFF 800000 008000 000080 808000 800080 008080 C0C0C0 808080 9999FF 993366 FFFFCC CCFFFF 660066 FF8080 0066CC CCCCFF 000080 FF00FF FFFF00 00FFFF 800080 800000 008080 0000FF 00CCFF CCFFFF CCFFCC FFFF99 99CCFF FF99CC CC99FF FFCC99 3366FF 33CCCC 99CC00 FFCC00 FF9900 FF6600 666699 969696 003366 339966 003300 333300 993300 993366 333399 333333".split(" ");
54014
+ Object.freeze({
54015
+ "#NULL!": 0,
54016
+ "#DIV/0!": 7,
54017
+ "#VALUE!": 15,
54018
+ "#REF!": 23,
54019
+ "#NAME?": 29,
54020
+ "#NUM!": 36,
54021
+ "#N/A": 42,
54022
+ "#GETTING_DATA": 43
54023
+ });
54024
+ Object.freeze({
54025
+ read: Object.freeze([
54026
+ "BIFF8 worksheets",
54027
+ "cell values and cached formulas",
54028
+ "styles and merges",
54029
+ "opaque compound streams"
54030
+ ]),
54031
+ write: Object.freeze([
54032
+ "existing NUMBER/RK/MULRK numeric values",
54033
+ "existing LABELSST/NUMBER/RK/MULRK plain string values",
54034
+ "existing NUMBER/RK/MULRK/BOOLERR boolean and error values"
54035
+ ]),
54036
+ limitations: Object.freeze([
54037
+ "No cell creation, formula editing or recalculation",
54038
+ "Numeric writes require exact original encoding",
54039
+ "Resizing writes reject unsupported relocation records and container layouts",
54040
+ "Plain string replacement removes selected rich text runs",
54041
+ "String-to-boolean/error and boolean/error-to-number/string conversions unsupported"
54042
+ ])
54043
+ });
54044
+ Object.freeze({
54045
+ read: Object.freeze([
54046
+ "active-slide-ids",
54047
+ "active-outline-and-inline-text",
54048
+ "text-encoding",
54049
+ "active-shape-ids-and-flags",
54050
+ "primitive-shape-kind",
54051
+ "explicit-anchor-geometry",
54052
+ "validated-inline-shape-text",
54053
+ "opaque-streams"
54054
+ ]),
54055
+ write: Object.freeze(["existing-text-fixed-utf16-length", "unmirrored-top-level-small-anchor-bounds"]),
54056
+ limitations: Object.freeze([
54057
+ "unresolved-outline-shape-text",
54058
+ "rich-text-runs",
54059
+ "notes",
54060
+ "variable-length-text",
54061
+ "OOXML-mirrored-text-and-shapes",
54062
+ "group-transforms-and-geometry",
54063
+ "large-anchor-writes",
54064
+ "inherited-rotated-or-flipped-geometry",
54065
+ "animations",
54066
+ "masters",
54067
+ "embedded-objects"
54068
+ ])
54069
+ });
54070
+ Object.freeze({
54071
+ read: Object.freeze([
54072
+ "v11-pages",
54073
+ "explicit-shape-transform",
54074
+ "utf16-shape-text",
54075
+ "move-to-line-to"
54076
+ ]),
54077
+ write: Object.freeze(["equal-length-shape-text", "literal-shape-transform"]),
54078
+ limitations: Object.freeze([
54079
+ "Version 11 only; stored values without master/style/formula evaluation.",
54080
+ "No added/deleted shapes, text length changes or text field edits.",
54081
+ "Shared/overlapping VSD blocks cannot be edited; no native Visio fidelity claim."
54082
+ ])
54083
+ });
54084
+ Object.freeze({
54085
+ read: Object.freeze(["directory", "stream-by-path"]),
54086
+ write: Object.freeze(["existing-stream-bytes"]),
54087
+ limitations: Object.freeze([
54088
+ "Container editing does not update Office format records.",
54089
+ "New directory entries and external DIFAT expansion are unsupported.",
54090
+ "Variable-length v4 mini-stream edits are unsupported."
54091
+ ])
54092
+ });
54093
+ (() => {
54094
+ const table = /* @__PURE__ */ new Uint32Array(256);
54095
+ for (let n = 0; n < 256; n++) {
54096
+ let c = n;
54097
+ for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
54098
+ table[n] = c >>> 0;
54099
+ }
54100
+ return table;
54101
+ })();
53938
54102
  Object.freeze({
53939
54103
  maxShapes: 25e3,
53940
54104
  maxDepth: 64,
@@ -53994,7 +54158,7 @@ function writeEditedPackage(parts, maxBytes, deadline, check) {
53994
54158
  check();
53995
54159
  zip.file(path, bytes, { createFolders: false });
53996
54160
  }
53997
- return new Promise((resolve, reject) => {
54161
+ return new Promise((resolve, reject2) => {
53998
54162
  const stream = zip.generateInternalStream({
53999
54163
  type: "uint8array",
54000
54164
  compression: "STORE",
@@ -54009,7 +54173,7 @@ function writeEditedPackage(parts, maxBytes, deadline, check) {
54009
54173
  stream.pause();
54010
54174
  chunks = [];
54011
54175
  clearTimeout(timer);
54012
- reject(error);
54176
+ reject2(error);
54013
54177
  };
54014
54178
  const timer = setTimeout(() => {
54015
54179
  try {
@@ -54124,7 +54288,7 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
54124
54288
  if (/[\u0000-\u0008\u000b\u000c\u000d\u000e-\u001f\ufffe\uffff]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/u.test(value)) fail("INVALID_EDIT_TEXT", "Replacement text contains invalid XML characters.");
54125
54289
  return value;
54126
54290
  };
54127
- const numeric4 = (value, dimension = false) => {
54291
+ const numeric5 = (value, dimension = false) => {
54128
54292
  if (typeof value !== "number" || !Number.isFinite(value) || Math.abs(value) > 1e6 || dimension && value <= 0) fail("INVALID_EDIT", "Geometry requires finite drawing inches within limits and positive dimensions.");
54129
54293
  return value;
54130
54294
  };
@@ -54144,23 +54308,23 @@ function snapshotVisioEdits(edits, maxEdits, maxText) {
54144
54308
  case "create-rectangle": return {
54145
54309
  ...target,
54146
54310
  type: edit.type,
54147
- x: numeric4(edit.x),
54148
- y: numeric4(edit.y),
54149
- width: numeric4(edit.width, true),
54150
- height: numeric4(edit.height, true),
54311
+ x: numeric5(edit.x),
54312
+ y: numeric5(edit.y),
54313
+ width: numeric5(edit.width, true),
54314
+ height: numeric5(edit.height, true),
54151
54315
  ...edit.text === void 0 ? {} : { text: text(edit.text) }
54152
54316
  };
54153
54317
  case "move-shape": return {
54154
54318
  ...target,
54155
54319
  type: edit.type,
54156
- x: numeric4(edit.x),
54157
- y: numeric4(edit.y)
54320
+ x: numeric5(edit.x),
54321
+ y: numeric5(edit.y)
54158
54322
  };
54159
54323
  case "resize-shape": return {
54160
54324
  ...target,
54161
54325
  type: edit.type,
54162
- width: numeric4(edit.width, true),
54163
- height: numeric4(edit.height, true)
54326
+ width: numeric5(edit.width, true),
54327
+ height: numeric5(edit.height, true)
54164
54328
  };
54165
54329
  case "delete-shape": return {
54166
54330
  ...target,
@@ -54561,16 +54725,16 @@ var units = {
54561
54725
  };
54562
54726
  function visioFormulaCachedValue(value, unit) {
54563
54727
  if (!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(value.trim())) return formulaFailure("value", "Non-numeric cell cache");
54564
- const numeric4 = Number(value);
54565
- if (!Number.isFinite(numeric4)) return formulaFailure("value", "Non-finite cell cache");
54728
+ const numeric5 = Number(value);
54729
+ if (!Number.isFinite(numeric5)) return formulaFailure("value", "Non-finite cell cache");
54566
54730
  if (!unit || unit === "NUM" || unit === "BOOL") return {
54567
- value: numeric4,
54731
+ value: numeric5,
54568
54732
  unit: "scalar"
54569
54733
  };
54570
54734
  const definition = Object.hasOwn(units, unit.toUpperCase()) ? units[unit.toUpperCase()] : void 0;
54571
54735
  if (!definition) return formulaFailure("unit", `Unsupported unit ${unit}`);
54572
54736
  return {
54573
- value: numeric4,
54737
+ value: numeric5,
54574
54738
  unit: definition[0]
54575
54739
  };
54576
54740
  }
@@ -55000,7 +55164,7 @@ var locks = [
55000
55164
  "LockDelete"
55001
55165
  ];
55002
55166
  var cells = (shape) => new Map(children(shape, "Cell").map((node) => [attribute2(node, "N") ?? "", node]));
55003
- function numeric3(node, fallback) {
55167
+ function numeric4(node, fallback) {
55004
55168
  if (!node && fallback !== void 0) return fallback;
55005
55169
  if (!node || node.hasAttribute("E")) fail("UNSUPPORTED_GEOMETRY_EDIT", "A usable local numeric transform cache is required.");
55006
55170
  const value = visioFormulaCachedValue(attribute2(node, "V") ?? "", attribute2(node, "U")).value;
@@ -55052,14 +55216,14 @@ function admitted(root, shapeId, masterMovePins = /* @__PURE__ */ new Set(), mas
55052
55216
  const unit = attribute2(local.get(name), "U");
55053
55217
  if (unit && visioFormulaCachedValue("0", unit).unit !== "length") fail("EDIT_FORMULA_UNIT", "Transform cells must use length units.");
55054
55218
  }
55055
- if (numeric3(local.get("OneD"), 0) !== 0 || [
55219
+ if (numeric4(local.get("OneD"), 0) !== 0 || [
55056
55220
  "BeginX",
55057
55221
  "BeginY",
55058
55222
  "EndX",
55059
55223
  "EndY"
55060
55224
  ].some((name) => local.has(name))) fail("UNSUPPORTED_GEOMETRY_EDIT", "Only local 2D shapes are admitted; line routing and glue are unsupported.");
55061
55225
  const proven = masterDimensions.get(shape);
55062
- if (!(numeric3(local.get("Width"), proven?.width) > 0) || !(numeric3(local.get("Height"), proven?.height) > 0)) fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive proven Width and Height caches are required.");
55226
+ if (!(numeric4(local.get("Width"), proven?.width) > 0) || !(numeric4(local.get("Height"), proven?.height) > 0)) fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive proven Width and Height caches are required.");
55063
55227
  return shape;
55064
55228
  }
55065
55229
  function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Set()) {
@@ -55076,7 +55240,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
55076
55240
  }
55077
55241
  const validateProtection = (cell) => {
55078
55242
  try {
55079
- const cached2 = numeric3(cell);
55243
+ const cached2 = numeric4(cell);
55080
55244
  const operationIndependent = certifiedMove && [
55081
55245
  "LockWidth",
55082
55246
  "LockHeight",
@@ -55109,7 +55273,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
55109
55273
  if (parent === void 0 || parent === id) fail("EDIT_PROTECTED_CELL", "Inherited protection has no provable parent.");
55110
55274
  const inherited = resolve(parent, category, lock, seen);
55111
55275
  if (!inherited) fail("EDIT_PROTECTED_CELL", "Inherited protection has no explicit provable ancestor.");
55112
- if (numeric3(cell) !== numeric3(inherited)) fail("EDIT_PROTECTED_CELL", "Delegated protection cache disagrees with its ancestor.");
55276
+ if (numeric4(cell) !== numeric4(inherited)) fail("EDIT_PROTECTED_CELL", "Delegated protection cache disagrees with its ancestor.");
55113
55277
  return inherited;
55114
55278
  }
55115
55279
  return parent !== void 0 && parent !== id ? resolve(parent, category, lock, seen) : void 0;
@@ -55134,7 +55298,7 @@ function protectedShape(shape, document, masterMovePins = /* @__PURE__ */ new Se
55134
55298
  const analysis = analyzeVisioFormula(formula);
55135
55299
  if (analysis.dynamic || analysis.references.length || analysis.unsupportedFunctions.length) fail("EDIT_PROTECTED_CELL", "Protection formula cannot be resolved safely.");
55136
55300
  const result = evaluateVisioFormula(formula, () => fail("EDIT_PROTECTED_CELL", "Protection dependency is unsupported."));
55137
- if (result.unit !== "scalar" || result.value !== numeric3(cell)) fail("EDIT_PROTECTED_CELL", "Protection cache is stale.");
55301
+ if (result.unit !== "scalar" || result.value !== numeric4(cell)) fail("EDIT_PROTECTED_CELL", "Protection cache is stale.");
55138
55302
  }
55139
55303
  }
55140
55304
  }
@@ -55155,9 +55319,9 @@ function resizeGeometry(shape, roots, edit, check) {
55155
55319
  if (!["X", "Y"].includes(attribute2(node, "N") ?? "")) fail("UNSUPPORTED_GEOMETRY_EDIT", "Unknown geometry row cells are unsupported.");
55156
55320
  if ((type ?? "").startsWith("Rel")) continue;
55157
55321
  const formula = executableCellFormula(attribute2(node, "F"));
55158
- if (!formula && numeric3(node) === 0) continue;
55322
+ if (!formula && numeric4(node) === 0) continue;
55159
55323
  if (!formula) fail("UNSUPPORTED_GEOMETRY_EDIT", "Absolute geometry needs a provable dimension-dependent formula.");
55160
- if (!analyzeVisioFormula(formula).references.length && numeric3(node) === 0) continue;
55324
+ if (!analyzeVisioFormula(formula).references.length && numeric4(node) === 0) continue;
55161
55325
  const cell = `Geometry${Number(attribute2(section, "IX") ?? "0") + 1}.${attribute2(node, "N")}${attribute2(row, "IX")}`;
55162
55326
  if (!visioCellDependsOn(roots, {
55163
55327
  pageId: edit.pageId,
@@ -55224,17 +55388,17 @@ function prepareMasterMovePins(roots, commands, bindings, check) {
55224
55388
  ]) if (binding.cells.has(name.toLowerCase())) fail("UNSUPPORTED_GEOMETRY_EDIT", "Master lines and endpoint routing remain unsupported.");
55225
55389
  const oneD = binding.cells.get("oned")?.node;
55226
55390
  charge();
55227
- if (oneD && (numeric3(oneD) !== 0 || visioFormulaCachedValue(attribute2(oneD, "V") ?? "", attribute2(oneD, "U")).unit !== "scalar" || executableCellFormula(attribute2(oneD, "F")))) fail("UNSUPPORTED_GEOMETRY_EDIT", "A static effective 2D master is required.");
55391
+ if (oneD && (numeric4(oneD) !== 0 || visioFormulaCachedValue(attribute2(oneD, "V") ?? "", attribute2(oneD, "U")).unit !== "scalar" || executableCellFormula(attribute2(oneD, "F")))) fail("UNSUPPORTED_GEOMETRY_EDIT", "A static effective 2D master is required.");
55228
55392
  const local = cells(instance);
55229
55393
  for (const name of dimensions2) {
55230
55394
  const effective = binding.cells.get(name.toLowerCase())?.node;
55231
55395
  for (const node of /* @__PURE__ */ new Set([effective, ...local.has(name) ? [local.get(name)] : []])) {
55232
55396
  charge();
55233
- numeric3(node);
55397
+ numeric4(node);
55234
55398
  if (visioFormulaCachedValue("0", attribute2(node, "U") ?? "DL").unit !== "length") fail("EDIT_FORMULA_UNIT", "Master transform caches require length units.");
55235
55399
  }
55236
55400
  }
55237
- const dimension = (name) => numeric3(local.get(name) ?? binding.cells.get(name.toLowerCase())?.node);
55401
+ const dimension = (name) => numeric4(local.get(name) ?? binding.cells.get(name.toLowerCase())?.node);
55238
55402
  const width = dimension("Width"), height = dimension("Height");
55239
55403
  if (width <= 0 || height <= 0) fail("UNSUPPORTED_GEOMETRY_EDIT", "Positive proven effective dimensions are required.");
55240
55404
  provenDimensions.set(instance, {
@@ -55244,7 +55408,7 @@ function prepareMasterMovePins(roots, commands, bindings, check) {
55244
55408
  for (const name of protection) {
55245
55409
  charge();
55246
55410
  const node = binding.cells.get(name.toLowerCase())?.node;
55247
- const cached2 = node ? numeric3(node) : NaN;
55411
+ const cached2 = node ? numeric4(node) : NaN;
55248
55412
  const moving = name === "LockMoveX" || name === "LockMoveY";
55249
55413
  if (!node || visioFormulaCachedValue(attribute2(node, "V") ?? "", attribute2(node, "U")).unit !== "scalar" || ![0, 1].includes(cached2) || moving && cached2 !== 0) fail("EDIT_PROTECTED_CELL", "Effective master protection must be proven boolean with inactive movement locks.");
55250
55414
  const formula = executableCellFormula(attribute2(node, "F"));
@@ -55263,7 +55427,7 @@ function prepareMasterMovePins(roots, commands, bindings, check) {
55263
55427
  charge(executableCellFormula(attribute2(node, "F"))?.length ?? 0);
55264
55428
  editableCell(node);
55265
55429
  const inherited = binding.inheritedCells.get(name.toLowerCase())?.node;
55266
- numeric3(inherited);
55430
+ numeric4(inherited);
55267
55431
  if (visioFormulaCachedValue("0", attribute2(inherited, "U") ?? "DL").unit !== "length") fail("EDIT_FORMULA_UNIT", "Inherited rotation pins require length units.");
55268
55432
  const formula = executableCellFormula(attribute2(inherited, "F"));
55269
55433
  if (formula) {
@@ -55370,7 +55534,7 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
55370
55534
  }
55371
55535
  const local = cells(shape);
55372
55536
  const unlocked = (name) => {
55373
- if (numeric3(local.get(name), 0) !== 0) fail("EDIT_PROTECTED_CELL", `${name} prevents this operation.`);
55537
+ if (numeric4(local.get(name), 0) !== 0) fail("EDIT_PROTECTED_CELL", `${name} prevents this operation.`);
55374
55538
  };
55375
55539
  if (edit.type === "delete-shape") {
55376
55540
  unlocked("LockDelete");
@@ -55381,8 +55545,8 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
55381
55545
  if (edit.type === "move-shape") {
55382
55546
  const proven = masterDimensions.get(shape);
55383
55547
  expected = {
55384
- width: numeric3(local.get("Width"), proven?.width),
55385
- height: numeric3(local.get("Height"), proven?.height),
55548
+ width: numeric4(local.get("Width"), proven?.width),
55549
+ height: numeric4(local.get("Height"), proven?.height),
55386
55550
  x: edit.x,
55387
55551
  y: edit.y
55388
55552
  };
@@ -55395,23 +55559,23 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
55395
55559
  edit.y,
55396
55560
  "LockMoveY"
55397
55561
  ]]) {
55398
- if (numeric3(local.get(name), name === "PinX" ? expected.width / 2 : expected.height / 2) === value) continue;
55562
+ if (numeric4(local.get(name), name === "PinX" ? expected.width / 2 : expected.height / 2) === value) continue;
55399
55563
  unlocked(lock);
55400
55564
  editableCell(local.get(name));
55401
55565
  setCell(shape, name, value);
55402
55566
  add(name);
55403
55567
  }
55404
55568
  } else {
55405
- const width = numeric3(local.get("Width")), height = numeric3(local.get("Height"));
55569
+ const width = numeric4(local.get("Width")), height = numeric4(local.get("Height"));
55406
55570
  expected = {
55407
55571
  width: edit.width,
55408
55572
  height: edit.height,
55409
- x: numeric3(local.get("PinX"), width / 2),
55410
- y: numeric3(local.get("PinY"), height / 2)
55573
+ x: numeric4(local.get("PinX"), width / 2),
55574
+ y: numeric4(local.get("PinY"), height / 2)
55411
55575
  };
55412
55576
  if (width === edit.width && height === edit.height) return [];
55413
55577
  resizeGeometry(shape, roots, edit, check);
55414
- if (numeric3(local.get("LockAspect"), 0) !== 0 && Math.abs(edit.width / width - edit.height / height) > 1e-9) fail("EDIT_PROTECTED_CELL", "LockAspect prevents changing the aspect ratio.");
55578
+ if (numeric4(local.get("LockAspect"), 0) !== 0 && Math.abs(edit.width / width - edit.height / height) > 1e-9) fail("EDIT_PROTECTED_CELL", "LockAspect prevents changing the aspect ratio.");
55415
55579
  for (const [name, value] of [["PinX", width / 2], ["PinY", height / 2]]) if (!local.has(name)) setCell(shape, name, value);
55416
55580
  for (const [name, value, lock] of [[
55417
55581
  "Width",
@@ -55422,7 +55586,7 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
55422
55586
  edit.height,
55423
55587
  "LockHeight"
55424
55588
  ]]) {
55425
- if (numeric3(local.get(name)) === value) continue;
55589
+ if (numeric4(local.get(name)) === value) continue;
55426
55590
  unlocked(lock);
55427
55591
  editableCell(local.get(name));
55428
55592
  setCell(shape, name, value);
@@ -55446,7 +55610,7 @@ function applyGeometryEdit(roots, document, edit, check, masterMoveProof = empty
55446
55610
  });
55447
55611
  const resultShape = admitted(root, edit.shapeId, edit.type === "move-shape" ? masterMovePins : /* @__PURE__ */ new Set(), edit.type === "move-shape" ? masterDimensions : /* @__PURE__ */ new Map());
55448
55612
  const result = cells(resultShape), provenResult = masterDimensions.get(resultShape);
55449
- if (expected && (numeric3(result.get("Width"), provenResult?.width) !== expected.width || numeric3(result.get("Height"), provenResult?.height) !== expected.height || numeric3(result.get("PinX"), expected.width / 2) !== expected.x || numeric3(result.get("PinY"), expected.height / 2) !== expected.y)) fail("EDIT_UNSUPPORTED_DEPENDENCY", "Dependent formulas would violate the requested geometry or fixed rotation pin.");
55613
+ if (expected && (numeric4(result.get("Width"), provenResult?.width) !== expected.width || numeric4(result.get("Height"), provenResult?.height) !== expected.height || numeric4(result.get("PinX"), expected.width / 2) !== expected.x || numeric4(result.get("PinY"), expected.height / 2) !== expected.y)) fail("EDIT_UNSUPPORTED_DEPENDENCY", "Dependent formulas would violate the requested geometry or fixed rotation pin.");
55450
55614
  return [.../* @__PURE__ */ new Set([edit.pageId, ...affectedPages])];
55451
55615
  }
55452
55616
  function analyzeVisioMasterFormula(source, options) {
@@ -55801,7 +55965,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
55801
55965
  return result;
55802
55966
  };
55803
55967
  let steps = 1e5;
55804
- const inspect2 = (binding, name) => {
55968
+ const inspect4 = (binding, name) => {
55805
55969
  check();
55806
55970
  if (--steps < 0) problem("Master dependency proof exceeded its cell budget.");
55807
55971
  name = name.toLowerCase();
@@ -55823,7 +55987,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
55823
55987
  txtlocpinx: "txtwidth",
55824
55988
  txtlocpiny: "txtheight"
55825
55989
  }[name];
55826
- if (dimension) inspect2(binding, dimension);
55990
+ if (dimension) inspect4(binding, dimension);
55827
55991
  else if (!themeCell.test(name)) problem(`Missing effective master reference ${name}.`);
55828
55992
  } else {
55829
55993
  const formula = executableCellFormula(attribute2(source.node, "F"));
@@ -55839,11 +56003,11 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
55839
56003
  if (analysis.dynamic) problem("Effective master formula has unknown dynamic dependencies.");
55840
56004
  for (const ref of analysis.references) {
55841
56005
  if (analysis.readsText && ref.shapeId === void 0 && ref.cell.toLowerCase() === "thetext") continue;
55842
- if (ref.shapeId === void 0) inspect2(binding, ref.cell);
56006
+ if (ref.shapeId === void 0) inspect4(binding, ref.cell);
55843
56007
  else if (source.kind === "template") {
55844
56008
  const target = binding.context.get(ref.shapeId);
55845
56009
  if (!target) problem("Missing master-local Sheet reference.");
55846
- inspect2(target, ref.cell);
56010
+ inspect4(target, ref.cell);
55847
56011
  } else {
55848
56012
  if (source.kind === "style") problem("Explicit sheet references in inherited master styles are ambiguous.");
55849
56013
  if (directAffected(binding.pageId, ref.shapeId, ref.cell) || query({
@@ -55851,11 +56015,11 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
55851
56015
  shapeId: ref.shapeId,
55852
56016
  cell: ref.cell
55853
56017
  }, changed)) problem("Effective master cache depends on an edited page shape.");
55854
- inspect2(pageInput(binding.pageId, ref.shapeId), ref.cell);
56018
+ inspect4(pageInput(binding.pageId, ref.shapeId), ref.cell);
55855
56019
  }
55856
56020
  }
55857
56021
  if (analysis.readsText) {
55858
- for (const cell of binding.cells.keys()) if (/^(character\.|paragraph\.|tabs\.|leftmargin$|rightmargin$|topmargin$|bottommargin$)/i.test(cell)) inspect2(binding, cell);
56022
+ for (const cell of binding.cells.keys()) if (/^(character\.|paragraph\.|tabs\.|leftmargin$|rightmargin$|topmargin$|bottommargin$)/i.test(cell)) inspect4(binding, cell);
55859
56023
  }
55860
56024
  }
55861
56025
  }
@@ -55865,7 +56029,7 @@ async function assertVisioMasterIndependence(pkg, roots, commands, check) {
55865
56029
  for (const binding of bindings) for (const name of binding.cells.keys()) {
55866
56030
  const source = binding.cells.get(name);
55867
56031
  if (["pinx", "piny"].includes(name) && source?.kind === "instance" && movePins.pins.has(source.node)) continue;
55868
- inspect2(binding, name);
56032
+ inspect4(binding, name);
55869
56033
  }
55870
56034
  return movePins;
55871
56035
  }