@pixldocs/canvas-renderer 0.5.373 → 0.5.375

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- var _a, _b;
4
+ var _a, _b, _c;
5
5
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
6
6
  import { forwardRef, useRef, useState, useCallback, useMemo, useEffect, useImperativeHandle, createElement } from "react";
7
7
  import { flushSync } from "react-dom";
@@ -293,14 +293,14 @@ function lineToString(line) {
293
293
  return Array.isArray(line) ? line.join("") : String(line ?? "");
294
294
  }
295
295
  function measureTextLineWithCanvas(textbox, lineText, lineIndex) {
296
- var _a2, _b2, _c, _d, _e;
296
+ var _a2, _b2, _c2, _d, _e;
297
297
  if (!lineText) return 0;
298
298
  const ctx = getMeasureContext();
299
299
  if (!ctx) return null;
300
300
  const tb = textbox;
301
301
  const fontSize = Number(((_a2 = tb.getValueOfPropertyAt) == null ? void 0 : _a2.call(tb, lineIndex, 0, "fontSize")) ?? textbox.fontSize ?? 16);
302
302
  const fontStyle = String(((_b2 = tb.getValueOfPropertyAt) == null ? void 0 : _b2.call(tb, lineIndex, 0, "fontStyle")) ?? textbox.fontStyle ?? "normal");
303
- const fontWeight = String(((_c = tb.getValueOfPropertyAt) == null ? void 0 : _c.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
303
+ const fontWeight = String(((_c2 = tb.getValueOfPropertyAt) == null ? void 0 : _c2.call(tb, lineIndex, 0, "fontWeight")) ?? textbox.fontWeight ?? "400");
304
304
  const fontFamily = String(((_d = tb.getValueOfPropertyAt) == null ? void 0 : _d.call(tb, lineIndex, 0, "fontFamily")) ?? textbox.fontFamily ?? "Open Sans");
305
305
  const charSpacing = Number(((_e = tb.getValueOfPropertyAt) == null ? void 0 : _e.call(tb, lineIndex, 0, "charSpacing")) ?? textbox.charSpacing ?? 0);
306
306
  ctx.save();
@@ -3620,14 +3620,14 @@ const clearFontCacheAndRerender = (canvas, options = {}) => {
3620
3620
  canvas.requestRenderAll();
3621
3621
  };
3622
3622
  const ensureFontLoaded = async (fontFamily) => {
3623
- var _a2, _b2, _c;
3623
+ var _a2, _b2, _c2;
3624
3624
  if (!fontFamily) return;
3625
3625
  if (LOCAL_FONTS.has(fontFamily)) {
3626
3626
  try {
3627
3627
  const isLoaded = (_a2 = document.fonts) == null ? void 0 : _a2.check(`16px "${fontFamily}"`);
3628
3628
  if (isLoaded) return;
3629
3629
  await ((_b2 = document.fonts) == null ? void 0 : _b2.load(`16px "${fontFamily}"`));
3630
- await ((_c = document.fonts) == null ? void 0 : _c.load(`bold 16px "${fontFamily}"`));
3630
+ await ((_c2 = document.fonts) == null ? void 0 : _c2.load(`bold 16px "${fontFamily}"`));
3631
3631
  } catch (e) {
3632
3632
  console.warn(`Failed to ensure local font loaded: ${fontFamily}`, e);
3633
3633
  }
@@ -4121,7 +4121,7 @@ function createImageClipPath(element, imgWidth, imgHeight) {
4121
4121
  }
4122
4122
  }
4123
4123
  async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef, isTransforming) {
4124
- var _a2, _b2, _c, _d;
4124
+ var _a2, _b2, _c2, _d;
4125
4125
  const imageUrl = element.src || element.imageUrl;
4126
4126
  if (!imageUrl) return;
4127
4127
  const nextSvgColorMap = element.svgColorMap ? JSON.stringify(element.svgColorMap) : "";
@@ -4286,7 +4286,7 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
4286
4286
  const existingImg = (_a2 = existingCropGroup.__cropData) == null ? void 0 : _a2._img;
4287
4287
  if (existingImg) {
4288
4288
  panX = ((_b2 = existingImg._ct) == null ? void 0 : _b2.panX) ?? existingImg.__panX ?? 0.5;
4289
- panY = ((_c = existingImg._ct) == null ? void 0 : _c.panY) ?? existingImg.__panY ?? 0.5;
4289
+ panY = ((_c2 = existingImg._ct) == null ? void 0 : _c2.panY) ?? existingImg.__panY ?? 0.5;
4290
4290
  zoom = ((_d = existingImg._ct) == null ? void 0 : _d.zoom) ?? 1;
4291
4291
  }
4292
4292
  }
@@ -4521,7 +4521,7 @@ async function detectMaskType(svgUrl) {
4521
4521
  }
4522
4522
  }
4523
4523
  async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4524
- var _a2, _b2, _c;
4524
+ var _a2, _b2, _c2;
4525
4525
  if (!isCropGroup(cropGroup)) {
4526
4526
  throw new Error("Selected object is not a crop group / image");
4527
4527
  }
@@ -4551,7 +4551,7 @@ async function applySvgMaskToCropGroup(cropGroup, svgUrl) {
4551
4551
  child.dirty = true;
4552
4552
  }
4553
4553
  }
4554
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4554
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4555
4555
  }
4556
4556
  function loadSvgAsImage(svgUrl) {
4557
4557
  return new Promise((resolve, reject) => {
@@ -4612,7 +4612,7 @@ async function buildLuminanceAlphaCanvas(svgUrl, frameW, frameH) {
4612
4612
  return canvas;
4613
4613
  }
4614
4614
  async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4615
- var _a2, _b2, _c;
4615
+ var _a2, _b2, _c2;
4616
4616
  if (!isCropGroup(cropGroup)) {
4617
4617
  throw new Error("Selected object is not a crop group / image");
4618
4618
  }
@@ -4647,7 +4647,7 @@ async function applyLuminanceMaskToCropGroup(cropGroup, svgUrl) {
4647
4647
  child.dirty = true;
4648
4648
  }
4649
4649
  }
4650
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4650
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4651
4651
  }
4652
4652
  async function applyMaskToCropGroup(cropGroup, svgUrl, maskType) {
4653
4653
  if (maskType === "luminance") {
@@ -4666,7 +4666,7 @@ function getAppliedSvgMaskType(obj) {
4666
4666
  return t === "luminance" || t === "shape" ? t : null;
4667
4667
  }
4668
4668
  function clearSvgMaskFromCropGroup(cropGroup) {
4669
- var _a2, _b2, _c;
4669
+ var _a2, _b2, _c2;
4670
4670
  if (!isCropGroup(cropGroup)) return;
4671
4671
  const frameW = ((_a2 = cropGroup._ct) == null ? void 0 : _a2.frameW) ?? cropGroup.width ?? 0;
4672
4672
  const frameH = ((_b2 = cropGroup._ct) == null ? void 0 : _b2.frameH) ?? cropGroup.height ?? 0;
@@ -4688,7 +4688,7 @@ function clearSvgMaskFromCropGroup(cropGroup) {
4688
4688
  delete cropGroup.__svgMaskUrl;
4689
4689
  delete cropGroup.__svgMaskType;
4690
4690
  cropGroup.dirty = true;
4691
- (_c = cropGroup.canvas) == null ? void 0 : _c.requestRenderAll();
4691
+ (_c2 = cropGroup.canvas) == null ? void 0 : _c2.requestRenderAll();
4692
4692
  }
4693
4693
  const svgMaskApply = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4694
4694
  __proto__: null,
@@ -6180,7 +6180,7 @@ function calculateScaleSnapGuides(scalingObj, corner, canvas, canvasWidth, canva
6180
6180
  const MIN_SNAP_BOX = 20;
6181
6181
  const SNAP_HYSTERESIS_PX = 6;
6182
6182
  function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, snapToGuides, snapThreshold, excludeObjectId, options) {
6183
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
6183
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
6184
6184
  const hysteresis = (options == null ? void 0 : options.hysteresis) ?? SNAP_HYSTERESIS_PX;
6185
6185
  const activeSnapRef = options == null ? void 0 : options.activeSnapRef;
6186
6186
  const roundSnappedOnly = (options == null ? void 0 : options.roundSnappedOnly) ?? false;
@@ -6276,7 +6276,7 @@ function applyScaleSnapToBox(box, corner, canvas, canvasWidth, canvasHeight, sna
6276
6276
  let snappedTop = false;
6277
6277
  let snappedBottom = false;
6278
6278
  if (resizingLeft) {
6279
- const stick = (_c = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c.left;
6279
+ const stick = (_c2 = activeSnapRef == null ? void 0 : activeSnapRef.current) == null ? void 0 : _c2.left;
6280
6280
  if (stick !== void 0) {
6281
6281
  const dist = Math.abs(box.left - stick);
6282
6282
  if (dist <= releaseDist) {
@@ -6930,7 +6930,7 @@ function scaleLocalToScreen(target, p) {
6930
6930
  return new fabric.Point(p.x * sx * zx, p.y * sy * zy);
6931
6931
  }
6932
6932
  function applyTextPathControls(textbox) {
6933
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6933
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
6934
6934
  const obj = textbox;
6935
6935
  if (!hasActiveTextPath(obj)) {
6936
6936
  obj.__pdTextPathHovered = false;
@@ -6953,7 +6953,7 @@ function applyTextPathControls(textbox) {
6953
6953
  delete obj.controls.bzMidT1;
6954
6954
  delete obj.controls.tpRot;
6955
6955
  delete obj.controls.tpPivot;
6956
- (_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 });
6956
+ (_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 });
6957
6957
  obj.hasBorders = true;
6958
6958
  obj.__pdTextPathControls = false;
6959
6959
  obj.setCoords();
@@ -7653,10 +7653,10 @@ function textPathBoundsContainScenePoint(obj, point) {
7653
7653
  }
7654
7654
  }
7655
7655
  function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7656
- var _a2, _b2, _c;
7656
+ var _a2, _b2, _c2;
7657
7657
  const host = hostCanvas || obj.canvas || ((_a2 = obj.group) == null ? void 0 : _a2.canvas);
7658
7658
  if (!host) return;
7659
- const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c = obj.getCanvasRetinaScaling) == null ? void 0 : _c.call(obj)) || 1;
7659
+ const retina = ((_b2 = host.getRetinaScaling) == null ? void 0 : _b2.call(host)) || ((_c2 = obj.getCanvasRetinaScaling) == null ? void 0 : _c2.call(obj)) || 1;
7660
7660
  const matrix = fabric.util.multiplyTransformMatrices(host.viewportTransform || [1, 0, 0, 1, 0, 0], obj.calcTransformMatrix());
7661
7661
  const corners = [
7662
7662
  new fabric.Point(bounds.minX, bounds.minY),
@@ -7678,8 +7678,8 @@ function drawTextPathBounds(ctx, obj, bounds, hostCanvas) {
7678
7678
  }
7679
7679
  if (typeof TextboxProto._renderControls === "function" && !TextboxProto.__pixldocsOrigRenderControls) {
7680
7680
  let drawWarpGuides = function(ctx) {
7681
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
7682
- 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);
7681
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
7682
+ 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);
7683
7683
  if (!hostCanvas) return;
7684
7684
  const hoverBounds = getTextPathHitBounds(this);
7685
7685
  const active = (_d = hostCanvas.getActiveObject) == null ? void 0 : _d.call(hostCanvas);
@@ -8102,14 +8102,14 @@ function buildRoundedRectPath2D(ctx, x, y, w, h, rTL, rTR, rBR, rBL) {
8102
8102
  ctx.closePath();
8103
8103
  }
8104
8104
  function measureLineGlyphWidth(obj, lineIndex) {
8105
- var _a2, _b2, _c, _d, _e, _f;
8105
+ var _a2, _b2, _c2, _d, _e, _f;
8106
8106
  try {
8107
8107
  const rawLine = (_a2 = obj == null ? void 0 : obj._textLines) == null ? void 0 : _a2[lineIndex];
8108
8108
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
8109
8109
  if (!lineText) return 0;
8110
8110
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
8111
8111
  if (!fontSize) return 0;
8112
- const fontStyle = String(((_c = obj.getValueOfPropertyAt) == null ? void 0 : _c.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8112
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
8113
8113
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
8114
8114
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
8115
8115
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -9500,7 +9500,7 @@ function createShape(element) {
9500
9500
  }
9501
9501
  }
9502
9502
  function createText(element) {
9503
- var _a2, _b2, _c, _d, _e;
9503
+ var _a2, _b2, _c2, _d, _e;
9504
9504
  const overflowPolicy = element.overflowPolicy || "grow-and-push";
9505
9505
  let text = element.text ?? "";
9506
9506
  let fontSize = element.fontSize || 16;
@@ -9716,7 +9716,7 @@ function createText(element) {
9716
9716
  } catch {
9717
9717
  }
9718
9718
  try {
9719
- const baseCtrls = (_d = (_c = fabric.Object) == null ? void 0 : _c.prototype) == null ? void 0 : _d.controls;
9719
+ const baseCtrls = (_d = (_c2 = fabric.Object) == null ? void 0 : _c2.prototype) == null ? void 0 : _d.controls;
9720
9720
  if (baseCtrls) {
9721
9721
  textbox.controls = {
9722
9722
  ...textbox.controls || {},
@@ -10514,6 +10514,24 @@ try {
10514
10514
  const height = Math.max(0, ((size == null ? void 0 : size.y) ?? 0) - border);
10515
10515
  ctx.strokeRect(-width / 2, -height / 2, width, height);
10516
10516
  };
10517
+ if (typeof InteractiveBase.prototype.drawControlsConnectingLines === "function") {
10518
+ const originalDrawControlConnections = InteractiveBase.prototype.drawControlsConnectingLines;
10519
+ InteractiveBase.prototype.drawControlsConnectingLines = function(ctx, size) {
10520
+ var _a2;
10521
+ const disabledRotateConnections = [];
10522
+ try {
10523
+ (_a2 = this.forEachControl) == null ? void 0 : _a2.call(this, (control, key) => {
10524
+ if (key === "mtr" || String((control == null ? void 0 : control.actionName) ?? "") === "rotate") {
10525
+ disabledRotateConnections.push([control, control.withConnection]);
10526
+ control.withConnection = false;
10527
+ }
10528
+ });
10529
+ originalDrawControlConnections.call(this, ctx, size);
10530
+ } finally {
10531
+ for (const [control, wasConnected] of disabledRotateConnections) control.withConnection = wasConnected;
10532
+ }
10533
+ };
10534
+ }
10517
10535
  }
10518
10536
  if (InteractiveBase == null ? void 0 : InteractiveBase.ownDefaults) {
10519
10537
  Object.assign(InteractiveBase.ownDefaults, {
@@ -10574,13 +10592,13 @@ try {
10574
10592
  };
10575
10593
  const COLLAPSE_THRESHOLD_PX = 32;
10576
10594
  const shouldCollapseHandles = (fabricObject) => {
10577
- var _a2, _b2, _c;
10595
+ var _a2, _b2, _c2;
10578
10596
  try {
10579
10597
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
10580
10598
  if (!canvas) return false;
10581
10599
  const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
10582
10600
  const w = (((_b2 = fabricObject.getScaledWidth) == null ? void 0 : _b2.call(fabricObject)) ?? fabricObject.width ?? 0) * zoom;
10583
- 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;
10584
10602
  return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
10585
10603
  } catch {
10586
10604
  return false;
@@ -10598,11 +10616,11 @@ try {
10598
10616
  control.__pixldocsCollapseVisibilityWrapped = true;
10599
10617
  };
10600
10618
  const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
10601
- var _a2, _b2, _c;
10619
+ var _a2, _b2, _c2;
10602
10620
  const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
10603
10621
  if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10604
10622
  if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
10605
- 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);
10606
10624
  const p = getHoverProgress(fabricObject, controlKey);
10607
10625
  const scale = getVisualScale(fabricObject);
10608
10626
  const pillLen = PILL_LEN * scale;
@@ -10799,7 +10817,7 @@ try {
10799
10817
  mtr.x = 0;
10800
10818
  mtr.y = -0.5;
10801
10819
  mtr.cursorStyle = getRotateCursor(null);
10802
- mtr.cursorStyleHandler = (_e, _c, fabricObject) => {
10820
+ mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
10803
10821
  const cursor = getRotateCursor(fabricObject);
10804
10822
  try {
10805
10823
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
@@ -10942,6 +10960,35 @@ try {
10942
10960
  }
10943
10961
  return controls;
10944
10962
  };
10963
+ const ControlProto = (_b = fabric.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
+ }
10945
10992
  ensureCanvaControlRenders = (obj) => {
10946
10993
  try {
10947
10994
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -10974,7 +11021,7 @@ try {
10974
11021
  wrapClassCreateControls(fabric.IText);
10975
11022
  wrapClassCreateControls(fabric.ActiveSelection);
10976
11023
  wrapClassCreateControls(fabric.Group);
10977
- const CanvasProto = (_b = fabric.Canvas) == null ? void 0 : _b.prototype;
11024
+ const CanvasProto = (_c = fabric.Canvas) == null ? void 0 : _c.prototype;
10978
11025
  if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
10979
11026
  const origSet = CanvasProto._setCursorFromEvent;
10980
11027
  CanvasProto._setCursorFromEvent = function(e, target) {
@@ -11122,14 +11169,14 @@ const matrixForRotDriftLog = (matrix) => {
11122
11169
  return matrix.map((entry) => roundRotDriftNumber(entry));
11123
11170
  };
11124
11171
  const summarizeRotDriftObject = (obj, worldMatrix) => {
11125
- 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;
11126
11173
  if (!obj) return null;
11127
11174
  const anyObj = obj;
11128
11175
  try {
11129
11176
  const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
11130
11177
  const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
11131
11178
  const decomposed = calcWorld ? fabric.util.qrDecompose(calcWorld) : null;
11132
- const center = (_c = obj.getCenterPoint) == null ? void 0 : _c.call(obj);
11179
+ const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
11133
11180
  const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
11134
11181
  return {
11135
11182
  id: getObjectId(obj),
@@ -12660,7 +12707,7 @@ const PageCanvas = forwardRef(
12660
12707
  clearSectionGroupTransientSnapshot();
12661
12708
  });
12662
12709
  const syncSelectionToStore = () => {
12663
- var _a2, _b2, _c, _d;
12710
+ var _a2, _b2, _c2, _d;
12664
12711
  if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
12665
12712
  const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
12666
12713
  let topmost = null;
@@ -12729,7 +12776,7 @@ const PageCanvas = forwardRef(
12729
12776
  }
12730
12777
  if (ids.length > 1 && !(active instanceof fabric.ActiveSelection && active.__pixldocsGroupSelection)) {
12731
12778
  const state = useEditorStore.getState();
12732
- 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);
12733
12780
  const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
12734
12781
  const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
12735
12782
  const involvedGroupIds = /* @__PURE__ */ new Set();
@@ -12870,7 +12917,7 @@ const PageCanvas = forwardRef(
12870
12917
  }
12871
12918
  });
12872
12919
  fabricCanvas.on("mouse:dblclick", (opt) => {
12873
- var _a2, _b2, _c;
12920
+ var _a2, _b2, _c2;
12874
12921
  const target = opt == null ? void 0 : opt.target;
12875
12922
  if (!target) return;
12876
12923
  if (target.isEditing) return;
@@ -12966,7 +13013,7 @@ const PageCanvas = forwardRef(
12966
13013
  const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
12967
13014
  selectElements([selectedId], false, false);
12968
13015
  try {
12969
- (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
13016
+ (_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
12970
13017
  } catch {
12971
13018
  }
12972
13019
  });
@@ -13117,7 +13164,7 @@ const PageCanvas = forwardRef(
13117
13164
  };
13118
13165
  const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
13119
13166
  const pickChildInActiveSelectionAtPointer = (selection, event) => {
13120
- var _a2, _b2, _c, _d, _e;
13167
+ var _a2, _b2, _c2, _d, _e;
13121
13168
  try {
13122
13169
  const pointer = fabricCanvas.getPointer(event);
13123
13170
  const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
@@ -13128,7 +13175,7 @@ const PageCanvas = forwardRef(
13128
13175
  const obj = members[i];
13129
13176
  const id = getObjectId(obj);
13130
13177
  if (!id || id === "__background__" || obj.visible === false) continue;
13131
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
13178
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
13132
13179
  const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
13133
13180
  const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
13134
13181
  if (containsScene || containsViewport) return obj;
@@ -13162,7 +13209,7 @@ const PageCanvas = forwardRef(
13162
13209
  };
13163
13210
  let pendingShiftMultiSelect = null;
13164
13211
  const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
13165
- var _a2, _b2, _c;
13212
+ var _a2, _b2, _c2;
13166
13213
  if (!target || !target.selectable) return false;
13167
13214
  const active = baselineActive;
13168
13215
  if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
@@ -13197,7 +13244,7 @@ const PageCanvas = forwardRef(
13197
13244
  });
13198
13245
  }
13199
13246
  (_b2 = event == null ? void 0 : event.preventDefault) == null ? void 0 : _b2.call(event);
13200
- (_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);
13201
13248
  return true;
13202
13249
  };
13203
13250
  const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
@@ -13234,9 +13281,9 @@ const PageCanvas = forwardRef(
13234
13281
  return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
13235
13282
  };
13236
13283
  const promoteToCropGroup = (opt) => {
13237
- var _a2, _b2, _c, _d, _e, _f;
13284
+ var _a2, _b2, _c2, _d, _e, _f;
13238
13285
  const t = opt.target;
13239
- 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") {
13240
13287
  if (t && isCropGroup2(t)) {
13241
13288
  fabricCanvas._hoveredTarget = t;
13242
13289
  } else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
@@ -13406,14 +13453,14 @@ const PageCanvas = forwardRef(
13406
13453
  };
13407
13454
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
13408
13455
  fabricCanvas.on("mouse:down:before", (opt) => {
13409
- 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;
13410
13457
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13411
13458
  if (editLockRef.current) {
13412
13459
  const active = fabricCanvas.getActiveObject();
13413
13460
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
13414
13461
  opt.target = active;
13415
13462
  if (opt.e) {
13416
- (_c = (_b2 = opt.e).preventDefault) == null ? void 0 : _c.call(_b2);
13463
+ (_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
13417
13464
  (_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
13418
13465
  }
13419
13466
  }
@@ -13669,7 +13716,7 @@ const PageCanvas = forwardRef(
13669
13716
  o.__lockScaleDuringCrop = false;
13670
13717
  });
13671
13718
  fabricCanvas.on("mouse:up", (e) => {
13672
- var _a2, _b2, _c;
13719
+ var _a2, _b2, _c2;
13673
13720
  clearTransforming();
13674
13721
  setGuides([]);
13675
13722
  setRotationLabel(null);
@@ -13763,7 +13810,7 @@ const PageCanvas = forwardRef(
13763
13810
  }
13764
13811
  }
13765
13812
  const activeObj = fabricCanvas.getActiveObject();
13766
- 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))) {
13767
13814
  activeObj.__lockScaleDuringCrop = false;
13768
13815
  if (activeObj.__cropDrag) {
13769
13816
  delete activeObj.__cropDrag;
@@ -13859,7 +13906,7 @@ const PageCanvas = forwardRef(
13859
13906
  fabricCanvas.on("selection:cleared", () => {
13860
13907
  });
13861
13908
  fabricCanvas.on("object:scaling", (e) => {
13862
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
13909
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
13863
13910
  if (!isActiveRef.current) return;
13864
13911
  const t = e.target;
13865
13912
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14035,7 +14082,7 @@ const PageCanvas = forwardRef(
14035
14082
  time: Math.round(performance.now()),
14036
14083
  corner,
14037
14084
  groupSelectionId: obj.__pixldocsGroupSelection,
14038
- currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
14085
+ currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
14039
14086
  selection: summarizeFabricObjectForResizeDebug(obj),
14040
14087
  textChildren: obj.getObjects().filter((child) => child instanceof fabric.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
14041
14088
  };
@@ -14553,7 +14600,7 @@ const PageCanvas = forwardRef(
14553
14600
  });
14554
14601
  let cropGroupSaveTimer = null;
14555
14602
  fabricCanvas.on("object:modified", (e) => {
14556
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14603
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14557
14604
  try {
14558
14605
  if (suppressObjectModifiedDuringInternalReselectRef.current) return;
14559
14606
  dragStarted = false;
@@ -14708,12 +14755,12 @@ const PageCanvas = forwardRef(
14708
14755
  clearTimeout(cropGroupSaveTimer);
14709
14756
  }
14710
14757
  cropGroupSaveTimer = setTimeout(() => {
14711
- var _a3, _b3, _c2;
14758
+ var _a3, _b3, _c3;
14712
14759
  const { updateElement: updateElement2 } = useEditorStore.getState();
14713
14760
  const img = ct._img;
14714
14761
  const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
14715
14762
  const panX = ((_b3 = img == null ? void 0 : img._ct) == null ? void 0 : _b3.panX) ?? 0.5;
14716
- 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;
14717
14764
  const stateCrop = useEditorStore.getState();
14718
14765
  const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
14719
14766
  const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
@@ -14743,7 +14790,7 @@ const PageCanvas = forwardRef(
14743
14790
  }
14744
14791
  if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14745
14792
  const groupId = getObjectId(active);
14746
- 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) ?? [];
14747
14794
  const modifiedTarget2 = e == null ? void 0 : e.target;
14748
14795
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14749
14796
  lastResizeScaleTargetRef.current = null;
@@ -15878,7 +15925,7 @@ const PageCanvas = forwardRef(
15878
15925
  visibilityUpdateInProgressRef.current = false;
15879
15926
  }
15880
15927
  doSyncRef.current = () => {
15881
- 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;
15882
15929
  const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
15883
15930
  const state = useEditorStore.getState();
15884
15931
  const elementsToSync = elements;
@@ -15922,7 +15969,7 @@ const PageCanvas = forwardRef(
15922
15969
  const activeObjId = activeObj ? getObjectId(activeObj) : null;
15923
15970
  const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
15924
15971
  const isMultiSelect = activeObj instanceof fabric.ActiveSelection;
15925
- 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) {
15926
15973
  fc.discardActiveObject();
15927
15974
  }
15928
15975
  }
@@ -17080,7 +17127,7 @@ const PageCanvas = forwardRef(
17080
17127
  return unsub;
17081
17128
  }, []);
17082
17129
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
17083
- var _a2, _b2, _c;
17130
+ var _a2, _b2, _c2;
17084
17131
  const fc = fabricRef.current;
17085
17132
  if (fc && isTransforming(fc)) {
17086
17133
  return;
@@ -17601,7 +17648,7 @@ const PageCanvas = forwardRef(
17601
17648
  } catch {
17602
17649
  }
17603
17650
  obj.dirty = true;
17604
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
17651
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
17605
17652
  obj.__lastTextBgShadowJson = JSON.stringify({
17606
17653
  c: element.textBgColor ?? null,
17607
17654
  g: element.textBgGradient ?? null,
@@ -17909,7 +17956,7 @@ const PageCanvas = forwardRef(
17909
17956
  return Math.max(min, Math.min(max, v));
17910
17957
  };
17911
17958
  const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
17912
- var _a2, _b2, _c;
17959
+ var _a2, _b2, _c2;
17913
17960
  const fadeElement = element;
17914
17961
  const fadeGroup = group;
17915
17962
  const inputKey = edgeFadeKey(fadeElement);
@@ -18044,10 +18091,10 @@ const PageCanvas = forwardRef(
18044
18091
  children.forEach((child) => {
18045
18092
  child.dirty = true;
18046
18093
  });
18047
- (_c = group.canvas) == null ? void 0 : _c.requestRenderAll();
18094
+ (_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
18048
18095
  };
18049
18096
  const loadImageAsync2 = async (element, placeholder, fc) => {
18050
- 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;
18051
18098
  const imageUrl = element.src || element.imageUrl;
18052
18099
  if (!imageUrl) return;
18053
18100
  const elementId = element.id;
@@ -18082,7 +18129,7 @@ const PageCanvas = forwardRef(
18082
18129
  const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
18083
18130
  try {
18084
18131
  if (hasEdgeFade(element) && !willUseCropGroupForFade) {
18085
- const srcEl = (_c = img.getElement) == null ? void 0 : _c.call(img);
18132
+ const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
18086
18133
  if (srcEl) {
18087
18134
  const baked = bakeEdgeFade(srcEl, element);
18088
18135
  img.setElement(baked);
@@ -18849,14 +18896,14 @@ function PreviewCanvas({
18849
18896
  onDynamicFieldClick,
18850
18897
  onReady
18851
18898
  }) {
18852
- var _a2, _b2, _c, _d, _e;
18899
+ var _a2, _b2, _c2, _d, _e;
18853
18900
  const canvasRef = useRef(null);
18854
18901
  const containerRef = useRef(null);
18855
18902
  const [containerWidth, setContainerWidth] = useState(0);
18856
18903
  const [hoveredFieldId, setHoveredFieldId] = useState(null);
18857
18904
  const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
18858
18905
  const canvasWidth = ((_b2 = config == null ? void 0 : config.canvas) == null ? void 0 : _b2.width) || 612;
18859
- 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;
18860
18907
  const elementToFieldMap = useMemo(
18861
18908
  () => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
18862
18909
  [config == null ? void 0 : config.dynamicFields]
@@ -18912,7 +18959,7 @@ function PreviewCanvas({
18912
18959
  };
18913
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]);
18914
18961
  const projectSettings = useMemo(() => {
18915
- var _a3, _b3, _c2;
18962
+ var _a3, _b3, _c3;
18916
18963
  const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
18917
18964
  return {
18918
18965
  showGrid: false,
@@ -18921,7 +18968,7 @@ function PreviewCanvas({
18921
18968
  snapToGuides: false,
18922
18969
  snapThreshold: 5,
18923
18970
  primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
18924
- secondaryColor: (_c2 = vars.secondary) == null ? void 0 : _c2.value
18971
+ secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
18925
18972
  };
18926
18973
  }, [config.themeConfig]);
18927
18974
  const handleDynamicFieldClick = useCallback((elementId) => {
@@ -19072,7 +19119,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
19072
19119
  PreviewCanvas
19073
19120
  }, Symbol.toStringTag, { value: "Module" }));
19074
19121
  function applyThemeToConfig(config, themeOverrides) {
19075
- var _a2, _b2, _c;
19122
+ var _a2, _b2, _c2;
19076
19123
  if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
19077
19124
  const cloned = JSON.parse(JSON.stringify(config));
19078
19125
  if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
@@ -19104,7 +19151,7 @@ function applyThemeToConfig(config, themeOverrides) {
19104
19151
  }
19105
19152
  }
19106
19153
  for (const page of cloned.pages || []) {
19107
- const bgBinding = (_c = page.themeBindings) == null ? void 0 : _c.backgroundColor;
19154
+ const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
19108
19155
  if (bgBinding && varMap.has(bgBinding) && page.settings) {
19109
19156
  page.settings.backgroundColor = varMap.get(bgBinding);
19110
19157
  }
@@ -20023,7 +20070,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
20023
20070
  return Math.max(1, maxIndex);
20024
20071
  }
20025
20072
  function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
20026
- var _a2, _b2, _c;
20073
+ var _a2, _b2, _c2;
20027
20074
  const cloned = JSON.parse(JSON.stringify(config));
20028
20075
  if (!cloned.pages) return cloned;
20029
20076
  const dynamicFields = cloned.dynamicFields;
@@ -20587,7 +20634,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
20587
20634
  }
20588
20635
  }
20589
20636
  for (const page of pages) {
20590
- if ((_c = page.children) == null ? void 0 : _c.length) {
20637
+ if ((_c2 = page.children) == null ? void 0 : _c2.length) {
20591
20638
  page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
20592
20639
  }
20593
20640
  }
@@ -20800,7 +20847,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
20800
20847
  return { stayChildren: newStay, overflowChildren: newOverflow };
20801
20848
  }
20802
20849
  function paginateSinglePage(sourcePage, pageOffsetIndex) {
20803
- var _a2, _b2, _c, _d, _e, _f;
20850
+ var _a2, _b2, _c2, _d, _e, _f;
20804
20851
  const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
20805
20852
  const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
20806
20853
  if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
@@ -20877,7 +20924,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
20877
20924
  children: applyStackReflowToPageTree(updatedContChildren)
20878
20925
  };
20879
20926
  if (nextOverflowChildren.length > 0) {
20880
- const originalFlowStack = ((_c = currentOverflows[si]) == null ? void 0 : _c.flowStack) ?? contFlowStack;
20927
+ const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
20881
20928
  nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
20882
20929
  }
20883
20930
  }
@@ -23071,7 +23118,7 @@ async function resolveTemplateData(options) {
23071
23118
  };
23072
23119
  }
23073
23120
  async function resolveFromForm(options) {
23074
- var _a2, _b2, _c;
23121
+ var _a2, _b2, _c2;
23075
23122
  const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
23076
23123
  const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
23077
23124
  if (!formSchemaId && !hasSectionStateInput) {
@@ -23273,7 +23320,7 @@ async function resolveFromForm(options) {
23273
23320
  displayFormatMap.size > 0 ? displayFormatMap : void 0,
23274
23321
  buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
23275
23322
  );
23276
- if ((_c = resolvedConfig.themeConfig) == null ? void 0 : _c.variables) {
23323
+ if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
23277
23324
  const baseOverrides = {};
23278
23325
  for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
23279
23326
  baseOverrides[key] = def.value;
@@ -23308,12 +23355,12 @@ function themeBaseId(id) {
23308
23355
  return out;
23309
23356
  }
23310
23357
  function applyThemeVariantToConfig(config, themeConfig, themeId) {
23311
- var _a2, _b2, _c, _d;
23358
+ var _a2, _b2, _c2, _d;
23312
23359
  if (!themeConfig) return config;
23313
23360
  const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
23314
23361
  const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
23315
23362
  if (!variant && !shouldApplyDefaults) return config;
23316
- if (!((_c = themeConfig.properties) == null ? void 0 : _c.length)) return config;
23363
+ if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
23317
23364
  const result = JSON.parse(JSON.stringify(config));
23318
23365
  const cloneIdMap = config.__cloneIdMap || {};
23319
23366
  const pageElements = result.pages.map((page) => flattenAll(page.children || []));
@@ -24224,7 +24271,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
24224
24271
  return `url(#${id})`;
24225
24272
  }
24226
24273
  function warpTextboxSvgAlongPath(svg, obj) {
24227
- var _a2, _b2, _c, _d, _e;
24274
+ var _a2, _b2, _c2, _d, _e;
24228
24275
  const tp = obj == null ? void 0 : obj.textPath;
24229
24276
  if (!tp || !tp.preset || tp.preset === "none") return svg;
24230
24277
  if (tp.preset === "rise" || tp.preset === "angle") {
@@ -24328,7 +24375,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
24328
24375
  for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
24329
24376
  for (const filter of Array.from(doc.querySelectorAll("filter"))) {
24330
24377
  try {
24331
- (_c = filter.parentNode) == null ? void 0 : _c.removeChild(filter);
24378
+ (_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
24332
24379
  } catch {
24333
24380
  }
24334
24381
  }
@@ -24663,9 +24710,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24663
24710
  }
24664
24711
  return svgString;
24665
24712
  }
24666
- const resolvedPackageVersion = "0.5.373";
24713
+ const resolvedPackageVersion = "0.5.375";
24667
24714
  const PACKAGE_VERSION = resolvedPackageVersion;
24668
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.373";
24715
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.375";
24669
24716
  const roundParityValue = (value) => {
24670
24717
  if (typeof value !== "number") return value;
24671
24718
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24842,12 +24889,12 @@ function installUnderlineFix(fab) {
24842
24889
  if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
24843
24890
  const original = TextProto._renderTextDecoration;
24844
24891
  const measureLineTextWidth = (obj, ctx, lineIndex) => {
24845
- var _a3, _b2, _c, _d, _e, _f;
24892
+ var _a3, _b2, _c2, _d, _e, _f;
24846
24893
  const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
24847
24894
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
24848
24895
  if (!lineText) return 0;
24849
24896
  const fontSize = Number(((_b2 = obj.getValueOfPropertyAt) == null ? void 0 : _b2.call(obj, lineIndex, 0, "fontSize")) ?? obj.fontSize ?? 0);
24850
- 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");
24851
24898
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
24852
24899
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
24853
24900
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -25479,7 +25526,7 @@ class PixldocsRenderer {
25479
25526
  await this.waitForCanvasScene(container, cloned, i);
25480
25527
  }
25481
25528
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25482
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B6Afy8UC.js");
25529
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BDdjWeve.js");
25483
25530
  const prepared = preparePagesForExport(
25484
25531
  cloned.pages,
25485
25532
  canvasWidth,
@@ -26163,7 +26210,7 @@ class PixldocsRenderer {
26163
26210
  logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
26164
26211
  }
26165
26212
  async waitForStableTextMetrics(container, config, options = {}) {
26166
- var _a2, _b2, _c;
26213
+ var _a2, _b2, _c2;
26167
26214
  if (typeof document !== "undefined") {
26168
26215
  void ensureFontsForResolvedConfig(config);
26169
26216
  await this.waitForRelevantFonts(config);
@@ -26207,7 +26254,7 @@ class PixldocsRenderer {
26207
26254
  (_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
26208
26255
  (_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
26209
26256
  await waitForPaint();
26210
- (_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
26257
+ (_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
26211
26258
  await waitForPaint();
26212
26259
  this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
26213
26260
  }
@@ -26721,7 +26768,7 @@ function normalizeSvgExplicitColors(svg) {
26721
26768
  function bakeGroupOpacityIntoChildren(svg) {
26722
26769
  const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
26723
26770
  function walkAndBake(el, inheritedOpacity) {
26724
- var _a2, _b2, _c, _d;
26771
+ var _a2, _b2, _c2, _d;
26725
26772
  if (isInSvgDefinitionSubtree(el)) {
26726
26773
  for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
26727
26774
  return;
@@ -26733,7 +26780,7 @@ function bakeGroupOpacityIntoChildren(svg) {
26733
26780
  const combinedOpacity = inheritedOpacity * ownOpacity;
26734
26781
  if (ownOpacity < 0.999 && tag !== "image") {
26735
26782
  el.removeAttribute("opacity");
26736
- 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");
26737
26784
  }
26738
26785
  if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
26739
26786
  multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
@@ -27530,7 +27577,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
27530
27577
  }
27531
27578
  }
27532
27579
  async function rasterizeShadowMarkers(svg) {
27533
- var _a2, _b2, _c, _d, _e, _f;
27580
+ var _a2, _b2, _c2, _d, _e, _f;
27534
27581
  if (typeof window === "undefined" || typeof document === "undefined") return;
27535
27582
  const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
27536
27583
  if (markers.length === 0) return;
@@ -27562,7 +27609,7 @@ async function rasterizeShadowMarkers(svg) {
27562
27609
  );
27563
27610
  try {
27564
27611
  const fontSpecs = collectFontSpecsFromMarkup(innerXml);
27565
- 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)) {
27566
27613
  await Promise.all(
27567
27614
  fontSpecs.map(
27568
27615
  (spec) => document.fonts.load(spec).catch(() => void 0)
@@ -27799,7 +27846,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27799
27846
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27800
27847
  sanitizeSvgTreeForPdf(svgToDraw);
27801
27848
  try {
27802
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B6Afy8UC.js");
27849
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BDdjWeve.js");
27803
27850
  try {
27804
27851
  await logTextMeasurementDiagnostic(svgToDraw);
27805
27852
  } catch {
@@ -28199,4 +28246,4 @@ export {
28199
28246
  buildTeaserBlurFlatKeys as y,
28200
28247
  collectFontDescriptorsFromConfig as z
28201
28248
  };
28202
- //# sourceMappingURL=index-bAD0lJdv.js.map
28249
+ //# sourceMappingURL=index-B0HRibrY.js.map