@lucablockltd/ultimate-packaging 1.5.0 → 1.5.2

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.
package/dist/index.js CHANGED
@@ -1088,6 +1088,203 @@ async function exportDimensionPdf(params) {
1088
1088
  const arrayBuffer = doc.output("arraybuffer");
1089
1089
  return new Blob([arrayBuffer], { type: "application/pdf" });
1090
1090
  }
1091
+
1092
+ // src/utils/readyToPrint.ts
1093
+ var DIM_PADDING2 = 15;
1094
+ var FOOTER_H2 = 40;
1095
+ var MARGIN2 = 5;
1096
+ function camelToCapitalize2(str) {
1097
+ return str.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
1098
+ }
1099
+ function hexToRgb2(hex) {
1100
+ return {
1101
+ r: parseInt(hex.slice(1, 3), 16),
1102
+ g: parseInt(hex.slice(3, 5), 16),
1103
+ b: parseInt(hex.slice(5, 7), 16)
1104
+ };
1105
+ }
1106
+ function drawPath(doc, d, ox, oy) {
1107
+ const commands = parseSvgPath(d);
1108
+ let startX = 0;
1109
+ let startY = 0;
1110
+ let curX = 0;
1111
+ let curY = 0;
1112
+ for (const cmd of commands) {
1113
+ switch (cmd.type) {
1114
+ case "M":
1115
+ curX = cmd.x + ox;
1116
+ curY = cmd.y + oy;
1117
+ startX = curX;
1118
+ startY = curY;
1119
+ break;
1120
+ case "L": {
1121
+ const nx = cmd.x + ox;
1122
+ const ny = cmd.y + oy;
1123
+ doc.line(curX, curY, nx, ny);
1124
+ curX = nx;
1125
+ curY = ny;
1126
+ break;
1127
+ }
1128
+ case "C": {
1129
+ const x0 = curX;
1130
+ const y0 = curY;
1131
+ const x1 = cmd.x1 + ox;
1132
+ const y1 = cmd.y1 + oy;
1133
+ const x2 = cmd.x2 + ox;
1134
+ const y2 = cmd.y2 + oy;
1135
+ const x3 = cmd.x + ox;
1136
+ const y3 = cmd.y + oy;
1137
+ const steps = 20;
1138
+ let prevX = x0;
1139
+ let prevY = y0;
1140
+ for (let si = 1; si <= steps; si++) {
1141
+ const t = si / steps;
1142
+ const mt = 1 - t;
1143
+ const nx = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
1144
+ const ny = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
1145
+ doc.line(prevX, prevY, nx, ny);
1146
+ prevX = nx;
1147
+ prevY = ny;
1148
+ }
1149
+ curX = x3;
1150
+ curY = y3;
1151
+ break;
1152
+ }
1153
+ case "Q": {
1154
+ const qx0 = curX;
1155
+ const qy0 = curY;
1156
+ const qx1 = cmd.x1 + ox;
1157
+ const qy1 = cmd.y1 + oy;
1158
+ const qx2 = cmd.x + ox;
1159
+ const qy2 = cmd.y + oy;
1160
+ const qSteps = 16;
1161
+ let qPrevX = qx0;
1162
+ let qPrevY = qy0;
1163
+ for (let si = 1; si <= qSteps; si++) {
1164
+ const t = si / qSteps;
1165
+ const mt = 1 - t;
1166
+ const nx = mt * mt * qx0 + 2 * mt * t * qx1 + t * t * qx2;
1167
+ const ny = mt * mt * qy0 + 2 * mt * t * qy1 + t * t * qy2;
1168
+ doc.line(qPrevX, qPrevY, nx, ny);
1169
+ qPrevX = nx;
1170
+ qPrevY = ny;
1171
+ }
1172
+ curX = qx2;
1173
+ curY = qy2;
1174
+ break;
1175
+ }
1176
+ case "Z":
1177
+ doc.line(curX, curY, startX, startY);
1178
+ curX = startX;
1179
+ curY = startY;
1180
+ break;
1181
+ }
1182
+ }
1183
+ }
1184
+ async function readyToPrintPdf(params) {
1185
+ const { modelId, dieline, dimensions, attributes, unit, factor, theme } = params;
1186
+ const { width: vw, height: vh } = dieline.viewBox;
1187
+ const contentW = vw + DIM_PADDING2 * 2;
1188
+ const contentH = vh + DIM_PADDING2 * 2;
1189
+ const pageW = contentW + MARGIN2 * 2;
1190
+ const pageH = contentH + MARGIN2 * 2 + FOOTER_H2;
1191
+ const { jsPDF } = await import('jspdf');
1192
+ const doc = new jsPDF({
1193
+ orientation: pageW > pageH ? "landscape" : "portrait",
1194
+ unit: "mm",
1195
+ format: [pageW, pageH]
1196
+ });
1197
+ const ox = MARGIN2 + DIM_PADDING2;
1198
+ const oy = MARGIN2 + DIM_PADDING2;
1199
+ const creaseRgb = hexToRgb2(theme.colorFoldLine);
1200
+ doc.setDrawColor(creaseRgb.r, creaseRgb.g, creaseRgb.b);
1201
+ doc.setLineWidth(0.3);
1202
+ for (const d of dieline.crease) {
1203
+ drawPath(doc, d, ox, oy);
1204
+ }
1205
+ const cutRgb = hexToRgb2(theme.colorDieLine);
1206
+ doc.setDrawColor(cutRgb.r, cutRgb.g, cutRgb.b);
1207
+ doc.setLineWidth(0.3);
1208
+ for (const d of dieline.cut) {
1209
+ drawPath(doc, d, ox, oy);
1210
+ }
1211
+ const tick = 1.5;
1212
+ for (const dim of dimensions) {
1213
+ if (dim.orientation === "horizontal") {
1214
+ const y = dim.y1 + dim.offset + oy;
1215
+ const x1 = dim.x1 + ox;
1216
+ const x2 = dim.x2 + ox;
1217
+ doc.setDrawColor(0, 0, 0);
1218
+ doc.setLineWidth(0.2);
1219
+ doc.line(x1, y, x2, y);
1220
+ doc.setLineWidth(0.3);
1221
+ doc.line(x1, y - tick, x1, y + tick);
1222
+ doc.line(x2, y - tick, x2, y + tick);
1223
+ const midX = (x1 + x2) / 2;
1224
+ doc.setFontSize(3.5 * 2.83);
1225
+ doc.setTextColor(0, 0, 0);
1226
+ doc.text(dim.label, midX, y - 1.5, { align: "center" });
1227
+ } else {
1228
+ const x = dim.x1 + dim.offset + ox;
1229
+ const y1 = dim.y1 + oy;
1230
+ const y2 = dim.y2 + oy;
1231
+ doc.setDrawColor(0, 0, 0);
1232
+ doc.setLineWidth(0.2);
1233
+ doc.line(x, y1, x, y2);
1234
+ doc.setLineWidth(0.3);
1235
+ doc.line(x - tick, y1, x + tick, y1);
1236
+ doc.line(x - tick, y2, x + tick, y2);
1237
+ const midY = (y1 + y2) / 2;
1238
+ doc.setFontSize(3.5 * 2.83);
1239
+ doc.setTextColor(0, 0, 0);
1240
+ const textX = x - 1.5;
1241
+ const tw = doc.getTextWidth(dim.label);
1242
+ doc.text(dim.label, textX, midY + tw / 2, { angle: 90 });
1243
+ }
1244
+ }
1245
+ const footerY = pageH - FOOTER_H2;
1246
+ const halfW = (pageW - MARGIN2 * 2) / 2;
1247
+ const centerX = MARGIN2 + halfW;
1248
+ doc.setDrawColor(180, 180, 180);
1249
+ doc.setLineWidth(0.3);
1250
+ doc.line(MARGIN2, footerY, pageW - MARGIN2, footerY);
1251
+ doc.line(centerX, footerY, centerX, pageH - MARGIN2);
1252
+ doc.setTextColor(0, 0, 0);
1253
+ doc.setFontSize(9);
1254
+ doc.text("Luca Block Co.,Ltd.", MARGIN2 + 3, footerY + 6);
1255
+ doc.text(
1256
+ `Cartons-Tuck end boxes-${modelId}`,
1257
+ pageW - MARGIN2 - 3,
1258
+ footerY + 6,
1259
+ { align: "right" }
1260
+ );
1261
+ const attrEntries = Object.entries(attributes);
1262
+ const col1X = MARGIN2 + 3;
1263
+ const col2X = MARGIN2 + 3 + halfW / 2;
1264
+ const attrStartY = footerY + 14;
1265
+ const lineH = 5;
1266
+ doc.setFontSize(7);
1267
+ const half = Math.ceil(attrEntries.length / 2);
1268
+ for (let i = 0; i < half; i++) {
1269
+ const [key, val] = attrEntries[i];
1270
+ doc.text(
1271
+ `${camelToCapitalize2(key)}: ${(val * factor).toFixed(1)} ${unit}`,
1272
+ col1X,
1273
+ attrStartY + i * lineH
1274
+ );
1275
+ const j = i + half;
1276
+ if (j < attrEntries.length) {
1277
+ const [key2, val2] = attrEntries[j];
1278
+ doc.text(
1279
+ `${camelToCapitalize2(key2)}: ${(val2 * factor).toFixed(1)} ${unit}`,
1280
+ col2X,
1281
+ attrStartY + i * lineH
1282
+ );
1283
+ }
1284
+ }
1285
+ const arrayBuffer = doc.output("arraybuffer");
1286
+ return new Blob([arrayBuffer], { type: "application/pdf" });
1287
+ }
1091
1288
  function DebugOverlay({ data, fontSize }) {
1092
1289
  const ptR = fontSize * 0.3;
1093
1290
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -1303,6 +1500,18 @@ var DIE_LINE_BECF_1010A = react.forwardRef(
1303
1500
  factor,
1304
1501
  theme
1305
1502
  });
1503
+ },
1504
+ readyToPrint: async () => {
1505
+ const dimData = generateDimensions(attributes, unit);
1506
+ return readyToPrintPdf({
1507
+ modelId: MODEL_ID,
1508
+ dieline,
1509
+ dimensions: dimData,
1510
+ attributes,
1511
+ unit,
1512
+ factor,
1513
+ theme
1514
+ });
1306
1515
  }
1307
1516
  }),
1308
1517
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -1403,6 +1612,7 @@ var CANVAS_BECF_1010A = react.forwardRef(
1403
1612
  });
1404
1613
  },
1405
1614
  exportDimension: () => dieLineRef.current.exportDimension(),
1615
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
1406
1616
  resetView: () => canvasRef.current?.resetView(),
1407
1617
  fitView: () => canvasRef.current?.fitView()
1408
1618
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -1996,6 +2206,18 @@ var DIE_LINE_BECF_1030A = react.forwardRef(
1996
2206
  factor,
1997
2207
  theme
1998
2208
  });
2209
+ },
2210
+ readyToPrint: async () => {
2211
+ const dimData = generateDimensions2(attributes, unit);
2212
+ return readyToPrintPdf({
2213
+ modelId: MODEL_ID2,
2214
+ dieline,
2215
+ dimensions: dimData,
2216
+ attributes,
2217
+ unit,
2218
+ factor,
2219
+ theme
2220
+ });
1999
2221
  }
2000
2222
  }),
2001
2223
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -2096,6 +2318,7 @@ var CANVAS_BECF_1030A = react.forwardRef(
2096
2318
  });
2097
2319
  },
2098
2320
  exportDimension: () => dieLineRef.current.exportDimension(),
2321
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
2099
2322
  resetView: () => canvasRef.current?.resetView(),
2100
2323
  fitView: () => canvasRef.current?.fitView()
2101
2324
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -2691,6 +2914,18 @@ var DIE_LINE_BECF_1040A = react.forwardRef(
2691
2914
  factor,
2692
2915
  theme
2693
2916
  });
2917
+ },
2918
+ readyToPrint: async () => {
2919
+ const dimData = generateDimensions3(attributes, unit);
2920
+ return readyToPrintPdf({
2921
+ modelId: MODEL_ID3,
2922
+ dieline,
2923
+ dimensions: dimData,
2924
+ attributes,
2925
+ unit,
2926
+ factor,
2927
+ theme
2928
+ });
2694
2929
  }
2695
2930
  }),
2696
2931
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -2791,6 +3026,7 @@ var CANVAS_BECF_1040A = react.forwardRef(
2791
3026
  });
2792
3027
  },
2793
3028
  exportDimension: () => dieLineRef.current.exportDimension(),
3029
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
2794
3030
  resetView: () => canvasRef.current?.resetView(),
2795
3031
  fitView: () => canvasRef.current?.fitView()
2796
3032
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -3406,6 +3642,18 @@ var DIE_LINE_BECF_11D01 = react.forwardRef(
3406
3642
  factor,
3407
3643
  theme
3408
3644
  });
3645
+ },
3646
+ readyToPrint: async () => {
3647
+ const dimData = generateDimensions4(attributes, unit);
3648
+ return readyToPrintPdf({
3649
+ modelId: MODEL_ID4,
3650
+ dieline,
3651
+ dimensions: dimData,
3652
+ attributes,
3653
+ unit,
3654
+ factor,
3655
+ theme
3656
+ });
3409
3657
  }
3410
3658
  }),
3411
3659
  [attributes, dieline, factor, unit, serializeSvg, theme]
@@ -3502,6 +3750,7 @@ var CANVAS_BECF_11D01 = react.forwardRef(
3502
3750
  });
3503
3751
  },
3504
3752
  exportDimension: () => dieLineRef.current.exportDimension(),
3753
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
3505
3754
  resetView: () => canvasRef.current?.resetView(),
3506
3755
  fitView: () => canvasRef.current?.fitView()
3507
3756
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -3536,10 +3785,10 @@ var MODEL_BECF_11D01 = react.forwardRef(
3536
3785
  // src/components/dieline/bags-pillows/becf-12101/generate.ts
3537
3786
  var DIP = 15;
3538
3787
  var ROPE_R = 3;
3539
- var ROPE_Y = 20;
3540
- var D_MAX = 40;
3541
- function calcD(c, b) {
3542
- return Math.min(c - 2 - b / 2, D_MAX);
3788
+ var D_SMALL = 30;
3789
+ var D_LARGE = 40;
3790
+ function calcD(c) {
3791
+ return c < 300 ? D_SMALL : D_LARGE;
3543
3792
  }
3544
3793
  function calcKulak(b) {
3545
3794
  if (b <= 13) return b - 1;
@@ -3553,10 +3802,10 @@ function calcX(a) {
3553
3802
  }
3554
3803
  function getAutoCalcValues(attr) {
3555
3804
  const { length: A, width: B, height: C, glueArea } = attr;
3556
- const D = calcD(C, B);
3805
+ const D = calcD(C);
3557
3806
  const kulak = glueArea ?? calcKulak(B);
3558
3807
  const X = calcX(A);
3559
- return { d: D, kulak, dip: DIP, ropeR: ROPE_R, ropeY: ROPE_Y, ropeX: X };
3808
+ return { d: D, kulak, dip: DIP, ropeR: ROPE_R, ropeY: D / 2, ropeX: X };
3560
3809
  }
3561
3810
  function line5(x1, y1, x2, y2) {
3562
3811
  return `M${x1} ${y1} L${x2} ${y2}`;
@@ -3566,7 +3815,7 @@ function circlePath(cx, cy, r) {
3566
3815
  }
3567
3816
  function generateBecf12101(attr) {
3568
3817
  const { length: A, width: B, height: C, glueArea } = attr;
3569
- const D = calcD(C, B);
3818
+ const D = calcD(C);
3570
3819
  const kulak = glueArea ?? calcKulak(B);
3571
3820
  const X = calcX(A);
3572
3821
  const xFront = kulak;
@@ -3595,8 +3844,8 @@ function generateBecf12101(attr) {
3595
3844
  cut.push(line5(kulak + 2 * A + B - B / 2, yBottomFlap, kulak + 2 * A + B - B / 2, yEnd));
3596
3845
  const frontCx = kulak + A / 2;
3597
3846
  const backCx = kulak + A + B + A / 2;
3598
- const ropeTopY = yFoldTop - ROPE_Y;
3599
- const ropeBotY = yFoldTop + ROPE_Y;
3847
+ const ropeTopY = D / 2;
3848
+ const ropeBotY = yFoldTop + D / 2;
3600
3849
  cut.push(circlePath(frontCx - X / 2, ropeTopY, ROPE_R));
3601
3850
  cut.push(circlePath(frontCx - X / 2, ropeBotY, ROPE_R));
3602
3851
  cut.push(circlePath(frontCx + X / 2, ropeTopY, ROPE_R));
@@ -3623,7 +3872,7 @@ function generateBecf12101(attr) {
3623
3872
  }
3624
3873
  function generateBecf12101DebugSections(attr) {
3625
3874
  const { length: A, width: B, height: C, glueArea } = attr;
3626
- const D = calcD(C, B);
3875
+ const D = calcD(C);
3627
3876
  const kulak = glueArea ?? calcKulak(B);
3628
3877
  const X = calcX(A);
3629
3878
  const xFront = kulak;
@@ -3657,8 +3906,8 @@ function generateBecf12101DebugSections(attr) {
3657
3906
  crease.push(line5(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
3658
3907
  const frontCx = kulak + A / 2;
3659
3908
  const backCx = kulak + A + B + A / 2;
3660
- const ropeTopY = yFoldTop - ROPE_Y;
3661
- const ropeBotY = yFoldTop + ROPE_Y;
3909
+ const ropeTopY = D / 2;
3910
+ const ropeBotY = yFoldTop + D / 2;
3662
3911
  let ci = 0;
3663
3912
  const sections = [
3664
3913
  {
@@ -3706,7 +3955,7 @@ function generateBecf12101DebugSections(attr) {
3706
3955
  }
3707
3956
  function generateOuterContour5(attr) {
3708
3957
  const { length: A, width: B, height: C, glueArea } = attr;
3709
- const D = calcD(C, B);
3958
+ const D = calcD(C);
3710
3959
  const kulak = glueArea ?? calcKulak(B);
3711
3960
  const totalWidth = kulak + 2 * A + 2 * B - 2;
3712
3961
  const totalHeight = D + C + B / 2 + DIP;
@@ -3764,7 +4013,7 @@ function contourToPath5(points) {
3764
4013
  }
3765
4014
  function generateDimensions5(attr, unit) {
3766
4015
  const { length: A, width: B, height: C, glueArea } = attr;
3767
- const D = calcD(C, B);
4016
+ const D = calcD(C);
3768
4017
  const kulak = glueArea ?? calcKulak(B);
3769
4018
  const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
3770
4019
  const suffix = unit;
@@ -3774,10 +4023,10 @@ function generateDimensions5(attr, unit) {
3774
4023
  const xBack = kulak + A + B;
3775
4024
  const yFoldTop = D;
3776
4025
  const yFoldBottom = D + C;
4026
+ const yBottomFlap = D + C + B / 2;
3777
4027
  const yEnd = D + C + B / 2 + DIP;
3778
4028
  const totalWidth = kulak + 2 * A + 2 * B - 2;
3779
4029
  const totalHeight = yEnd;
3780
- const bottomSection = B / 2 + DIP;
3781
4030
  return [
3782
4031
  // Overall dimensions (outside)
3783
4032
  {
@@ -3798,7 +4047,17 @@ function generateDimensions5(attr, unit) {
3798
4047
  orientation: "vertical",
3799
4048
  offset: -12
3800
4049
  },
3801
- // Height (C) — body area (centered on back panel)
4050
+ // Top flap (D)
4051
+ {
4052
+ x1: xBack + A * 0.6,
4053
+ y1: 0,
4054
+ x2: xBack + A * 0.6,
4055
+ y2: yFoldTop,
4056
+ label: fmt(D),
4057
+ orientation: "vertical",
4058
+ offset: -10
4059
+ },
4060
+ // Body height (h = C)
3802
4061
  {
3803
4062
  x1: xBack + A * 0.6,
3804
4063
  y1: yFoldTop,
@@ -3808,23 +4067,23 @@ function generateDimensions5(attr, unit) {
3808
4067
  orientation: "vertical",
3809
4068
  offset: -10
3810
4069
  },
3811
- // Top flap (D) (centered on back panel)
4070
+ // W-fold lower (B/2) yFoldBottom to yBottomFlap
3812
4071
  {
3813
4072
  x1: xBack + A * 0.6,
3814
- y1: 0,
4073
+ y1: yFoldBottom,
3815
4074
  x2: xBack + A * 0.6,
3816
- y2: yFoldTop,
3817
- label: fmt(D),
4075
+ y2: yBottomFlap,
4076
+ label: fmt(B / 2),
3818
4077
  orientation: "vertical",
3819
4078
  offset: -10
3820
4079
  },
3821
- // Bottom section (B/2 + _dip) (centered on back panel)
4080
+ // DIP bottom glue tab
3822
4081
  {
3823
4082
  x1: xBack + A * 0.6,
3824
- y1: yFoldBottom,
4083
+ y1: yBottomFlap,
3825
4084
  x2: xBack + A * 0.6,
3826
4085
  y2: yEnd,
3827
- label: fmt(bottomSection),
4086
+ label: fmt(DIP),
3828
4087
  orientation: "vertical",
3829
4088
  offset: -10
3830
4089
  },
@@ -4012,6 +4271,18 @@ var DIE_LINE_BECF_12101 = react.forwardRef(
4012
4271
  factor,
4013
4272
  theme
4014
4273
  });
4274
+ },
4275
+ readyToPrint: async () => {
4276
+ const dimData = generateDimensions5(attributes, unit);
4277
+ return readyToPrintPdf({
4278
+ modelId: MODEL_ID5,
4279
+ dieline,
4280
+ dimensions: dimData,
4281
+ attributes,
4282
+ unit,
4283
+ factor,
4284
+ theme
4285
+ });
4015
4286
  }
4016
4287
  };
4017
4288
  },
@@ -4109,6 +4380,7 @@ var CANVAS_BECF_12101 = react.forwardRef(
4109
4380
  });
4110
4381
  },
4111
4382
  exportDimension: () => dieLineRef.current.exportDimension(),
4383
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
4112
4384
  resetView: () => canvasRef.current?.resetView(),
4113
4385
  fitView: () => canvasRef.current?.fitView()
4114
4386
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -4141,14 +4413,14 @@ var MODEL_BECF_12101 = react.forwardRef(
4141
4413
  );
4142
4414
 
4143
4415
  // src/components/dieline/bags-pillows/becf-12109/generate.ts
4144
- var DIP2 = 13;
4416
+ var DIP2 = 15;
4145
4417
  var ROPE_R2 = 3;
4146
- var ROPE_Y2 = 20;
4147
- var D_MAX2 = 40;
4418
+ var D_SMALL2 = 30;
4419
+ var D_LARGE2 = 40;
4148
4420
  var NOTCH_X = 3;
4149
4421
  var NOTCH_Y = 5;
4150
- function calcD2(c, b) {
4151
- return Math.min(c - 2 - b / 2, D_MAX2);
4422
+ function calcD2(c) {
4423
+ return c < 300 ? D_SMALL2 : D_LARGE2;
4152
4424
  }
4153
4425
  function calcKulak2(b) {
4154
4426
  if (b <= 13) return b - 1;
@@ -4162,10 +4434,10 @@ function calcX2(a) {
4162
4434
  }
4163
4435
  function getAutoCalcValues2(attr) {
4164
4436
  const { length: A, width: B, height: C, glueArea } = attr;
4165
- const D = calcD2(C, B);
4437
+ const D = calcD2(C);
4166
4438
  const kulak = glueArea ?? calcKulak2(B);
4167
4439
  const X = calcX2(A);
4168
- return { d: D, kulak, dip: DIP2, ropeR: ROPE_R2, ropeY: ROPE_Y2, ropeX: X };
4440
+ return { d: D, kulak, dip: DIP2, ropeR: ROPE_R2, ropeY: D / 2, ropeX: X };
4169
4441
  }
4170
4442
  function line6(x1, y1, x2, y2) {
4171
4443
  return `M${x1} ${y1} L${x2} ${y2}`;
@@ -4175,7 +4447,7 @@ function circlePath2(cx, cy, r) {
4175
4447
  }
4176
4448
  function generateBecf12109(attr) {
4177
4449
  const { length: A, width: B, height: C, glueArea } = attr;
4178
- const D = calcD2(C, B);
4450
+ const D = calcD2(C);
4179
4451
  const kulak = glueArea ?? calcKulak2(B);
4180
4452
  const X = calcX2(A);
4181
4453
  const xFront = kulak;
@@ -4218,8 +4490,8 @@ function generateBecf12109(attr) {
4218
4490
  cut.push(line6(xSide2 + NOTCH_X, totalHeight, xEnd - NOTCH_X, totalHeight));
4219
4491
  const frontCx = kulak + A / 2;
4220
4492
  const backCx = kulak + A + B + A / 2;
4221
- const ropeTopY = yFoldTop - ROPE_Y2;
4222
- const ropeBotY = yFoldTop + ROPE_Y2;
4493
+ const ropeTopY = D / 2;
4494
+ const ropeBotY = yFoldTop + D / 2;
4223
4495
  cut.push(circlePath2(frontCx - X / 2, ropeTopY, ROPE_R2));
4224
4496
  cut.push(circlePath2(frontCx - X / 2, ropeBotY, ROPE_R2));
4225
4497
  cut.push(circlePath2(frontCx + X / 2, ropeTopY, ROPE_R2));
@@ -4245,7 +4517,7 @@ function generateBecf12109(attr) {
4245
4517
  }
4246
4518
  function generateBecf12109DebugSections(attr) {
4247
4519
  const { length: A, width: B, height: C, glueArea } = attr;
4248
- const D = calcD2(C, B);
4520
+ const D = calcD2(C);
4249
4521
  const kulak = glueArea ?? calcKulak2(B);
4250
4522
  const X = calcX2(A);
4251
4523
  const xFront = kulak;
@@ -4278,8 +4550,8 @@ function generateBecf12109DebugSections(attr) {
4278
4550
  crease.push(line6(xSide2Mid, yFoldBottomStart, xEnd, D + C - 2));
4279
4551
  const frontCx = kulak + A / 2;
4280
4552
  const backCx = kulak + A + B + A / 2;
4281
- const ropeTopY = yFoldTop - ROPE_Y2;
4282
- const ropeBotY = yFoldTop + ROPE_Y2;
4553
+ const ropeTopY = D / 2;
4554
+ const ropeBotY = yFoldTop + D / 2;
4283
4555
  const boundaries = [xFront, xSide1, xBack, xSide2, xEnd];
4284
4556
  const vNotchPaths = [];
4285
4557
  for (let i = 0; i < boundaries.length; i++) {
@@ -4353,7 +4625,7 @@ function generateBecf12109DebugSections(attr) {
4353
4625
  }
4354
4626
  function generateOuterContour6(attr) {
4355
4627
  const { length: A, width: B, height: C, glueArea } = attr;
4356
- const D = calcD2(C, B);
4628
+ const D = calcD2(C);
4357
4629
  const kulak = glueArea ?? calcKulak2(B);
4358
4630
  const xFront = kulak;
4359
4631
  const xSide1 = kulak + A;
@@ -4446,7 +4718,7 @@ function contourToPath6(points) {
4446
4718
  }
4447
4719
  function generateDimensions6(attr, unit) {
4448
4720
  const { length: A, width: B, height: C, glueArea } = attr;
4449
- const D = calcD2(C, B);
4721
+ const D = calcD2(C);
4450
4722
  const kulak = glueArea ?? calcKulak2(B);
4451
4723
  const factor = unit === "cm" ? 0.1 : unit === "in" ? 1 / 25.4 : 1;
4452
4724
  const suffix = unit;
@@ -4456,10 +4728,10 @@ function generateDimensions6(attr, unit) {
4456
4728
  const xBack = kulak + A + B;
4457
4729
  const yFoldTop = D;
4458
4730
  const yFoldBottom = D + C;
4731
+ const yBottomFlap = D + C + B / 2;
4459
4732
  const yEnd = D + C + B / 2 + DIP2;
4460
4733
  const totalWidth = kulak + 2 * A + 2 * B - 2;
4461
4734
  const totalHeight = yEnd;
4462
- const bottomSection = B / 2 + DIP2;
4463
4735
  return [
4464
4736
  // Overall dimensions (outside)
4465
4737
  {
@@ -4480,7 +4752,17 @@ function generateDimensions6(attr, unit) {
4480
4752
  orientation: "vertical",
4481
4753
  offset: -12
4482
4754
  },
4483
- // Height (C) — body area (centered on back panel)
4755
+ // Top flap (D)
4756
+ {
4757
+ x1: xBack + A * 0.6,
4758
+ y1: 0,
4759
+ x2: xBack + A * 0.6,
4760
+ y2: yFoldTop,
4761
+ label: fmt(D),
4762
+ orientation: "vertical",
4763
+ offset: -10
4764
+ },
4765
+ // Body height (h = C)
4484
4766
  {
4485
4767
  x1: xBack + A * 0.6,
4486
4768
  y1: yFoldTop,
@@ -4490,23 +4772,23 @@ function generateDimensions6(attr, unit) {
4490
4772
  orientation: "vertical",
4491
4773
  offset: -10
4492
4774
  },
4493
- // Top flap (D) (centered on back panel)
4775
+ // W-fold lower (B/2) yFoldBottom to yBottomFlap
4494
4776
  {
4495
4777
  x1: xBack + A * 0.6,
4496
- y1: 0,
4778
+ y1: yFoldBottom,
4497
4779
  x2: xBack + A * 0.6,
4498
- y2: yFoldTop,
4499
- label: fmt(D),
4780
+ y2: yBottomFlap,
4781
+ label: fmt(B / 2),
4500
4782
  orientation: "vertical",
4501
4783
  offset: -10
4502
4784
  },
4503
- // Bottom section (B/2 + _dip) (centered on back panel)
4785
+ // DIP bottom glue tab
4504
4786
  {
4505
4787
  x1: xBack + A * 0.6,
4506
- y1: yFoldBottom,
4788
+ y1: yBottomFlap,
4507
4789
  x2: xBack + A * 0.6,
4508
4790
  y2: yEnd,
4509
- label: fmt(bottomSection),
4791
+ label: fmt(DIP2),
4510
4792
  orientation: "vertical",
4511
4793
  offset: -10
4512
4794
  },
@@ -4694,6 +4976,18 @@ var DIE_LINE_BECF_12109 = react.forwardRef(
4694
4976
  factor,
4695
4977
  theme
4696
4978
  });
4979
+ },
4980
+ readyToPrint: async () => {
4981
+ const dimData = generateDimensions6(attributes, unit);
4982
+ return readyToPrintPdf({
4983
+ modelId: MODEL_ID6,
4984
+ dieline,
4985
+ dimensions: dimData,
4986
+ attributes,
4987
+ unit,
4988
+ factor,
4989
+ theme
4990
+ });
4697
4991
  }
4698
4992
  };
4699
4993
  },
@@ -4791,6 +5085,7 @@ var CANVAS_BECF_12109 = react.forwardRef(
4791
5085
  });
4792
5086
  },
4793
5087
  exportDimension: () => dieLineRef.current.exportDimension(),
5088
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
4794
5089
  resetView: () => canvasRef.current?.resetView(),
4795
5090
  fitView: () => canvasRef.current?.fitView()
4796
5091
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -4827,9 +5122,9 @@ var DIP3 = 15;
4827
5122
  var RIBBON_HALF_W = 9;
4828
5123
  var RIBBON_DX = 2;
4829
5124
  var RIBBON_DY = 2;
4830
- var D_MAX3 = 40;
5125
+ var D_MAX = 40;
4831
5126
  function calcD3(c, b) {
4832
- return Math.min(c - 2 - b / 2, D_MAX3);
5127
+ return Math.min(c - 2 - b / 2, D_MAX);
4833
5128
  }
4834
5129
  function calcKulak3(b) {
4835
5130
  if (b <= 13) return b - 1;
@@ -5304,6 +5599,18 @@ var DIE_LINE_BECF_C_12101 = react.forwardRef(
5304
5599
  factor,
5305
5600
  theme
5306
5601
  });
5602
+ },
5603
+ readyToPrint: async () => {
5604
+ const dimData = generateDimensions7(attributes, unit);
5605
+ return readyToPrintPdf({
5606
+ modelId: MODEL_ID7,
5607
+ dieline,
5608
+ dimensions: dimData,
5609
+ attributes,
5610
+ unit,
5611
+ factor,
5612
+ theme
5613
+ });
5307
5614
  }
5308
5615
  };
5309
5616
  },
@@ -5401,6 +5708,7 @@ var CANVAS_BECF_C_12101 = react.forwardRef(
5401
5708
  });
5402
5709
  },
5403
5710
  exportDimension: () => dieLineRef.current.exportDimension(),
5711
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
5404
5712
  resetView: () => canvasRef.current?.resetView(),
5405
5713
  fitView: () => canvasRef.current?.fitView()
5406
5714
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -5437,11 +5745,11 @@ var DIP4 = 13;
5437
5745
  var RIBBON_HALF_W2 = 9;
5438
5746
  var RIBBON_DX2 = 2;
5439
5747
  var RIBBON_DY2 = 2;
5440
- var D_MAX4 = 40;
5748
+ var D_MAX2 = 40;
5441
5749
  var NOTCH_X2 = 3;
5442
5750
  var NOTCH_Y2 = 5;
5443
5751
  function calcD4(c, b) {
5444
- return Math.min(c - 2 - b / 2, D_MAX4);
5752
+ return Math.min(c - 2 - b / 2, D_MAX2);
5445
5753
  }
5446
5754
  function calcKulak4(b) {
5447
5755
  if (b <= 13) return b - 1;
@@ -6004,6 +6312,18 @@ var DIE_LINE_BECF_C_12109 = react.forwardRef(
6004
6312
  factor,
6005
6313
  theme
6006
6314
  });
6315
+ },
6316
+ readyToPrint: async () => {
6317
+ const dimData = generateDimensions8(attributes, unit);
6318
+ return readyToPrintPdf({
6319
+ modelId: MODEL_ID8,
6320
+ dieline,
6321
+ dimensions: dimData,
6322
+ attributes,
6323
+ unit,
6324
+ factor,
6325
+ theme
6326
+ });
6007
6327
  }
6008
6328
  };
6009
6329
  },
@@ -6101,6 +6421,7 @@ var CANVAS_BECF_C_12109 = react.forwardRef(
6101
6421
  });
6102
6422
  },
6103
6423
  exportDimension: () => dieLineRef.current.exportDimension(),
6424
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
6104
6425
  resetView: () => canvasRef.current?.resetView(),
6105
6426
  fitView: () => canvasRef.current?.fitView()
6106
6427
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -6480,6 +6801,10 @@ var DIE_LINE_BECF_B_12101 = react.forwardRef(
6480
6801
  exportDimension: async () => {
6481
6802
  const dimData = generateDimensions9(attributes, unit);
6482
6803
  return exportDimensionPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
6804
+ },
6805
+ readyToPrint: async () => {
6806
+ const dimData = generateDimensions9(attributes, unit);
6807
+ return readyToPrintPdf({ modelId: MODEL_ID9, dieline, dimensions: dimData, attributes, unit, factor, theme });
6483
6808
  }
6484
6809
  };
6485
6810
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -6546,6 +6871,7 @@ var CANVAS_BECF_B_12101 = react.forwardRef(
6546
6871
  });
6547
6872
  },
6548
6873
  exportDimension: () => dieLineRef.current.exportDimension(),
6874
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
6549
6875
  resetView: () => canvasRef.current?.resetView(),
6550
6876
  fitView: () => canvasRef.current?.fitView()
6551
6877
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -7005,6 +7331,10 @@ var DIE_LINE_BECF_B_12109 = react.forwardRef(
7005
7331
  exportDimension: async () => {
7006
7332
  const dimData = generateDimensions10(attributes, unit);
7007
7333
  return exportDimensionPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
7334
+ },
7335
+ readyToPrint: async () => {
7336
+ const dimData = generateDimensions10(attributes, unit);
7337
+ return readyToPrintPdf({ modelId: MODEL_ID10, dieline, dimensions: dimData, attributes, unit, factor, theme });
7008
7338
  }
7009
7339
  };
7010
7340
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -7071,6 +7401,7 @@ var CANVAS_BECF_B_12109 = react.forwardRef(
7071
7401
  });
7072
7402
  },
7073
7403
  exportDimension: () => dieLineRef.current.exportDimension(),
7404
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
7074
7405
  resetView: () => canvasRef.current?.resetView(),
7075
7406
  fitView: () => canvasRef.current?.fitView()
7076
7407
  }), [serializeCanvasSvg, dieline.viewBox.width, dieline.viewBox.height]);
@@ -7753,6 +8084,18 @@ var DIE_LINE_BECF_10A0A = react.forwardRef(
7753
8084
  factor,
7754
8085
  theme
7755
8086
  });
8087
+ },
8088
+ readyToPrint: async () => {
8089
+ const dimData = generateDimensions11(attributes, unit);
8090
+ return readyToPrintPdf({
8091
+ modelId: MODEL_ID11,
8092
+ dieline,
8093
+ dimensions: dimData,
8094
+ attributes,
8095
+ unit,
8096
+ factor,
8097
+ theme
8098
+ });
7756
8099
  }
7757
8100
  };
7758
8101
  }, [attributes, dieline, factor, unit, serializeSvg, theme]);
@@ -7921,6 +8264,7 @@ var CANVAS_BECF_10A0A = react.forwardRef((props, ref) => {
7921
8264
  });
7922
8265
  },
7923
8266
  exportDimension: () => dieLineRef.current.exportDimension(),
8267
+ readyToPrint: () => dieLineRef.current.readyToPrint(),
7924
8268
  resetView: () => canvasRef.current?.resetView(),
7925
8269
  fitView: () => canvasRef.current?.fitView()
7926
8270
  }),
@@ -11275,12 +11619,12 @@ var AUTO_LAYOUT = react.forwardRef(
11275
11619
  });
11276
11620
  }
11277
11621
  if (pdfGriper > 0) {
11278
- const hexToRgb2 = (hex) => ({
11622
+ const hexToRgb3 = (hex) => ({
11279
11623
  r: parseInt(hex.slice(1, 3), 16),
11280
11624
  g: parseInt(hex.slice(3, 5), 16),
11281
11625
  b: parseInt(hex.slice(5, 7), 16)
11282
11626
  });
11283
- const gc = hexToRgb2(theme.colorGriper);
11627
+ const gc = hexToRgb3(theme.colorGriper);
11284
11628
  doc.setFillColor(gc.r, gc.g, gc.b);
11285
11629
  const depth = pdfGriper;
11286
11630
  switch (gripperSide) {
@@ -11303,7 +11647,7 @@ var AUTO_LAYOUT = react.forwardRef(
11303
11647
  const totalMarks = (ARROW_COLORS_HEX.length - 1) * ARROW_SPACING2;
11304
11648
  const isHoriz = gripperSide === "top" || gripperSide === "bottom";
11305
11649
  ARROW_COLORS_HEX.forEach((hex, idx) => {
11306
- const ac = hexToRgb2(hex);
11650
+ const ac = hexToRgb3(hex);
11307
11651
  doc.setFillColor(ac.r, ac.g, ac.b);
11308
11652
  if (isHoriz) {
11309
11653
  const cx = (pw - totalMarks) / 2 + idx * ARROW_SPACING2;
@@ -11771,7 +12115,7 @@ var BECF_12101_DEFAULT_ATTRIBUTES = {
11771
12115
  length: 100,
11772
12116
  width: 50,
11773
12117
  height: 150,
11774
- glueArea: 13
12118
+ glueArea: 15
11775
12119
  };
11776
12120
 
11777
12121
  // src/statics/bags-pillows/becf-12109/DEFAULT_ATTRIBUTES.ts
@@ -11779,7 +12123,7 @@ var BECF_12109_DEFAULT_ATTRIBUTES = {
11779
12123
  length: 100,
11780
12124
  width: 50,
11781
12125
  height: 150,
11782
- glueArea: 13
12126
+ glueArea: 15
11783
12127
  };
11784
12128
 
11785
12129
  // src/statics/bags-pillows/becf-c-12101/DEFAULT_ATTRIBUTES.ts
@@ -11787,7 +12131,7 @@ var BECF_C_12101_DEFAULT_ATTRIBUTES = {
11787
12131
  length: 100,
11788
12132
  width: 50,
11789
12133
  height: 150,
11790
- glueArea: 13
12134
+ glueArea: 15
11791
12135
  };
11792
12136
 
11793
12137
  // src/statics/bags-pillows/becf-c-12109/DEFAULT_ATTRIBUTES.ts
@@ -11795,7 +12139,7 @@ var BECF_C_12109_DEFAULT_ATTRIBUTES = {
11795
12139
  length: 100,
11796
12140
  width: 50,
11797
12141
  height: 150,
11798
- glueArea: 13
12142
+ glueArea: 15
11799
12143
  };
11800
12144
 
11801
12145
  // src/statics/bags-pillows/becf-b-12101/DEFAULT_ATTRIBUTES.ts
@@ -11803,7 +12147,7 @@ var BECF_B_12101_DEFAULT_ATTRIBUTES = {
11803
12147
  length: 100,
11804
12148
  width: 50,
11805
12149
  height: 150,
11806
- glueArea: 13
12150
+ glueArea: 15
11807
12151
  };
11808
12152
 
11809
12153
  // src/statics/bags-pillows/becf-b-12109/DEFAULT_ATTRIBUTES.ts
@@ -11811,7 +12155,7 @@ var BECF_B_12109_DEFAULT_ATTRIBUTES = {
11811
12155
  length: 100,
11812
12156
  width: 50,
11813
12157
  height: 150,
11814
- glueArea: 13
12158
+ glueArea: 15
11815
12159
  };
11816
12160
 
11817
12161
  // src/statics/snap-lock-boxes/becf-10a0a/DEFAULT_ATTRIBUTES.ts
@@ -11819,7 +12163,7 @@ var BECF_10A0A_DEFAULT_ATTRIBUTES = {
11819
12163
  length: 100,
11820
12164
  width: 50,
11821
12165
  height: 150,
11822
- glueArea: 13
12166
+ glueArea: 15
11823
12167
  };
11824
12168
 
11825
12169
  // src/statics/modelList.ts