@pixldocs/canvas-renderer 0.5.373 → 0.5.374

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.
@@ -2,7 +2,7 @@
2
2
  var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- var _a, _b;
5
+ var _a, _b, _c;
6
6
  const jsxRuntime = require("react/jsx-runtime");
7
7
  const react = require("react");
8
8
  const reactDom = require("react-dom");
@@ -311,14 +311,14 @@ function lineToString(line) {
311
311
  return Array.isArray(line) ? line.join("") : String(line ?? "");
312
312
  }
313
313
  function measureTextLineWithCanvas(textbox, lineText, lineIndex) {
314
- var _a2, _b2, _c, _d, _e;
314
+ var _a2, _b2, _c2, _d, _e;
315
315
  if (!lineText) return 0;
316
316
  const ctx = getMeasureContext();
317
317
  if (!ctx) return null;
318
318
  const tb = textbox;
319
319
  const fontSize = Number(((_a2 = tb.getValueOfPropertyAt) == null ? void 0 : _a2.call(tb, lineIndex, 0, "fontSize")) ?? textbox.fontSize ?? 16);
320
320
  const fontStyle = String(((_b2 = tb.getValueOfPropertyAt) == null ? void 0 : _b2.call(tb, lineIndex, 0, "fontStyle")) ?? textbox.fontStyle ?? "normal");
321
- const fontWeight = String(((_c = tb.getValueOfPropertyAt) == null ? void 0 : _c.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
321
+ const fontWeight = String(((_c2 = tb.getValueOfPropertyAt) == null ? void 0 : _c2.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
322
322
  const fontFamily = String(((_d = tb.getValueOfPropertyAt) == null ? void 0 : _d.call(tb, lineIndex, 0, "fontFamily")) ?? textbox.fontFamily ?? "Open Sans");
323
323
  const charSpacing = Number(((_e = tb.getValueOfPropertyAt) == null ? void 0 : _e.call(tb, lineIndex, 0, "charSpacing")) ?? textbox.charSpacing ?? 0);
324
324
  ctx.save();
@@ -3638,14 +3638,14 @@ const clearFontCacheAndRerender = (canvas, options = {}) => {
3638
3638
  canvas.requestRenderAll();
3639
3639
  };
3640
3640
  const ensureFontLoaded = async (fontFamily) => {
3641
- var _a2, _b2, _c;
3641
+ var _a2, _b2, _c2;
3642
3642
  if (!fontFamily) return;
3643
3643
  if (LOCAL_FONTS.has(fontFamily)) {
3644
3644
  try {
3645
3645
  const isLoaded = (_a2 = document.fonts) == null ? void 0 : _a2.check(`16px "${fontFamily}"`);
3646
3646
  if (isLoaded) return;
3647
3647
  await ((_b2 = document.fonts) == null ? void 0 : _b2.load(`16px "${fontFamily}"`));
3648
- await ((_c = document.fonts) == null ? void 0 : _c.load(`bold 16px "${fontFamily}"`));
3648
+ await ((_c2 = document.fonts) == null ? void 0 : _c2.load(`bold 16px "${fontFamily}"`));
3649
3649
  } catch (e) {
3650
3650
  console.warn(`Failed to ensure local font loaded: ${fontFamily}`, e);
3651
3651
  }
@@ -4139,7 +4139,7 @@ function createImageClipPath(element, imgWidth, imgHeight) {
4139
4139
  }
4140
4140
  }
4141
4141
  async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef, isTransforming) {
4142
- var _a2, _b2, _c, _d;
4142
+ var _a2, _b2, _c2, _d;
4143
4143
  const imageUrl = element.src || element.imageUrl;
4144
4144
  if (!imageUrl) return;
4145
4145
  const nextSvgColorMap = element.svgColorMap ? JSON.stringify(element.svgColorMap) : "";
@@ -4304,7 +4304,7 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
4304
4304
  const existingImg = (_a2 = existingCropGroup.__cropData) == null ? void 0 : _a2._img;
4305
4305
  if (existingImg) {
4306
4306
  panX = ((_b2 = existingImg._ct) == null ? void 0 : _b2.panX) ?? existingImg.__panX ?? 0.5;
4307
- panY = ((_c = existingImg._ct) == null ? void 0 : _c.panY) ?? existingImg.__panY ?? 0.5;
4307
+ panY = ((_c2 = existingImg._ct) == null ? void 0 : _c2.panY) ?? existingImg.__panY ?? 0.5;
4308
4308
  zoom = ((_d = existingImg._ct) == null ? void 0 : _d.zoom) ?? 1;
4309
4309
  }
4310
4310
  }
@@ -4539,7 +4539,7 @@ async function detectMaskType(svgUrl) {
4539
4539
  }
4540
4540
  }
4541
4541
  async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4542
- var _a2, _b2, _c;
4542
+ var _a2, _b2, _c2;
4543
4543
  if (!isCropGroup(cropGroup)) {
4544
4544
  throw new Error("Selected object is not a crop group / image");
4545
4545
  }
@@ -4569,7 +4569,7 @@ async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4569
4569
  child.dirty = true;
4570
4570
  }
4571
4571
  }
4572
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4572
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4573
4573
  }
4574
4574
  function loadSvgAsImage(svgUrl) {
4575
4575
  return new Promise((resolve, reject) => {
@@ -4630,7 +4630,7 @@ async function buildLuminanceAlphaCanvas(svgUrl, frameW, frameH) {
4630
4630
  return canvas;
4631
4631
  }
4632
4632
  async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4633
- var _a2, _b2, _c;
4633
+ var _a2, _b2, _c2;
4634
4634
  if (!isCropGroup(cropGroup)) {
4635
4635
  throw new Error("Selected object is not a crop group / image");
4636
4636
  }
@@ -4665,7 +4665,7 @@ async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4665
4665
  child.dirty = true;
4666
4666
  }
4667
4667
  }
4668
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4668
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4669
4669
  }
4670
4670
  async function applyMaskToCropGroup(cropGroup, svgUrl, maskType) {
4671
4671
  if (maskType === "luminance") {
@@ -4684,7 +4684,7 @@ function getAppliedSvgMaskType(obj) {
4684
4684
  return t === "luminance" || t === "shape" ? t : null;
4685
4685
  }
4686
4686
  function clearSvgMaskFromCropGroup(cropGroup) {
4687
- var _a2, _b2, _c;
4687
+ var _a2, _b2, _c2;
4688
4688
  if (!isCropGroup(cropGroup)) return;
4689
4689
  const frameW = ((_a2 = cropGroup._ct) == null ? void 0 : _a2.frameW) ?? cropGroup.width ?? 0;
4690
4690
  const frameH = ((_b2 = cropGroup._ct) == null ? void 0 : _b2.frameH) ?? cropGroup.height ?? 0;
@@ -4706,7 +4706,7 @@ function clearSvgMaskFromCropGroup(cropGroup) {
4706
4706
  delete cropGroup.__svgMaskUrl;
4707
4707
  delete cropGroup.__svgMaskType;
4708
4708
  cropGroup.dirty = true;
4709
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4709
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4710
4710
  }
4711
4711
  const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4712
4712
  __proto__: null,
@@ -6198,7 +6198,7 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
6198
6198
  const MIN_SNAP_BOX = 20;
6199
6199
  const SNAP_HYSTERESIS_PX = 6;
6200
6200
  function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, snapToGuides, snapThreshold, excludeObjectId, options) {
6201
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
6201
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
6202
6202
  const hysteresis = (options == null ? void 0 : options.hysteresis) ?? SNAP_HYSTERESIS_PX;
6203
6203
  const activeSnapRef = options == null ? void 0 : options.activeSnapRef;
6204
6204
  const roundSnappedOnly = (options == null ? void 0 : options.roundSnappedOnly) ?? false;
@@ -6294,7 +6294,7 @@ function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, sna
6294
6294
  let snappedTop = false;
6295
6295
  let snappedBottom = false;
6296
6296
  if (resizingLeft) {
6297
- const stick = (_c = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c.left;
6297
+ const stick = (_c2 = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c2.left;
6298
6298
  if (stick !== void 0) {
6299
6299
  const dist = Math.abs(box.left - stick);
6300
6300
  if (dist <= releaseDist) {
@@ -6948,7 +6948,7 @@ function scaleLocalToScreen(target, p) {
6948
6948
  return new fabric__namespace.Point(p.x * sx * zx, p.y * sy * zy);
6949
6949
  }
6950
6950
  function applyTextPathControls(textbox) {
6951
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6951
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6952
6952
  const obj = textbox;
6953
6953
  if (!hasActiveTextPath(obj)) {
6954
6954
  obj.__pdTextPathHovered = false;
@@ -6971,7 +6971,7 @@ function applyTextPathControls(textbox) {
6971
6971
  delete obj.controls.bzMidT1;
6972
6972
  delete obj.controls.tpRot;
6973
6973
  delete obj.controls.tpPivot;
6974
- (_c = obj.setControlsVisibility) == null ? void 0 : _c.call(obj, { tl: true, tr: true, bl: true, br: true, mt: true, mb: true, ml: true, mr: true, mtr: true });
6974
+ (_c2 = obj.setControlsVisibility) == null ? void 0 : _c2.call(obj, { tl: true, tr: true, bl: true, br: true, mt: true, mb: true, ml: true, mr: true, mtr: true });
6975
6975
  obj.hasBorders = true;
6976
6976
  obj.__pdTextPathControls = false;
6977
6977
  obj.setCoords();
@@ -7671,10 +7671,10 @@ function textPathBoundsContainScenePoint(obj, point) {
7671
7671
  }
7672
7672
  }
7673
7673
  function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7674
- var _a2, _b2, _c;
7674
+ var _a2, _b2, _c2;
7675
7675
  const host = hostCanvas || obj.canvas || ((_a2 = obj.group) == null ? void 0 : _a2.canvas);
7676
7676
  if (!host) return;
7677
- const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c = obj.getCanvasRetinaScaling) == null ? void 0 : _c.call(obj)) || 1;
7677
+ const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c2 = obj.getCanvasRetinaScaling) == null ? void 0 : _c2.call(obj)) || 1;
7678
7678
  const matrix = fabric__namespace.util.multiplyTransformMatrices(host.viewportTransform || [1, 0, 0, 1, 0, 0], obj.calcTransformMatrix());
7679
7679
  const corners = [
7680
7680
  new fabric__namespace.Point(bounds.minX, bounds.minY),
@@ -7696,8 +7696,8 @@ function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7696
7696
  }
7697
7697
  if (typeof TextboxProto._renderControls === "function" && !TextboxProto.__pixldocsOrigRenderControls) {
7698
7698
  let drawWarpGuides = function(ctx) {
7699
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
7700
- const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((_c = (_b2 = this.group) == null ? void 0 : _b2.group) == null ? void 0 : _c.canvas);
7699
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
7700
+ const hostCanvas = this.canvas || ((_a2 = this.group) == null ? void 0 : _a2.canvas) || ((_c2 = (_b2 = this.group) == null ? void 0 : _b2.group) == null ? void 0 : _c2.canvas);
7701
7701
  if (!hostCanvas) return;
7702
7702
  const hoverBounds = getTextPathHitBounds(this);
7703
7703
  const active = (_d = hostCanvas.getActiveObject) == null ? void 0 : _d.call(hostCanvas);
@@ -8120,14 +8120,14 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
8120
8120
  ctx.closePath();
8121
8121
  }
8122
8122
  function measureLineGlyphWidth(obj, lineIndex) {
8123
- var _a2, _b2, _c, _d, _e, _f;
8123
+ var _a2, _b2, _c2, _d, _e, _f;
8124
8124
  try {
8125
8125
  const rawLine = (_a2 = obj == null ? void 0 : obj._textLines) == null ? void 0 : _a2[lineIndex];
8126
8126
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
8127
8127
  if (!lineText) return 0;
8128
8128
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
8129
8129
  if (!fontSize) return 0;
8130
- const fontStyle = String(((_c = obj.getValueOfPropertyAt) == null ? void 0 : _c.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8130
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8131
8131
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
8132
8132
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
8133
8133
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -9518,7 +9518,7 @@ function createShape(element) {
9518
9518
  }
9519
9519
  }
9520
9520
  function createText(element) {
9521
- var _a2, _b2, _c, _d, _e;
9521
+ var _a2, _b2, _c2, _d, _e;
9522
9522
  const overflowPolicy = element.overflowPolicy || "grow-and-push";
9523
9523
  let text = element.text ?? "";
9524
9524
  let fontSize = element.fontSize || 16;
@@ -9734,7 +9734,7 @@ function createText(element) {
9734
9734
  } catch {
9735
9735
  }
9736
9736
  try {
9737
- const baseCtrls = (_d = (_c = fabric__namespace.Object) == null ? void 0 : _c.prototype) == null ? void 0 : _d.controls;
9737
+ const baseCtrls = (_d = (_c2 = fabric__namespace.Object) == null ? void 0 : _c2.prototype) == null ? void 0 : _d.controls;
9738
9738
  if (baseCtrls) {
9739
9739
  textbox.controls = {
9740
9740
  ...textbox.controls || {},
@@ -10592,13 +10592,13 @@ try {
10592
10592
  };
10593
10593
  const COLLAPSE_THRESHOLD_PX = 32;
10594
10594
  const shouldCollapseHandles = (fabricObject) => {
10595
- var _a2, _b2, _c;
10595
+ var _a2, _b2, _c2;
10596
10596
  try {
10597
10597
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
10598
10598
  if (!canvas) return false;
10599
10599
  const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
10600
10600
  const w = (((_b2 = fabricObject.getScaledWidth) == null ? void 0 : _b2.call(fabricObject)) ?? fabricObject.width ?? 0) * zoom;
10601
- const h = (((_c = fabricObject.getScaledHeight) == null ? void 0 : _c.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
10601
+ const h = (((_c2 = fabricObject.getScaledHeight) == null ? void 0 : _c2.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
10602
10602
  return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
10603
10603
  } catch {
10604
10604
  return false;
@@ -10616,11 +10616,11 @@ try {
10616
10616
  control.__pixldocsCollapseVisibilityWrapped = true;
10617
10617
  };
10618
10618
  const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
10619
- var _a2, _b2, _c;
10619
+ var _a2, _b2, _c2;
10620
10620
  const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
10621
10621
  if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10622
10622
  if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
10623
- const angle = ((_c = fabricObject.getTotalAngle) == null ? void 0 : _c.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10623
+ const angle = ((_c2 = fabricObject.getTotalAngle) == null ? void 0 : _c2.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10624
10624
  const p = getHoverProgress(fabricObject, controlKey);
10625
10625
  const scale = getVisualScale(fabricObject);
10626
10626
  const pillLen = PILL_LEN * scale;
@@ -10817,7 +10817,7 @@ try {
10817
10817
  mtr.x = 0;
10818
10818
  mtr.y = -0.5;
10819
10819
  mtr.cursorStyle = getRotateCursor(null);
10820
- mtr.cursorStyleHandler = (_e, _c, fabricObject) => {
10820
+ mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
10821
10821
  const cursor = getRotateCursor(fabricObject);
10822
10822
  try {
10823
10823
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
@@ -10960,6 +10960,35 @@ try {
10960
10960
  }
10961
10961
  return controls;
10962
10962
  };
10963
+ const ControlProto = (_b = fabric__namespace.Control) == null ? void 0 : _b.prototype;
10964
+ if (ControlProto && !ControlProto.__pixldocsCanvaRenderFallback) {
10965
+ const originalControlRender = ControlProto.render;
10966
+ ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
10967
+ const actionName = String(this.actionName ?? "");
10968
+ if (actionName !== "rotate" && actionName !== "drag") {
10969
+ const x = Number(this.x ?? 0);
10970
+ const y = Number(this.y ?? 0);
10971
+ const atLeftRight = Math.abs(Math.abs(x) - 0.5) < 1e-3;
10972
+ const atTopBottom = Math.abs(Math.abs(y) - 0.5) < 1e-3;
10973
+ const atCenterX = Math.abs(x) < 1e-3;
10974
+ const atCenterY = Math.abs(y) < 1e-3;
10975
+ if (atLeftRight && atCenterY) {
10976
+ const key = x < 0 ? "ml" : "mr";
10977
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "vertical", key);
10978
+ }
10979
+ if (atCenterX && atTopBottom) {
10980
+ const key = y < 0 ? "mt" : "mb";
10981
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "horizontal", key);
10982
+ }
10983
+ if (atLeftRight && atTopBottom) {
10984
+ const key = `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
10985
+ return renderCornerDot(ctx, left, top, styleOverride, fabricObject, key);
10986
+ }
10987
+ }
10988
+ return originalControlRender.call(this, ctx, left, top, styleOverride, fabricObject);
10989
+ };
10990
+ ControlProto.__pixldocsCanvaRenderFallback = true;
10991
+ }
10963
10992
  ensureCanvaControlRenders = (obj) => {
10964
10993
  try {
10965
10994
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -10992,7 +11021,7 @@ try {
10992
11021
  wrapClassCreateControls(fabric__namespace.IText);
10993
11022
  wrapClassCreateControls(fabric__namespace.ActiveSelection);
10994
11023
  wrapClassCreateControls(fabric__namespace.Group);
10995
- const CanvasProto = (_b = fabric__namespace.Canvas) == null ? void 0 : _b.prototype;
11024
+ const CanvasProto = (_c = fabric__namespace.Canvas) == null ? void 0 : _c.prototype;
10996
11025
  if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
10997
11026
  const origSet = CanvasProto._setCursorFromEvent;
10998
11027
  CanvasProto._setCursorFromEvent = function(e, target) {
@@ -11140,14 +11169,14 @@ const matrixForRotDriftLog = (matrix) => {
11140
11169
  return matrix.map((entry) => roundRotDriftNumber(entry));
11141
11170
  };
11142
11171
  const summarizeRotDriftObject = (obj, worldMatrix) => {
11143
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11172
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11144
11173
  if (!obj) return null;
11145
11174
  const anyObj = obj;
11146
11175
  try {
11147
11176
  const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
11148
11177
  const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
11149
11178
  const decomposed = calcWorld ? fabric__namespace.util.qrDecompose(calcWorld) : null;
11150
- const center = (_c = obj.getCenterPoint) == null ? void 0 : _c.call(obj);
11179
+ const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
11151
11180
  const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
11152
11181
  return {
11153
11182
  id: getObjectId(obj),
@@ -12678,7 +12707,7 @@ const PageCanvas = react.forwardRef(
12678
12707
  clearSectionGroupTransientSnapshot();
12679
12708
  });
12680
12709
  const syncSelectionToStore = () => {
12681
- var _a2, _b2, _c, _d;
12710
+ var _a2, _b2, _c2, _d;
12682
12711
  if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
12683
12712
  const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
12684
12713
  let topmost = null;
@@ -12747,7 +12776,7 @@ const PageCanvas = react.forwardRef(
12747
12776
  }
12748
12777
  if (ids.length > 1 && !(active instanceof fabric__namespace.ActiveSelection && active.__pixldocsGroupSelection)) {
12749
12778
  const state = useEditorStore.getState();
12750
- const currentPage2 = (_c = state.canvas.pages) == null ? void 0 : _c.find((p) => p.id === pageId);
12779
+ const currentPage2 = (_c2 = state.canvas.pages) == null ? void 0 : _c2.find((p) => p.id === pageId);
12751
12780
  const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
12752
12781
  const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
12753
12782
  const involvedGroupIds = /* @__PURE__ */ new Set();
@@ -12888,7 +12917,7 @@ const PageCanvas = react.forwardRef(
12888
12917
  }
12889
12918
  });
12890
12919
  fabricCanvas.on("mouse:dblclick", (opt) => {
12891
- var _a2, _b2, _c;
12920
+ var _a2, _b2, _c2;
12892
12921
  const target = opt == null ? void 0 : opt.target;
12893
12922
  if (!target) return;
12894
12923
  if (target.isEditing) return;
@@ -12984,7 +13013,7 @@ const PageCanvas = react.forwardRef(
12984
13013
  const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
12985
13014
  selectElements([selectedId], false, false);
12986
13015
  try {
12987
- (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
13016
+ (_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
12988
13017
  } catch {
12989
13018
  }
12990
13019
  });
@@ -13135,7 +13164,7 @@ const PageCanvas = react.forwardRef(
13135
13164
  };
13136
13165
  const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
13137
13166
  const pickChildInActiveSelectionAtPointer = (selection, event) => {
13138
- var _a2, _b2, _c, _d, _e;
13167
+ var _a2, _b2, _c2, _d, _e;
13139
13168
  try {
13140
13169
  const pointer = fabricCanvas.getPointer(event);
13141
13170
  const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
@@ -13146,7 +13175,7 @@ const PageCanvas = react.forwardRef(
13146
13175
  const obj = members[i];
13147
13176
  const id = getObjectId(obj);
13148
13177
  if (!id || id === "__background__" || obj.visible === false) continue;
13149
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
13178
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
13150
13179
  const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
13151
13180
  const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
13152
13181
  if (containsScene || containsViewport) return obj;
@@ -13180,7 +13209,7 @@ const PageCanvas = react.forwardRef(
13180
13209
  };
13181
13210
  let pendingShiftMultiSelect = null;
13182
13211
  const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
13183
- var _a2, _b2, _c;
13212
+ var _a2, _b2, _c2;
13184
13213
  if (!target || !target.selectable) return false;
13185
13214
  const active = baselineActive;
13186
13215
  if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
@@ -13215,7 +13244,7 @@ const PageCanvas = react.forwardRef(
13215
13244
  });
13216
13245
  }
13217
13246
  (_b2 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _b2.call(event);
13218
- (_c = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c.call(event);
13247
+ (_c2 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c2.call(event);
13219
13248
  return true;
13220
13249
  };
13221
13250
  const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
@@ -13252,9 +13281,9 @@ const PageCanvas = react.forwardRef(
13252
13281
  return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
13253
13282
  };
13254
13283
  const promoteToCropGroup = (opt) => {
13255
- var _a2, _b2, _c, _d, _e, _f;
13284
+ var _a2, _b2, _c2, _d, _e, _f;
13256
13285
  const t = opt.target;
13257
- if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((_c = opt.e) == null ? void 0 : _c.type) !== "touchstart") {
13286
+ if (((_a2 = opt.e) == null ? void 0 : _a2.type) !== "mousedown" && ((_b2 = opt.e) == null ? void 0 : _b2.type) !== "pointerdown" && ((_c2 = opt.e) == null ? void 0 : _c2.type) !== "touchstart") {
13258
13287
  if (t && isCropGroup2(t)) {
13259
13288
  fabricCanvas._hoveredTarget = t;
13260
13289
  } else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
@@ -13424,14 +13453,14 @@ const PageCanvas = react.forwardRef(
13424
13453
  };
13425
13454
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
13426
13455
  fabricCanvas.on("mouse:down:before", (opt) => {
13427
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13456
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13428
13457
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13429
13458
  if (editLockRef.current) {
13430
13459
  const active = fabricCanvas.getActiveObject();
13431
13460
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
13432
13461
  opt.target = active;
13433
13462
  if (opt.e) {
13434
- (_c = (_b2 = opt.e).preventDefault) == null ? void 0 : _c.call(_b2);
13463
+ (_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
13435
13464
  (_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
13436
13465
  }
13437
13466
  }
@@ -13687,7 +13716,7 @@ const PageCanvas = react.forwardRef(
13687
13716
  o.__lockScaleDuringCrop = false;
13688
13717
  });
13689
13718
  fabricCanvas.on("mouse:up", (e) => {
13690
- var _a2, _b2, _c;
13719
+ var _a2, _b2, _c2;
13691
13720
  clearTransforming();
13692
13721
  setGuides([]);
13693
13722
  setRotationLabel(null);
@@ -13781,7 +13810,7 @@ const PageCanvas = react.forwardRef(
13781
13810
  }
13782
13811
  }
13783
13812
  const activeObj = fabricCanvas.getActiveObject();
13784
- if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
13813
+ if (activeObj && (activeObj.__cropGroup || ((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup))) {
13785
13814
  activeObj.__lockScaleDuringCrop = false;
13786
13815
  if (activeObj.__cropDrag) {
13787
13816
  delete activeObj.__cropDrag;
@@ -13877,7 +13906,7 @@ const PageCanvas = react.forwardRef(
13877
13906
  fabricCanvas.on("selection:cleared", () => {
13878
13907
  });
13879
13908
  fabricCanvas.on("object:scaling", (e) => {
13880
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
13909
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
13881
13910
  if (!isActiveRef.current) return;
13882
13911
  const t = e.target;
13883
13912
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14053,7 +14082,7 @@ const PageCanvas = react.forwardRef(
14053
14082
  time: Math.round(performance.now()),
14054
14083
  corner,
14055
14084
  groupSelectionId: obj.__pixldocsGroupSelection,
14056
- currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
14085
+ currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
14057
14086
  selection: summarizeFabricObjectForResizeDebug(obj),
14058
14087
  textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
14059
14088
  };
@@ -14571,7 +14600,7 @@ const PageCanvas = react.forwardRef(
14571
14600
  });
14572
14601
  let cropGroupSaveTimer = null;
14573
14602
  fabricCanvas.on("object:modified", (e) => {
14574
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14603
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14575
14604
  try {
14576
14605
  if (suppressObjectModifiedDuringInternalReselectRef.current) return;
14577
14606
  dragStarted = false;
@@ -14726,12 +14755,12 @@ const PageCanvas = react.forwardRef(
14726
14755
  clearTimeout(cropGroupSaveTimer);
14727
14756
  }
14728
14757
  cropGroupSaveTimer = setTimeout(() => {
14729
- var _a3, _b3, _c2;
14758
+ var _a3, _b3, _c3;
14730
14759
  const { updateElement: updateElement2 } = useEditorStore.getState();
14731
14760
  const img = ct._img;
14732
14761
  const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
14733
14762
  const panX = ((_b3 = img == null ? void 0 : img._ct) == null ? void 0 : _b3.panX) ?? 0.5;
14734
- const panY = ((_c2 = img == null ? void 0 : img._ct) == null ? void 0 : _c2.panY) ?? 0.5;
14763
+ const panY = ((_c3 = img == null ? void 0 : img._ct) == null ? void 0 : _c3.panY) ?? 0.5;
14735
14764
  const stateCrop = useEditorStore.getState();
14736
14765
  const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
14737
14766
  const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
@@ -14761,7 +14790,7 @@ const PageCanvas = react.forwardRef(
14761
14790
  }
14762
14791
  if (active && active instanceof fabric__namespace.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14763
14792
  const groupId = getObjectId(active);
14764
- const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14793
+ const pageChildrenSec = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
14765
14794
  const modifiedTarget2 = e == null ? void 0 : e.target;
14766
14795
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14767
14796
  lastResizeScaleTargetRef.current = null;
@@ -15896,7 +15925,7 @@ const PageCanvas = react.forwardRef(
15896
15925
  visibilityUpdateInProgressRef.current = false;
15897
15926
  }
15898
15927
  doSyncRef.current = () => {
15899
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
15928
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
15900
15929
  const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
15901
15930
  const state = useEditorStore.getState();
15902
15931
  const elementsToSync = elements;
@@ -15940,7 +15969,7 @@ const PageCanvas = react.forwardRef(
15940
15969
  const activeObjId = activeObj ? getObjectId(activeObj) : null;
15941
15970
  const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
15942
15971
  const isMultiSelect = activeObj instanceof fabric__namespace.ActiveSelection;
15943
- if (activeObj && isMultiSelect && !(((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15972
+ if (activeObj && isMultiSelect && !(((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15944
15973
  fc.discardActiveObject();
15945
15974
  }
15946
15975
  }
@@ -17098,7 +17127,7 @@ const PageCanvas = react.forwardRef(
17098
17127
  return unsub;
17099
17128
  }, []);
17100
17129
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
17101
- var _a2, _b2, _c;
17130
+ var _a2, _b2, _c2;
17102
17131
  const fc = fabricRef.current;
17103
17132
  if (fc && isTransforming(fc)) {
17104
17133
  return;
@@ -17619,7 +17648,7 @@ const PageCanvas = react.forwardRef(
17619
17648
  } catch {
17620
17649
  }
17621
17650
  obj.dirty = true;
17622
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
17651
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
17623
17652
  obj.__lastTextBgShadowJson = JSON.stringify({
17624
17653
  c: element.textBgColor ?? null,
17625
17654
  g: element.textBgGradient ?? null,
@@ -17927,7 +17956,7 @@ const PageCanvas = react.forwardRef(
17927
17956
  return Math.max(min, Math.min(max, v));
17928
17957
  };
17929
17958
  const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
17930
- var _a2, _b2, _c;
17959
+ var _a2, _b2, _c2;
17931
17960
  const fadeElement = element;
17932
17961
  const fadeGroup = group;
17933
17962
  const inputKey = edgeFadeKey(fadeElement);
@@ -18062,10 +18091,10 @@ const PageCanvas = react.forwardRef(
18062
18091
  children.forEach((child) => {
18063
18092
  child.dirty = true;
18064
18093
  });
18065
- (_c = group.canvas) == null ? void 0 : _c.requestRenderAll();
18094
+ (_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
18066
18095
  };
18067
18096
  const loadImageAsync2 = async (element, placeholder, fc) => {
18068
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18097
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18069
18098
  const imageUrl = element.src || element.imageUrl;
18070
18099
  if (!imageUrl) return;
18071
18100
  const elementId = element.id;
@@ -18100,7 +18129,7 @@ const PageCanvas = react.forwardRef(
18100
18129
  const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
18101
18130
  try {
18102
18131
  if (hasEdgeFade(element) && !willUseCropGroupForFade) {
18103
- const srcEl = (_c = img.getElement) == null ? void 0 : _c.call(img);
18132
+ const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
18104
18133
  if (srcEl) {
18105
18134
  const baked = bakeEdgeFade(srcEl, element);
18106
18135
  img.setElement(baked);
@@ -18867,14 +18896,14 @@ function PreviewCanvas({
18867
18896
  onDynamicFieldClick,
18868
18897
  onReady
18869
18898
  }) {
18870
- var _a2, _b2, _c, _d, _e;
18899
+ var _a2, _b2, _c2, _d, _e;
18871
18900
  const canvasRef = react.useRef(null);
18872
18901
  const containerRef = react.useRef(null);
18873
18902
  const [containerWidth, setContainerWidth] = react.useState(0);
18874
18903
  const [hoveredFieldId, setHoveredFieldId] = react.useState(null);
18875
18904
  const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
18876
18905
  const canvasWidth = ((_b2 = config == null ? void 0 : config.canvas) == null ? void 0 : _b2.width) || 612;
18877
- const canvasHeight = ((_c = config == null ? void 0 : config.canvas) == null ? void 0 : _c.height) || 792;
18906
+ const canvasHeight = ((_c2 = config == null ? void 0 : config.canvas) == null ? void 0 : _c2.height) || 792;
18878
18907
  const elementToFieldMap = react.useMemo(
18879
18908
  () => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
18880
18909
  [config == null ? void 0 : config.dynamicFields]
@@ -18930,7 +18959,7 @@ function PreviewCanvas({
18930
18959
  };
18931
18960
  }, [(_d = page == null ? void 0 : page.settings) == null ? void 0 : _d.backgroundColor, (_e = page == null ? void 0 : page.settings) == null ? void 0 : _e.backgroundGradient]);
18932
18961
  const projectSettings = react.useMemo(() => {
18933
- var _a3, _b3, _c2;
18962
+ var _a3, _b3, _c3;
18934
18963
  const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
18935
18964
  return {
18936
18965
  showGrid: false,
@@ -18939,7 +18968,7 @@ function PreviewCanvas({
18939
18968
  snapToGuides: false,
18940
18969
  snapThreshold: 5,
18941
18970
  primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
18942
- secondaryColor: (_c2 = vars.secondary) == null ? void 0 : _c2.value
18971
+ secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
18943
18972
  };
18944
18973
  }, [config.themeConfig]);
18945
18974
  const handleDynamicFieldClick = react.useCallback((elementId) => {
@@ -19090,7 +19119,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
19090
19119
  PreviewCanvas
19091
19120
  }, Symbol.toStringTag, { value: "Module" }));
19092
19121
  function applyThemeToConfig(config, themeOverrides) {
19093
- var _a2, _b2, _c;
19122
+ var _a2, _b2, _c2;
19094
19123
  if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
19095
19124
  const cloned = JSON.parse(JSON.stringify(config));
19096
19125
  if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
@@ -19122,7 +19151,7 @@ function applyThemeToConfig(config, themeOverrides) {
19122
19151
  }
19123
19152
  }
19124
19153
  for (const page of cloned.pages || []) {
19125
- const bgBinding = (_c = page.themeBindings) == null ? void 0 : _c.backgroundColor;
19154
+ const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
19126
19155
  if (bgBinding && varMap.has(bgBinding) && page.settings) {
19127
19156
  page.settings.backgroundColor = varMap.get(bgBinding);
19128
19157
  }
@@ -20041,7 +20070,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
20041
20070
  return Math.max(1, maxIndex);
20042
20071
  }
20043
20072
  function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
20044
- var _a2, _b2, _c;
20073
+ var _a2, _b2, _c2;
20045
20074
  const cloned = JSON.parse(JSON.stringify(config));
20046
20075
  if (!cloned.pages) return cloned;
20047
20076
  const dynamicFields = cloned.dynamicFields;
@@ -20605,7 +20634,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
20605
20634
  }
20606
20635
  }
20607
20636
  for (const page of pages) {
20608
- if ((_c = page.children) == null ? void 0 : _c.length) {
20637
+ if ((_c2 = page.children) == null ? void 0 : _c2.length) {
20609
20638
  page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
20610
20639
  }
20611
20640
  }
@@ -20818,7 +20847,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
20818
20847
  return { stayChildren: newStay, overflowChildren: newOverflow };
20819
20848
  }
20820
20849
  function paginateSinglePage(sourcePage, pageOffsetIndex) {
20821
- var _a2, _b2, _c, _d, _e, _f;
20850
+ var _a2, _b2, _c2, _d, _e, _f;
20822
20851
  const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
20823
20852
  const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
20824
20853
  if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
@@ -20895,7 +20924,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
20895
20924
  children: applyStackReflowToPageTree(updatedContChildren)
20896
20925
  };
20897
20926
  if (nextOverflowChildren.length > 0) {
20898
- const originalFlowStack = ((_c = currentOverflows[si]) == null ? void 0 : _c.flowStack) ?? contFlowStack;
20927
+ const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
20899
20928
  nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
20900
20929
  }
20901
20930
  }
@@ -23089,7 +23118,7 @@ async function resolveTemplateData(options) {
23089
23118
  };
23090
23119
  }
23091
23120
  async function resolveFromForm(options) {
23092
- var _a2, _b2, _c;
23121
+ var _a2, _b2, _c2;
23093
23122
  const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
23094
23123
  const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
23095
23124
  if (!formSchemaId && !hasSectionStateInput) {
@@ -23291,7 +23320,7 @@ async function resolveFromForm(options) {
23291
23320
  displayFormatMap.size > 0 ? displayFormatMap : void 0,
23292
23321
  buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
23293
23322
  );
23294
- if ((_c = resolvedConfig.themeConfig) == null ? void 0 : _c.variables) {
23323
+ if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
23295
23324
  const baseOverrides = {};
23296
23325
  for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
23297
23326
  baseOverrides[key] = def.value;
@@ -23326,12 +23355,12 @@ function themeBaseId(id) {
23326
23355
  return out;
23327
23356
  }
23328
23357
  function applyThemeVariantToConfig(config, themeConfig, themeId) {
23329
- var _a2, _b2, _c, _d;
23358
+ var _a2, _b2, _c2, _d;
23330
23359
  if (!themeConfig) return config;
23331
23360
  const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
23332
23361
  const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
23333
23362
  if (!variant && !shouldApplyDefaults) return config;
23334
- if (!((_c = themeConfig.properties) == null ? void 0 : _c.length)) return config;
23363
+ if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
23335
23364
  const result = JSON.parse(JSON.stringify(config));
23336
23365
  const cloneIdMap = config.__cloneIdMap || {};
23337
23366
  const pageElements = result.pages.map((page) => flattenAll(page.children || []));
@@ -24242,7 +24271,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
24242
24271
  return `url(#${id})`;
24243
24272
  }
24244
24273
  function warpTextboxSvgAlongPath(svg, obj) {
24245
- var _a2, _b2, _c, _d, _e;
24274
+ var _a2, _b2, _c2, _d, _e;
24246
24275
  const tp = obj == null ? void 0 : obj.textPath;
24247
24276
  if (!tp || !tp.preset || tp.preset === "none") return svg;
24248
24277
  if (tp.preset === "rise" || tp.preset === "angle") {
@@ -24346,7 +24375,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
24346
24375
  for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
24347
24376
  for (const filter of Array.from(doc.querySelectorAll("filter"))) {
24348
24377
  try {
24349
- (_c = filter.parentNode) == null ? void 0 : _c.removeChild(filter);
24378
+ (_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
24350
24379
  } catch {
24351
24380
  }
24352
24381
  }
@@ -24681,9 +24710,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24681
24710
  }
24682
24711
  return svgString;
24683
24712
  }
24684
- const resolvedPackageVersion = "0.5.373";
24713
+ const resolvedPackageVersion = "0.5.374";
24685
24714
  const PACKAGE_VERSION = resolvedPackageVersion;
24686
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.373";
24715
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.374";
24687
24716
  const roundParityValue = (value) => {
24688
24717
  if (typeof value !== "number") return value;
24689
24718
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24860,12 +24889,12 @@ function installUnderlineFix(fab) {
24860
24889
  if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
24861
24890
  const original = TextProto._renderTextDecoration;
24862
24891
  const measureLineTextWidth = (obj, ctx, lineIndex) => {
24863
- var _a3, _b2, _c, _d, _e, _f;
24892
+ var _a3, _b2, _c2, _d, _e, _f;
24864
24893
  const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
24865
24894
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
24866
24895
  if (!lineText) return 0;
24867
24896
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
24868
- const fontStyle = String(((_c = obj.getValueOfPropertyAt) == null ? void 0 : _c.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
24897
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
24869
24898
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
24870
24899
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
24871
24900
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -25497,7 +25526,7 @@ class PixldocsRenderer {
25497
25526
  await this.waitForCanvasScene(container, cloned, i);
25498
25527
  }
25499
25528
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25500
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BrAC0-i_.cjs"));
25529
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Cfe50WTF.cjs"));
25501
25530
  const prepared = preparePagesForExport(
25502
25531
  cloned.pages,
25503
25532
  canvasWidth,
@@ -26181,7 +26210,7 @@ class PixldocsRenderer {
26181
26210
  logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
26182
26211
  }
26183
26212
  async waitForStableTextMetrics(container, config, options = {}) {
26184
- var _a2, _b2, _c;
26213
+ var _a2, _b2, _c2;
26185
26214
  if (typeof document !== "undefined") {
26186
26215
  void ensureFontsForResolvedConfig(config);
26187
26216
  await this.waitForRelevantFonts(config);
@@ -26225,7 +26254,7 @@ class PixldocsRenderer {
26225
26254
  (_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
26226
26255
  (_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
26227
26256
  await waitForPaint();
26228
- (_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
26257
+ (_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
26229
26258
  await waitForPaint();
26230
26259
  this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
26231
26260
  }
@@ -26739,7 +26768,7 @@ function normalizeSvgExplicitColors(svg) {
26739
26768
  function bakeGroupOpacityIntoChildren(svg) {
26740
26769
  const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
26741
26770
  function walkAndBake(el, inheritedOpacity) {
26742
- var _a2, _b2, _c, _d;
26771
+ var _a2, _b2, _c2, _d;
26743
26772
  if (isInSvgDefinitionSubtree(el)) {
26744
26773
  for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
26745
26774
  return;
@@ -26751,7 +26780,7 @@ function bakeGroupOpacityIntoChildren(svg) {
26751
26780
  const combinedOpacity = inheritedOpacity * ownOpacity;
26752
26781
  if (ownOpacity < 0.999 && tag !== "image") {
26753
26782
  el.removeAttribute("opacity");
26754
- if ((_c = el.style) == null ? void 0 : _c.opacity) el.style.removeProperty("opacity");
26783
+ if ((_c2 = el.style) == null ? void 0 : _c2.opacity) el.style.removeProperty("opacity");
26755
26784
  }
26756
26785
  if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
26757
26786
  multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
@@ -27548,7 +27577,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
27548
27577
  }
27549
27578
  }
27550
27579
  async function rasterizeShadowMarkers(svg) {
27551
- var _a2, _b2, _c, _d, _e, _f;
27580
+ var _a2, _b2, _c2, _d, _e, _f;
27552
27581
  if (typeof window === "undefined" || typeof document === "undefined") return;
27553
27582
  const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
27554
27583
  if (markers.length === 0) return;
@@ -27580,7 +27609,7 @@ async function rasterizeShadowMarkers(svg) {
27580
27609
  );
27581
27610
  try {
27582
27611
  const fontSpecs = collectFontSpecsFromMarkup(innerXml);
27583
- if (fontSpecs.length > 0 && ((_c = document.fonts) == null ? void 0 : _c.load)) {
27612
+ if (fontSpecs.length > 0 && ((_c2 = document.fonts) == null ? void 0 : _c2.load)) {
27584
27613
  await Promise.all(
27585
27614
  fontSpecs.map(
27586
27615
  (spec) => document.fonts.load(spec).catch(() => void 0)
@@ -27817,7 +27846,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27817
27846
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27818
27847
  sanitizeSvgTreeForPdf(svgToDraw);
27819
27848
  try {
27820
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BrAC0-i_.cjs"));
27849
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Cfe50WTF.cjs"));
27821
27850
  try {
27822
27851
  await logTextMeasurementDiagnostic(svgToDraw);
27823
27852
  } catch {
@@ -28214,4 +28243,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28214
28243
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28215
28244
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28216
28245
  exports.warmTemplateFromForm = warmTemplateFromForm;
28217
- //# sourceMappingURL=index-CKSrApMp.cjs.map
28246
+ //# sourceMappingURL=index-DpwFuxG9.cjs.map