@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.
@@ -17372,7 +17372,13 @@ function sanitizeSectionStateAgainstSchema(state, schema) {
17372
17372
  if (!state) return {};
17373
17373
  if (!schema) return { ...state };
17374
17374
  const known = /* @__PURE__ */ new Set();
17375
- for (const s of schema.sections ?? []) known.add(s.id);
17375
+ const collectSectionIds = (sections) => {
17376
+ for (const s of sections ?? []) {
17377
+ known.add(s.id);
17378
+ collectSectionIds(s.children);
17379
+ }
17380
+ };
17381
+ collectSectionIds(schema.sections);
17376
17382
  for (const p of schema.repeatablePages ?? []) known.add(p.id);
17377
17383
  const out = {};
17378
17384
  for (const [key, value] of Object.entries(state)) {
@@ -17519,7 +17525,7 @@ async function resolveTemplateData(options) {
17519
17525
  }
17520
17526
  }
17521
17527
  if (repeatableSectionsInput.length > 0) {
17522
- paintRepeatableSections(config, repeatableSectionsInput);
17528
+ paintRepeatableSections(config, repeatableSectionsInput, inlineFormSchema);
17523
17529
  }
17524
17530
  }
17525
17531
  const mergedFormData = {
@@ -17591,7 +17597,7 @@ async function resolveFromForm(options) {
17591
17597
  normalizeLayoutModes(templateConfig);
17592
17598
  const repeatableFromSchema = templateFormSchema == null ? void 0 : templateFormSchema.repeatableSections;
17593
17599
  if ((repeatableFromSchema == null ? void 0 : repeatableFromSchema.length) && templateConfig.pages) {
17594
- paintRepeatableSections(templateConfig, repeatableFromSchema);
17600
+ paintRepeatableSections(templateConfig, repeatableFromSchema, templateFormSchema);
17595
17601
  }
17596
17602
  const schemaSections = getRenderableFormSections(formSchema);
17597
17603
  const repeatableNodeMap = /* @__PURE__ */ new Map();
@@ -17894,8 +17900,11 @@ function normalizeLayoutModes(config) {
17894
17900
  }
17895
17901
  }
17896
17902
  }
17897
- function paintRepeatableSections(config, repeatableSections) {
17903
+ function paintRepeatableSections(config, repeatableSections, formSchema) {
17904
+ var _a, _b;
17898
17905
  const pages = config.pages ?? [];
17906
+ const entryFilters = (formSchema == null ? void 0 : formSchema.entryFilters) ?? [];
17907
+ const entryFilterBases = new Set(entryFilters.map((f) => baseId(f.nodeId)));
17899
17908
  function stripFlags(nodes) {
17900
17909
  for (const node of nodes) {
17901
17910
  delete node.repeatableSection;
@@ -17905,32 +17914,53 @@ function paintRepeatableSections(config, repeatableSections) {
17905
17914
  for (const page of pages) {
17906
17915
  if (page.children) stripFlags(page.children);
17907
17916
  }
17908
- function setRepeatable(nodes, nodeId, payload) {
17917
+ function setRepeatableAll(nodes, nodeId, payload) {
17918
+ let painted = 0;
17909
17919
  for (const node of nodes) {
17910
17920
  const id = node.id;
17911
- if (node.repeatableSection) {
17912
- if (Array.isArray(node.children) && setRepeatable(node.children, nodeId, payload)) {
17913
- return true;
17914
- }
17915
- continue;
17916
- }
17917
17921
  if (id && (id === nodeId || baseId(id) === baseId(nodeId))) {
17918
17922
  node.repeatableSection = payload;
17919
- return true;
17923
+ painted++;
17920
17924
  }
17921
- if (Array.isArray(node.children) && setRepeatable(node.children, nodeId, payload)) {
17922
- return true;
17925
+ if (Array.isArray(node.children)) {
17926
+ painted += setRepeatableAll(node.children, nodeId, payload);
17923
17927
  }
17924
17928
  }
17925
- return false;
17929
+ return painted;
17926
17930
  }
17927
17931
  for (const section of repeatableSections) {
17932
+ const inlineRange = ((_a = section.entryFilter) == null ? void 0 : _a.mode) === "range" ? (_b = section.entryFilter.range) == null ? void 0 : _b.trim() : void 0;
17933
+ const shouldUseInlineFilter = !!inlineRange && !entryFilterBases.has(baseId(section.nodeId));
17928
17934
  const payload = { label: section.label };
17929
17935
  if (section.minEntries !== void 0) payload.minEntries = section.minEntries;
17930
17936
  if (section.maxEntries !== void 0) payload.maxEntries = section.maxEntries;
17931
- if (section.entryFilter !== void 0) payload.entryFilter = section.entryFilter;
17937
+ if (shouldUseInlineFilter) payload.entryFilter = { mode: "range", range: inlineRange };
17932
17938
  for (const page of pages) {
17933
- if (setRepeatable(page.children ?? [], section.nodeId, payload)) break;
17939
+ setRepeatableAll(page.children ?? [], section.nodeId, payload);
17940
+ }
17941
+ }
17942
+ if (entryFilters.length) {
17943
+ const occurrencesByBase = /* @__PURE__ */ new Map();
17944
+ const collect = (nodes) => {
17945
+ var _a2;
17946
+ for (const node of nodes ?? []) {
17947
+ if ((_a2 = node.repeatableSection) == null ? void 0 : _a2.label) {
17948
+ const base = baseId(node.id);
17949
+ if (!occurrencesByBase.has(base)) occurrencesByBase.set(base, []);
17950
+ occurrencesByBase.get(base).push(node);
17951
+ }
17952
+ if (Array.isArray(node.children)) collect(node.children);
17953
+ }
17954
+ };
17955
+ for (const page of pages) collect(page.children ?? []);
17956
+ for (const filter of entryFilters) {
17957
+ const base = baseId(filter.nodeId);
17958
+ const occurrences = occurrencesByBase.get(base);
17959
+ if (!(occurrences == null ? void 0 : occurrences.length)) continue;
17960
+ const target = filter.occurrenceIndex && filter.occurrenceIndex >= 1 ? occurrences[filter.occurrenceIndex - 1] : occurrences.find((node) => node.id === filter.nodeId) ?? occurrences[0];
17961
+ if (target == null ? void 0 : target.repeatableSection) {
17962
+ target.repeatableSection.entryFilter = { mode: filter.mode, ...filter.range ? { range: filter.range } : {} };
17963
+ }
17934
17964
  }
17935
17965
  }
17936
17966
  }
@@ -19075,9 +19105,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
19075
19105
  }
19076
19106
  return svgString;
19077
19107
  }
19078
- const resolvedPackageVersion = "0.5.221";
19108
+ const resolvedPackageVersion = "0.5.223";
19079
19109
  const PACKAGE_VERSION = resolvedPackageVersion;
19080
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.221";
19110
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.223";
19081
19111
  const roundParityValue = (value) => {
19082
19112
  if (typeof value !== "number") return value;
19083
19113
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -19821,7 +19851,7 @@ class PixldocsRenderer {
19821
19851
  await this.waitForCanvasScene(container, cloned, i);
19822
19852
  }
19823
19853
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
19824
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BR2dJuvJ.js");
19854
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Cb5fFgNi.js");
19825
19855
  const prepared = preparePagesForExport(
19826
19856
  cloned.pages,
19827
19857
  canvasWidth,
@@ -21217,6 +21247,8 @@ function normalizeSvgViewBoxOrigin(svg) {
21217
21247
  if (parts.length !== 4) return;
21218
21248
  const [vx, vy, vw, vh] = parts;
21219
21249
  if (vw <= 0 || vh <= 0) return;
21250
+ svg.setAttribute("width", String(vw));
21251
+ svg.setAttribute("height", String(vh));
21220
21252
  if (Math.abs(vx) < 1e-3 && Math.abs(vy) < 1e-3) return;
21221
21253
  const doc = svg.ownerDocument;
21222
21254
  if (!doc) return;
@@ -21303,7 +21335,20 @@ function decodeSvgDataUri(href) {
21303
21335
  }
21304
21336
  }
21305
21337
  }
21306
- function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21338
+ async function readNestedSvgImageMarkup(href) {
21339
+ if (!href) return null;
21340
+ if (href.startsWith("data:image/svg+xml")) return decodeSvgDataUri(href);
21341
+ if (!/\.svg(?:[?#]|$)/i.test(href) && !href.startsWith("blob:")) return null;
21342
+ try {
21343
+ const res = await fetch(href, { cache: "no-store" });
21344
+ if (!res.ok) return null;
21345
+ const text = await res.text();
21346
+ return /<svg[\s>]/i.test(text) ? text : null;
21347
+ } catch {
21348
+ return null;
21349
+ }
21350
+ }
21351
+ async function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21307
21352
  var _a;
21308
21353
  try {
21309
21354
  const doc = domParser.parseFromString(svgString, "image/svg+xml");
@@ -21311,47 +21356,161 @@ function inlineNestedSvgImageDataUris(svgString, domParser = new DOMParser()) {
21311
21356
  const root = doc.documentElement;
21312
21357
  if (!root || root.tagName.toLowerCase() !== "svg") return svgString;
21313
21358
  let changed = false;
21314
- for (const img of Array.from(doc.querySelectorAll("image"))) {
21359
+ let inlined = 0;
21360
+ const images = Array.from(doc.querySelectorAll("image"));
21361
+ for (const [imageIndex, img] of images.entries()) {
21315
21362
  const href = img.getAttribute("href") || img.getAttributeNS("http://www.w3.org/1999/xlink", "href");
21316
- if (!href || !href.startsWith("data:image/svg+xml")) continue;
21363
+ if (!href) continue;
21317
21364
  try {
21318
- const svgContent = decodeSvgDataUri(href);
21365
+ const svgContent = await readNestedSvgImageMarkup(href);
21319
21366
  if (!svgContent || !/<svg[\s>]/i.test(svgContent)) continue;
21320
21367
  const innerDoc = domParser.parseFromString(svgContent, "image/svg+xml");
21321
21368
  if (innerDoc.querySelector("parsererror")) continue;
21322
21369
  const innerSvg = innerDoc.documentElement;
21323
21370
  if (!innerSvg || innerSvg.tagName.toLowerCase() !== "svg") continue;
21371
+ const sourceId = img.getAttribute("id") || `image-${imageIndex}`;
21372
+ prefixSvgIds(innerSvg, `inline-${sourceId}`);
21324
21373
  const ix = parseFloat(img.getAttribute("x") || "0") || 0;
21325
21374
  const iy = parseFloat(img.getAttribute("y") || "0") || 0;
21326
21375
  const iw = parseFloat(img.getAttribute("width") || "0");
21327
21376
  const ih = parseFloat(img.getAttribute("height") || "0");
21328
21377
  if (!(iw > 0 && ih > 0)) continue;
21329
- const nestedSvg = doc.importNode(innerSvg, true);
21330
- if (!nestedSvg.getAttribute("viewBox")) nestedSvg.setAttribute("viewBox", `0 0 ${iw} ${ih}`);
21331
- nestedSvg.setAttribute("x", "0");
21332
- nestedSvg.setAttribute("y", "0");
21333
- nestedSvg.setAttribute("width", String(iw));
21334
- nestedSvg.setAttribute("height", String(ih));
21335
- nestedSvg.setAttribute("preserveAspectRatio", img.getAttribute("preserveAspectRatio") || nestedSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet");
21336
21378
  const g = doc.createElementNS("http://www.w3.org/2000/svg", "g");
21337
21379
  const existingTransform = img.getAttribute("transform") || "";
21338
- g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}translate(${ix},${iy})`);
21380
+ const vb = (innerSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/).map((n) => Number.parseFloat(n));
21381
+ 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];
21382
+ const par = img.getAttribute("preserveAspectRatio") || innerSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet";
21383
+ const parParts = par.trim().split(/\s+/).filter(Boolean);
21384
+ const align = parParts[0] === "defer" ? parParts[1] || "xMidYMid" : parParts[0] || "xMidYMid";
21385
+ const meetOrSlice = parParts[0] === "defer" ? parParts[2] || "meet" : parParts[1] || "meet";
21386
+ let sx = iw / vbW;
21387
+ let sy = ih / vbH;
21388
+ let ox = 0;
21389
+ let oy = 0;
21390
+ if (align !== "none") {
21391
+ const s = meetOrSlice === "slice" ? Math.max(sx, sy) : Math.min(sx, sy);
21392
+ sx = s;
21393
+ sy = s;
21394
+ const extraW = iw - vbW * s;
21395
+ const extraH = ih - vbH * s;
21396
+ if (align.includes("xMid")) ox = extraW / 2;
21397
+ else if (align.includes("xMax")) ox = extraW;
21398
+ if (align.includes("YMid")) oy = extraH / 2;
21399
+ else if (align.includes("YMax")) oy = extraH;
21400
+ }
21401
+ g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}translate(${ix + ox},${iy + oy}) scale(${sx},${sy}) translate(${-vbX},${-vbY})`);
21402
+ const imageClipPath = img.getAttribute("clip-path") || getInlineStyleValue(img, "clip-path");
21403
+ const dropImageClipPath = isRedundantImageClipPathForInlineSvg(root, imageClipPath, ix, iy, iw, ih);
21404
+ if (dropImageClipPath) console.log("[canvas-renderer][pdf] dropped redundant inline SVG image clipPath", { imageIndex, sourceId, clipPath: imageClipPath });
21339
21405
  for (const attr of Array.from(img.attributes)) {
21406
+ if (dropImageClipPath && attr.name === "clip-path") continue;
21407
+ if (dropImageClipPath && attr.name === "style") {
21408
+ const kept = parseInlineSvgStyleDeclarations(attr.value).filter((decl) => decl.key !== "clip-path").map((decl) => `${decl.key}: ${decl.value}`).join("; ");
21409
+ if (kept) g.setAttribute("style", kept);
21410
+ continue;
21411
+ }
21340
21412
  if (["id", "class", "style", "opacity", "display", "visibility", "clip-path", "mask", "filter", "pointer-events"].includes(attr.name)) {
21341
21413
  g.setAttribute(attr.name, attr.value);
21342
21414
  }
21343
21415
  }
21344
- g.appendChild(nestedSvg);
21416
+ for (const child of Array.from(innerSvg.childNodes)) g.appendChild(doc.importNode(child, true));
21345
21417
  (_a = img.parentNode) == null ? void 0 : _a.replaceChild(g, img);
21346
21418
  changed = true;
21419
+ inlined++;
21347
21420
  } catch {
21348
21421
  }
21349
21422
  }
21423
+ if (inlined > 0) console.log(`[canvas-renderer][pdf] inlined ${inlined} nested SVG image(s)`);
21350
21424
  return changed ? new XMLSerializer().serializeToString(doc.documentElement) : svgString;
21351
21425
  } catch {
21352
21426
  return svgString;
21353
21427
  }
21354
21428
  }
21429
+ function parseSvgLength(value, fallback) {
21430
+ if (!value) return fallback;
21431
+ const trimmed = value.trim();
21432
+ if (!trimmed || trimmed.endsWith("%")) return fallback;
21433
+ const parsed = Number.parseFloat(trimmed);
21434
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
21435
+ }
21436
+ function isIdentitySvgMatrix(value) {
21437
+ var _a;
21438
+ if (!value) return true;
21439
+ const nums = ((_a = value.match(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi)) == null ? void 0 : _a.map(Number)) ?? [];
21440
+ 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;
21441
+ }
21442
+ function isRedundantImageClipPathForInlineSvg(root, clipPathRef, ix, iy, iw, ih) {
21443
+ const clipId = extractGradientIdFromPaint(clipPathRef);
21444
+ if (!clipId || !(iw > 0 && ih > 0)) return false;
21445
+ let clip = null;
21446
+ for (const el of root.querySelectorAll("[id]")) {
21447
+ if (el.getAttribute("id") === clipId) {
21448
+ clip = el;
21449
+ break;
21450
+ }
21451
+ }
21452
+ if (!clip || clip.tagName.toLowerCase() !== "clippath") return false;
21453
+ const units = (clip.getAttribute("clipPathUnits") || "userSpaceOnUse").toLowerCase();
21454
+ const rects = Array.from(clip.children).filter((el) => el.tagName.toLowerCase() === "rect");
21455
+ if (rects.length !== 1 || rects[0].parentElement !== clip) return false;
21456
+ const rect = rects[0];
21457
+ if (!isIdentitySvgMatrix(rect.getAttribute("transform"))) return false;
21458
+ const rx = Number.parseFloat(rect.getAttribute("x") || "0") || 0;
21459
+ const ry = Number.parseFloat(rect.getAttribute("y") || "0") || 0;
21460
+ const rw = Number.parseFloat(rect.getAttribute("width") || "0");
21461
+ const rh = Number.parseFloat(rect.getAttribute("height") || "0");
21462
+ if (!(rw > 0 && rh > 0)) return false;
21463
+ const near = (a, b) => Math.abs(a - b) <= Math.max(1, Math.max(Math.abs(a), Math.abs(b)) * 0.01);
21464
+ if (units === "objectboundingbox") return near(rx, 0) && near(ry, 0) && near(rw, 1) && near(rh, 1);
21465
+ return near(rx, ix) && near(ry, iy) && near(rw, iw) && near(rh, ih);
21466
+ }
21467
+ function flattenNestedSvgViewports(rootSvg) {
21468
+ const nestedSvgs = Array.from(rootSvg.querySelectorAll("svg")).filter((svg) => svg !== rootSvg).reverse();
21469
+ let flattened = 0;
21470
+ for (const nestedSvg of nestedSvgs) {
21471
+ const parent = nestedSvg.parentNode;
21472
+ const doc = nestedSvg.ownerDocument;
21473
+ if (!parent || !doc) continue;
21474
+ const vb = (nestedSvg.getAttribute("viewBox") || "").trim().split(/[\s,]+/).map((n) => Number.parseFloat(n));
21475
+ const hasViewBox = vb.length === 4 && vb.every((n) => Number.isFinite(n)) && vb[2] > 0 && vb[3] > 0;
21476
+ const [vbX, vbY, vbW, vbH] = hasViewBox ? vb : [0, 0, 0, 0];
21477
+ const width = parseSvgLength(nestedSvg.getAttribute("width"), hasViewBox ? vbW : 0);
21478
+ const height = parseSvgLength(nestedSvg.getAttribute("height"), hasViewBox ? vbH : 0);
21479
+ if (!(width > 0 && height > 0)) continue;
21480
+ const x = Number.parseFloat(nestedSvg.getAttribute("x") || "0") || 0;
21481
+ const y = Number.parseFloat(nestedSvg.getAttribute("y") || "0") || 0;
21482
+ const par = nestedSvg.getAttribute("preserveAspectRatio") || "xMidYMid meet";
21483
+ const parParts = par.trim().split(/\s+/).filter(Boolean);
21484
+ const align = parParts[0] === "defer" ? parParts[1] || "xMidYMid" : parParts[0] || "xMidYMid";
21485
+ const meetOrSlice = parParts[0] === "defer" ? parParts[2] || "meet" : parParts[1] || "meet";
21486
+ let sx = hasViewBox ? width / vbW : 1;
21487
+ let sy = hasViewBox ? height / vbH : 1;
21488
+ let ox = 0;
21489
+ let oy = 0;
21490
+ if (hasViewBox && align !== "none") {
21491
+ const s = meetOrSlice === "slice" ? Math.max(sx, sy) : Math.min(sx, sy);
21492
+ sx = s;
21493
+ sy = s;
21494
+ const extraW = width - vbW * s;
21495
+ const extraH = height - vbH * s;
21496
+ if (align.includes("xMid")) ox = extraW / 2;
21497
+ else if (align.includes("xMax")) ox = extraW;
21498
+ if (align.includes("YMid")) oy = extraH / 2;
21499
+ else if (align.includes("YMax")) oy = extraH;
21500
+ }
21501
+ const g = doc.createElementNS("http://www.w3.org/2000/svg", "g");
21502
+ const existingTransform = nestedSvg.getAttribute("transform") || "";
21503
+ const viewBoxTransform = hasViewBox ? `translate(${x + ox},${y + oy}) scale(${sx},${sy}) translate(${-vbX},${-vbY})` : `translate(${x},${y})`;
21504
+ g.setAttribute("transform", `${existingTransform}${existingTransform ? " " : ""}${viewBoxTransform}`);
21505
+ for (const attr of Array.from(nestedSvg.attributes)) {
21506
+ if (["id", "class", "style", "opacity", "display", "visibility", "clip-path", "mask", "filter", "pointer-events"].includes(attr.name)) g.setAttribute(attr.name, attr.value);
21507
+ }
21508
+ for (const child of Array.from(nestedSvg.childNodes)) g.appendChild(child);
21509
+ parent.replaceChild(g, nestedSvg);
21510
+ flattened++;
21511
+ }
21512
+ if (flattened > 0) console.log("[canvas-renderer][pdf] flattened nested SVG viewport(s)", { flattened });
21513
+ }
21355
21514
  function inlineComputedStyles(svg) {
21356
21515
  if (typeof document === "undefined") return;
21357
21516
  const wrap = document.createElement("div");
@@ -21392,7 +21551,7 @@ function inlineComputedStyles(svg) {
21392
21551
  function disambiguateNestedSvgIds(rootSvg) {
21393
21552
  const nestedSvgs = Array.from(rootSvg.querySelectorAll("svg"));
21394
21553
  const toProcess = nestedSvgs.filter((s) => s !== rootSvg);
21395
- if (toProcess.length < 2) return;
21554
+ if (toProcess.length === 0) return;
21396
21555
  toProcess.forEach((nested, idx) => {
21397
21556
  prefixSvgIds(nested, `n${idx}`);
21398
21557
  });
@@ -21984,7 +22143,7 @@ function restoreSourceFontsForShadowRaster(markup) {
21984
22143
  async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey, options) {
21985
22144
  try {
21986
22145
  const parser = new DOMParser();
21987
- const processedSvg = inlineNestedSvgImageDataUris(rawSvg, parser);
22146
+ const processedSvg = await inlineNestedSvgImageDataUris(rawSvg, parser);
21988
22147
  const doc = parser.parseFromString(processedSvg, "image/svg+xml");
21989
22148
  if (doc.querySelector("parsererror")) return null;
21990
22149
  const svg = doc.documentElement;
@@ -21998,6 +22157,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
21998
22157
  svg.setAttribute("viewBox", `0 0 ${pageWidth} ${pageHeight}`);
21999
22158
  sanitizeSvgTreeForPdf(svg);
22000
22159
  normalizeSvgViewBoxOrigin(svg);
22160
+ flattenNestedSvgViewports(svg);
22001
22161
  disambiguateNestedSvgIds(svg);
22002
22162
  expandSvgUseElements(svg);
22003
22163
  const svgToDraw = normalizeSvgExplicitColors(svg);
@@ -22011,7 +22171,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
22011
22171
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
22012
22172
  sanitizeSvgTreeForPdf(svgToDraw);
22013
22173
  try {
22014
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BR2dJuvJ.js");
22174
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Cb5fFgNi.js");
22015
22175
  try {
22016
22176
  await logTextMeasurementDiagnostic(svgToDraw);
22017
22177
  } catch {
@@ -22111,9 +22271,8 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
22111
22271
  }
22112
22272
  const pdf = new jsPDF({
22113
22273
  orientation,
22114
- unit: "px",
22274
+ unit: "pt",
22115
22275
  format: [firstPage.width, firstPage.height],
22116
- hotfixes: ["px_scaling"],
22117
22276
  compress: true
22118
22277
  });
22119
22278
  if (title) pdf.setProperties({ title, creator: "Pixldocs" });
@@ -22411,4 +22570,4 @@ export {
22411
22570
  buildTeaserBlurFlatKeys as y,
22412
22571
  collectFontDescriptorsFromConfig as z
22413
22572
  };
22414
- //# sourceMappingURL=index-mmjF0tPc.js.map
22573
+ //# sourceMappingURL=index-DXJtHKQO.js.map