@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.
@@ -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 || {},
@@ -10574,13 +10574,13 @@ try {
10574
10574
  };
10575
10575
  const COLLAPSE_THRESHOLD_PX = 32;
10576
10576
  const shouldCollapseHandles = (fabricObject) => {
10577
- var _a2, _b2, _c;
10577
+ var _a2, _b2, _c2;
10578
10578
  try {
10579
10579
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
10580
10580
  if (!canvas) return false;
10581
10581
  const zoom = ((_a2 = canvas.getZoom) == null ? void 0 : _a2.call(canvas)) ?? 1;
10582
10582
  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;
10583
+ const h = (((_c2 = fabricObject.getScaledHeight) == null ? void 0 : _c2.call(fabricObject)) ?? fabricObject.height ?? 0) * zoom;
10584
10584
  return Math.min(w, h) < COLLAPSE_THRESHOLD_PX;
10585
10585
  } catch {
10586
10586
  return false;
@@ -10598,11 +10598,11 @@ try {
10598
10598
  control.__pixldocsCollapseVisibilityWrapped = true;
10599
10599
  };
10600
10600
  const renderPill = (ctx, left, top, _styleOverride, fabricObject, orientation, controlKey) => {
10601
- var _a2, _b2, _c;
10601
+ var _a2, _b2, _c2;
10602
10602
  const action = (_b2 = (_a2 = fabricObject.canvas) == null ? void 0 : _a2._currentTransform) == null ? void 0 : _b2.action;
10603
10603
  if (action === "drag" && fabricObject.__pixldocsDragMoved) return;
10604
10604
  if (shouldCollapseHandles(fabricObject) && !isVisibleControlWhenCollapsed(controlKey)) return;
10605
- const angle = ((_c = fabricObject.getTotalAngle) == null ? void 0 : _c.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10605
+ const angle = ((_c2 = fabricObject.getTotalAngle) == null ? void 0 : _c2.call(fabricObject)) ?? (fabricObject.angle ?? 0);
10606
10606
  const p = getHoverProgress(fabricObject, controlKey);
10607
10607
  const scale = getVisualScale(fabricObject);
10608
10608
  const pillLen = PILL_LEN * scale;
@@ -10799,7 +10799,7 @@ try {
10799
10799
  mtr.x = 0;
10800
10800
  mtr.y = -0.5;
10801
10801
  mtr.cursorStyle = getRotateCursor(null);
10802
- mtr.cursorStyleHandler = (_e, _c, fabricObject) => {
10802
+ mtr.cursorStyleHandler = (_e, _c2, fabricObject) => {
10803
10803
  const cursor = getRotateCursor(fabricObject);
10804
10804
  try {
10805
10805
  const canvas = fabricObject == null ? void 0 : fabricObject.canvas;
@@ -10942,6 +10942,35 @@ try {
10942
10942
  }
10943
10943
  return controls;
10944
10944
  };
10945
+ const ControlProto = (_b = fabric.Control) == null ? void 0 : _b.prototype;
10946
+ if (ControlProto && !ControlProto.__pixldocsCanvaRenderFallback) {
10947
+ const originalControlRender = ControlProto.render;
10948
+ ControlProto.render = function(ctx, left, top, styleOverride, fabricObject) {
10949
+ const actionName = String(this.actionName ?? "");
10950
+ if (actionName !== "rotate" && actionName !== "drag") {
10951
+ const x = Number(this.x ?? 0);
10952
+ const y = Number(this.y ?? 0);
10953
+ const atLeftRight = Math.abs(Math.abs(x) - 0.5) < 1e-3;
10954
+ const atTopBottom = Math.abs(Math.abs(y) - 0.5) < 1e-3;
10955
+ const atCenterX = Math.abs(x) < 1e-3;
10956
+ const atCenterY = Math.abs(y) < 1e-3;
10957
+ if (atLeftRight && atCenterY) {
10958
+ const key = x < 0 ? "ml" : "mr";
10959
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "vertical", key);
10960
+ }
10961
+ if (atCenterX && atTopBottom) {
10962
+ const key = y < 0 ? "mt" : "mb";
10963
+ return renderPill(ctx, left, top, styleOverride, fabricObject, "horizontal", key);
10964
+ }
10965
+ if (atLeftRight && atTopBottom) {
10966
+ const key = `${y < 0 ? "t" : "b"}${x < 0 ? "l" : "r"}`;
10967
+ return renderCornerDot(ctx, left, top, styleOverride, fabricObject, key);
10968
+ }
10969
+ }
10970
+ return originalControlRender.call(this, ctx, left, top, styleOverride, fabricObject);
10971
+ };
10972
+ ControlProto.__pixldocsCanvaRenderFallback = true;
10973
+ }
10945
10974
  ensureCanvaControlRenders = (obj) => {
10946
10975
  try {
10947
10976
  if (obj && obj.controls) installPillRenders(obj.controls);
@@ -10974,7 +11003,7 @@ try {
10974
11003
  wrapClassCreateControls(fabric.IText);
10975
11004
  wrapClassCreateControls(fabric.ActiveSelection);
10976
11005
  wrapClassCreateControls(fabric.Group);
10977
- const CanvasProto = (_b = fabric.Canvas) == null ? void 0 : _b.prototype;
11006
+ const CanvasProto = (_c = fabric.Canvas) == null ? void 0 : _c.prototype;
10978
11007
  if (CanvasProto && typeof CanvasProto._setCursorFromEvent === "function") {
10979
11008
  const origSet = CanvasProto._setCursorFromEvent;
10980
11009
  CanvasProto._setCursorFromEvent = function(e, target) {
@@ -11122,14 +11151,14 @@ const matrixForRotDriftLog = (matrix) => {
11122
11151
  return matrix.map((entry) => roundRotDriftNumber(entry));
11123
11152
  };
11124
11153
  const summarizeRotDriftObject = (obj, worldMatrix) => {
11125
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11154
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
11126
11155
  if (!obj) return null;
11127
11156
  const anyObj = obj;
11128
11157
  try {
11129
11158
  const ownMatrix = (_a2 = obj.calcOwnMatrix) == null ? void 0 : _a2.call(obj);
11130
11159
  const calcWorld = worldMatrix ?? ((_b2 = obj.calcTransformMatrix) == null ? void 0 : _b2.call(obj));
11131
11160
  const decomposed = calcWorld ? fabric.util.qrDecompose(calcWorld) : null;
11132
- const center = (_c = obj.getCenterPoint) == null ? void 0 : _c.call(obj);
11161
+ const center = (_c2 = obj.getCenterPoint) == null ? void 0 : _c2.call(obj);
11133
11162
  const rect = (_d = obj.getBoundingRect) == null ? void 0 : _d.call(obj);
11134
11163
  return {
11135
11164
  id: getObjectId(obj),
@@ -12660,7 +12689,7 @@ const PageCanvas = forwardRef(
12660
12689
  clearSectionGroupTransientSnapshot();
12661
12690
  });
12662
12691
  const syncSelectionToStore = () => {
12663
- var _a2, _b2, _c, _d;
12692
+ var _a2, _b2, _c2, _d;
12664
12693
  if (!isActiveRef.current || isRebuildingRef.current || isSyncingSelectionToFabricRef.current || !allowSelection) return;
12665
12694
  const walkToTopmostGroup = (childId, children, activeEditingGroupId) => {
12666
12695
  let topmost = null;
@@ -12729,7 +12758,7 @@ const PageCanvas = forwardRef(
12729
12758
  }
12730
12759
  if (ids.length > 1 && !(active instanceof fabric.ActiveSelection && active.__pixldocsGroupSelection)) {
12731
12760
  const state = useEditorStore.getState();
12732
- const currentPage2 = (_c = state.canvas.pages) == null ? void 0 : _c.find((p) => p.id === pageId);
12761
+ const currentPage2 = (_c2 = state.canvas.pages) == null ? void 0 : _c2.find((p) => p.id === pageId);
12733
12762
  const children = (currentPage2 == null ? void 0 : currentPage2.children) ?? [];
12734
12763
  const activeEditingGroupId = fabricCanvas.__activeEditingGroupId ?? null;
12735
12764
  const involvedGroupIds = /* @__PURE__ */ new Set();
@@ -12870,7 +12899,7 @@ const PageCanvas = forwardRef(
12870
12899
  }
12871
12900
  });
12872
12901
  fabricCanvas.on("mouse:dblclick", (opt) => {
12873
- var _a2, _b2, _c;
12902
+ var _a2, _b2, _c2;
12874
12903
  const target = opt == null ? void 0 : opt.target;
12875
12904
  if (!target) return;
12876
12905
  if (target.isEditing) return;
@@ -12966,7 +12995,7 @@ const PageCanvas = forwardRef(
12966
12995
  const selectedId = selectionIdx < 0 ? childId : chain[selectionIdx].id;
12967
12996
  selectElements([selectedId], false, false);
12968
12997
  try {
12969
- (_c = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c.call(fabricCanvas);
12998
+ (_c2 = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _c2.call(fabricCanvas);
12970
12999
  } catch {
12971
13000
  }
12972
13001
  });
@@ -13117,7 +13146,7 @@ const PageCanvas = forwardRef(
13117
13146
  };
13118
13147
  const isMultiSelectModifier = (event) => !!((event == null ? void 0 : event.shiftKey) || (event == null ? void 0 : event.metaKey) || (event == null ? void 0 : event.ctrlKey));
13119
13148
  const pickChildInActiveSelectionAtPointer = (selection, event) => {
13120
- var _a2, _b2, _c, _d, _e;
13149
+ var _a2, _b2, _c2, _d, _e;
13121
13150
  try {
13122
13151
  const pointer = fabricCanvas.getPointer(event);
13123
13152
  const viewportPointer = (_a2 = fabricCanvas.getViewportPoint) == null ? void 0 : _a2.call(fabricCanvas, event);
@@ -13128,7 +13157,7 @@ const PageCanvas = forwardRef(
13128
13157
  const obj = members[i];
13129
13158
  const id = getObjectId(obj);
13130
13159
  if (!id || id === "__background__" || obj.visible === false) continue;
13131
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
13160
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
13132
13161
  const containsScene = typeof obj.containsPoint === "function" && obj.containsPoint(pointer);
13133
13162
  const containsViewport = !!(viewportPointer && typeof obj.containsPoint === "function" && obj.containsPoint(viewportPointer));
13134
13163
  if (containsScene || containsViewport) return obj;
@@ -13162,7 +13191,7 @@ const PageCanvas = forwardRef(
13162
13191
  };
13163
13192
  let pendingShiftMultiSelect = null;
13164
13193
  const applyShiftMultiSelect = (target, event, baselineActive = fabricCanvas.getActiveObject(), baselineObjects = fabricCanvas.getActiveObjects()) => {
13165
- var _a2, _b2, _c;
13194
+ var _a2, _b2, _c2;
13166
13195
  if (!target || !target.selectable) return false;
13167
13196
  const active = baselineActive;
13168
13197
  if (!active || ((_a2 = active.getActiveControl) == null ? void 0 : _a2.call(active))) return false;
@@ -13197,7 +13226,7 @@ const PageCanvas = forwardRef(
13197
13226
  });
13198
13227
  }
13199
13228
  (_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);
13229
+ (_c2 = event == null ? void 0 : event.stopPropagation) == null ? void 0 : _c2.call(event);
13201
13230
  return true;
13202
13231
  };
13203
13232
  const markMixedLogicalSelection = (selection, groupIds, groupMemberIds) => {
@@ -13234,9 +13263,9 @@ const PageCanvas = forwardRef(
13234
13263
  return !!(((_a2 = o == null ? void 0 : o._ct) == null ? void 0 : _a2.isCropGroup) || (o == null ? void 0 : o.__cropGroup));
13235
13264
  };
13236
13265
  const promoteToCropGroup = (opt) => {
13237
- var _a2, _b2, _c, _d, _e, _f;
13266
+ var _a2, _b2, _c2, _d, _e, _f;
13238
13267
  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") {
13268
+ 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
13269
  if (t && isCropGroup2(t)) {
13241
13270
  fabricCanvas._hoveredTarget = t;
13242
13271
  } else if ((t == null ? void 0 : t.group) && isCropGroup2(t.group)) {
@@ -13406,14 +13435,14 @@ const PageCanvas = forwardRef(
13406
13435
  };
13407
13436
  fabricCanvas.__updateDrilledGroupOutline = updateDrilledGroupOutline;
13408
13437
  fabricCanvas.on("mouse:down:before", (opt) => {
13409
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13438
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
13410
13439
  const activeBeforeMouseDown = fabricCanvas.getActiveObject();
13411
13440
  if (editLockRef.current) {
13412
13441
  const active = fabricCanvas.getActiveObject();
13413
13442
  if (active && (((_a2 = active._ct) == null ? void 0 : _a2.isCropGroup) || active.__cropGroup)) {
13414
13443
  opt.target = active;
13415
13444
  if (opt.e) {
13416
- (_c = (_b2 = opt.e).preventDefault) == null ? void 0 : _c.call(_b2);
13445
+ (_c2 = (_b2 = opt.e).preventDefault) == null ? void 0 : _c2.call(_b2);
13417
13446
  (_e = (_d = opt.e).stopPropagation) == null ? void 0 : _e.call(_d);
13418
13447
  }
13419
13448
  }
@@ -13669,7 +13698,7 @@ const PageCanvas = forwardRef(
13669
13698
  o.__lockScaleDuringCrop = false;
13670
13699
  });
13671
13700
  fabricCanvas.on("mouse:up", (e) => {
13672
- var _a2, _b2, _c;
13701
+ var _a2, _b2, _c2;
13673
13702
  clearTransforming();
13674
13703
  setGuides([]);
13675
13704
  setRotationLabel(null);
@@ -13763,7 +13792,7 @@ const PageCanvas = forwardRef(
13763
13792
  }
13764
13793
  }
13765
13794
  const activeObj = fabricCanvas.getActiveObject();
13766
- if (activeObj && (activeObj.__cropGroup || ((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup))) {
13795
+ if (activeObj && (activeObj.__cropGroup || ((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup))) {
13767
13796
  activeObj.__lockScaleDuringCrop = false;
13768
13797
  if (activeObj.__cropDrag) {
13769
13798
  delete activeObj.__cropDrag;
@@ -13859,7 +13888,7 @@ const PageCanvas = forwardRef(
13859
13888
  fabricCanvas.on("selection:cleared", () => {
13860
13889
  });
13861
13890
  fabricCanvas.on("object:scaling", (e) => {
13862
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
13891
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h;
13863
13892
  if (!isActiveRef.current) return;
13864
13893
  const t = e.target;
13865
13894
  if (t) lastResizeScaleTargetRef.current = t;
@@ -14035,7 +14064,7 @@ const PageCanvas = forwardRef(
14035
14064
  time: Math.round(performance.now()),
14036
14065
  corner,
14037
14066
  groupSelectionId: obj.__pixldocsGroupSelection,
14038
- currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
14067
+ currentTransformAction: (_c2 = fabricCanvas._currentTransform) == null ? void 0 : _c2.action,
14039
14068
  selection: summarizeFabricObjectForResizeDebug(obj),
14040
14069
  textChildren: obj.getObjects().filter((child) => child instanceof fabric.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
14041
14070
  };
@@ -14553,7 +14582,7 @@ const PageCanvas = forwardRef(
14553
14582
  });
14554
14583
  let cropGroupSaveTimer = null;
14555
14584
  fabricCanvas.on("object:modified", (e) => {
14556
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j;
14585
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j;
14557
14586
  try {
14558
14587
  if (suppressObjectModifiedDuringInternalReselectRef.current) return;
14559
14588
  dragStarted = false;
@@ -14708,12 +14737,12 @@ const PageCanvas = forwardRef(
14708
14737
  clearTimeout(cropGroupSaveTimer);
14709
14738
  }
14710
14739
  cropGroupSaveTimer = setTimeout(() => {
14711
- var _a3, _b3, _c2;
14740
+ var _a3, _b3, _c3;
14712
14741
  const { updateElement: updateElement2 } = useEditorStore.getState();
14713
14742
  const img = ct._img;
14714
14743
  const zoom3 = ((_a3 = img == null ? void 0 : img._ct) == null ? void 0 : _a3.zoom) ?? 1;
14715
14744
  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;
14745
+ const panY = ((_c3 = img == null ? void 0 : img._ct) == null ? void 0 : _c3.panY) ?? 0.5;
14717
14746
  const stateCrop = useEditorStore.getState();
14718
14747
  const pageCrop = stateCrop.canvas.pages.find((p) => p.id === pageId);
14719
14748
  const pageChildrenCrop = (pageCrop == null ? void 0 : pageCrop.children) ?? [];
@@ -14743,7 +14772,7 @@ const PageCanvas = forwardRef(
14743
14772
  }
14744
14773
  if (active && active instanceof fabric.Group && active.__docuforgeSectionGroup && getObjectId(active)) {
14745
14774
  const groupId = getObjectId(active);
14746
- const pageChildrenSec = ((_c = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
14775
+ const pageChildrenSec = ((_c2 = useEditorStore.getState().canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c2.children) ?? [];
14747
14776
  const modifiedTarget2 = e == null ? void 0 : e.target;
14748
14777
  const resizeScaleTarget = lastResizeScaleTargetRef.current;
14749
14778
  lastResizeScaleTargetRef.current = null;
@@ -15878,7 +15907,7 @@ const PageCanvas = forwardRef(
15878
15907
  visibilityUpdateInProgressRef.current = false;
15879
15908
  }
15880
15909
  doSyncRef.current = () => {
15881
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
15910
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
15882
15911
  const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
15883
15912
  const state = useEditorStore.getState();
15884
15913
  const elementsToSync = elements;
@@ -15922,7 +15951,7 @@ const PageCanvas = forwardRef(
15922
15951
  const activeObjId = activeObj ? getObjectId(activeObj) : null;
15923
15952
  const isTextBeingEdited = activeObjId && editingTextIdRef.current === activeObjId;
15924
15953
  const isMultiSelect = activeObj instanceof fabric.ActiveSelection;
15925
- if (activeObj && isMultiSelect && !(((_c = activeObj._ct) == null ? void 0 : _c.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15954
+ if (activeObj && isMultiSelect && !(((_c2 = activeObj._ct) == null ? void 0 : _c2.isCropGroup) || activeObj.__cropGroup) && !isTextBeingEdited) {
15926
15955
  fc.discardActiveObject();
15927
15956
  }
15928
15957
  }
@@ -17080,7 +17109,7 @@ const PageCanvas = forwardRef(
17080
17109
  return unsub;
17081
17110
  }, []);
17082
17111
  const updateFabricObject = (obj, element, skipPositionUpdate = false) => {
17083
- var _a2, _b2, _c;
17112
+ var _a2, _b2, _c2;
17084
17113
  const fc = fabricRef.current;
17085
17114
  if (fc && isTransforming(fc)) {
17086
17115
  return;
@@ -17601,7 +17630,7 @@ const PageCanvas = forwardRef(
17601
17630
  } catch {
17602
17631
  }
17603
17632
  obj.dirty = true;
17604
- (_c = obj.setCoords) == null ? void 0 : _c.call(obj);
17633
+ (_c2 = obj.setCoords) == null ? void 0 : _c2.call(obj);
17605
17634
  obj.__lastTextBgShadowJson = JSON.stringify({
17606
17635
  c: element.textBgColor ?? null,
17607
17636
  g: element.textBgGradient ?? null,
@@ -17909,7 +17938,7 @@ const PageCanvas = forwardRef(
17909
17938
  return Math.max(min, Math.min(max, v));
17910
17939
  };
17911
17940
  const applyEdgeFadeFrameClipPath = (group, element, frameW, frameH, shape, rxRatio) => {
17912
- var _a2, _b2, _c;
17941
+ var _a2, _b2, _c2;
17913
17942
  const fadeElement = element;
17914
17943
  const fadeGroup = group;
17915
17944
  const inputKey = edgeFadeKey(fadeElement);
@@ -18044,10 +18073,10 @@ const PageCanvas = forwardRef(
18044
18073
  children.forEach((child) => {
18045
18074
  child.dirty = true;
18046
18075
  });
18047
- (_c = group.canvas) == null ? void 0 : _c.requestRenderAll();
18076
+ (_c2 = group.canvas) == null ? void 0 : _c2.requestRenderAll();
18048
18077
  };
18049
18078
  const loadImageAsync2 = async (element, placeholder, fc) => {
18050
- var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18079
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
18051
18080
  const imageUrl = element.src || element.imageUrl;
18052
18081
  if (!imageUrl) return;
18053
18082
  const elementId = element.id;
@@ -18082,7 +18111,7 @@ const PageCanvas = forwardRef(
18082
18111
  const willUseCropGroupForFade = imageFitForFade !== "fill" || clipShapeForFade && clipShapeForFade !== "none";
18083
18112
  try {
18084
18113
  if (hasEdgeFade(element) && !willUseCropGroupForFade) {
18085
- const srcEl = (_c = img.getElement) == null ? void 0 : _c.call(img);
18114
+ const srcEl = (_c2 = img.getElement) == null ? void 0 : _c2.call(img);
18086
18115
  if (srcEl) {
18087
18116
  const baked = bakeEdgeFade(srcEl, element);
18088
18117
  img.setElement(baked);
@@ -18849,14 +18878,14 @@ function PreviewCanvas({
18849
18878
  onDynamicFieldClick,
18850
18879
  onReady
18851
18880
  }) {
18852
- var _a2, _b2, _c, _d, _e;
18881
+ var _a2, _b2, _c2, _d, _e;
18853
18882
  const canvasRef = useRef(null);
18854
18883
  const containerRef = useRef(null);
18855
18884
  const [containerWidth, setContainerWidth] = useState(0);
18856
18885
  const [hoveredFieldId, setHoveredFieldId] = useState(null);
18857
18886
  const page = (_a2 = config == null ? void 0 : config.pages) == null ? void 0 : _a2[pageIndex];
18858
18887
  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;
18888
+ const canvasHeight = ((_c2 = config == null ? void 0 : config.canvas) == null ? void 0 : _c2.height) || 792;
18860
18889
  const elementToFieldMap = useMemo(
18861
18890
  () => buildElementToFieldMap(config == null ? void 0 : config.dynamicFields),
18862
18891
  [config == null ? void 0 : config.dynamicFields]
@@ -18912,7 +18941,7 @@ function PreviewCanvas({
18912
18941
  };
18913
18942
  }, [(_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
18943
  const projectSettings = useMemo(() => {
18915
- var _a3, _b3, _c2;
18944
+ var _a3, _b3, _c3;
18916
18945
  const vars = ((_a3 = config.themeConfig) == null ? void 0 : _a3.variables) || {};
18917
18946
  return {
18918
18947
  showGrid: false,
@@ -18921,7 +18950,7 @@ function PreviewCanvas({
18921
18950
  snapToGuides: false,
18922
18951
  snapThreshold: 5,
18923
18952
  primaryColor: (_b3 = vars.primary) == null ? void 0 : _b3.value,
18924
- secondaryColor: (_c2 = vars.secondary) == null ? void 0 : _c2.value
18953
+ secondaryColor: (_c3 = vars.secondary) == null ? void 0 : _c3.value
18925
18954
  };
18926
18955
  }, [config.themeConfig]);
18927
18956
  const handleDynamicFieldClick = useCallback((elementId) => {
@@ -19072,7 +19101,7 @@ const PreviewCanvas$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
19072
19101
  PreviewCanvas
19073
19102
  }, Symbol.toStringTag, { value: "Module" }));
19074
19103
  function applyThemeToConfig(config, themeOverrides) {
19075
- var _a2, _b2, _c;
19104
+ var _a2, _b2, _c2;
19076
19105
  if (!themeOverrides || Object.keys(themeOverrides).length === 0) return config;
19077
19106
  const cloned = JSON.parse(JSON.stringify(config));
19078
19107
  if ((_a2 = cloned.themeConfig) == null ? void 0 : _a2.variables) {
@@ -19104,7 +19133,7 @@ function applyThemeToConfig(config, themeOverrides) {
19104
19133
  }
19105
19134
  }
19106
19135
  for (const page of cloned.pages || []) {
19107
- const bgBinding = (_c = page.themeBindings) == null ? void 0 : _c.backgroundColor;
19136
+ const bgBinding = (_c2 = page.themeBindings) == null ? void 0 : _c2.backgroundColor;
19108
19137
  if (bgBinding && varMap.has(bgBinding) && page.settings) {
19109
19138
  page.settings.backgroundColor = varMap.get(bgBinding);
19110
19139
  }
@@ -20023,7 +20052,7 @@ function getNestedRepeatableEntryCount(parentId, parentIndex, childId, formValue
20023
20052
  return Math.max(1, maxIndex);
20024
20053
  }
20025
20054
  function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsFromSchema, repeatableEntryCounts, repeatableNestedEntryCounts, displayFormatMap, repeatablePagesFromSchema) {
20026
- var _a2, _b2, _c;
20055
+ var _a2, _b2, _c2;
20027
20056
  const cloned = JSON.parse(JSON.stringify(config));
20028
20057
  if (!cloned.pages) return cloned;
20029
20058
  const dynamicFields = cloned.dynamicFields;
@@ -20587,7 +20616,7 @@ function applyFormDataToConfig(config, mappings, formValues, repeatableSectionsF
20587
20616
  }
20588
20617
  }
20589
20618
  for (const page of pages) {
20590
- if ((_c = page.children) == null ? void 0 : _c.length) {
20619
+ if ((_c2 = page.children) == null ? void 0 : _c2.length) {
20591
20620
  page.children = applyStackReflowToPageTree(page.children, { preserveExplicitTextHeights: true });
20592
20621
  }
20593
20622
  }
@@ -20800,7 +20829,7 @@ function splitNestedForOverflow(flowStack, stayChildren, overflowChildren, overf
20800
20829
  return { stayChildren: newStay, overflowChildren: newOverflow };
20801
20830
  }
20802
20831
  function paginateSinglePage(sourcePage, pageOffsetIndex) {
20803
- var _a2, _b2, _c, _d, _e, _f;
20832
+ var _a2, _b2, _c2, _d, _e, _f;
20804
20833
  const contentTop = (_a2 = sourcePage.settings) == null ? void 0 : _a2.contentTop;
20805
20834
  const contentBottom = (_b2 = sourcePage.settings) == null ? void 0 : _b2.contentBottom;
20806
20835
  if (contentTop == null || contentBottom == null || contentBottom <= contentTop) {
@@ -20877,7 +20906,7 @@ function paginateSinglePage(sourcePage, pageOffsetIndex) {
20877
20906
  children: applyStackReflowToPageTree(updatedContChildren)
20878
20907
  };
20879
20908
  if (nextOverflowChildren.length > 0) {
20880
- const originalFlowStack = ((_c = currentOverflows[si]) == null ? void 0 : _c.flowStack) ?? contFlowStack;
20909
+ const originalFlowStack = ((_c2 = currentOverflows[si]) == null ? void 0 : _c2.flowStack) ?? contFlowStack;
20881
20910
  nextOverflows.push({ flowStack: originalFlowStack, overflowChildren: nextOverflowChildren });
20882
20911
  }
20883
20912
  }
@@ -23071,7 +23100,7 @@ async function resolveTemplateData(options) {
23071
23100
  };
23072
23101
  }
23073
23102
  async function resolveFromForm(options) {
23074
- var _a2, _b2, _c;
23103
+ var _a2, _b2, _c2;
23075
23104
  const { templateId, formSchemaId, sectionState, flatFormData: directFlatFormData, themeId, supabaseUrl, supabaseAnonKey, prefetched } = options;
23076
23105
  const hasSectionStateInput = !!sectionState && Object.keys(sectionState).length > 0;
23077
23106
  if (!formSchemaId && !hasSectionStateInput) {
@@ -23273,7 +23302,7 @@ async function resolveFromForm(options) {
23273
23302
  displayFormatMap.size > 0 ? displayFormatMap : void 0,
23274
23303
  buildRepeatablePagesInputForApply(formSchema, mergedSectionState)
23275
23304
  );
23276
- if ((_c = resolvedConfig.themeConfig) == null ? void 0 : _c.variables) {
23305
+ if ((_c2 = resolvedConfig.themeConfig) == null ? void 0 : _c2.variables) {
23277
23306
  const baseOverrides = {};
23278
23307
  for (const [key, def] of Object.entries(resolvedConfig.themeConfig.variables)) {
23279
23308
  baseOverrides[key] = def.value;
@@ -23308,12 +23337,12 @@ function themeBaseId(id) {
23308
23337
  return out;
23309
23338
  }
23310
23339
  function applyThemeVariantToConfig(config, themeConfig, themeId) {
23311
- var _a2, _b2, _c, _d;
23340
+ var _a2, _b2, _c2, _d;
23312
23341
  if (!themeConfig) return config;
23313
23342
  const variant = themeId && themeId !== "default" ? (_a2 = themeConfig.variants) == null ? void 0 : _a2.find((v) => v.id === themeId) : null;
23314
23343
  const shouldApplyDefaults = !variant && ((_b2 = themeConfig.properties) == null ? void 0 : _b2.length);
23315
23344
  if (!variant && !shouldApplyDefaults) return config;
23316
- if (!((_c = themeConfig.properties) == null ? void 0 : _c.length)) return config;
23345
+ if (!((_c2 = themeConfig.properties) == null ? void 0 : _c2.length)) return config;
23317
23346
  const result = JSON.parse(JSON.stringify(config));
23318
23347
  const cloneIdMap = config.__cloneIdMap || {};
23319
23348
  const pageElements = result.pages.map((page) => flattenAll(page.children || []));
@@ -24224,7 +24253,7 @@ function ensureFabricGradientDef(doc, obj, width, height) {
24224
24253
  return `url(#${id})`;
24225
24254
  }
24226
24255
  function warpTextboxSvgAlongPath(svg, obj) {
24227
- var _a2, _b2, _c, _d, _e;
24256
+ var _a2, _b2, _c2, _d, _e;
24228
24257
  const tp = obj == null ? void 0 : obj.textPath;
24229
24258
  if (!tp || !tp.preset || tp.preset === "none") return svg;
24230
24259
  if (tp.preset === "rise" || tp.preset === "angle") {
@@ -24328,7 +24357,7 @@ function warpTextboxSvgAlongPath(svg, obj) {
24328
24357
  for (const el of Array.from(doc.querySelectorAll("*"))) stripFilter(el);
24329
24358
  for (const filter of Array.from(doc.querySelectorAll("filter"))) {
24330
24359
  try {
24331
- (_c = filter.parentNode) == null ? void 0 : _c.removeChild(filter);
24360
+ (_c2 = filter.parentNode) == null ? void 0 : _c2.removeChild(filter);
24332
24361
  } catch {
24333
24362
  }
24334
24363
  }
@@ -24663,9 +24692,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24663
24692
  }
24664
24693
  return svgString;
24665
24694
  }
24666
- const resolvedPackageVersion = "0.5.373";
24695
+ const resolvedPackageVersion = "0.5.374";
24667
24696
  const PACKAGE_VERSION = resolvedPackageVersion;
24668
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.373";
24697
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.374";
24669
24698
  const roundParityValue = (value) => {
24670
24699
  if (typeof value !== "number") return value;
24671
24700
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24842,12 +24871,12 @@ function installUnderlineFix(fab) {
24842
24871
  if (!TextProto || typeof TextProto._renderTextDecoration !== "function") return;
24843
24872
  const original = TextProto._renderTextDecoration;
24844
24873
  const measureLineTextWidth = (obj, ctx, lineIndex) => {
24845
- var _a3, _b2, _c, _d, _e, _f;
24874
+ var _a3, _b2, _c2, _d, _e, _f;
24846
24875
  const rawLine = (_a3 = obj._textLines) == null ? void 0 : _a3[lineIndex];
24847
24876
  const lineText = Array.isArray(rawLine) ? rawLine.join("") : String(rawLine ?? "");
24848
24877
  if (!lineText) return 0;
24849
24878
  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");
24879
+ const fontStyle = String(((_c2 = obj.getValueOfPropertyAt) == null ? void 0 : _c2.call(obj, lineIndex, 0, "fontStyle")) ?? obj.fontStyle ?? "normal");
24851
24880
  const fontWeight = String(((_d = obj.getValueOfPropertyAt) == null ? void 0 : _d.call(obj, lineIndex, 0, "fontWeight")) ?? obj.fontWeight ?? "400");
24852
24881
  const fontFamily = String(((_e = obj.getValueOfPropertyAt) == null ? void 0 : _e.call(obj, lineIndex, 0, "fontFamily")) ?? obj.fontFamily ?? "sans-serif");
24853
24882
  const charSpacing = Number(((_f = obj.getValueOfPropertyAt) == null ? void 0 : _f.call(obj, lineIndex, 0, "charSpacing")) ?? obj.charSpacing ?? 0);
@@ -25479,7 +25508,7 @@ class PixldocsRenderer {
25479
25508
  await this.waitForCanvasScene(container, cloned, i);
25480
25509
  }
25481
25510
  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");
25511
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-HghwbAxV.js");
25483
25512
  const prepared = preparePagesForExport(
25484
25513
  cloned.pages,
25485
25514
  canvasWidth,
@@ -26163,7 +26192,7 @@ class PixldocsRenderer {
26163
26192
  logJsonLine("[canvas-renderer][fabric-text-parity]", { stage, textboxes: sample.length, sample });
26164
26193
  }
26165
26194
  async waitForStableTextMetrics(container, config, options = {}) {
26166
- var _a2, _b2, _c;
26195
+ var _a2, _b2, _c2;
26167
26196
  if (typeof document !== "undefined") {
26168
26197
  void ensureFontsForResolvedConfig(config);
26169
26198
  await this.waitForRelevantFonts(config);
@@ -26207,7 +26236,7 @@ class PixldocsRenderer {
26207
26236
  (_a2 = fabricInstance.calcOffset) == null ? void 0 : _a2.call(fabricInstance);
26208
26237
  (_b2 = fabricInstance.renderAll) == null ? void 0 : _b2.call(fabricInstance);
26209
26238
  await waitForPaint();
26210
- (_c = fabricInstance.renderAll) == null ? void 0 : _c.call(fabricInstance);
26239
+ (_c2 = fabricInstance.renderAll) == null ? void 0 : _c2.call(fabricInstance);
26211
26240
  await waitForPaint();
26212
26241
  this.logFabricTextParitySnapshot("after-stable-text-metrics", fabricInstance);
26213
26242
  }
@@ -26721,7 +26750,7 @@ function normalizeSvgExplicitColors(svg) {
26721
26750
  function bakeGroupOpacityIntoChildren(svg) {
26722
26751
  const DRAWABLE = /* @__PURE__ */ new Set(["path", "rect", "circle", "ellipse", "polygon", "polyline", "line", "text", "tspan"]);
26723
26752
  function walkAndBake(el, inheritedOpacity) {
26724
- var _a2, _b2, _c, _d;
26753
+ var _a2, _b2, _c2, _d;
26725
26754
  if (isInSvgDefinitionSubtree(el)) {
26726
26755
  for (let i = 0; i < el.children.length; i++) walkAndBake(el.children[i], 1);
26727
26756
  return;
@@ -26733,7 +26762,7 @@ function bakeGroupOpacityIntoChildren(svg) {
26733
26762
  const combinedOpacity = inheritedOpacity * ownOpacity;
26734
26763
  if (ownOpacity < 0.999 && tag !== "image") {
26735
26764
  el.removeAttribute("opacity");
26736
- if ((_c = el.style) == null ? void 0 : _c.opacity) el.style.removeProperty("opacity");
26765
+ if ((_c2 = el.style) == null ? void 0 : _c2.opacity) el.style.removeProperty("opacity");
26737
26766
  }
26738
26767
  if (DRAWABLE.has(tag) && combinedOpacity < 0.999) {
26739
26768
  multiplySvgOpacityAttr(el, "fill-opacity", combinedOpacity);
@@ -27530,7 +27559,7 @@ async function convertSvgTextDecorationsToLinesString(svgStr) {
27530
27559
  }
27531
27560
  }
27532
27561
  async function rasterizeShadowMarkers(svg) {
27533
- var _a2, _b2, _c, _d, _e, _f;
27562
+ var _a2, _b2, _c2, _d, _e, _f;
27534
27563
  if (typeof window === "undefined" || typeof document === "undefined") return;
27535
27564
  const markers = Array.from(svg.querySelectorAll("g.__pdShadowRaster"));
27536
27565
  if (markers.length === 0) return;
@@ -27562,7 +27591,7 @@ async function rasterizeShadowMarkers(svg) {
27562
27591
  );
27563
27592
  try {
27564
27593
  const fontSpecs = collectFontSpecsFromMarkup(innerXml);
27565
- if (fontSpecs.length > 0 && ((_c = document.fonts) == null ? void 0 : _c.load)) {
27594
+ if (fontSpecs.length > 0 && ((_c2 = document.fonts) == null ? void 0 : _c2.load)) {
27566
27595
  await Promise.all(
27567
27596
  fontSpecs.map(
27568
27597
  (spec) => document.fonts.load(spec).catch(() => void 0)
@@ -27799,7 +27828,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27799
27828
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27800
27829
  sanitizeSvgTreeForPdf(svgToDraw);
27801
27830
  try {
27802
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B6Afy8UC.js");
27831
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-HghwbAxV.js");
27803
27832
  try {
27804
27833
  await logTextMeasurementDiagnostic(svgToDraw);
27805
27834
  } catch {
@@ -28199,4 +28228,4 @@ export {
28199
28228
  buildTeaserBlurFlatKeys as y,
28200
28229
  collectFontDescriptorsFromConfig as z
28201
28230
  };
28202
- //# sourceMappingURL=index-bAD0lJdv.js.map
28231
+ //# sourceMappingURL=index-DQyoK8Nv.js.map