@pixldocs/canvas-renderer 0.5.221 → 0.5.223

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.
@@ -17390,7 +17390,13 @@ function sanitizeSectionStateAgainstSchema(state, schema) {
17390
17390
  if (!state) return {};
17391
17391
  if (!schema) return { ...state };
17392
17392
  const known = /* @__PURE__ */ new Set();
17393
- for (const s of schema.sections ?? []) known.add(s.id);
17393
+ const collectSectionIds = (sections) => {
17394
+ for (const s of sections ?? []) {
17395
+ known.add(s.id);
17396
+ collectSectionIds(s.children);
17397
+ }
17398
+ };
17399
+ collectSectionIds(schema.sections);
17394
17400
  for (const p of schema.repeatablePages ?? []) known.add(p.id);
17395
17401
  const out = {};
17396
17402
  for (const [key, value] of Object.entries(state)) {
@@ -17537,7 +17543,7 @@ async function resolveTemplateData(options) {
17537
17543
  }
17538
17544
  }
17539
17545
  if (repeatableSectionsInput.length > 0) {
17540
- paintRepeatableSections(config, repeatableSectionsInput);
17546
+ paintRepeatableSections(config, repeatableSectionsInput, inlineFormSchema);
17541
17547
  }
17542
17548
  }
17543
17549
  const mergedFormData = {
@@ -17609,7 +17615,7 @@ async function resolveFromForm(options) {
17609
17615
  normalizeLayoutModes(templateConfig);
17610
17616
  const repeatableFromSchema = templateFormSchema == null ? void 0 : templateFormSchema.repeatableSections;
17611
17617
  if ((repeatableFromSchema == null ? void 0 : repeatableFromSchema.length) && templateConfig.pages) {
17612
- paintRepeatableSections(templateConfig, repeatableFromSchema);
17618
+ paintRepeatableSections(templateConfig, repeatableFromSchema, templateFormSchema);
17613
17619
  }
17614
17620
  const schemaSections = getRenderableFormSections(formSchema);
17615
17621
  const repeatableNodeMap = /* @__PURE__ */ new Map();
@@ -17912,8 +17918,11 @@ function normalizeLayoutModes(config) {
17912
17918
  }
17913
17919
  }
17914
17920
  }
17915
- function paintRepeatableSections(config, repeatableSections) {
17921
+ function paintRepeatableSections(config, repeatableSections, formSchema) {
17922
+ var _a, _b;
17916
17923
  const pages = config.pages ?? [];
17924
+ const entryFilters = (formSchema == null ? void 0 : formSchema.entryFilters) ?? [];
17925
+ const entryFilterBases = new Set(entryFilters.map((f) => baseId(f.nodeId)));
17917
17926
  function stripFlags(nodes) {
17918
17927
  for (const node of nodes) {
17919
17928
  delete node.repeatableSection;
@@ -17923,32 +17932,53 @@ function paintRepeatableSections(config, repeatableSections) {
17923
17932
  for (const page of pages) {
17924
17933
  if (page.children) stripFlags(page.children);
17925
17934
  }
17926
- function setRepeatable(nodes, nodeId, payload) {
17935
+ function setRepeatableAll(nodes, nodeId, payload) {
17936
+ let painted = 0;
17927
17937
  for (const node of nodes) {
17928
17938
  const id = node.id;
17929
- if (node.repeatableSection) {
17930
- if (Array.isArray(node.children) && setRepeatable(node.children, nodeId, payload)) {
17931
- return true;
17932
- }
17933
- continue;
17934
- }
17935
17939
  if (id && (id === nodeId || baseId(id) === baseId(nodeId))) {
17936
17940
  node.repeatableSection = payload;
17937
- return true;
17941
+ painted++;
17938
17942
  }
17939
- if (Array.isArray(node.children) && setRepeatable(node.children, nodeId, payload)) {
17940
- return true;
17943
+ if (Array.isArray(node.children)) {
17944
+ painted += setRepeatableAll(node.children, nodeId, payload);
17941
17945
  }
17942
17946
  }
17943
- return false;
17947
+ return painted;
17944
17948
  }
17945
17949
  for (const section of repeatableSections) {
17950
+ const inlineRange = ((_a = section.entryFilter) == null ? void 0 : _a.mode) === "range" ? (_b = section.entryFilter.range) == null ? void 0 : _b.trim() : void 0;
17951
+ const shouldUseInlineFilter = !!inlineRange && !entryFilterBases.has(baseId(section.nodeId));
17946
17952
  const payload = { label: section.label };
17947
17953
  if (section.minEntries !== void 0) payload.minEntries = section.minEntries;
17948
17954
  if (section.maxEntries !== void 0) payload.maxEntries = section.maxEntries;
17949
- if (section.entryFilter !== void 0) payload.entryFilter = section.entryFilter;
17955
+ if (shouldUseInlineFilter) payload.entryFilter = { mode: "range", range: inlineRange };
17950
17956
  for (const page of pages) {
17951
- if (setRepeatable(page.children ?? [], section.nodeId, payload)) break;
17957
+ setRepeatableAll(page.children ?? [], section.nodeId, payload);
17958
+ }
17959
+ }
17960
+ if (entryFilters.length) {
17961
+ const occurrencesByBase = /* @__PURE__ */ new Map();
17962
+ const collect = (nodes) => {
17963
+ var _a2;
17964
+ for (const node of nodes ?? []) {
17965
+ if ((_a2 = node.repeatableSection) == null ? void 0 : _a2.label) {
17966
+ const base = baseId(node.id);
17967
+ if (!occurrencesByBase.has(base)) occurrencesByBase.set(base, []);
17968
+ occurrencesByBase.get(base).push(node);
17969
+ }
17970
+ if (Array.isArray(node.children)) collect(node.children);
17971
+ }
17972
+ };
17973
+ for (const page of pages) collect(page.children ?? []);
17974
+ for (const filter of entryFilters) {
17975
+ const base = baseId(filter.nodeId);
17976
+ const occurrences = occurrencesByBase.get(base);
17977
+ if (!(occurrences == null ? void 0 : occurrences.length)) continue;
17978
+ const target = filter.occurrenceIndex && filter.occurrenceIndex >= 1 ? occurrences[filter.occurrenceIndex - 1] : occurrences.find((node) => node.id === filter.nodeId) ?? occurrences[0];
17979
+ if (target == null ? void 0 : target.repeatableSection) {
17980
+ target.repeatableSection.entryFilter = { mode: filter.mode, ...filter.range ? { range: filter.range } : {} };
17981
+ }
17952
17982
  }
17953
17983
  }
17954
17984
  }
@@ -19093,9 +19123,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
19093
19123
  }
19094
19124
  return svgString;
19095
19125
  }
19096
- const resolvedPackageVersion = "0.5.221";
19126
+ const resolvedPackageVersion = "0.5.223";
19097
19127
  const PACKAGE_VERSION = resolvedPackageVersion;
19098
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.221";
19128
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.223";
19099
19129
  const roundParityValue = (value) => {
19100
19130
  if (typeof value !== "number") return value;
19101
19131
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -19839,7 +19869,7 @@ class PixldocsRenderer {
19839
19869
  await this.waitForCanvasScene(container, cloned, i);
19840
19870
  }
19841
19871
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
19842
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CZjhPHZh.cjs"));
19872
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C-l9Vtku.cjs"));
19843
19873
  const prepared = preparePagesForExport(
19844
19874
  cloned.pages,
19845
19875
  canvasWidth,
@@ -21235,6 +21265,8 @@ function normalizeSvgViewBoxOrigin(svg) {
21235
21265
  if (parts.length !== 4) return;
21236
21266
  const [vx, vy, vw, vh] = parts;
21237
21267
  if (vw <= 0 || vh <= 0) return;
21268
+ svg.setAttribute("width", String(vw));
21269
+ svg.setAttribute("height", String(vh));
21238
21270
  if (Math.abs(vx) < 1e-3 && Math.abs(vy) < 1e-3) return;
21239
21271
  const doc = svg.ownerDocument;
21240
21272
  if (!doc) return;
@@ -21321,7 +21353,20 @@ function decodeSvgDataUri(href) {
21321
21353
  }
21322
21354
  }
21323
21355
  }
21324
- function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21356
+ async function readNestedSvgImageMarkup(href) {
21357
+ if (!href) return null;
21358
+ if (href.startsWith("data:image/svg+xml")) return decodeSvgDataUri(href);
21359
+ if (!/\.svg(?:[?#]|$)/i.test(href) && !href.startsWith("blob:")) return null;
21360
+ try {
21361
+ const res = await fetch(href, { cache: "no-store" });
21362
+ if (!res.ok) return null;
21363
+ const text = await res.text();
21364
+ return /<svg[\s>]/i.test(text) ? text : null;
21365
+ } catch {
21366
+ return null;
21367
+ }
21368
+ }
21369
+ async function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21325
21370
  var _a;
21326
21371
  try {
21327
21372
  const doc = domParser.parseFromString(svgString, "image/svg+xml");
@@ -21329,47 +21374,161 @@ function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21329
21374
  const root = doc.documentElement;
21330
21375
  if (!root || root.tagName.toLowerCase() !== "svg") return svgString;
21331
21376
  let changed = false;
21332
- for (const img of Array.from(doc.querySelectorAll("image"))) {
21377
+ let inlined = 0;
21378
+ const images = Array.from(doc.querySelectorAll("image"));
21379
+ for (const [imageIndex, img] of images.entries()) {
21333
21380
  const href = img.getAttribute("href") || img.getAttributeNS("http://www.w3.org/1999/xlink", "href");
21334
- if (!href || !href.startsWith("data:image/svg+xml")) continue;
21381
+ if (!href) continue;
21335
21382
  try {
21336
- const svgContent = decodeSvgDataUri(href);
21383
+ const svgContent = await readNestedSvgImageMarkup(href);
21337
21384
  if (!svgContent || !/<svg[\s>]/i.test(svgContent)) continue;
21338
21385
  const innerDoc = domParser.parseFromString(svgContent, "image/svg+xml");
21339
21386
  if (innerDoc.querySelector("parsererror")) continue;
21340
21387
  const innerSvg = innerDoc.documentElement;
21341
21388
  if (!innerSvg || innerSvg.tagName.toLowerCase() !== "svg") continue;
21389
+ const sourceId = img.getAttribute("id") || `image-${imageIndex}`;
21390
+ prefixSvgIds(innerSvg, `inline-${sourceId}`);
21342
21391
  const ix = parseFloat(img.getAttribute("x") || "0") || 0;
21343
21392
  const iy = parseFloat(img.getAttribute("y") || "0") || 0;
21344
21393
  const iw = parseFloat(img.getAttribute("width") || "0");
21345
21394
  const ih = parseFloat(img.getAttribute("height") || "0");
21346
21395
  if (!(iw > 0 && ih > 0)) continue;
21347
- const nestedSvg = doc.importNode(innerSvg, true);
21348
- if (!nestedSvg.getAttribute("viewBox")) nestedSvg.setAttribute("viewBox", `0 0 ${iw} ${ih}`);
21349
- nestedSvg.setAttribute("x", "0");
21350
- nestedSvg.setAttribute("y", "0");
21351
- nestedSvg.setAttribute("width", String(iw));
21352
- nestedSvg.setAttribute("height", String(ih));
21353
- nestedSvg.setAttribute("preserveAspectRatio", img.getAttribute("preserveAspectRatio") || nestedSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet");
21354
21396
  const g = doc.createElementNS("http://www.w3.org/2000/svg", "g");
21355
21397
  const existingTransform = img.getAttribute("transform") || "";
21356
- g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}translate(${ix},${iy})`);
21398
+ const vb = (innerSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/).map((n) => Number.parseFloat(n));
21399
+ const [vbX, vbY, vbW, vbH] = vb.length === 4 && vb.every((n) => Number.isFinite(n)) && vb[2] > 0 && vb[3] > 0 ? vb : [0, 0, iw, ih];
21400
+ const par = img.getAttribute("preserveAspectRatio") || innerSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet";
21401
+ const parParts = par.trim().split(/\s+/).filter(Boolean);
21402
+ const align = parParts[0] === "defer" ? parParts[1] || "xMidYMid" : parParts[0] || "xMidYMid";
21403
+ const meetOrSlice = parParts[0] === "defer" ? parParts[2] || "meet" : parParts[1] || "meet";
21404
+ let sx = iw / vbW;
21405
+ let sy = ih / vbH;
21406
+ let ox = 0;
21407
+ let oy = 0;
21408
+ if (align !== "none") {
21409
+ const s = meetOrSlice === "slice" ? Math.max(sx, sy) : Math.min(sx, sy);
21410
+ sx = s;
21411
+ sy = s;
21412
+ const extraW = iw - vbW * s;
21413
+ const extraH = ih - vbH * s;
21414
+ if (align.includes("xMid")) ox = extraW / 2;
21415
+ else if (align.includes("xMax")) ox = extraW;
21416
+ if (align.includes("YMid")) oy = extraH / 2;
21417
+ else if (align.includes("YMax")) oy = extraH;
21418
+ }
21419
+ g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}translate(${ix + ox},${iy + oy}) scale(${sx},${sy}) translate(${-vbX},${-vbY})`);
21420
+ const imageClipPath = img.getAttribute("clip-path") || getInlineStyleValue(img, "clip-path");
21421
+ const dropImageClipPath = isRedundantImageClipPathForInlineSvg(root, imageClipPath, ix, iy, iw, ih);
21422
+ if (dropImageClipPath) console.log("[canvas-renderer][pdf] dropped redundant inline SVG image clipPath", { imageIndex, sourceId, clipPath: imageClipPath });
21357
21423
  for (const attr of Array.from(img.attributes)) {
21424
+ if (dropImageClipPath && attr.name === "clip-path") continue;
21425
+ if (dropImageClipPath && attr.name === "style") {
21426
+ const kept = parseInlineSvgStyleDeclarations(attr.value).filter((decl) => decl.key !== "clip-path").map((decl) => `${decl.key}: ${decl.value}`).join("; ");
21427
+ if (kept) g.setAttribute("style", kept);
21428
+ continue;
21429
+ }
21358
21430
  if (["id", "class", "style", "opacity", "display", "visibility", "clip-path", "mask", "filter", "pointer-events"].includes(attr.name)) {
21359
21431
  g.setAttribute(attr.name, attr.value);
21360
21432
  }
21361
21433
  }
21362
- g.appendChild(nestedSvg);
21434
+ for (const child of Array.from(innerSvg.childNodes)) g.appendChild(doc.importNode(child, true));
21363
21435
  (_a = img.parentNode) == null ? void 0 : _a.replaceChild(g, img);
21364
21436
  changed = true;
21437
+ inlined++;
21365
21438
  } catch {
21366
21439
  }
21367
21440
  }
21441
+ if (inlined > 0) console.log(`[canvas-renderer][pdf] inlined ${inlined} nested SVG image(s)`);
21368
21442
  return changed ? new XMLSerializer().serializeToString(doc.documentElement) : svgString;
21369
21443
  } catch {
21370
21444
  return svgString;
21371
21445
  }
21372
21446
  }
21447
+ function parseSvgLength(value, fallback) {
21448
+ if (!value) return fallback;
21449
+ const trimmed = value.trim();
21450
+ if (!trimmed || trimmed.endsWith("%")) return fallback;
21451
+ const parsed = Number.parseFloat(trimmed);
21452
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
21453
+ }
21454
+ function isIdentitySvgMatrix(value) {
21455
+ var _a;
21456
+ if (!value) return true;
21457
+ const nums = ((_a = value.match(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi)) == null ? void 0 : _a.map(Number)) ?? [];
21458
+ return nums.length === 6 && Math.abs(nums[0] - 1) < 1e-3 && Math.abs(nums[1]) < 1e-3 && Math.abs(nums[2]) < 1e-3 && Math.abs(nums[3] - 1) < 1e-3 && Math.abs(nums[4]) < 1e-3 && Math.abs(nums[5]) < 1e-3;
21459
+ }
21460
+ function isRedundantImageClipPathForInlineSvg(root, clipPathRef, ix, iy, iw, ih) {
21461
+ const clipId = extractGradientIdFromPaint(clipPathRef);
21462
+ if (!clipId || !(iw > 0 && ih > 0)) return false;
21463
+ let clip = null;
21464
+ for (const el of root.querySelectorAll("[id]")) {
21465
+ if (el.getAttribute("id") === clipId) {
21466
+ clip = el;
21467
+ break;
21468
+ }
21469
+ }
21470
+ if (!clip || clip.tagName.toLowerCase() !== "clippath") return false;
21471
+ const units = (clip.getAttribute("clipPathUnits") || "userSpaceOnUse").toLowerCase();
21472
+ const rects = Array.from(clip.children).filter((el) => el.tagName.toLowerCase() === "rect");
21473
+ if (rects.length !== 1 || rects[0].parentElement !== clip) return false;
21474
+ const rect = rects[0];
21475
+ if (!isIdentitySvgMatrix(rect.getAttribute("transform"))) return false;
21476
+ const rx = Number.parseFloat(rect.getAttribute("x") || "0") || 0;
21477
+ const ry = Number.parseFloat(rect.getAttribute("y") || "0") || 0;
21478
+ const rw = Number.parseFloat(rect.getAttribute("width") || "0");
21479
+ const rh = Number.parseFloat(rect.getAttribute("height") || "0");
21480
+ if (!(rw > 0 && rh > 0)) return false;
21481
+ const near = (a, b) => Math.abs(a - b) <= Math.max(1, Math.max(Math.abs(a), Math.abs(b)) * 0.01);
21482
+ if (units === "objectboundingbox") return near(rx, 0) && near(ry, 0) && near(rw, 1) && near(rh, 1);
21483
+ return near(rx, ix) && near(ry, iy) && near(rw, iw) && near(rh, ih);
21484
+ }
21485
+ function flattenNestedSvgViewports(rootSvg) {
21486
+ const nestedSvgs = Array.from(rootSvg.querySelectorAll("svg")).filter((svg) => svg !== rootSvg).reverse();
21487
+ let flattened = 0;
21488
+ for (const nestedSvg of nestedSvgs) {
21489
+ const parent = nestedSvg.parentNode;
21490
+ const doc = nestedSvg.ownerDocument;
21491
+ if (!parent || !doc) continue;
21492
+ const vb = (nestedSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/).map((n) => Number.parseFloat(n));
21493
+ const hasViewBox = vb.length === 4 && vb.every((n) => Number.isFinite(n)) && vb[2] > 0 && vb[3] > 0;
21494
+ const [vbX, vbY, vbW, vbH] = hasViewBox ? vb : [0, 0, 0, 0];
21495
+ const width = parseSvgLength(nestedSvg.getAttribute("width"), hasViewBox ? vbW : 0);
21496
+ const height = parseSvgLength(nestedSvg.getAttribute("height"), hasViewBox ? vbH : 0);
21497
+ if (!(width > 0 && height > 0)) continue;
21498
+ const x = Number.parseFloat(nestedSvg.getAttribute("x") || "0") || 0;
21499
+ const y = Number.parseFloat(nestedSvg.getAttribute("y") || "0") || 0;
21500
+ const par = nestedSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet";
21501
+ const parParts = par.trim().split(/\s+/).filter(Boolean);
21502
+ const align = parParts[0] === "defer" ? parParts[1] || "xMidYMid" : parParts[0] || "xMidYMid";
21503
+ const meetOrSlice = parParts[0] === "defer" ? parParts[2] || "meet" : parParts[1] || "meet";
21504
+ let sx = hasViewBox ? width / vbW : 1;
21505
+ let sy = hasViewBox ? height / vbH : 1;
21506
+ let ox = 0;
21507
+ let oy = 0;
21508
+ if (hasViewBox && align !== "none") {
21509
+ const s = meetOrSlice === "slice" ? Math.max(sx, sy) : Math.min(sx, sy);
21510
+ sx = s;
21511
+ sy = s;
21512
+ const extraW = width - vbW * s;
21513
+ const extraH = height - vbH * s;
21514
+ if (align.includes("xMid")) ox = extraW / 2;
21515
+ else if (align.includes("xMax")) ox = extraW;
21516
+ if (align.includes("YMid")) oy = extraH / 2;
21517
+ else if (align.includes("YMax")) oy = extraH;
21518
+ }
21519
+ const g = doc.createElementNS("http://www.w3.org/2000/svg", "g");
21520
+ const existingTransform = nestedSvg.getAttribute("transform") || "";
21521
+ const viewBoxTransform = hasViewBox ? `translate(${x + ox},${y + oy}) scale(${sx},${sy}) translate(${-vbX},${-vbY})` : `translate(${x},${y})`;
21522
+ g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}${viewBoxTransform}`);
21523
+ for (const attr of Array.from(nestedSvg.attributes)) {
21524
+ if (["id", "class", "style", "opacity", "display", "visibility", "clip-path", "mask", "filter", "pointer-events"].includes(attr.name)) g.setAttribute(attr.name, attr.value);
21525
+ }
21526
+ for (const child of Array.from(nestedSvg.childNodes)) g.appendChild(child);
21527
+ parent.replaceChild(g, nestedSvg);
21528
+ flattened++;
21529
+ }
21530
+ if (flattened > 0) console.log("[canvas-renderer][pdf] flattened nested SVG viewport(s)", { flattened });
21531
+ }
21373
21532
  function inlineComputedStyles(svg) {
21374
21533
  if (typeof document === "undefined") return;
21375
21534
  const wrap = document.createElement("div");
@@ -21410,7 +21569,7 @@ function inlineComputedStyles(svg) {
21410
21569
  function disambiguateNestedSvgIds(rootSvg) {
21411
21570
  const nestedSvgs = Array.from(rootSvg.querySelectorAll("svg"));
21412
21571
  const toProcess = nestedSvgs.filter((s) => s !== rootSvg);
21413
- if (toProcess.length < 2) return;
21572
+ if (toProcess.length === 0) return;
21414
21573
  toProcess.forEach((nested, idx) => {
21415
21574
  prefixSvgIds(nested, `n${idx}`);
21416
21575
  });
@@ -22002,7 +22161,7 @@ function restoreSourceFontsForShadowRaster(markup) {
22002
22161
  async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
22003
22162
  try {
22004
22163
  const parser = new DOMParser();
22005
- const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
22164
+ const processedSvg = await inlineNestedSvgImageDataUris(rawSvg, parser);
22006
22165
  const doc = parser.parseFromString(processedSvg, "image/svg+xml");
22007
22166
  if (doc.querySelector("parsererror")) return null;
22008
22167
  const svg = doc.documentElement;
@@ -22016,6 +22175,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
22016
22175
  svg.setAttribute("viewBox", `0 0 ${pageWidth} ${pageHeight}`);
22017
22176
  sanitizeSvgTreeForPdf(svg);
22018
22177
  normalizeSvgViewBoxOrigin(svg);
22178
+ flattenNestedSvgViewports(svg);
22019
22179
  disambiguateNestedSvgIds(svg);
22020
22180
  expandSvgUseElements(svg);
22021
22181
  const svgToDraw = normalizeSvgExplicitColors(svg);
@@ -22029,7 +22189,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
22029
22189
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
22030
22190
  sanitizeSvgTreeForPdf(svgToDraw);
22031
22191
  try {
22032
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CZjhPHZh.cjs"));
22192
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C-l9Vtku.cjs"));
22033
22193
  try {
22034
22194
  await logTextMeasurementDiagnostic(svgToDraw);
22035
22195
  } catch {
@@ -22129,9 +22289,8 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
22129
22289
  }
22130
22290
  const pdf = new jspdf.jsPDF({
22131
22291
  orientation,
22132
- unit: "px",
22292
+ unit: "pt",
22133
22293
  format: [firstPage.width, firstPage.height],
22134
- hotfixes: ["px_scaling"],
22135
22294
  compress: true
22136
22295
  });
22137
22296
  if (title) pdf.setProperties({ title, creator: "Pixldocs" });
@@ -22426,4 +22585,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
22426
22585
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
22427
22586
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
22428
22587
  exports.warmTemplateFromForm = warmTemplateFromForm;
22429
- //# sourceMappingURL=index-DIokvyoP.cjs.map
22588
+ //# sourceMappingURL=index-xWTAswf0.cjs.map