@snowcone-app/canvas 0.42.1 → 0.43.0
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/ERROR_CONTRACT.md +45 -0
- package/dist/{CanvasRenderer-Bm7KLh38.js → CanvasRenderer-DnYgiWjt.js} +2 -2
- package/dist/{CanvasRenderer-Bm7KLh38.js.map → CanvasRenderer-DnYgiWjt.js.map} +1 -1
- package/dist/{CanvasStateV1-DPSSkdyD.js → CanvasStateV1-B51bXTyy.js} +2 -2
- package/dist/{CanvasStateV1-DPSSkdyD.js.map → CanvasStateV1-B51bXTyy.js.map} +1 -1
- package/dist/{ContextualToolbars-BuWJ3vD8.js → ContextualToolbars-DtlxDatY.js} +4 -4
- package/dist/{ContextualToolbars-BuWJ3vD8.js.map → ContextualToolbars-DtlxDatY.js.map} +1 -1
- package/dist/{EditorCanvasImpl-CtiIZyyt.js → EditorCanvasImpl-BpudFLkw.js} +6 -6
- package/dist/{EditorCanvasImpl-CtiIZyyt.js.map → EditorCanvasImpl-BpudFLkw.js.map} +1 -1
- package/dist/{ExportManager-DCEgNCL-.js → ExportManager-vAuaoF5Q.js} +1212 -1224
- package/dist/{ExportManager-DCEgNCL-.js.map → ExportManager-vAuaoF5Q.js.map} +1 -1
- package/dist/FontAnalyzer-D9R2PYsy.js.map +1 -1
- package/dist/{ImagePanel-WLkHhuBY.js → ImagePanel-kybrF6yT.js} +3 -3
- package/dist/{ImagePanel-WLkHhuBY.js.map → ImagePanel-kybrF6yT.js.map} +1 -1
- package/dist/SnowconeCanvas-p9XmnSCK.js +1157 -0
- package/dist/SnowconeCanvas-p9XmnSCK.js.map +1 -0
- package/dist/advanced.mjs +9 -9
- package/dist/api/embed.d.ts +1 -0
- package/dist/api/stable.d.ts +1 -0
- package/dist/components/embed/SnowconeCanvas.d.ts +13 -0
- package/dist/{custom-icons-B3auKmXj.js → custom-icons-Dlfrg3A_.js} +2 -2
- package/dist/{custom-icons-B3auKmXj.js.map → custom-icons-Dlfrg3A_.js.map} +1 -1
- package/dist/{embed-hQtKIv0u.js → embed-DuIOU8mL.js} +7 -7
- package/dist/{embed-hQtKIv0u.js.map → embed-DuIOU8mL.js.map} +1 -1
- package/dist/embed.mjs +5 -5
- package/dist/errors/editorError.d.ts +4 -1
- package/dist/index.mjs +7 -7
- package/dist/internals.mjs +4 -4
- package/dist/{template-fields-pasAAplQ.js → template-fields-DCZ9TqxY.js} +3 -3
- package/dist/{template-fields-pasAAplQ.js.map → template-fields-DCZ9TqxY.js.map} +1 -1
- package/dist/{useCommands-htOtw7w6.js → useCommands-d5UM6Cnc.js} +5 -5
- package/dist/{useCommands-htOtw7w6.js.map → useCommands-d5UM6Cnc.js.map} +1 -1
- package/dist/utils/ExportManager.d.ts +37 -1
- package/dist/utils/printFiles.d.ts +23 -0
- package/dist/{validation-m6hAaElF.js → validation-C8qNtk6j.js} +9 -9
- package/dist/{validation-m6hAaElF.js.map → validation-C8qNtk6j.js.map} +1 -1
- package/example/package.json +1 -1
- package/package.json +2 -2
- package/dist/SnowconeCanvas-1wc08k_m.js +0 -1098
- package/dist/SnowconeCanvas-1wc08k_m.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as j, G as
|
|
1
|
+
import { c as j, G as Vt, ag as Je, x as Ke, v as Qe, ak as Ee, aS as Jt, ai as ze, af as D, s as Ze, w as De, ah as at, aj as Kt, z as ee, ax as xe, al as tr, aT as J, aU as er, b as rr, aV as vt, aW as nr, _ as Se, aX as Ce, P as or, S as ar, I as Wt, F as sr, W as ir, f as lr, d as cr, L as hr, C as fr, g as dr, A as re, $ as ur, a0 as gr, i as pr, t as gt } from "./FontAnalyzer-D9R2PYsy.js";
|
|
2
2
|
let Pe = null;
|
|
3
|
-
function
|
|
3
|
+
function mr(e) {
|
|
4
4
|
Pe = e;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function zn() {
|
|
7
7
|
return Pe;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
9
|
+
const yr = j("TextureManager"), it = class it {
|
|
10
10
|
/**
|
|
11
11
|
* Load a texture by ID or URL
|
|
12
12
|
*/
|
|
@@ -16,12 +16,12 @@ const mr = j("TextureManager"), lt = class lt {
|
|
|
16
16
|
if (this.loading.has(t))
|
|
17
17
|
return this.loading.get(t);
|
|
18
18
|
const r = this.resolveTextureUrl(t), n = new Promise((o, i) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
this.cache.set(t,
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
},
|
|
19
|
+
const a = new Image();
|
|
20
|
+
a.crossOrigin = "anonymous", a.onload = () => {
|
|
21
|
+
this.cache.set(t, a), this.cache.set(r, a), this.loading.delete(t), this.loading.delete(r), o(a);
|
|
22
|
+
}, a.onerror = () => {
|
|
23
|
+
yr.error("Failed to load texture:", r), this.loading.delete(t), this.loading.delete(r), i(new Error(`Failed to load texture: ${r}`));
|
|
24
|
+
}, a.src = r;
|
|
25
25
|
});
|
|
26
26
|
return this.loading.set(t, n), r !== t && this.loading.set(r, n), n;
|
|
27
27
|
}
|
|
@@ -86,7 +86,7 @@ const mr = j("TextureManager"), lt = class lt {
|
|
|
86
86
|
return (r == null ? void 0 : r.presetColor) || "#ffffff";
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
|
|
89
|
+
it.cache = /* @__PURE__ */ new Map(), it.loading = /* @__PURE__ */ new Map(), it.TEXTURES = [
|
|
90
90
|
{
|
|
91
91
|
id: "glass-frame",
|
|
92
92
|
name: "Glass Frame",
|
|
@@ -96,85 +96,85 @@ lt.cache = /* @__PURE__ */ new Map(), lt.loading = /* @__PURE__ */ new Map(), lt
|
|
|
96
96
|
// Light gray
|
|
97
97
|
}
|
|
98
98
|
];
|
|
99
|
-
let
|
|
100
|
-
const
|
|
99
|
+
let pt = it;
|
|
100
|
+
const wr = j("ElementPreviewRenderer"), br = {
|
|
101
101
|
width: 40,
|
|
102
102
|
height: 40,
|
|
103
103
|
padding: 4,
|
|
104
104
|
backgroundColor: "transparent"
|
|
105
105
|
};
|
|
106
106
|
function kr(e, t = {}) {
|
|
107
|
-
|
|
108
|
-
const r = { ...
|
|
107
|
+
zt();
|
|
108
|
+
const r = { ...br, ...t }, n = document.createElement("canvas");
|
|
109
109
|
n.width = r.width, n.height = r.height;
|
|
110
110
|
const o = n.getContext("2d");
|
|
111
111
|
if (!o)
|
|
112
112
|
return "";
|
|
113
113
|
r.backgroundColor !== "transparent" && (o.fillStyle = r.backgroundColor, o.fillRect(0, 0, r.width, r.height)), o.save();
|
|
114
114
|
try {
|
|
115
|
-
e instanceof
|
|
115
|
+
e instanceof Vt ? vr(o, e, r) : Tr(o, e, r);
|
|
116
116
|
} catch (i) {
|
|
117
|
-
|
|
117
|
+
wr.warn("Failed to generate preview:", i);
|
|
118
118
|
}
|
|
119
119
|
return o.restore(), n.toDataURL("image/png");
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function Tr(e, t, r) {
|
|
122
122
|
var d;
|
|
123
123
|
const n = ((d = t.getBoundingBox) == null ? void 0 : d.call(t)) || { x: 0, y: 0, width: 100, height: 100 }, o = n.width, i = n.height;
|
|
124
124
|
if (o === 0 || i === 0) {
|
|
125
|
-
|
|
125
|
+
ne(e, t, r);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
|
|
128
|
+
const a = r.width - r.padding * 2, l = r.height - r.padding * 2, s = Math.min(
|
|
129
|
+
a / o,
|
|
130
130
|
l / i,
|
|
131
131
|
1
|
|
132
132
|
// Don't scale up, only down
|
|
133
|
-
), c = o *
|
|
134
|
-
e.save(), e.translate(f - n.x *
|
|
133
|
+
), c = o * s, h = i * s, f = r.padding + (a - c) / 2, u = r.padding + (l - h) / 2;
|
|
134
|
+
e.save(), e.translate(f - n.x * s, u - n.y * s), e.scale(s, s), typeof t.render == "function" ? t.render(e, !1, !1) : ne(e, t, r), e.restore();
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function ne(e, t, r) {
|
|
137
137
|
e.fillStyle = "#888888", e.font = "10px Arial", e.textAlign = "center", e.textBaseline = "middle";
|
|
138
138
|
const n = t.transformType || "Element";
|
|
139
139
|
e.fillText(n, r.width / 2, r.height / 2);
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const n = r.width - r.padding * 2, o = r.height - r.padding * 2, i = r.padding,
|
|
141
|
+
function vr(e, t, r) {
|
|
142
|
+
const n = r.width - r.padding * 2, o = r.height - r.padding * 2, i = r.padding, a = r.padding;
|
|
143
143
|
e.fillStyle = "#888888", e.strokeStyle = "#666666", e.lineWidth = 1;
|
|
144
|
-
const l = o * 0.7,
|
|
145
|
-
e.fillRect(i,
|
|
144
|
+
const l = o * 0.7, s = a + o * 0.3, c = n * 0.4, h = o * 0.2;
|
|
145
|
+
e.fillRect(i, s, n, l), e.fillRect(i, s - h, c, h), t.children && t.children.length > 0 && (e.fillStyle = "#FFFFFF", e.font = "bold 10px Arial", e.textAlign = "center", e.textBaseline = "middle", e.fillText(
|
|
146
146
|
t.children.length.toString(),
|
|
147
147
|
i + n / 2,
|
|
148
|
-
|
|
148
|
+
s + l / 2
|
|
149
149
|
));
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function Zn(e, t, r) {
|
|
152
152
|
var c;
|
|
153
153
|
e.translate(t.x || 0, t.y || 0), e.rotate(-(t.rotation || 0) * Math.PI / 180);
|
|
154
|
-
const n = t, o = n.fontSize || 24, i = n.fontFamily || "Arial",
|
|
155
|
-
e.font =
|
|
156
|
-
const
|
|
154
|
+
const n = t, o = n.fontSize || 24, i = n.fontFamily || "Arial", a = n.bold || !1, l = n.italic || !1;
|
|
155
|
+
e.font = Je(o, i, a, l);
|
|
156
|
+
const s = n.text || "";
|
|
157
157
|
if (t.transformType === "custom") {
|
|
158
|
-
const f = ((c = t.transformData) == null ? void 0 : c.width) || 200, u =
|
|
159
|
-
e.rect(-d / 2, -
|
|
158
|
+
const f = ((c = t.transformData) == null ? void 0 : c.width) || 200, u = Ke(s, o, i, a, l), d = Math.min(u, f), p = o * 1.2;
|
|
159
|
+
e.rect(-d / 2, -p / 2, d, p);
|
|
160
160
|
} else {
|
|
161
|
-
const h = e.measureText(
|
|
161
|
+
const h = e.measureText(s).width;
|
|
162
162
|
e.beginPath(), e.moveTo(-h / 2, 0), e.lineTo(h / 2, 0), e.moveTo(-h / 2, -o), e.lineTo(h / 2, -o), e.moveTo(-h / 2, o * 0.2), e.lineTo(h / 2, o * 0.2);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function Mr(e, t) {
|
|
166
166
|
if (!t.transformData) return;
|
|
167
167
|
const { borderRadius: r = 0 } = t.transformData, n = t.transformData.width ?? 100, o = t.transformData.height ?? 100;
|
|
168
168
|
if (e.translate(t.x || 0, t.y || 0), e.rotate(-(t.rotation || 0) * Math.PI / 180), e.beginPath(), r > 0) {
|
|
169
|
-
const i = Math.min(n, o) / 2,
|
|
170
|
-
e.moveTo(l +
|
|
169
|
+
const i = Math.min(n, o) / 2, a = Math.min(r, i), l = -n / 2, s = -o / 2;
|
|
170
|
+
e.moveTo(l + a, s), e.lineTo(l + n - a, s), e.arcTo(l + n, s, l + n, s + a, a), e.lineTo(l + n, s + o - a), e.arcTo(l + n, s + o, l + n - a, s + o, a), e.lineTo(l + a, s + o), e.arcTo(l, s + o, l, s + o - a, a), e.lineTo(l, s + a), e.arcTo(l, s, l + a, s, a), e.closePath();
|
|
171
171
|
} else
|
|
172
172
|
e.rect(-n / 2, -o / 2, n, o);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Dn(e, t, r, n) {
|
|
175
175
|
e.beginPath(), e.arc(t, r, n, 0, Math.PI * 2), e.closePath();
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function xn(e, t, r, n, o) {
|
|
178
178
|
e.beginPath(), e.rect(t, r, n, o), e.closePath();
|
|
179
179
|
}
|
|
180
180
|
function Ie(e, t) {
|
|
@@ -187,335 +187,335 @@ function Er(e, t) {
|
|
|
187
187
|
return r.width = e, r.height = t, r;
|
|
188
188
|
}
|
|
189
189
|
function Ae(e, t, r) {
|
|
190
|
-
var
|
|
191
|
-
if (!((
|
|
190
|
+
var s;
|
|
191
|
+
if (!((s = t.stroke) != null && s.enabled)) return;
|
|
192
192
|
const n = t;
|
|
193
193
|
if (!(n.text || "")) return;
|
|
194
|
-
const i = (r == null ? void 0 : r.isKnockout) === !0,
|
|
195
|
-
if (!i &&
|
|
194
|
+
const i = (r == null ? void 0 : r.isKnockout) === !0, a = t.stroke.opacity ?? 1;
|
|
195
|
+
if (!i && a < 1)
|
|
196
196
|
try {
|
|
197
|
-
Sr(e, t, n, r,
|
|
197
|
+
Sr(e, t, n, r, a);
|
|
198
198
|
} catch {
|
|
199
|
-
|
|
199
|
+
st(e, t, n, r, !1);
|
|
200
200
|
}
|
|
201
201
|
else
|
|
202
|
-
|
|
202
|
+
st(e, t, n, r, i);
|
|
203
203
|
}
|
|
204
204
|
function Sr(e, t, r, n, o) {
|
|
205
|
-
var
|
|
206
|
-
const i = r.text || "",
|
|
207
|
-
if (
|
|
208
|
-
|
|
205
|
+
var P, I;
|
|
206
|
+
const i = r.text || "", a = r.fontSize || 24, l = t.stroke.width, s = t.stroke.feather || 0, c = t.transformType === "custom" && ((P = t.transformData) == null ? void 0 : P.width), h = c ? ((I = t.transformData) == null ? void 0 : I.width) ?? 200 : 0, f = c ? h + l * 2 + s * 2 + 40 : a * i.length * 0.7 + l * 2 + s * 2 + 40, u = a * 3 + l * 2 + s * 2 + 40, d = e.getTransform(), p = Math.max(Math.abs(d.a), Math.abs(d.d), 1), m = Math.ceil(f * p / 2) * 2, w = Math.ceil(u * p / 2) * 2;
|
|
207
|
+
if (m <= 0 || w <= 0) {
|
|
208
|
+
st(e, t, r, n, !1);
|
|
209
209
|
return;
|
|
210
210
|
}
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
213
|
-
|
|
211
|
+
const k = Er(m, w), b = k.getContext("2d");
|
|
212
|
+
if (!b) {
|
|
213
|
+
st(e, t, r, n, !1);
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
|
-
const
|
|
217
|
-
|
|
216
|
+
const T = t.x || 0, g = t.y || 0, y = d.a * T + d.c * g + d.e, S = d.b * T + d.d * g + d.f;
|
|
217
|
+
b.setTransform(
|
|
218
218
|
d.a,
|
|
219
219
|
d.b,
|
|
220
220
|
d.c,
|
|
221
221
|
d.d,
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
m / 2 - y + d.e,
|
|
223
|
+
w / 2 - S + d.f
|
|
224
224
|
);
|
|
225
|
-
const
|
|
226
|
-
t.stroke.opacity = 1,
|
|
227
|
-
|
|
228
|
-
Math.round(y -
|
|
229
|
-
Math.round(
|
|
225
|
+
const C = t.stroke.opacity;
|
|
226
|
+
t.stroke.opacity = 1, st(b, t, r, n, !1), t.stroke.opacity = C, e.save(), e.resetTransform(), e.globalAlpha = o, e.drawImage(
|
|
227
|
+
k,
|
|
228
|
+
Math.round(y - m / 2),
|
|
229
|
+
Math.round(S - w / 2)
|
|
230
230
|
), e.restore();
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function st(e, t, r, n, o) {
|
|
233
233
|
var d;
|
|
234
234
|
const i = r.text || "";
|
|
235
235
|
e.save(), n != null && n.positionApplied || (e.translate(t.x || 0, t.y || 0), e.rotate(-(t.rotation || 0) * Math.PI / 180));
|
|
236
|
-
const
|
|
237
|
-
e.font = `${c ? "italic " : ""}${
|
|
238
|
-
const f =
|
|
236
|
+
const a = r.fontSize || 24, l = r.fontFamily || "Arial", s = r.bold || !1, c = r.italic || !1, h = r.textAlign || "center";
|
|
237
|
+
e.font = `${c ? "italic " : ""}${s ? "bold " : ""}${a}px ${l}`, e.textAlign = h, e.textBaseline = "alphabetic", o ? (e.strokeStyle = "#000000", e.globalAlpha = 1) : (e.strokeStyle = t.stroke.color, t.stroke.opacity !== void 0 && (e.globalAlpha = t.stroke.opacity)), e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "round", e.lineJoin = t.stroke.lineJoin || "round", t.stroke.miterLimit !== void 0 && (e.miterLimit = t.stroke.miterLimit), !o && t.stroke.feather && t.stroke.feather > 0 && "filter" in e && (e.filter = `blur(${t.stroke.feather}px)`);
|
|
238
|
+
const f = Qe(a, l, s, c);
|
|
239
239
|
if (t.transformType === "custom" && ((d = t.transformData) == null ? void 0 : d.width)) {
|
|
240
|
-
const
|
|
240
|
+
const p = t.transformData, m = (p == null ? void 0 : p.width) ?? 200, w = m - D * 2, k = r.letterSpacing ?? 0, { lines: b, height: T } = Ee(
|
|
241
241
|
i,
|
|
242
|
-
|
|
243
|
-
s,
|
|
244
|
-
l,
|
|
242
|
+
w,
|
|
245
243
|
a,
|
|
244
|
+
l,
|
|
245
|
+
s,
|
|
246
246
|
c,
|
|
247
247
|
void 0,
|
|
248
248
|
// No locked line count for stroke
|
|
249
249
|
!0,
|
|
250
250
|
// strict: wrap exactly at maxWidth
|
|
251
|
-
{ letterSpacing:
|
|
252
|
-
),
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
let A =
|
|
256
|
-
if (!
|
|
257
|
-
const R =
|
|
258
|
-
|
|
251
|
+
{ letterSpacing: k, lineHeight: r.lineHeight }
|
|
252
|
+
), g = -m / 2, y = -T / 2, S = a * (r.lineHeight ?? Jt);
|
|
253
|
+
b.forEach((C, P) => {
|
|
254
|
+
const I = P === 0, M = P === b.length - 1;
|
|
255
|
+
let A = C;
|
|
256
|
+
if (!I) {
|
|
257
|
+
const R = C.match(/^ +/), U = R ? R[0].length : 0;
|
|
258
|
+
U > 0 && (A = A.substring(U));
|
|
259
259
|
}
|
|
260
|
-
if (!
|
|
261
|
-
const R = A.match(/ +$/),
|
|
262
|
-
|
|
260
|
+
if (!M) {
|
|
261
|
+
const R = A.match(/ +$/), U = R ? R[0].length : 0;
|
|
262
|
+
U > 0 && (A = A.substring(0, A.length - U));
|
|
263
263
|
}
|
|
264
|
-
let
|
|
265
|
-
h === "center" ?
|
|
266
|
-
const
|
|
267
|
-
|
|
264
|
+
let E = g + D;
|
|
265
|
+
h === "center" ? E = g + m / 2 : h === "right" && (E = g + m - D);
|
|
266
|
+
const v = y + f.ascent + P * S;
|
|
267
|
+
ze(e, A, E, v, k);
|
|
268
268
|
});
|
|
269
269
|
} else {
|
|
270
|
-
const
|
|
271
|
-
e.strokeText(i, 0,
|
|
270
|
+
const w = -f.height / 2 + f.ascent;
|
|
271
|
+
e.strokeText(i, 0, w);
|
|
272
272
|
}
|
|
273
273
|
e.restore();
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Cr(e, t, r) {
|
|
276
276
|
var o;
|
|
277
277
|
if (!((o = t.stroke) != null && o.enabled) || !t.transformData) return;
|
|
278
278
|
const n = (r == null ? void 0 : r.isKnockout) === !0;
|
|
279
|
-
e.save(), n ? (e.strokeStyle = "#000000", e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "butt", e.lineJoin = t.stroke.lineJoin || "miter", e.globalAlpha = 1, t.stroke.miterLimit !== void 0 && (e.miterLimit = t.stroke.miterLimit)) : Ie(e, t.stroke), !n && t.stroke.feather && t.stroke.feather > 0 && "filter" in e && (e.filter = `blur(${t.stroke.feather}px)`),
|
|
279
|
+
e.save(), n ? (e.strokeStyle = "#000000", e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "butt", e.lineJoin = t.stroke.lineJoin || "miter", e.globalAlpha = 1, t.stroke.miterLimit !== void 0 && (e.miterLimit = t.stroke.miterLimit)) : Ie(e, t.stroke), !n && t.stroke.feather && t.stroke.feather > 0 && "filter" in e && (e.filter = `blur(${t.stroke.feather}px)`), Mr(e, t), e.stroke(), e.restore();
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function to(e, t, r) {
|
|
282
282
|
t.enabled && (e.save(), Ie(e, t), t.feather && t.feather > 0 && "filter" in e && (e.filter = `blur(${t.feather}px)`), e.beginPath(), r(), e.stroke(), e.restore());
|
|
283
283
|
}
|
|
284
|
-
const
|
|
285
|
-
function
|
|
284
|
+
const oe = j("GlyphRenderer");
|
|
285
|
+
function Pr(e, t, r, n, o, i, a, l = {}) {
|
|
286
286
|
try {
|
|
287
|
-
const
|
|
288
|
-
Object.entries(
|
|
289
|
-
|
|
287
|
+
const s = [];
|
|
288
|
+
Object.entries(a).forEach(([w, k]) => {
|
|
289
|
+
k && s.push(w);
|
|
290
290
|
});
|
|
291
291
|
const c = [];
|
|
292
|
-
t.GSUB && t.GSUB.featureList && t.GSUB.featureList.forEach((
|
|
293
|
-
c.push(
|
|
292
|
+
t.GSUB && t.GSUB.featureList && t.GSUB.featureList.forEach((w) => {
|
|
293
|
+
c.push(w.tag);
|
|
294
294
|
});
|
|
295
295
|
const h = {};
|
|
296
|
-
h.ccmp = !0, h.locl = !0, h.kern = !0,
|
|
297
|
-
h[
|
|
296
|
+
h.ccmp = !0, h.locl = !0, h.kern = !0, s.forEach((w) => {
|
|
297
|
+
h[w] = !0;
|
|
298
298
|
}), h.calt && (h.liga = !0, h.init = !0, h.fina = !0);
|
|
299
299
|
const f = t.layout(r, h, "latn"), u = i / t.unitsPerEm;
|
|
300
300
|
let d = 0;
|
|
301
|
-
f.glyphs.forEach((
|
|
302
|
-
d +=
|
|
301
|
+
f.glyphs.forEach((w) => {
|
|
302
|
+
d += w.advanceWidth * u;
|
|
303
303
|
});
|
|
304
|
-
let
|
|
305
|
-
l.align === "center" ?
|
|
306
|
-
let
|
|
307
|
-
f.glyphs.forEach((
|
|
308
|
-
const
|
|
309
|
-
let
|
|
304
|
+
let p = n;
|
|
305
|
+
l.align === "center" ? p = n - d / 2 : l.align === "right" && (p = n - d), e.save(), e.fillStyle = l.color || "#000000";
|
|
306
|
+
let m = p;
|
|
307
|
+
f.glyphs.forEach((w, k) => {
|
|
308
|
+
const b = f.positions[k];
|
|
309
|
+
let T = null;
|
|
310
310
|
try {
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
else if (
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
316
|
-
|
|
311
|
+
if (w.path && typeof w.path.toPath == "function")
|
|
312
|
+
T = w.path.toPath();
|
|
313
|
+
else if (w.path && typeof w.path.toSVG == "function") {
|
|
314
|
+
const g = w.path.toSVG();
|
|
315
|
+
if (g && /^[MmLlHhVvCcSsQqTtAaZz]/.test(g))
|
|
316
|
+
T = g;
|
|
317
317
|
else {
|
|
318
|
-
const y =
|
|
319
|
-
|
|
318
|
+
const y = g == null ? void 0 : g.match(/\bd=["']([^"']+)["']/);
|
|
319
|
+
T = y ? y[1] : null;
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
} catch (
|
|
323
|
-
|
|
322
|
+
} catch (g) {
|
|
323
|
+
oe.warn("Error getting path for glyph:", w.name, g);
|
|
324
324
|
}
|
|
325
|
-
if (
|
|
326
|
-
const
|
|
327
|
-
e.save(), e.translate(
|
|
325
|
+
if (T) {
|
|
326
|
+
const g = new Path2D(T);
|
|
327
|
+
e.save(), e.translate(m + b.xOffset * u, o + b.yOffset * u), e.scale(u, -u), e.fill(g), e.restore();
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
m += w.advanceWidth * u;
|
|
330
330
|
}), e.restore();
|
|
331
|
-
} catch (
|
|
332
|
-
|
|
331
|
+
} catch (s) {
|
|
332
|
+
oe.error("Error rendering with fontkit:", s), e.fillStyle = l.color || "#000000", e.textAlign = l.align || "left", e.fillText(r, n, o);
|
|
333
333
|
}
|
|
334
334
|
}
|
|
335
|
-
function
|
|
336
|
-
const c = ((
|
|
337
|
-
for (const
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
335
|
+
function Ir(e, t, r, n, o, i, a, l = {}) {
|
|
336
|
+
const c = ((w) => {
|
|
337
|
+
for (const k of w) {
|
|
338
|
+
const b = k.codePointAt(0);
|
|
339
|
+
if (b && b >= 983040 && b <= 1048573) return !0;
|
|
340
340
|
}
|
|
341
341
|
return !1;
|
|
342
342
|
})(r);
|
|
343
|
-
if ((!
|
|
343
|
+
if ((!a || a.length === 0) && !c) {
|
|
344
344
|
e.fillStyle = l.color || "#000000", e.textAlign = l.align || "left", e.fillText(r, n, o);
|
|
345
345
|
return;
|
|
346
346
|
}
|
|
347
347
|
const h = /* @__PURE__ */ new Map();
|
|
348
|
-
|
|
349
|
-
h.set(
|
|
348
|
+
a && a.forEach((w) => {
|
|
349
|
+
h.set(w.charIndex, w.glyphIndex);
|
|
350
350
|
});
|
|
351
351
|
const f = i / t.unitsPerEm, u = Array.from(r);
|
|
352
352
|
let d = 0;
|
|
353
|
-
u.forEach((
|
|
354
|
-
const
|
|
355
|
-
let
|
|
356
|
-
if (
|
|
357
|
-
|
|
358
|
-
else if (
|
|
359
|
-
const y = t.glyphForCodePoint(
|
|
360
|
-
|
|
353
|
+
u.forEach((w, k) => {
|
|
354
|
+
const b = w.codePointAt(0) || 0;
|
|
355
|
+
let T;
|
|
356
|
+
if (b >= 983040 && b <= 1048573)
|
|
357
|
+
T = b - 983040;
|
|
358
|
+
else if (T = h.get(k), T === void 0) {
|
|
359
|
+
const y = t.glyphForCodePoint(b);
|
|
360
|
+
T = y ? y.id : 0;
|
|
361
361
|
}
|
|
362
|
-
const
|
|
363
|
-
|
|
362
|
+
const g = t.getGlyph(T);
|
|
363
|
+
g && (d += g.advanceWidth * f);
|
|
364
364
|
});
|
|
365
|
-
let
|
|
366
|
-
l.align === "center" ?
|
|
367
|
-
let
|
|
368
|
-
u.forEach((
|
|
369
|
-
const
|
|
370
|
-
let
|
|
371
|
-
if (
|
|
372
|
-
|
|
373
|
-
else if (
|
|
374
|
-
const y = t.glyphForCodePoint(
|
|
375
|
-
|
|
365
|
+
let p = n;
|
|
366
|
+
l.align === "center" ? p = n - d / 2 : l.align === "right" && (p = n - d), e.save(), e.fillStyle = l.color || "#000000";
|
|
367
|
+
let m = p;
|
|
368
|
+
u.forEach((w, k) => {
|
|
369
|
+
const b = w.codePointAt(0) || 0;
|
|
370
|
+
let T;
|
|
371
|
+
if (b >= 983040 && b <= 1048573)
|
|
372
|
+
T = b - 983040;
|
|
373
|
+
else if (T = h.get(k), T === void 0) {
|
|
374
|
+
const y = t.glyphForCodePoint(b);
|
|
375
|
+
T = y ? y.id : 0;
|
|
376
376
|
}
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
const y =
|
|
377
|
+
const g = t.getGlyph(T);
|
|
378
|
+
if (g) {
|
|
379
|
+
const y = g.path.toSVG();
|
|
380
380
|
if (y) {
|
|
381
|
-
const
|
|
382
|
-
e.save(), e.translate(
|
|
381
|
+
const S = new Path2D(y);
|
|
382
|
+
e.save(), e.translate(m, o), e.scale(f, -f), e.fill(S), e.restore();
|
|
383
383
|
}
|
|
384
|
-
|
|
384
|
+
m += g.advanceWidth * f;
|
|
385
385
|
}
|
|
386
386
|
}), e.restore();
|
|
387
387
|
}
|
|
388
|
-
function
|
|
388
|
+
function Ar(e, t, r, n, o) {
|
|
389
389
|
e.fillStyle = r.color;
|
|
390
|
-
const i = r.textAlign || "center",
|
|
391
|
-
let
|
|
392
|
-
n !== void 0 && n > 0 && !o ? (
|
|
393
|
-
const
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
isParagraphStart:
|
|
397
|
-
isParagraphEnd:
|
|
390
|
+
const i = r.textAlign || "center", a = (m) => m.letterSpacing !== void 0 ? m.letterSpacing : r.letterSpacing ?? 0, l = Ze(t);
|
|
391
|
+
let s, c;
|
|
392
|
+
n !== void 0 && n > 0 && !o ? (s = [], c = [], l.forEach((m) => {
|
|
393
|
+
const w = De(m, n, r);
|
|
394
|
+
w.forEach((k, b) => {
|
|
395
|
+
s.push(k), c.push({
|
|
396
|
+
isParagraphStart: b === 0,
|
|
397
|
+
isParagraphEnd: b === w.length - 1
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
|
-
})) : (
|
|
400
|
+
})) : (s = l, c = l.map(() => ({
|
|
401
401
|
isParagraphStart: !0,
|
|
402
402
|
isParagraphEnd: !0
|
|
403
403
|
})));
|
|
404
404
|
const h = [];
|
|
405
|
-
|
|
406
|
-
const
|
|
407
|
-
let
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
const R =
|
|
411
|
-
e.font = q(R, W, F
|
|
412
|
-
const B = at(e.measureText(
|
|
413
|
-
|
|
414
|
-
const $ =
|
|
415
|
-
|
|
405
|
+
s.forEach((m, w) => {
|
|
406
|
+
const k = [];
|
|
407
|
+
let b = 0, T = 0;
|
|
408
|
+
const g = c[w].isParagraphStart, y = c[w].isParagraphEnd;
|
|
409
|
+
m.forEach((v) => {
|
|
410
|
+
const R = v.style.fontSize !== void 0 ? v.style.fontSize : r.fontSize, U = v.style.fontFamily !== void 0 ? v.style.fontFamily : r.fontFamily, W = v.style.bold !== void 0 ? v.style.bold : r.bold || !1, F = v.style.italic !== void 0 ? v.style.italic : r.italic || !1;
|
|
411
|
+
e.font = q(R, U, W, F);
|
|
412
|
+
const B = at(e.measureText(v.text).width, v.text, a(v.style));
|
|
413
|
+
k.push(B);
|
|
414
|
+
const $ = ct(R, U, W, F);
|
|
415
|
+
b = Math.max(b, $.height), T = Math.max(T, $.ascent);
|
|
416
416
|
});
|
|
417
|
-
const
|
|
418
|
-
let A = 0,
|
|
419
|
-
|
|
420
|
-
const R =
|
|
421
|
-
let B =
|
|
422
|
-
const $ =
|
|
423
|
-
if (!
|
|
424
|
-
const L = Math.min(
|
|
417
|
+
const S = m.map((v) => v.text).join(""), C = S.match(/^ +/), P = S.match(/ +$/), I = C ? C[0].length : 0, M = P ? P[0].length : 0;
|
|
418
|
+
let A = 0, E = 0;
|
|
419
|
+
m.forEach((v) => {
|
|
420
|
+
const R = v.style.fontSize !== void 0 ? v.style.fontSize : r.fontSize, U = v.style.fontFamily !== void 0 ? v.style.fontFamily : r.fontFamily, W = v.style.bold !== void 0 ? v.style.bold : r.bold || !1, F = v.style.italic !== void 0 ? v.style.italic : r.italic || !1;
|
|
421
|
+
let B = v.text;
|
|
422
|
+
const $ = E, St = E + v.text.length;
|
|
423
|
+
if (!g && I > 0 && $ < I) {
|
|
424
|
+
const L = Math.min(I - $, v.text.length);
|
|
425
425
|
B = B.substring(L);
|
|
426
426
|
}
|
|
427
|
-
if (!y &&
|
|
428
|
-
const L =
|
|
427
|
+
if (!y && M > 0) {
|
|
428
|
+
const L = S.length - M;
|
|
429
429
|
if (St > L) {
|
|
430
|
-
const G = !
|
|
431
|
-
B = B.substring(0,
|
|
430
|
+
const G = !g && I > 0 && $ < I ? Math.min(I - $, v.text.length) : 0, Ct = Math.max(0, L - $ - G);
|
|
431
|
+
B = B.substring(0, Ct);
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
|
|
434
|
+
E += v.text.length, B.length > 0 && (e.save(), e.font = q(R, U, W, F), A += at(
|
|
435
435
|
e.measureText(B).width,
|
|
436
436
|
B,
|
|
437
|
-
|
|
437
|
+
a(v.style)
|
|
438
438
|
), e.restore());
|
|
439
439
|
}), h.push({
|
|
440
|
-
spans:
|
|
440
|
+
spans: m,
|
|
441
441
|
width: A,
|
|
442
442
|
// Use adjusted width for alignment (may be 0 for empty lines)
|
|
443
|
-
height:
|
|
444
|
-
ascent:
|
|
445
|
-
spanWidths:
|
|
446
|
-
isParagraphStart:
|
|
443
|
+
height: b,
|
|
444
|
+
ascent: T,
|
|
445
|
+
spanWidths: k,
|
|
446
|
+
isParagraphStart: g,
|
|
447
447
|
// Store metadata with line
|
|
448
448
|
isParagraphEnd: y
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
|
-
const f =
|
|
451
|
+
const f = ct(r.fontSize, r.fontFamily, r.bold, r.italic), u = r.fontSize * (r.lineHeight ?? Jt);
|
|
452
452
|
let d;
|
|
453
453
|
h.length === 0 ? d = 0 : h.length === 1 ? d = f.height : d = (h.length - 1) * u + f.height;
|
|
454
|
-
const
|
|
455
|
-
h.forEach((
|
|
456
|
-
const { spans:
|
|
454
|
+
const p = -d / 2;
|
|
455
|
+
h.forEach((m, w) => {
|
|
456
|
+
const { spans: k, width: b, isParagraphStart: T, isParagraphEnd: g } = m;
|
|
457
457
|
let y;
|
|
458
|
-
i === "center" ? y = -
|
|
459
|
-
const
|
|
460
|
-
let
|
|
461
|
-
|
|
462
|
-
const R =
|
|
463
|
-
let L =
|
|
464
|
-
if (!
|
|
465
|
-
const Y = Math.min(
|
|
458
|
+
i === "center" ? y = -b / 2 : i === "right" ? y = n !== void 0 ? n / 2 - b : -b : y = n !== void 0 ? -n / 2 : 0;
|
|
459
|
+
const S = p + f.ascent + w * u, C = k.map((v) => v.text).join(""), P = C.match(/^ +/), I = C.match(/ +$/), M = P ? P[0].length : 0, A = I ? I[0].length : 0;
|
|
460
|
+
let E = 0;
|
|
461
|
+
k.forEach((v) => {
|
|
462
|
+
const R = v.style.fontSize !== void 0 ? v.style.fontSize : r.fontSize, U = v.style.fontFamily !== void 0 ? v.style.fontFamily : r.fontFamily, W = v.style.color !== void 0 ? v.style.color : r.color, F = v.style.bold !== void 0 ? v.style.bold : r.bold || !1, B = v.style.italic !== void 0 ? v.style.italic : r.italic || !1, $ = v.style.underline !== void 0 ? v.style.underline : r.underline || !1, St = v.style.strikethrough !== void 0 ? v.style.strikethrough : r.strikethrough || !1;
|
|
463
|
+
let L = v.text, G = E, Ct = E + v.text.length;
|
|
464
|
+
if (!T && M > 0 && G < M) {
|
|
465
|
+
const Y = Math.min(M - G, v.text.length);
|
|
466
466
|
L = L.substring(Y);
|
|
467
467
|
}
|
|
468
|
-
if (!
|
|
469
|
-
const Y =
|
|
470
|
-
if (
|
|
471
|
-
const
|
|
468
|
+
if (!g && A > 0) {
|
|
469
|
+
const Y = C.length - A;
|
|
470
|
+
if (Ct > Y) {
|
|
471
|
+
const rt = !T && M > 0 && G < M ? Math.min(M - G, v.text.length) : 0, V = Math.max(0, Y - G - rt);
|
|
472
472
|
L = L.substring(0, V);
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
if (
|
|
476
|
-
const Y =
|
|
477
|
-
e.font = q(R,
|
|
478
|
-
const
|
|
475
|
+
if (E += v.text.length, L.length > 0) {
|
|
476
|
+
const Y = a(v.style);
|
|
477
|
+
e.font = q(R, U, F, B), e.fillStyle = W, e.textBaseline = "alphabetic", e.textAlign = "left", Kt(e, L, y, S, Y);
|
|
478
|
+
const rt = at(e.measureText(L).width, L, Y);
|
|
479
479
|
if ($) {
|
|
480
|
-
const V =
|
|
481
|
-
e.beginPath(), e.moveTo(y, V), e.lineTo(y +
|
|
480
|
+
const V = S + R * 0.1;
|
|
481
|
+
e.beginPath(), e.moveTo(y, V), e.lineTo(y + rt, V), e.lineWidth = Math.max(1, R * 0.05), e.strokeStyle = W, e.stroke();
|
|
482
482
|
}
|
|
483
483
|
if (St) {
|
|
484
|
-
const V =
|
|
485
|
-
e.beginPath(), e.moveTo(y, V), e.lineTo(y +
|
|
484
|
+
const V = S - R * 0.25;
|
|
485
|
+
e.beginPath(), e.moveTo(y, V), e.lineTo(y + rt, V), e.lineWidth = Math.max(1, R * 0.05), e.strokeStyle = W, e.stroke();
|
|
486
486
|
}
|
|
487
|
-
y +=
|
|
487
|
+
y += rt;
|
|
488
488
|
}
|
|
489
489
|
});
|
|
490
490
|
});
|
|
491
491
|
}
|
|
492
|
-
const
|
|
493
|
-
let
|
|
494
|
-
function
|
|
495
|
-
if (!
|
|
492
|
+
const Ft = j("canvas-renderer");
|
|
493
|
+
let dt = null;
|
|
494
|
+
function Qt() {
|
|
495
|
+
if (!dt)
|
|
496
496
|
if (typeof OffscreenCanvas < "u")
|
|
497
|
-
|
|
497
|
+
dt = new OffscreenCanvas(1, 1).getContext("2d");
|
|
498
498
|
else if (typeof document < "u")
|
|
499
|
-
|
|
499
|
+
dt = document.createElement("canvas").getContext("2d");
|
|
500
500
|
else
|
|
501
501
|
throw new Error("No canvas context available");
|
|
502
|
-
return
|
|
502
|
+
return dt;
|
|
503
503
|
}
|
|
504
504
|
function q(e, t, r = !1, n = !1) {
|
|
505
505
|
const o = [];
|
|
506
506
|
return n && o.push("italic"), r && o.push("bold"), o.push(`${e}px`), o.push(t), o.join(" ");
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
const
|
|
510
|
-
return
|
|
508
|
+
function ae(e, t, r, n = !1, o = !1, i = 0) {
|
|
509
|
+
const a = Qt();
|
|
510
|
+
return a.font = q(t, r, n, o), at(a.measureText(e).width, e, i);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
const o =
|
|
512
|
+
function ct(e, t, r = !1, n = !1) {
|
|
513
|
+
const o = Qt();
|
|
514
514
|
o.font = q(e, t, r, n);
|
|
515
|
-
const
|
|
516
|
-
return { ascent: l, descent:
|
|
515
|
+
const a = o.measureText("ÁÉÍgjpqy"), l = a.actualBoundingBoxAscent || e * 0.8, s = a.actualBoundingBoxDescent || e * 0.2, c = l + s;
|
|
516
|
+
return { ascent: l, descent: s, height: c };
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function eo(e, t) {
|
|
519
519
|
const r = e.map((o, i) => ({
|
|
520
520
|
isParagraphStart: !t && i === 0,
|
|
521
521
|
isParagraphEnd: !t && i === e.length - 1
|
|
@@ -523,116 +523,116 @@ function Dn(e, t) {
|
|
|
523
523
|
return e.map((o, i) => {
|
|
524
524
|
if (o.trim().length === 0)
|
|
525
525
|
return "";
|
|
526
|
-
const
|
|
527
|
-
let
|
|
528
|
-
return
|
|
526
|
+
const a = r[i].isParagraphStart, l = r[i].isParagraphEnd;
|
|
527
|
+
let s = o;
|
|
528
|
+
return a || (s = s.replace(/^ +/, "")), l || (s = s.replace(/ +$/, "")), s;
|
|
529
529
|
}).filter((o) => o.length > 0);
|
|
530
530
|
}
|
|
531
|
-
function
|
|
532
|
-
const r = t.fontSize, n = t.fontFamily, o = t.bold || !1, i = t.italic || !1,
|
|
533
|
-
e.font = q(r, n, o, i), e.textAlign =
|
|
534
|
-
const
|
|
535
|
-
|
|
531
|
+
function Rr(e, t) {
|
|
532
|
+
const r = t.fontSize, n = t.fontFamily, o = t.bold || !1, i = t.italic || !1, a = t.textAlign || "center", l = t.text;
|
|
533
|
+
e.font = q(r, n, o, i), e.textAlign = a, e.textBaseline = "alphabetic", e.fillStyle = t.color;
|
|
534
|
+
const s = ct(r, n, o, i), f = -s.height / 2 + s.ascent;
|
|
535
|
+
Kt(e, l, 0, f, t.letterSpacing);
|
|
536
536
|
}
|
|
537
|
-
function
|
|
538
|
-
const l =
|
|
537
|
+
function Wr(e, t, r, n, o = !1, i = !1, a) {
|
|
538
|
+
const l = Qt();
|
|
539
539
|
if (l.font = q(r, n, o, i), e.trim().length === 0)
|
|
540
540
|
return [e];
|
|
541
541
|
if (e.includes(`
|
|
542
542
|
`)) {
|
|
543
|
-
const
|
|
544
|
-
`),
|
|
545
|
-
for (let
|
|
546
|
-
const A =
|
|
547
|
-
|
|
543
|
+
const P = e.split(`
|
|
544
|
+
`), I = [];
|
|
545
|
+
for (let M = 0; M < P.length; M++) {
|
|
546
|
+
const A = P[M], E = Wr(A, t, r, n, o, i);
|
|
547
|
+
I.push(...E);
|
|
548
548
|
}
|
|
549
|
-
return
|
|
549
|
+
return I;
|
|
550
550
|
}
|
|
551
|
-
const
|
|
552
|
-
if (
|
|
553
|
-
if (
|
|
551
|
+
const s = e.match(/^\s*/), c = e.match(/\s*$/), h = s ? s[0] : "", f = c ? c[0] : "", d = e.substring(h.length, e.length - f.length).split(" ");
|
|
552
|
+
if (a !== void 0 && a > 0) {
|
|
553
|
+
if (a === 1)
|
|
554
554
|
return [h + d.join(" ") + f];
|
|
555
|
-
const
|
|
556
|
-
for (let
|
|
557
|
-
const
|
|
558
|
-
|
|
555
|
+
const P = [], I = Math.ceil(d.length / a);
|
|
556
|
+
for (let M = 0; M < d.length; M += I) {
|
|
557
|
+
const E = d.slice(M, M + I).join(" ");
|
|
558
|
+
M === 0 && M + I >= d.length ? P.push(h + E + f) : M === 0 ? P.push(h + E) : M + I >= d.length ? P.push(E + f) : P.push(E);
|
|
559
559
|
}
|
|
560
|
-
return
|
|
560
|
+
return P;
|
|
561
561
|
}
|
|
562
|
-
const
|
|
563
|
-
if (
|
|
564
|
-
return [
|
|
565
|
-
const
|
|
562
|
+
const p = d.join(" "), m = h + p + f, w = l.measureText(m).width, k = t < 200, T = Math.max(20, t * (k ? 0.08 : 0.05));
|
|
563
|
+
if (w <= t + T)
|
|
564
|
+
return [m];
|
|
565
|
+
const g = [];
|
|
566
566
|
let y = d[0];
|
|
567
|
-
const
|
|
568
|
-
for (let
|
|
569
|
-
const
|
|
570
|
-
l.measureText(
|
|
571
|
-
}
|
|
572
|
-
return
|
|
573
|
-
}
|
|
574
|
-
function
|
|
575
|
-
e.font = q(o, i, h, f), e.textBaseline = "alphabetic", e.textAlign =
|
|
576
|
-
const
|
|
577
|
-
for (const A of
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
567
|
+
const C = Math.max(15, t * (k ? 0.05 : 0.03));
|
|
568
|
+
for (let P = 1; P < d.length; P++) {
|
|
569
|
+
const I = d[P], M = y + " " + I;
|
|
570
|
+
l.measureText(M).width > t + C ? (g.push(y), y = I) : y = M;
|
|
571
|
+
}
|
|
572
|
+
return g.push(y), g.length > 0 && (g[0] = h + g[0], g[g.length - 1] = g[g.length - 1] + f), g;
|
|
573
|
+
}
|
|
574
|
+
function ro(e, t, r, n, o, i, a = "left", l = 0, s = 0, c = 1.2, h = !1, f = !1, u = !1, d = !1, p, m) {
|
|
575
|
+
e.font = q(o, i, h, f), e.textBaseline = "alphabetic", e.textAlign = a;
|
|
576
|
+
const w = (M) => {
|
|
577
|
+
for (const A of M) {
|
|
578
|
+
const E = A.codePointAt(0);
|
|
579
|
+
if (E && E >= 983040 && E <= 1048573)
|
|
580
580
|
return !0;
|
|
581
581
|
}
|
|
582
582
|
return !1;
|
|
583
|
-
},
|
|
584
|
-
y && !
|
|
585
|
-
`[renderMultilineText] Font ${i} not loaded for fontkit rendering. Text may not render correctly. Has PUA: ${
|
|
586
|
-
),
|
|
587
|
-
|
|
583
|
+
}, k = p && Object.values(p).some((M) => M), b = m && m.length > 0, T = t.join(" "), g = w(T), y = k || b || g, S = y ? ee.getFontSync(i, h ? 700 : 400) : null;
|
|
584
|
+
y && !S && (Ft.warn(
|
|
585
|
+
`[renderMultilineText] Font ${i} not loaded for fontkit rendering. Text may not render correctly. Has PUA: ${g}, Text: "${T}"`
|
|
586
|
+
), ee.loadFont(i, h ? 700 : 400).catch((M) => {
|
|
587
|
+
Ft.error("[renderMultilineText] Error loading font:", M);
|
|
588
588
|
}));
|
|
589
|
-
const
|
|
590
|
-
let
|
|
591
|
-
t.forEach((
|
|
592
|
-
let
|
|
593
|
-
|
|
594
|
-
const
|
|
595
|
-
const
|
|
596
|
-
return
|
|
597
|
-
}).map((
|
|
598
|
-
...
|
|
599
|
-
charIndex:
|
|
589
|
+
const C = ct(o, i, h, f), P = o * c;
|
|
590
|
+
let I = 0;
|
|
591
|
+
t.forEach((M, A) => {
|
|
592
|
+
let E = r + s;
|
|
593
|
+
a === "center" ? E = r + l / 2 : a === "right" && (E = r + l - s);
|
|
594
|
+
const v = n + C.ascent + A * P, R = Array.from(M).length, U = b ? m.filter((W) => {
|
|
595
|
+
const F = W.charIndex - I;
|
|
596
|
+
return F >= 0 && F < R;
|
|
597
|
+
}).map((W) => ({
|
|
598
|
+
...W,
|
|
599
|
+
charIndex: W.charIndex - I
|
|
600
600
|
// Adjust to line-relative index
|
|
601
601
|
})) : [];
|
|
602
|
-
if (
|
|
602
|
+
if (S && (k || U.length > 0 || g) ? U.length > 0 || w(M) ? Ir(e, S, M, E, v, o, U, {
|
|
603
603
|
color: e.fillStyle,
|
|
604
|
-
align:
|
|
605
|
-
}) :
|
|
604
|
+
align: a === "start" || a === "end" ? "left" : a
|
|
605
|
+
}) : p && Pr(e, S, M, E, v, o, p, {
|
|
606
606
|
color: e.fillStyle,
|
|
607
|
-
align:
|
|
608
|
-
}) : e.fillText(
|
|
609
|
-
const
|
|
610
|
-
let
|
|
611
|
-
|
|
612
|
-
const B =
|
|
613
|
-
e.beginPath(), e.moveTo(
|
|
607
|
+
align: a === "start" || a === "end" ? "left" : a
|
|
608
|
+
}) : e.fillText(M, E, v), I += R + 1, u) {
|
|
609
|
+
const W = ae(M, o, i, h, f);
|
|
610
|
+
let F = E;
|
|
611
|
+
a === "center" ? F = E - W / 2 : a === "right" && (F = E - W);
|
|
612
|
+
const B = v + o * 0.1;
|
|
613
|
+
e.beginPath(), e.moveTo(F, B), e.lineTo(F + W, B), e.lineWidth = Math.max(1, o * 0.05), e.strokeStyle = e.fillStyle, e.stroke();
|
|
614
614
|
}
|
|
615
615
|
if (d) {
|
|
616
|
-
const
|
|
617
|
-
let
|
|
618
|
-
|
|
619
|
-
const B =
|
|
620
|
-
e.beginPath(), e.moveTo(
|
|
616
|
+
const W = ae(M, o, i, h, f);
|
|
617
|
+
let F = E;
|
|
618
|
+
a === "center" ? F = E - W / 2 : a === "right" && (F = E - W);
|
|
619
|
+
const B = v - o * 0.25;
|
|
620
|
+
e.beginPath(), e.moveTo(F, B), e.lineTo(F + W, B), e.lineWidth = Math.max(1, o * 0.05), e.strokeStyle = e.fillStyle, e.stroke();
|
|
621
621
|
}
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
|
-
function
|
|
625
|
-
|
|
624
|
+
function Ut(e, t) {
|
|
625
|
+
Fr(e, t);
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function Fr(e, t) {
|
|
628
628
|
var o;
|
|
629
629
|
(o = t.stroke) != null && o.enabled && Ae(e, t), e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180);
|
|
630
|
-
const r = t.transformData, n = ((r == null ? void 0 : r.width) ?? 100) -
|
|
630
|
+
const r = t.transformData, n = ((r == null ? void 0 : r.width) ?? 100) - D * 2;
|
|
631
631
|
if (t.richText) {
|
|
632
|
-
const i =
|
|
632
|
+
const i = xe.fromJSON(t.richText);
|
|
633
633
|
e.save(), e.translate(0, 0);
|
|
634
|
-
const
|
|
635
|
-
|
|
634
|
+
const a = t._lockedLineCount;
|
|
635
|
+
Ar(
|
|
636
636
|
e,
|
|
637
637
|
i,
|
|
638
638
|
{
|
|
@@ -648,11 +648,11 @@ function Wr(e, t) {
|
|
|
648
648
|
lineHeight: t.lineHeight
|
|
649
649
|
},
|
|
650
650
|
n,
|
|
651
|
-
|
|
651
|
+
a
|
|
652
652
|
), e.restore();
|
|
653
653
|
} else if (t.text) {
|
|
654
654
|
e.fillStyle = t.color;
|
|
655
|
-
const i = t._lockedLineCount,
|
|
655
|
+
const i = t._lockedLineCount, a = t.letterSpacing ?? 0, { lines: l, height: s } = Ee(
|
|
656
656
|
t.text,
|
|
657
657
|
n,
|
|
658
658
|
t.fontSize,
|
|
@@ -662,78 +662,78 @@ function Wr(e, t) {
|
|
|
662
662
|
i,
|
|
663
663
|
!0,
|
|
664
664
|
// strict: true
|
|
665
|
-
{ letterSpacing:
|
|
666
|
-
), c =
|
|
665
|
+
{ letterSpacing: a, lineHeight: t.lineHeight }
|
|
666
|
+
), c = ct(
|
|
667
667
|
t.fontSize,
|
|
668
668
|
t.fontFamily,
|
|
669
669
|
t.bold,
|
|
670
670
|
t.italic
|
|
671
|
-
), h = -((r == null ? void 0 : r.width) ?? 100) / 2, f = -
|
|
672
|
-
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = t.textAlign, l.forEach((d,
|
|
673
|
-
const
|
|
674
|
-
let
|
|
675
|
-
if (!
|
|
676
|
-
const
|
|
677
|
-
y > 0 && (
|
|
671
|
+
), h = -((r == null ? void 0 : r.width) ?? 100) / 2, f = -s / 2, u = t.fontSize * (t.lineHeight ?? Jt);
|
|
672
|
+
e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSize}px ${t.fontFamily}`, e.textBaseline = "alphabetic", e.textAlign = t.textAlign, l.forEach((d, p) => {
|
|
673
|
+
const m = p === 0, w = p === l.length - 1;
|
|
674
|
+
let k = d;
|
|
675
|
+
if (!m) {
|
|
676
|
+
const g = d.match(/^ +/), y = g ? g[0].length : 0;
|
|
677
|
+
y > 0 && (k = k.substring(y));
|
|
678
678
|
}
|
|
679
|
-
if (!
|
|
680
|
-
const
|
|
681
|
-
y > 0 && (
|
|
679
|
+
if (!w) {
|
|
680
|
+
const g = k.match(/ +$/), y = g ? g[0].length : 0;
|
|
681
|
+
y > 0 && (k = k.substring(0, k.length - y));
|
|
682
682
|
}
|
|
683
|
-
let
|
|
684
|
-
t.textAlign === "center" ?
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
687
|
-
const
|
|
688
|
-
let y =
|
|
689
|
-
if (t.textAlign === "center" ? y -=
|
|
690
|
-
const
|
|
691
|
-
e.fillRect(y,
|
|
683
|
+
let b = h + D;
|
|
684
|
+
t.textAlign === "center" ? b = h + ((r == null ? void 0 : r.width) ?? 100) / 2 : t.textAlign === "right" && (b = h + ((r == null ? void 0 : r.width) ?? 100) - D);
|
|
685
|
+
const T = f + c.ascent + p * u;
|
|
686
|
+
if (Kt(e, k, b, T, a), k.length > 0) {
|
|
687
|
+
const g = at(e.measureText(k).width, k, a);
|
|
688
|
+
let y = b;
|
|
689
|
+
if (t.textAlign === "center" ? y -= g / 2 : t.textAlign === "right" && (y -= g), t.underline) {
|
|
690
|
+
const S = T + t.fontSize * 0.1;
|
|
691
|
+
e.fillRect(y, S, g, Math.max(1, t.fontSize * 0.05));
|
|
692
692
|
}
|
|
693
693
|
if (t.strikethrough) {
|
|
694
|
-
const
|
|
695
|
-
e.fillRect(y,
|
|
694
|
+
const S = T - c.ascent * 0.4;
|
|
695
|
+
e.fillRect(y, S, g, Math.max(1, t.fontSize * 0.05));
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
});
|
|
699
699
|
}
|
|
700
700
|
e.restore();
|
|
701
701
|
}
|
|
702
|
-
function
|
|
703
|
-
var
|
|
704
|
-
const r = t.opacity ?? 1, n = !!((
|
|
702
|
+
function no(e, t) {
|
|
703
|
+
var a;
|
|
704
|
+
const r = t.opacity ?? 1, n = !!((a = t.stroke) != null && a.enabled), o = t.type === "custom";
|
|
705
705
|
if (r < 1 && n && o) {
|
|
706
|
-
|
|
706
|
+
Ur(e, t, r);
|
|
707
707
|
return;
|
|
708
708
|
}
|
|
709
709
|
const i = e.globalAlpha;
|
|
710
|
-
r !== 1 && (e.globalAlpha = r),
|
|
710
|
+
r !== 1 && (e.globalAlpha = r), Bt(e, t), e.globalAlpha = i;
|
|
711
711
|
}
|
|
712
|
-
function
|
|
713
|
-
var
|
|
714
|
-
const n = t.transformData, o = t.fontSize || 24, i = ((
|
|
712
|
+
function Ur(e, t, r) {
|
|
713
|
+
var w;
|
|
714
|
+
const n = t.transformData, o = t.fontSize || 24, i = ((w = t.stroke) == null ? void 0 : w.width) || 0, a = ((n == null ? void 0 : n.width) ?? o * t.text.length * 0.7) + i * 2 + 40, l = o * 3 + i * 2 + 40, s = e.getTransform(), c = Math.max(Math.abs(s.a), Math.abs(s.d), 1), h = Math.ceil(a * c), f = Math.ceil(l * c);
|
|
715
715
|
let u;
|
|
716
716
|
typeof OffscreenCanvas < "u" ? u = new OffscreenCanvas(h, f) : (u = document.createElement("canvas"), u.width = h, u.height = f);
|
|
717
717
|
const d = u.getContext("2d");
|
|
718
718
|
if (!d) {
|
|
719
|
-
const
|
|
720
|
-
e.globalAlpha = r,
|
|
719
|
+
const k = e.globalAlpha;
|
|
720
|
+
e.globalAlpha = r, Bt(e, t), e.globalAlpha = k;
|
|
721
721
|
return;
|
|
722
722
|
}
|
|
723
|
-
const
|
|
723
|
+
const p = s.a * t.x + s.e, m = s.d * t.y + s.f;
|
|
724
724
|
d.setTransform(
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
),
|
|
725
|
+
s.a,
|
|
726
|
+
s.b,
|
|
727
|
+
s.c,
|
|
728
|
+
s.d,
|
|
729
|
+
s.e - p + h / 2,
|
|
730
|
+
s.f - m + f / 2
|
|
731
|
+
), Bt(d, t), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.globalAlpha = r, e.drawImage(u, p - h / 2, m - f / 2), e.restore();
|
|
732
732
|
}
|
|
733
|
-
function
|
|
733
|
+
function Bt(e, t) {
|
|
734
734
|
switch (t.type) {
|
|
735
735
|
case "custom":
|
|
736
|
-
|
|
736
|
+
Ut(e, t);
|
|
737
737
|
break;
|
|
738
738
|
case "circle":
|
|
739
739
|
Re(e, t);
|
|
@@ -754,16 +754,16 @@ function Ft(e, t) {
|
|
|
754
754
|
Oe(e, t);
|
|
755
755
|
break;
|
|
756
756
|
default:
|
|
757
|
-
|
|
757
|
+
Ft.warn(`[canvas-renderer] Unsupported transform type: ${t.type}`), Ut(e, t);
|
|
758
758
|
}
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function Br(e, t) {
|
|
761
761
|
if (typeof OffscreenCanvas < "u")
|
|
762
762
|
return new OffscreenCanvas(e, t);
|
|
763
763
|
const r = document.createElement("canvas");
|
|
764
764
|
return r.width = e, r.height = t, r;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function tt(e, t, r) {
|
|
767
767
|
if (r != null && r.enabled)
|
|
768
768
|
if (e.strokeStyle = r.color, e.lineWidth = r.width, e.lineCap = r.lineCap || "round", e.lineJoin = r.lineJoin || "round", r.miterLimit !== void 0 && (e.miterLimit = r.miterLimit), r.opacity !== void 0) {
|
|
769
769
|
const n = e.globalAlpha;
|
|
@@ -771,112 +771,112 @@ function et(e, t, r) {
|
|
|
771
771
|
} else
|
|
772
772
|
e.strokeText(t, 0, 0);
|
|
773
773
|
}
|
|
774
|
-
function
|
|
775
|
-
const n = t.stroke, o = (n == null ? void 0 : n.opacity) ?? 1, i = e.globalAlpha,
|
|
776
|
-
if (!(
|
|
774
|
+
function et(e, t, r) {
|
|
775
|
+
const n = t.stroke, o = (n == null ? void 0 : n.opacity) ?? 1, i = e.globalAlpha, a = (n == null ? void 0 : n.enabled) && o < 1, l = (n == null ? void 0 : n.enabled) && i < 1;
|
|
776
|
+
if (!(a || l)) {
|
|
777
777
|
r(e, t);
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
const c = t.fontSize || 24, h = n.width || 0, f = t.transformData, u = c * t.text.length * 0.7, d = f.width ?? (f.radius ? f.radius * 2 : 0),
|
|
781
|
-
if (
|
|
780
|
+
const c = t.fontSize || 24, h = n.width || 0, f = t.transformData, u = c * t.text.length * 0.7, d = f.width ?? (f.radius ? f.radius * 2 : 0), p = Math.max(d, u), m = (n.feather || 0) * 2, w = h * 4 + m + c + 40, k = p + w, b = f.archHeight ? Math.abs(f.archHeight) * c * 2 : 0, T = f.radius ? f.radius : 0, g = c * 3 + w + b + T, y = e.getTransform(), S = Math.max(Math.abs(y.a), Math.abs(y.d), 1), C = Math.ceil(k * S / 2) * 2, P = Math.ceil(g * S / 2) * 2;
|
|
781
|
+
if (C <= 0 || P <= 0) {
|
|
782
782
|
r(e, t);
|
|
783
783
|
return;
|
|
784
784
|
}
|
|
785
|
-
const
|
|
786
|
-
if (!
|
|
785
|
+
const I = Br(C, P), M = I.getContext("2d");
|
|
786
|
+
if (!M) {
|
|
787
787
|
r(e, t);
|
|
788
788
|
return;
|
|
789
789
|
}
|
|
790
|
-
const A = t.x || 0,
|
|
791
|
-
if (
|
|
790
|
+
const A = t.x || 0, E = t.y || 0, v = y.a * A + y.c * E + y.e, R = y.b * A + y.d * E + y.f, U = Math.round(v - C / 2), W = Math.round(R - P / 2);
|
|
791
|
+
if (M.setTransform(
|
|
792
792
|
y.a,
|
|
793
793
|
y.b,
|
|
794
794
|
y.c,
|
|
795
795
|
y.d,
|
|
796
|
-
|
|
797
|
-
|
|
796
|
+
C / 2 - v + y.e,
|
|
797
|
+
P / 2 - R + y.f
|
|
798
798
|
), l) {
|
|
799
|
-
|
|
799
|
+
M.globalAlpha = 1;
|
|
800
800
|
const $ = n.opacity;
|
|
801
|
-
|
|
801
|
+
a && (n.opacity = 1), r(M, t), a && (n.opacity = $), e.save(), e.resetTransform(), e.globalAlpha = i, e.drawImage(I, U, W), e.restore();
|
|
802
802
|
return;
|
|
803
803
|
}
|
|
804
|
-
const
|
|
805
|
-
n.opacity = 1, r(
|
|
804
|
+
const F = n.opacity;
|
|
805
|
+
n.opacity = 1, r(M, t), n.opacity = F;
|
|
806
806
|
const B = n.enabled;
|
|
807
807
|
n.enabled = !1, r(e, t), n.enabled = B, e.save(), e.resetTransform(), e.globalAlpha = o, e.drawImage(
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
808
|
+
I,
|
|
809
|
+
U,
|
|
810
|
+
W
|
|
811
811
|
), e.restore();
|
|
812
812
|
}
|
|
813
813
|
function Re(e, t) {
|
|
814
|
-
|
|
814
|
+
et(e, t, Or);
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function Or(e, t) {
|
|
817
817
|
const r = t.transformData;
|
|
818
818
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180), e.scale(r.scale, r.scale);
|
|
819
819
|
const n = t.bold ? "bold" : "normal", o = t.italic ? "italic" : "normal";
|
|
820
820
|
e.font = `${o} ${n} ${t.fontSize}px ${t.fontFamily}`, e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle";
|
|
821
|
-
const i = t.text.split(""),
|
|
821
|
+
const i = t.text.split(""), a = i.map((s) => e.measureText(s).width), l = a.reduce((s, c) => s + c, 0);
|
|
822
822
|
if (r.reverse) {
|
|
823
|
-
let
|
|
823
|
+
let s = Math.PI / 2 + l / (2 * r.radius);
|
|
824
824
|
i.forEach((c, h) => {
|
|
825
|
-
const u =
|
|
826
|
-
e.save(), e.translate(d,
|
|
825
|
+
const u = a[h] / r.radius, d = Math.cos(s - u / 2) * r.radius, p = Math.sin(s - u / 2) * r.radius;
|
|
826
|
+
e.save(), e.translate(d, p), e.rotate(s - u / 2 - Math.PI / 2), tt(e, c, t.stroke), e.fillText(c, 0, 0), e.restore(), s -= u;
|
|
827
827
|
});
|
|
828
828
|
} else {
|
|
829
|
-
let
|
|
829
|
+
let s = -Math.PI / 2 - l / (2 * r.radius);
|
|
830
830
|
i.forEach((c, h) => {
|
|
831
|
-
const u =
|
|
832
|
-
e.save(), e.translate(d,
|
|
831
|
+
const u = a[h] / r.radius, d = Math.cos(s + u / 2) * r.radius, p = Math.sin(s + u / 2) * r.radius;
|
|
832
|
+
e.save(), e.translate(d, p), e.rotate(s + u / 2 + Math.PI / 2), tt(e, c, t.stroke), e.fillText(c, 0, 0), e.restore(), s += u;
|
|
833
833
|
});
|
|
834
834
|
}
|
|
835
835
|
e.restore();
|
|
836
836
|
}
|
|
837
837
|
function We(e, t) {
|
|
838
|
-
|
|
838
|
+
et(e, t, Lr);
|
|
839
839
|
}
|
|
840
|
-
function
|
|
840
|
+
function Lr(e, t) {
|
|
841
841
|
const r = t.transformData;
|
|
842
842
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180), e.font = q(t.fontSize, t.fontFamily, t.bold, t.italic), e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle";
|
|
843
843
|
const n = t.text.split("");
|
|
844
|
-
let i = -n.reduce((
|
|
845
|
-
n.forEach((
|
|
846
|
-
const l = e.measureText(
|
|
847
|
-
e.save(), e.translate(
|
|
844
|
+
let i = -n.reduce((a, l) => a + e.measureText(l).width, 0) / 2;
|
|
845
|
+
n.forEach((a) => {
|
|
846
|
+
const l = e.measureText(a).width, s = i + l / 2, c = s / (r.width / 2), h = r.amplitude * t.fontSize * Math.sin(r.frequency * Math.PI * c), f = r.amplitude * r.frequency * Math.PI * Math.cos(r.frequency * Math.PI * c);
|
|
847
|
+
e.save(), e.translate(s, h), e.transform(1, f * tr, 0, 1, 0, 0), tt(e, a, t.stroke), e.fillText(a, 0, 0), e.restore(), i += l;
|
|
848
848
|
}), e.restore();
|
|
849
849
|
}
|
|
850
850
|
function Fe(e, t) {
|
|
851
|
-
|
|
851
|
+
et(e, t, qr);
|
|
852
852
|
}
|
|
853
|
-
function
|
|
853
|
+
function qr(e, t) {
|
|
854
854
|
const r = t.transformData;
|
|
855
855
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180), e.font = q(t.fontSize, t.fontFamily, t.bold, t.italic), e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle";
|
|
856
|
-
const n = t.text.split(""), o = n.reduce((l,
|
|
857
|
-
let
|
|
856
|
+
const n = t.text.split(""), o = n.reduce((l, s) => l + e.measureText(s).width, 0), i = r.width / 2;
|
|
857
|
+
let a = -o / 2;
|
|
858
858
|
n.forEach((l) => {
|
|
859
|
-
const
|
|
860
|
-
e.save(), e.translate(c, f), e.transform(1, u * 0.3, 0, 1, 0, 0),
|
|
859
|
+
const s = e.measureText(l).width, c = a + s / 2, h = c / i, f = (Math.pow(h, 2) - 1) * r.archHeight * t.fontSize, u = 2 * h * r.archHeight;
|
|
860
|
+
e.save(), e.translate(c, f), e.transform(1, u * 0.3, 0, 1, 0, 0), tt(e, l, t.stroke), e.fillText(l, 0, 0), e.restore(), a += s;
|
|
861
861
|
}), e.restore();
|
|
862
862
|
}
|
|
863
863
|
function Ue(e, t) {
|
|
864
|
-
|
|
864
|
+
et(e, t, $r);
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function $r(e, t) {
|
|
867
867
|
const r = t.transformData;
|
|
868
868
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180), e.font = q(t.fontSize, t.fontFamily, t.bold, t.italic), e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle";
|
|
869
|
-
const n = t.text.split(""), o = n.reduce((l,
|
|
870
|
-
let
|
|
869
|
+
const n = t.text.split(""), o = n.reduce((l, s) => l + e.measureText(s).width, 0), i = r.ascendAngle * Math.PI / 180;
|
|
870
|
+
let a = -o / 2;
|
|
871
871
|
n.forEach((l) => {
|
|
872
|
-
const
|
|
873
|
-
e.save(), e.translate(c, h), e.transform(1, f * 1, 0, 1, 0, 0),
|
|
872
|
+
const s = e.measureText(l).width, c = a + s / 2, h = c * Math.tan(i), f = Math.tan(i);
|
|
873
|
+
e.save(), e.translate(c, h), e.transform(1, f * 1, 0, 1, 0, 0), tt(e, l, t.stroke), e.fillText(l, 0, 0), e.restore(), a += s;
|
|
874
874
|
}), e.restore();
|
|
875
875
|
}
|
|
876
876
|
function Be(e, t) {
|
|
877
|
-
|
|
877
|
+
et(e, t, Hr);
|
|
878
878
|
}
|
|
879
|
-
function
|
|
879
|
+
function Hr(e, t) {
|
|
880
880
|
var o;
|
|
881
881
|
const r = t.transformData;
|
|
882
882
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180);
|
|
@@ -884,45 +884,45 @@ function $r(e, t) {
|
|
|
884
884
|
e.transform(1, 0, Math.tan(n), 1, 0, 0), e.font = q(t.fontSize, t.fontFamily, t.bold, t.italic), e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle", (o = t.stroke) != null && o.enabled && (e.save(), e.strokeStyle = t.stroke.color, e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "round", e.lineJoin = t.stroke.lineJoin || "round", t.stroke.opacity !== void 0 && (e.globalAlpha = t.stroke.opacity), e.strokeText(t.text, 0, 0), e.restore()), e.fillText(t.text, 0, 0), e.restore();
|
|
885
885
|
}
|
|
886
886
|
function Oe(e, t) {
|
|
887
|
-
|
|
887
|
+
et(e, t, jr);
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function jr(e, t) {
|
|
890
890
|
const r = t.transformData;
|
|
891
891
|
e.save(), e.translate(t.x, t.y), e.rotate(-t.rotation * Math.PI / 180), e.font = q(t.fontSize, t.fontFamily, t.bold, t.italic), e.fillStyle = t.color, e.textAlign = "center", e.textBaseline = "middle";
|
|
892
892
|
const n = t.text.split("");
|
|
893
|
-
let i = -n.reduce((
|
|
894
|
-
n.forEach((
|
|
895
|
-
const l = e.measureText(
|
|
896
|
-
e.save(), e.translate(
|
|
893
|
+
let i = -n.reduce((a, l) => a + e.measureText(l).width, 0) / 2;
|
|
894
|
+
n.forEach((a) => {
|
|
895
|
+
const l = e.measureText(a).width, s = i + l / 2, c = s / (r.width / 2), h = Math.abs(c), f = r.amplitude * h, u = f * t.fontSize * Math.sin(r.frequency * Math.PI * c), d = f * r.frequency * Math.PI * Math.cos(r.frequency * Math.PI * c), p = r.amplitude * Math.sign(c) * Math.sin(r.frequency * Math.PI * c), m = d + p;
|
|
896
|
+
e.save(), e.translate(s, u), e.transform(1, m * 0.3, 0, 1, 0, 0), tt(e, a, t.stroke), e.fillText(a, 0, 0), e.restore(), i += l;
|
|
897
897
|
}), e.restore();
|
|
898
898
|
}
|
|
899
899
|
function Q(e) {
|
|
900
900
|
return (t, r) => e(t, r);
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function _r(e, t) {
|
|
903
903
|
e.save();
|
|
904
|
-
const r = e.canvas, n = r.width, o = r.height, i = e.getTransform(),
|
|
904
|
+
const r = e.canvas, n = r.width, o = r.height, i = e.getTransform(), a = [];
|
|
905
905
|
let l = [];
|
|
906
|
-
for (const
|
|
907
|
-
|
|
908
|
-
l.length > 0 &&
|
|
909
|
-
for (const
|
|
910
|
-
if (!
|
|
911
|
-
|
|
906
|
+
for (const s of t)
|
|
907
|
+
s.isClipping ? l.length > 0 ? (a.push({ content: l, mask: s }), l = []) : a.push({ content: [s] }) : l.push(s);
|
|
908
|
+
l.length > 0 && a.push({ content: l });
|
|
909
|
+
for (const s of a)
|
|
910
|
+
if (!s.mask)
|
|
911
|
+
s.content.forEach((c) => c.render(e, !1, !1));
|
|
912
912
|
else {
|
|
913
913
|
const c = document.createElement("canvas");
|
|
914
914
|
c.width = n, c.height = o;
|
|
915
915
|
const h = c.getContext("2d");
|
|
916
916
|
if (!h) continue;
|
|
917
|
-
h.setTransform(i),
|
|
917
|
+
h.setTransform(i), s.content.forEach((d) => {
|
|
918
918
|
d.render(h, !1, !1);
|
|
919
919
|
});
|
|
920
920
|
const f = document.createElement("canvas");
|
|
921
921
|
f.width = n, f.height = o;
|
|
922
922
|
const u = f.getContext("2d");
|
|
923
923
|
if (!u) continue;
|
|
924
|
-
if (u.setTransform(i),
|
|
925
|
-
const d =
|
|
924
|
+
if (u.setTransform(i), s.mask.render(u, !1, !1), s.mask.transformType !== "image" && s.mask.transformType !== "shape") {
|
|
925
|
+
const d = s.mask.getBoundingBox();
|
|
926
926
|
u.save(), u.fillStyle = "#FFFFFF", u.fillRect(d.x, d.y, d.width, d.height), u.restore();
|
|
927
927
|
}
|
|
928
928
|
h.globalCompositeOperation = "destination-in", h.setTransform(1, 0, 0, 1, 0, 0), h.drawImage(f, 0, 0), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(c, 0, 0), e.setTransform(i);
|
|
@@ -930,36 +930,36 @@ function jr(e, t) {
|
|
|
930
930
|
e.restore();
|
|
931
931
|
}
|
|
932
932
|
var se = !1;
|
|
933
|
-
function
|
|
933
|
+
function zt() {
|
|
934
934
|
se || (se = !0, J("arch", Q(Fe)), J("ascend", Q(Ue)), J("circle", Q(Re)), J("flag", Q(Oe)), J("lean", Q(Be)), J("wave", Q(We)), J(
|
|
935
935
|
"custom",
|
|
936
|
-
(e, t) =>
|
|
937
|
-
),
|
|
936
|
+
(e, t) => Ut(e, t)
|
|
937
|
+
), er(_r), mr(
|
|
938
938
|
(e, t) => kr(e, t)
|
|
939
939
|
), globalThis.__scElementPaintersInstalled = !0);
|
|
940
940
|
}
|
|
941
|
-
|
|
942
|
-
function
|
|
941
|
+
zt();
|
|
942
|
+
function Zt(e, t, r = {}) {
|
|
943
943
|
const n = r.mode || "both";
|
|
944
944
|
switch (e.save(), e.translate(t.x || 0, t.y || 0), e.rotate(-(t.rotation || 0) * Math.PI / 180), t.transformType) {
|
|
945
945
|
case "image":
|
|
946
|
-
|
|
946
|
+
Xr(e, t, n, r);
|
|
947
947
|
break;
|
|
948
948
|
case "shape":
|
|
949
|
-
|
|
949
|
+
Gr(e, t, n, r);
|
|
950
950
|
break;
|
|
951
951
|
case "group":
|
|
952
952
|
break;
|
|
953
953
|
default:
|
|
954
|
-
|
|
954
|
+
Nr(e, t, n, r);
|
|
955
955
|
break;
|
|
956
956
|
}
|
|
957
957
|
e.restore();
|
|
958
958
|
}
|
|
959
|
-
function
|
|
960
|
-
var
|
|
959
|
+
function Nr(e, t, r, n) {
|
|
960
|
+
var a;
|
|
961
961
|
const o = t, i = o.text || "";
|
|
962
|
-
i && ((r === "stroke" || r === "both") && ((
|
|
962
|
+
i && ((r === "stroke" || r === "both") && ((a = t.stroke) != null && a.enabled) && (e.save(), Ae(e, t, { ...n.renderingContext, positionApplied: !0 }), e.restore()), (r === "fill" || r === "both") && (e.save(), Rr(e, {
|
|
963
963
|
text: i,
|
|
964
964
|
fontSize: o.fontSize || 24,
|
|
965
965
|
fontFamily: o.fontFamily || "Arial",
|
|
@@ -970,172 +970,172 @@ function _r(e, t, r, n) {
|
|
|
970
970
|
letterSpacing: o.letterSpacing
|
|
971
971
|
}), e.restore()));
|
|
972
972
|
}
|
|
973
|
-
function
|
|
973
|
+
function Xr(e, t, r, n) {
|
|
974
974
|
var i;
|
|
975
975
|
if (!t.transformData) return;
|
|
976
976
|
const o = t.transformData;
|
|
977
977
|
if (r === "fill" || r === "both")
|
|
978
|
-
if (
|
|
978
|
+
if (Qr(e, t), n.loadedImage) {
|
|
979
979
|
e.save(), e.clip();
|
|
980
|
-
const
|
|
981
|
-
e.scale(
|
|
982
|
-
const
|
|
983
|
-
e.drawImage(n.loadedImage, -
|
|
980
|
+
const a = o.flipHorizontal ? -1 : 1, l = o.flipVertical ? -1 : 1;
|
|
981
|
+
e.scale(a, l);
|
|
982
|
+
const s = o.width ?? 100, c = o.height ?? 100;
|
|
983
|
+
e.drawImage(n.loadedImage, -s / 2, -c / 2, s, c), e.restore();
|
|
984
984
|
} else
|
|
985
985
|
e.fillStyle = "#cccccc", e.fill();
|
|
986
|
-
(r === "stroke" || r === "both") && ((i = t.stroke) != null && i.enabled) && (e.save(),
|
|
986
|
+
(r === "stroke" || r === "both") && ((i = t.stroke) != null && i.enabled) && (e.save(), Cr(e, t, n.renderingContext), e.restore());
|
|
987
987
|
}
|
|
988
|
-
function
|
|
989
|
-
var
|
|
988
|
+
function Gr(e, t, r, n) {
|
|
989
|
+
var a, l;
|
|
990
990
|
if (!t.transformData) return;
|
|
991
|
-
const o = t.transformData, i = ((
|
|
992
|
-
e.beginPath(), Le(e, o), (r === "fill" || r === "both") && (e.fillStyle = i ? "#000000" :
|
|
991
|
+
const o = t.transformData, i = ((a = n.renderingContext) == null ? void 0 : a.isKnockout) === !0;
|
|
992
|
+
e.beginPath(), Le(e, o), (r === "fill" || r === "both") && (e.fillStyle = i ? "#000000" : rr(e, o), e.globalAlpha = i ? 1 : o.fillOpacity ?? 1, e.fill()), (r === "stroke" || r === "both") && ((l = t.stroke) != null && l.enabled) && (e.save(), Kr(e, t, n.renderingContext), e.restore());
|
|
993
993
|
}
|
|
994
994
|
function Le(e, t) {
|
|
995
995
|
const { shapeType: r } = t, n = t.width ?? 100, o = t.height ?? 100;
|
|
996
996
|
switch (r) {
|
|
997
997
|
case "rectangle":
|
|
998
|
-
|
|
998
|
+
ie(e, t, n, o);
|
|
999
999
|
break;
|
|
1000
1000
|
case "circle":
|
|
1001
|
-
|
|
1001
|
+
Yr(e, Math.min(n, o) / 2);
|
|
1002
1002
|
break;
|
|
1003
1003
|
case "ellipse":
|
|
1004
|
-
|
|
1004
|
+
Vr(e, n / 2, o / 2);
|
|
1005
1005
|
break;
|
|
1006
1006
|
case "star":
|
|
1007
|
-
|
|
1007
|
+
Jr(e, t, Math.min(n, o) / 2);
|
|
1008
1008
|
break;
|
|
1009
1009
|
default:
|
|
1010
|
-
|
|
1010
|
+
ie(e, t, n, o);
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
function
|
|
1014
|
-
const o = t.borderRadius || 0, i = -r / 2,
|
|
1013
|
+
function ie(e, t, r, n) {
|
|
1014
|
+
const o = t.borderRadius || 0, i = -r / 2, a = -n / 2;
|
|
1015
1015
|
if (o > 0) {
|
|
1016
1016
|
const l = Math.min(o / 100 * Math.min(r, n), r / 2, n / 2);
|
|
1017
|
-
e.roundRect(i,
|
|
1017
|
+
e.roundRect(i, a, r, n, l);
|
|
1018
1018
|
} else
|
|
1019
|
-
e.rect(i,
|
|
1019
|
+
e.rect(i, a, r, n);
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function Yr(e, t) {
|
|
1022
1022
|
e.arc(0, 0, t, 0, Math.PI * 2);
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function Vr(e, t, r) {
|
|
1025
1025
|
e.ellipse(0, 0, t, r, 0, 0, Math.PI * 2);
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const n = Math.max(3, Math.min(20, t.points || 5)), o = Math.max(0.1, Math.min(0.9, t.innerRadius || 0.4)), i = r * o,
|
|
1029
|
-
for (let
|
|
1030
|
-
const c = l +
|
|
1031
|
-
|
|
1027
|
+
function Jr(e, t, r) {
|
|
1028
|
+
const n = Math.max(3, Math.min(20, t.points || 5)), o = Math.max(0.1, Math.min(0.9, t.innerRadius || 0.4)), i = r * o, a = Math.PI / n, l = -Math.PI / 2;
|
|
1029
|
+
for (let s = 0; s < n * 2; s++) {
|
|
1030
|
+
const c = l + a * s, h = s % 2 === 0 ? r : i, f = Math.cos(c) * h, u = Math.sin(c) * h;
|
|
1031
|
+
s === 0 ? e.moveTo(f, u) : e.lineTo(f, u);
|
|
1032
1032
|
}
|
|
1033
1033
|
e.closePath();
|
|
1034
1034
|
}
|
|
1035
|
-
function
|
|
1035
|
+
function Kr(e, t, r) {
|
|
1036
1036
|
var o;
|
|
1037
1037
|
if (!((o = t.stroke) != null && o.enabled) || !t.transformData) return;
|
|
1038
1038
|
const n = (r == null ? void 0 : r.isKnockout) === !0;
|
|
1039
1039
|
e.save(), n ? (e.strokeStyle = "#000000", e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "butt", e.lineJoin = t.stroke.lineJoin || "miter", e.globalAlpha = 1) : (e.strokeStyle = t.stroke.color, e.lineWidth = t.stroke.width, e.lineCap = t.stroke.lineCap || "butt", e.lineJoin = t.stroke.lineJoin || "miter", t.stroke.opacity !== void 0 && (e.globalAlpha = t.stroke.opacity)), t.stroke.miterLimit !== void 0 && (e.miterLimit = t.stroke.miterLimit), t.stroke.dashArray && t.stroke.dashArray.length > 0 && e.setLineDash(t.stroke.dashArray), !n && t.stroke.feather && t.stroke.feather > 0 && "filter" in e && (e.filter = `blur(${t.stroke.feather}px)`), e.beginPath(), Le(e, t.transformData), e.stroke(), e.restore();
|
|
1040
1040
|
}
|
|
1041
|
-
function
|
|
1041
|
+
function Qr(e, t) {
|
|
1042
1042
|
if (!t.transformData) return;
|
|
1043
|
-
const { borderRadius: r } = t.transformData, n = t.transformData.width ?? 100, o = t.transformData.height ?? 100, i = -n / 2,
|
|
1043
|
+
const { borderRadius: r } = t.transformData, n = t.transformData.width ?? 100, o = t.transformData.height ?? 100, i = -n / 2, a = -o / 2;
|
|
1044
1044
|
if (e.beginPath(), r && r > 0) {
|
|
1045
1045
|
const l = Math.min(r / 100 * Math.min(n, o), n / 2, o / 2);
|
|
1046
|
-
e.roundRect(i,
|
|
1046
|
+
e.roundRect(i, a, n, o, l);
|
|
1047
1047
|
} else
|
|
1048
|
-
e.rect(i,
|
|
1048
|
+
e.rect(i, a, n, o);
|
|
1049
1049
|
}
|
|
1050
|
-
function
|
|
1051
|
-
var
|
|
1050
|
+
function qe(e, t, r, n, o, i, a = "destination-out") {
|
|
1051
|
+
var T;
|
|
1052
1052
|
if (!t.knockoutParts) return;
|
|
1053
1053
|
if (!(t.knockoutParts.fill || t.knockoutParts.stroke)) {
|
|
1054
1054
|
n(e, t);
|
|
1055
1055
|
return;
|
|
1056
1056
|
}
|
|
1057
|
-
const
|
|
1057
|
+
const s = e.getTransform();
|
|
1058
1058
|
e.save();
|
|
1059
|
-
const c = t.knockoutParts.scope || "group", h =
|
|
1059
|
+
const c = t.knockoutParts.scope || "group", h = zr(t, c, r);
|
|
1060
1060
|
if (h.length === 0 && c === "artboard") {
|
|
1061
|
-
|
|
1061
|
+
Dr(e, t, n), e.restore();
|
|
1062
1062
|
return;
|
|
1063
1063
|
}
|
|
1064
1064
|
if (h.length === 0) {
|
|
1065
1065
|
n(e, t), e.restore();
|
|
1066
1066
|
return;
|
|
1067
1067
|
}
|
|
1068
|
-
const f = e.canvas, d = e.getTransform().a,
|
|
1069
|
-
if (!
|
|
1070
|
-
|
|
1071
|
-
for (const
|
|
1072
|
-
n(
|
|
1073
|
-
t.knockoutParts.fill && !t.knockoutParts.stroke && ((
|
|
1074
|
-
const
|
|
1075
|
-
e.drawImage(
|
|
1076
|
-
const
|
|
1077
|
-
(Math.abs(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1068
|
+
const f = e.canvas, d = e.getTransform().a, p = xr(f.width, f.height), m = p.getContext("2d");
|
|
1069
|
+
if (!m) return;
|
|
1070
|
+
m.scale(d, d), o && i && (m.fillStyle = o, m.fillRect(i.x, i.y, i.width, i.height));
|
|
1071
|
+
for (const g of h)
|
|
1072
|
+
n(m, g);
|
|
1073
|
+
t.knockoutParts.fill && !t.knockoutParts.stroke && ((T = t.stroke) != null && T.enabled) && (m.save(), Lt(m, t), m.restore()), m.save(), m.globalCompositeOperation = a, t.knockoutParts.fill && Ot(m, t), t.knockoutParts.stroke && Lt(m, t), m.restore(), t.knockoutParts.fill || (m.save(), Ot(m, t), m.restore());
|
|
1074
|
+
const w = f.width / d, k = f.height / d;
|
|
1075
|
+
e.drawImage(p, 0, 0, w, k), e.restore();
|
|
1076
|
+
const b = e.getTransform();
|
|
1077
|
+
(Math.abs(b.a - s.a) > 1e-3 || Math.abs(b.d - s.d) > 1e-3 || Math.abs(b.e - s.e) > 1e-3 || Math.abs(b.f - s.f) > 1e-3) && e.setTransform(
|
|
1078
|
+
s.a,
|
|
1079
|
+
s.b,
|
|
1080
|
+
s.c,
|
|
1081
|
+
s.d,
|
|
1082
|
+
s.e,
|
|
1083
|
+
s.f
|
|
1084
1084
|
);
|
|
1085
1085
|
}
|
|
1086
|
-
function
|
|
1087
|
-
|
|
1086
|
+
function oo(e, t, r, n, o, i) {
|
|
1087
|
+
qe(e, t, r, n, o, i, "destination-out");
|
|
1088
1088
|
}
|
|
1089
|
-
function
|
|
1090
|
-
return t === "artboard" ?
|
|
1089
|
+
function zr(e, t, r) {
|
|
1090
|
+
return t === "artboard" ? $e(e, r) : Zr(e, r);
|
|
1091
1091
|
}
|
|
1092
|
-
function
|
|
1092
|
+
function $e(e, t) {
|
|
1093
1093
|
const r = t.findIndex((n) => n.id === e.id);
|
|
1094
1094
|
return r === -1 ? [] : t.slice(0, r);
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1097
|
-
const r =
|
|
1096
|
+
function Zr(e, t) {
|
|
1097
|
+
const r = He(e, t);
|
|
1098
1098
|
if (!r)
|
|
1099
|
-
return
|
|
1099
|
+
return $e(e, t);
|
|
1100
1100
|
if (r.transformType !== "group" || !r.children)
|
|
1101
1101
|
return [];
|
|
1102
1102
|
const n = r.children.findIndex((o) => o.id === e.id);
|
|
1103
1103
|
return n === -1 ? [] : r.children.slice(0, n);
|
|
1104
1104
|
}
|
|
1105
|
-
function
|
|
1105
|
+
function He(e, t) {
|
|
1106
1106
|
for (const r of t)
|
|
1107
1107
|
if (r.transformType === "group" && r.children) {
|
|
1108
1108
|
if (r.children.some((o) => o.id === e.id))
|
|
1109
1109
|
return r;
|
|
1110
|
-
const n =
|
|
1110
|
+
const n = He(e, r.children);
|
|
1111
1111
|
if (n)
|
|
1112
1112
|
return n;
|
|
1113
1113
|
}
|
|
1114
1114
|
return null;
|
|
1115
1115
|
}
|
|
1116
|
-
function
|
|
1117
|
-
|
|
1116
|
+
function Ot(e, t, r) {
|
|
1117
|
+
Zt(e, t, {
|
|
1118
1118
|
mode: "fill",
|
|
1119
1119
|
renderingContext: { isKnockout: !0 }
|
|
1120
1120
|
});
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1122
|
+
function Lt(e, t) {
|
|
1123
1123
|
var r;
|
|
1124
|
-
(r = t.stroke) != null && r.enabled &&
|
|
1124
|
+
(r = t.stroke) != null && r.enabled && Zt(e, t, {
|
|
1125
1125
|
mode: "stroke",
|
|
1126
1126
|
renderingContext: { isKnockout: !0 }
|
|
1127
1127
|
});
|
|
1128
1128
|
}
|
|
1129
|
-
function
|
|
1129
|
+
function Dr(e, t, r) {
|
|
1130
1130
|
var o;
|
|
1131
1131
|
const n = t.knockoutParts;
|
|
1132
1132
|
if (!n) {
|
|
1133
1133
|
r(e, t);
|
|
1134
1134
|
return;
|
|
1135
1135
|
}
|
|
1136
|
-
n.fill || (e.save(),
|
|
1136
|
+
n.fill || (e.save(), Ot(e, t), e.restore()), !n.stroke && ((o = t.stroke) != null && o.enabled) && (e.save(), Lt(e, t), e.restore());
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function xr(e, t) {
|
|
1139
1139
|
if (typeof OffscreenCanvas < "u")
|
|
1140
1140
|
return new OffscreenCanvas(e, t);
|
|
1141
1141
|
if (typeof document < "u") {
|
|
@@ -1144,47 +1144,47 @@ function Dr(e, t) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
throw new Error("No canvas context available");
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function le(e, t, r, n, o = 0) {
|
|
1148
1148
|
if (r <= 0 || n <= 0 || e <= 0 || t <= 0)
|
|
1149
1149
|
return { width: e + o, height: t + o };
|
|
1150
|
-
const i = r / n,
|
|
1151
|
-
let l,
|
|
1152
|
-
return
|
|
1150
|
+
const i = r / n, a = e / t;
|
|
1151
|
+
let l, s;
|
|
1152
|
+
return a > i ? (s = t, l = t * i) : (l = e, s = e / i), {
|
|
1153
1153
|
width: l + o,
|
|
1154
|
-
height:
|
|
1154
|
+
height: s + o
|
|
1155
1155
|
};
|
|
1156
1156
|
}
|
|
1157
|
-
const
|
|
1158
|
-
function
|
|
1157
|
+
const nt = 64, Pt = 512;
|
|
1158
|
+
function tn(e, t) {
|
|
1159
1159
|
e.beginPath(), e.arc(t / 2, t / 2, t * 0.45, 0, Math.PI * 2), e.fill();
|
|
1160
1160
|
}
|
|
1161
|
-
function
|
|
1162
|
-
const r = t / 2, n = t / 2, o = t * 0.45, i = o * 0.4,
|
|
1161
|
+
function en(e, t) {
|
|
1162
|
+
const r = t / 2, n = t / 2, o = t * 0.45, i = o * 0.4, a = 5;
|
|
1163
1163
|
e.beginPath();
|
|
1164
|
-
for (let l = 0; l <
|
|
1165
|
-
const
|
|
1164
|
+
for (let l = 0; l < a * 2; l++) {
|
|
1165
|
+
const s = -Math.PI / 2 + Math.PI / a * l, c = l % 2 === 0 ? o : i, h = r + Math.cos(s) * c, f = n + Math.sin(s) * c;
|
|
1166
1166
|
l === 0 ? e.moveTo(h, f) : e.lineTo(h, f);
|
|
1167
1167
|
}
|
|
1168
1168
|
e.closePath(), e.fill();
|
|
1169
1169
|
}
|
|
1170
|
-
function
|
|
1170
|
+
function rn(e, t) {
|
|
1171
1171
|
const r = t / 2, n = t * 0.42;
|
|
1172
1172
|
e.beginPath(), e.moveTo(r, t * 0.82), e.bezierCurveTo(r - n * 1.1, t * 0.6, r - n * 1.3, t * 0.2, r, t * 0.35), e.bezierCurveTo(r + n * 1.3, t * 0.2, r + n * 1.1, t * 0.6, r, t * 0.82), e.closePath(), e.fill();
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1174
|
+
function nn(e, t) {
|
|
1175
1175
|
const r = t / 2, n = t / 2, o = t * 0.4, i = t * 0.48;
|
|
1176
1176
|
e.beginPath(), e.moveTo(r, n - i), e.lineTo(r + o, n), e.lineTo(r, n + i), e.lineTo(r - o, n), e.closePath(), e.fill();
|
|
1177
1177
|
}
|
|
1178
|
-
function
|
|
1178
|
+
function on(e, t) {
|
|
1179
1179
|
const r = t / 2, n = t / 2, o = t * 0.44;
|
|
1180
1180
|
e.beginPath();
|
|
1181
1181
|
for (let i = 0; i < 6; i++) {
|
|
1182
|
-
const
|
|
1183
|
-
i === 0 ? e.moveTo(l,
|
|
1182
|
+
const a = -Math.PI / 2 + Math.PI / 3 * i, l = r + Math.cos(a) * o, s = n + Math.sin(a) * o;
|
|
1183
|
+
i === 0 ? e.moveTo(l, s) : e.lineTo(l, s);
|
|
1184
1184
|
}
|
|
1185
1185
|
e.closePath(), e.fill();
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1187
|
+
function an(e, t) {
|
|
1188
1188
|
const r = t / 2, n = t * 0.4, o = t * 0.12;
|
|
1189
1189
|
e.beginPath(), e.moveTo(r, o), e.lineTo(r + n, t * 0.25), e.lineTo(r + n, t * 0.55), e.quadraticCurveTo(r + n * 0.3, t * 0.8, r, t * 0.9), e.quadraticCurveTo(r - n * 0.3, t * 0.8, r - n, t * 0.55), e.lineTo(r - n, t * 0.25), e.closePath(), e.fill();
|
|
1190
1190
|
}
|
|
@@ -1193,215 +1193,215 @@ function sn(e, t) {
|
|
|
1193
1193
|
let o = 42;
|
|
1194
1194
|
const i = () => (o = (o * 16807 + 0) % 2147483647, o / 2147483647);
|
|
1195
1195
|
e.beginPath(), e.arc(r, n, t * 0.28, 0, Math.PI * 2), e.fill();
|
|
1196
|
-
for (let
|
|
1197
|
-
const l = i() * Math.PI * 2,
|
|
1198
|
-
e.beginPath(), e.arc(r + Math.cos(l) *
|
|
1196
|
+
for (let a = 0; a < 30; a++) {
|
|
1197
|
+
const l = i() * Math.PI * 2, s = t * 0.15 + i() * t * 0.3, c = t * 0.02 + i() * t * 0.06;
|
|
1198
|
+
e.beginPath(), e.arc(r + Math.cos(l) * s, n + Math.sin(l) * s, c, 0, Math.PI * 2), e.fill();
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
|
-
function
|
|
1201
|
+
function ln(e, t) {
|
|
1202
1202
|
let r = 123;
|
|
1203
1203
|
const n = () => (r = (r * 16807 + 0) % 2147483647, r / 2147483647), o = t * 0.08, i = 40;
|
|
1204
1204
|
e.beginPath(), e.moveTo(o, o);
|
|
1205
|
-
for (let
|
|
1206
|
-
const l = o + (t - 2 * o) * (
|
|
1207
|
-
e.lineTo(l,
|
|
1205
|
+
for (let a = 1; a <= i; a++) {
|
|
1206
|
+
const l = o + (t - 2 * o) * (a / i), s = o + (n() - 0.5) * t * 0.08;
|
|
1207
|
+
e.lineTo(l, s);
|
|
1208
1208
|
}
|
|
1209
|
-
for (let
|
|
1210
|
-
const l = t - o + (n() - 0.5) * t * 0.08,
|
|
1211
|
-
e.lineTo(l,
|
|
1209
|
+
for (let a = 1; a <= i; a++) {
|
|
1210
|
+
const l = t - o + (n() - 0.5) * t * 0.08, s = o + (t - 2 * o) * (a / i);
|
|
1211
|
+
e.lineTo(l, s);
|
|
1212
1212
|
}
|
|
1213
|
-
for (let
|
|
1214
|
-
const l = o + (t - 2 * o) * (
|
|
1215
|
-
e.lineTo(l,
|
|
1213
|
+
for (let a = i; a >= 0; a--) {
|
|
1214
|
+
const l = o + (t - 2 * o) * (a / i), s = t - o + (n() - 0.5) * t * 0.08;
|
|
1215
|
+
e.lineTo(l, s);
|
|
1216
1216
|
}
|
|
1217
|
-
for (let
|
|
1218
|
-
const l = o + (n() - 0.5) * t * 0.08,
|
|
1219
|
-
e.lineTo(l,
|
|
1217
|
+
for (let a = i; a >= 0; a--) {
|
|
1218
|
+
const l = o + (n() - 0.5) * t * 0.08, s = o + (t - 2 * o) * (a / i);
|
|
1219
|
+
e.lineTo(l, s);
|
|
1220
1220
|
}
|
|
1221
1221
|
e.closePath(), e.fill();
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1223
|
+
function cn(e, t) {
|
|
1224
1224
|
let r = 77;
|
|
1225
|
-
const n = () => (r = (r * 16807 + 0) % 2147483647, r / 2147483647), o = t * 0.25, i = t * 0.75,
|
|
1226
|
-
e.beginPath(), e.moveTo(
|
|
1225
|
+
const n = () => (r = (r * 16807 + 0) % 2147483647, r / 2147483647), o = t * 0.25, i = t * 0.75, a = t * 0.1;
|
|
1226
|
+
e.beginPath(), e.moveTo(a, o + n() * t * 0.05);
|
|
1227
1227
|
for (let l = 1; l <= 10; l++) {
|
|
1228
|
-
const
|
|
1229
|
-
e.lineTo(
|
|
1228
|
+
const s = a + (t - 2 * a) * (l / 10), c = o + (n() - 0.5) * t * 0.1;
|
|
1229
|
+
e.lineTo(s, c);
|
|
1230
1230
|
}
|
|
1231
1231
|
for (let l = 10; l >= 0; l--) {
|
|
1232
|
-
const
|
|
1233
|
-
e.lineTo(
|
|
1232
|
+
const s = a + (t - 2 * a) * (l / 10), c = i + (n() - 0.5) * t * 0.1;
|
|
1233
|
+
e.lineTo(s, c);
|
|
1234
1234
|
}
|
|
1235
1235
|
e.closePath(), e.fill();
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1237
|
+
function hn(e, t) {
|
|
1238
1238
|
const r = t / 2, n = t * 0.55;
|
|
1239
1239
|
e.beginPath(), e.arc(r, n, t * 0.2, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(r - t * 0.18, n + t * 0.02, t * 0.15, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(r + t * 0.18, n + t * 0.02, t * 0.16, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(r - t * 0.06, n - t * 0.14, t * 0.14, 0, Math.PI * 2), e.fill(), e.beginPath(), e.arc(r + t * 0.1, n - t * 0.12, t * 0.12, 0, Math.PI * 2), e.fill();
|
|
1240
1240
|
}
|
|
1241
|
-
const
|
|
1241
|
+
const fn = [
|
|
1242
1242
|
// Geometric
|
|
1243
|
-
{ id: "circle", name: "Circle", description: "Perfect circle", imageUrl: "builtin-mask:circle", thumbnailUrl: "", category: "geometric", draw:
|
|
1244
|
-
{ id: "star", name: "Star", description: "5-pointed star", imageUrl: "builtin-mask:star", thumbnailUrl: "", category: "geometric", draw:
|
|
1245
|
-
{ id: "heart", name: "Heart", description: "Heart shape", imageUrl: "builtin-mask:heart", thumbnailUrl: "", category: "geometric", draw:
|
|
1246
|
-
{ id: "diamond", name: "Diamond", description: "Diamond/rhombus", imageUrl: "builtin-mask:diamond", thumbnailUrl: "", category: "geometric", draw:
|
|
1247
|
-
{ id: "hexagon", name: "Hexagon", description: "Regular hexagon", imageUrl: "builtin-mask:hexagon", thumbnailUrl: "", category: "geometric", draw:
|
|
1248
|
-
{ id: "shield", name: "Shield", description: "Shield/crest shape", imageUrl: "builtin-mask:shield", thumbnailUrl: "", category: "geometric", draw:
|
|
1243
|
+
{ id: "circle", name: "Circle", description: "Perfect circle", imageUrl: "builtin-mask:circle", thumbnailUrl: "", category: "geometric", draw: tn },
|
|
1244
|
+
{ id: "star", name: "Star", description: "5-pointed star", imageUrl: "builtin-mask:star", thumbnailUrl: "", category: "geometric", draw: en },
|
|
1245
|
+
{ id: "heart", name: "Heart", description: "Heart shape", imageUrl: "builtin-mask:heart", thumbnailUrl: "", category: "geometric", draw: rn },
|
|
1246
|
+
{ id: "diamond", name: "Diamond", description: "Diamond/rhombus", imageUrl: "builtin-mask:diamond", thumbnailUrl: "", category: "geometric", draw: nn },
|
|
1247
|
+
{ id: "hexagon", name: "Hexagon", description: "Regular hexagon", imageUrl: "builtin-mask:hexagon", thumbnailUrl: "", category: "geometric", draw: on },
|
|
1248
|
+
{ id: "shield", name: "Shield", description: "Shield/crest shape", imageUrl: "builtin-mask:shield", thumbnailUrl: "", category: "geometric", draw: an },
|
|
1249
1249
|
// Organic
|
|
1250
1250
|
{ id: "splatter", name: "Splatter", description: "Ink splatter", imageUrl: "builtin-mask:splatter", thumbnailUrl: "", category: "organic", draw: sn },
|
|
1251
|
-
{ id: "torn-edge", name: "Torn Edge", description: "Rough torn paper edge", imageUrl: "builtin-mask:torn-edge", thumbnailUrl: "", category: "organic", draw:
|
|
1252
|
-
{ id: "paint-stroke", name: "Paint Stroke", description: "Horizontal brush stroke", imageUrl: "builtin-mask:paint-stroke", thumbnailUrl: "", category: "organic", draw:
|
|
1253
|
-
{ id: "cloud", name: "Cloud", description: "Soft cloud shape", imageUrl: "builtin-mask:cloud", thumbnailUrl: "", category: "organic", draw:
|
|
1251
|
+
{ id: "torn-edge", name: "Torn Edge", description: "Rough torn paper edge", imageUrl: "builtin-mask:torn-edge", thumbnailUrl: "", category: "organic", draw: ln },
|
|
1252
|
+
{ id: "paint-stroke", name: "Paint Stroke", description: "Horizontal brush stroke", imageUrl: "builtin-mask:paint-stroke", thumbnailUrl: "", category: "organic", draw: cn },
|
|
1253
|
+
{ id: "cloud", name: "Cloud", description: "Soft cloud shape", imageUrl: "builtin-mask:cloud", thumbnailUrl: "", category: "organic", draw: hn }
|
|
1254
1254
|
];
|
|
1255
|
-
let
|
|
1256
|
-
function
|
|
1255
|
+
let ce = !1;
|
|
1256
|
+
function he(e, t) {
|
|
1257
1257
|
if (typeof document > "u") return null;
|
|
1258
1258
|
const r = document.createElement("canvas");
|
|
1259
1259
|
return r.width = e, r.height = t, r;
|
|
1260
1260
|
}
|
|
1261
|
-
function
|
|
1262
|
-
if (typeof document > "u" ||
|
|
1263
|
-
|
|
1264
|
-
const e =
|
|
1265
|
-
for (const t of
|
|
1266
|
-
const r =
|
|
1261
|
+
function dn() {
|
|
1262
|
+
if (typeof document > "u" || ce) return;
|
|
1263
|
+
ce = !0;
|
|
1264
|
+
const e = vt.getInstance();
|
|
1265
|
+
for (const t of fn) {
|
|
1266
|
+
const r = he(Pt, Pt);
|
|
1267
1267
|
if (!r) continue;
|
|
1268
1268
|
const n = r.getContext("2d");
|
|
1269
1269
|
if (!n) continue;
|
|
1270
|
-
n.fillStyle = "white", t.draw(n,
|
|
1270
|
+
n.fillStyle = "white", t.draw(n, Pt);
|
|
1271
1271
|
const o = r.toDataURL("image/png"), i = e.acquire(t.imageUrl);
|
|
1272
1272
|
i.crossOrigin = "anonymous", i.src = o;
|
|
1273
|
-
const
|
|
1274
|
-
if (
|
|
1275
|
-
const l =
|
|
1276
|
-
l && (l.fillStyle = "#1a1a2e", l.fillRect(0, 0,
|
|
1273
|
+
const a = he(nt, nt);
|
|
1274
|
+
if (a) {
|
|
1275
|
+
const l = a.getContext("2d");
|
|
1276
|
+
l && (l.fillStyle = "#1a1a2e", l.fillRect(0, 0, nt, nt), l.fillStyle = "white", t.draw(l, nt), t.thumbnailUrl = a.toDataURL("image/png"));
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
-
const
|
|
1281
|
-
function
|
|
1280
|
+
const un = j("MaskRenderer"), qt = /* @__PURE__ */ new Map(), gn = /* @__PURE__ */ new Map();
|
|
1281
|
+
function ao(e) {
|
|
1282
1282
|
const t = [];
|
|
1283
|
-
|
|
1283
|
+
qt.forEach((r, n) => {
|
|
1284
1284
|
n.startsWith(e) && t.push(n);
|
|
1285
|
-
}), t.forEach((r) =>
|
|
1285
|
+
}), t.forEach((r) => qt.delete(r));
|
|
1286
1286
|
}
|
|
1287
|
-
function
|
|
1288
|
-
|
|
1287
|
+
function so() {
|
|
1288
|
+
qt.clear();
|
|
1289
1289
|
}
|
|
1290
|
-
function
|
|
1290
|
+
function fe(e, t, r) {
|
|
1291
1291
|
if (!t.masks || t.masks.length === 0) {
|
|
1292
1292
|
r(e);
|
|
1293
1293
|
return;
|
|
1294
1294
|
}
|
|
1295
|
-
const n = e.canvas, o =
|
|
1295
|
+
const n = e.canvas, o = mt(n.width, n.height), i = o.getContext("2d");
|
|
1296
1296
|
if (!i) {
|
|
1297
|
-
|
|
1297
|
+
un.error("[renderWithMasks] Failed to get offscreen context");
|
|
1298
1298
|
return;
|
|
1299
1299
|
}
|
|
1300
|
-
const
|
|
1301
|
-
i.setTransform(
|
|
1300
|
+
const a = e.getTransform();
|
|
1301
|
+
i.setTransform(a), r(i);
|
|
1302
1302
|
for (const l of t.masks)
|
|
1303
|
-
|
|
1303
|
+
pn(i, l, t);
|
|
1304
1304
|
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(o, 0, 0), e.restore();
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function pn(e, t, r) {
|
|
1307
1307
|
switch (t.type) {
|
|
1308
1308
|
case "clip":
|
|
1309
|
-
|
|
1309
|
+
mn(e, t, r);
|
|
1310
1310
|
break;
|
|
1311
1311
|
case "alpha":
|
|
1312
|
-
|
|
1312
|
+
yn(e, t, r);
|
|
1313
1313
|
break;
|
|
1314
1314
|
case "luma":
|
|
1315
|
-
|
|
1315
|
+
wn(e, t, r);
|
|
1316
1316
|
break;
|
|
1317
1317
|
case "distress":
|
|
1318
|
-
|
|
1318
|
+
bn(e, t, r);
|
|
1319
1319
|
break;
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
function pn(e, t, r) {
|
|
1323
|
-
e.save(), e.globalCompositeOperation = t.inverted ? "destination-out" : "destination-in", t.opacity !== void 0 && (e.globalAlpha = t.opacity), vt(e, t.maskElement, r), e.restore();
|
|
1324
|
-
}
|
|
1325
1322
|
function mn(e, t, r) {
|
|
1326
|
-
e.save(), e.globalCompositeOperation = t.inverted ? "destination-out" : "destination-in", t.opacity !== void 0 && (e.globalAlpha = t.opacity),
|
|
1323
|
+
e.save(), e.globalCompositeOperation = t.inverted ? "destination-out" : "destination-in", t.opacity !== void 0 && (e.globalAlpha = t.opacity), Mt(e, t.maskElement, r), e.restore();
|
|
1327
1324
|
}
|
|
1328
1325
|
function yn(e, t, r) {
|
|
1329
|
-
|
|
1326
|
+
e.save(), e.globalCompositeOperation = t.inverted ? "destination-out" : "destination-in", t.opacity !== void 0 && (e.globalAlpha = t.opacity), Mt(e, t.maskElement, r), t.feather && t.feather > 0 && je(e, t.feather), e.restore();
|
|
1327
|
+
}
|
|
1328
|
+
function wn(e, t, r) {
|
|
1329
|
+
const n = mt(e.canvas.width, e.canvas.height), o = n.getContext("2d");
|
|
1330
1330
|
if (!o) return;
|
|
1331
|
-
|
|
1332
|
-
const i = o.getImageData(0, 0, n.width, n.height),
|
|
1333
|
-
for (let l = 0; l <
|
|
1334
|
-
const
|
|
1335
|
-
|
|
1331
|
+
Mt(o, t.maskElement, r);
|
|
1332
|
+
const i = o.getImageData(0, 0, n.width, n.height), a = i.data;
|
|
1333
|
+
for (let l = 0; l < a.length; l += 4) {
|
|
1334
|
+
const s = a[l], c = a[l + 1], h = a[l + 2], f = 0.299 * s + 0.587 * c + 0.114 * h;
|
|
1335
|
+
a[l + 3] = t.inverted ? 255 - f : f;
|
|
1336
1336
|
}
|
|
1337
1337
|
o.putImageData(i, 0, 0), e.save(), e.globalCompositeOperation = "destination-in", t.opacity !== void 0 && (e.globalAlpha = t.opacity), e.drawImage(n, 0, 0), e.restore();
|
|
1338
1338
|
}
|
|
1339
|
-
function
|
|
1340
|
-
e.save(), e.globalCompositeOperation = t.inverted ? "destination-in" : "destination-out", t.opacity !== void 0 && (e.globalAlpha = t.opacity),
|
|
1339
|
+
function bn(e, t, r) {
|
|
1340
|
+
e.save(), e.globalCompositeOperation = t.inverted ? "destination-in" : "destination-out", t.opacity !== void 0 && (e.globalAlpha = t.opacity), Mt(e, t.maskElement, r), t.feather && t.feather > 0 && je(e, t.feather), e.restore();
|
|
1341
1341
|
}
|
|
1342
1342
|
function kn(e) {
|
|
1343
|
-
const t = e.transformData, r = e, n = t && t.type === "image" ?
|
|
1343
|
+
const t = e.transformData, r = e, n = t && t.type === "image" ? nr(t, Se(e)) : null;
|
|
1344
1344
|
return {
|
|
1345
1345
|
width: (n == null ? void 0 : n.width) || (t == null ? void 0 : t.width) || r.width || 0,
|
|
1346
1346
|
height: (n == null ? void 0 : n.height) || (t == null ? void 0 : t.height) || r.height || 0
|
|
1347
1347
|
};
|
|
1348
1348
|
}
|
|
1349
|
-
function
|
|
1350
|
-
const n = r.x || 0, o = r.y || 0, i = t.x || 0,
|
|
1349
|
+
function Mt(e, t, r) {
|
|
1350
|
+
const n = r.x || 0, o = r.y || 0, i = t.x || 0, a = t.y || 0, l = {
|
|
1351
1351
|
...t,
|
|
1352
1352
|
x: n + i,
|
|
1353
|
-
y: o +
|
|
1353
|
+
y: o + a,
|
|
1354
1354
|
// Inherit parent rotation so mask rotates with the element
|
|
1355
1355
|
rotation: (t.rotation || 0) + (r.rotation || 0)
|
|
1356
|
-
},
|
|
1356
|
+
}, s = 4, { width: c, height: h } = kn(r), f = t.transformData;
|
|
1357
1357
|
c && h && f && (l.transformData = {
|
|
1358
1358
|
...f,
|
|
1359
|
-
width: c +
|
|
1360
|
-
height: h +
|
|
1359
|
+
width: c + s,
|
|
1360
|
+
height: h + s
|
|
1361
1361
|
});
|
|
1362
1362
|
let u, d;
|
|
1363
1363
|
if (t.transformType === "image") {
|
|
1364
|
-
const
|
|
1365
|
-
if (
|
|
1364
|
+
const b = t;
|
|
1365
|
+
if (b.imageUrl)
|
|
1366
1366
|
if (typeof document < "u") {
|
|
1367
|
-
|
|
1368
|
-
const
|
|
1369
|
-
|
|
1367
|
+
b.imageUrl.startsWith("builtin-mask:") && dn();
|
|
1368
|
+
const T = vt.getInstance(), g = T.acquire(b.imageUrl);
|
|
1369
|
+
g.complete && g.naturalWidth > 0 && (u = g), T.release(b.imageUrl);
|
|
1370
1370
|
} else
|
|
1371
|
-
d =
|
|
1371
|
+
d = gn.get(b.imageUrl);
|
|
1372
1372
|
}
|
|
1373
|
-
const
|
|
1373
|
+
const p = l.transformData, m = (f == null ? void 0 : f.width) || 0, w = (f == null ? void 0 : f.height) || 0, k = m > 0 && w > 0 && c > 0 && h > 0 && Math.abs(m / w - c / h) > 1e-3;
|
|
1374
1374
|
if (d) {
|
|
1375
1375
|
e.save();
|
|
1376
|
-
const
|
|
1377
|
-
if (e.translate(l.x || 0, l.y || 0), e.rotate(-(l.rotation || 0) * Math.PI / 180),
|
|
1378
|
-
const
|
|
1379
|
-
w,
|
|
1376
|
+
const b = (p == null ? void 0 : p.width) || d.width, T = (p == null ? void 0 : p.height) || d.height;
|
|
1377
|
+
if (e.translate(l.x || 0, l.y || 0), e.rotate(-(l.rotation || 0) * Math.PI / 180), k) {
|
|
1378
|
+
const g = le(
|
|
1380
1379
|
b,
|
|
1381
|
-
|
|
1382
|
-
|
|
1380
|
+
T,
|
|
1381
|
+
m,
|
|
1382
|
+
w,
|
|
1383
1383
|
0
|
|
1384
1384
|
);
|
|
1385
|
-
e.drawImage(d, -
|
|
1385
|
+
e.drawImage(d, -g.width / 2, -g.height / 2, g.width, g.height);
|
|
1386
1386
|
} else
|
|
1387
|
-
e.drawImage(d, -
|
|
1387
|
+
e.drawImage(d, -b / 2, -T / 2, b, T);
|
|
1388
1388
|
e.restore();
|
|
1389
|
-
} else if (
|
|
1390
|
-
const
|
|
1391
|
-
w,
|
|
1389
|
+
} else if (k && u) {
|
|
1390
|
+
const b = (p == null ? void 0 : p.width) || c, T = (p == null ? void 0 : p.height) || h, g = le(
|
|
1392
1391
|
b,
|
|
1393
|
-
|
|
1394
|
-
|
|
1392
|
+
T,
|
|
1393
|
+
m,
|
|
1394
|
+
w,
|
|
1395
1395
|
0
|
|
1396
1396
|
);
|
|
1397
|
-
e.save(), e.translate(l.x || 0, l.y || 0), e.rotate(-(l.rotation || 0) * Math.PI / 180), e.drawImage(u, -
|
|
1397
|
+
e.save(), e.translate(l.x || 0, l.y || 0), e.rotate(-(l.rotation || 0) * Math.PI / 180), e.drawImage(u, -g.width / 2, -g.height / 2, g.width, g.height), e.restore();
|
|
1398
1398
|
} else
|
|
1399
|
-
|
|
1399
|
+
Zt(e, l, { mode: "both", loadedImage: u });
|
|
1400
1400
|
}
|
|
1401
|
-
function
|
|
1401
|
+
function je(e, t) {
|
|
1402
1402
|
"filter" in e && (e.filter = `blur(${t}px)`);
|
|
1403
1403
|
}
|
|
1404
|
-
function
|
|
1404
|
+
function mt(e, t) {
|
|
1405
1405
|
if (typeof OffscreenCanvas < "u")
|
|
1406
1406
|
return new OffscreenCanvas(e, t);
|
|
1407
1407
|
if (typeof document < "u") {
|
|
@@ -1410,75 +1410,75 @@ function pt(e, t) {
|
|
|
1410
1410
|
}
|
|
1411
1411
|
throw new Error("No canvas context available");
|
|
1412
1412
|
}
|
|
1413
|
-
function
|
|
1413
|
+
function Tn(e, t, r, n) {
|
|
1414
1414
|
if (!t.enabled || !t.imageUrl || t.opacity <= 0) return;
|
|
1415
|
-
const o =
|
|
1415
|
+
const o = vt.getInstance(), i = o.acquire(t.imageUrl);
|
|
1416
1416
|
if (!i.complete || i.naturalWidth === 0) {
|
|
1417
1417
|
o.release(t.imageUrl);
|
|
1418
1418
|
return;
|
|
1419
1419
|
}
|
|
1420
|
-
const { x:
|
|
1421
|
-
if (
|
|
1420
|
+
const { x: a, y: l, width: s, height: c } = r, h = e.getTransform(), f = h.a * a + h.e, u = h.d * l + h.f, d = h.a * s, p = h.d * c, m = Math.ceil(d), w = Math.ceil(p);
|
|
1421
|
+
if (m <= 0 || w <= 0) {
|
|
1422
1422
|
o.release(t.imageUrl);
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
1425
|
-
const
|
|
1426
|
-
if (!
|
|
1425
|
+
const k = mt(m, w), b = k.getContext("2d");
|
|
1426
|
+
if (!b) {
|
|
1427
1427
|
o.release(t.imageUrl);
|
|
1428
1428
|
return;
|
|
1429
1429
|
}
|
|
1430
|
-
|
|
1430
|
+
b.drawImage(
|
|
1431
1431
|
e.canvas,
|
|
1432
1432
|
f,
|
|
1433
1433
|
u,
|
|
1434
1434
|
d,
|
|
1435
|
-
|
|
1435
|
+
p,
|
|
1436
1436
|
0,
|
|
1437
1437
|
0,
|
|
1438
|
-
|
|
1439
|
-
|
|
1438
|
+
m,
|
|
1439
|
+
w
|
|
1440
1440
|
);
|
|
1441
|
-
let
|
|
1442
|
-
if (t.maskType === "luma" ?
|
|
1443
|
-
const
|
|
1441
|
+
let T;
|
|
1442
|
+
if (t.maskType === "luma" ? T = "destination-in" : T = t.inverted ? "destination-out" : "destination-in", t.maskType === "luma") {
|
|
1443
|
+
const g = mt(m, w), y = g.getContext("2d");
|
|
1444
1444
|
if (y) {
|
|
1445
|
-
y.drawImage(i, 0, 0,
|
|
1446
|
-
const
|
|
1447
|
-
for (let
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1445
|
+
y.drawImage(i, 0, 0, m, w);
|
|
1446
|
+
const S = y.getImageData(0, 0, m, w), C = S.data;
|
|
1447
|
+
for (let P = 0; P < C.length; P += 4) {
|
|
1448
|
+
const I = 0.299 * C[P] + 0.587 * C[P + 1] + 0.114 * C[P + 2];
|
|
1449
|
+
C[P + 3] = t.inverted ? 255 - I : I;
|
|
1450
1450
|
}
|
|
1451
|
-
y.putImageData(
|
|
1451
|
+
y.putImageData(S, 0, 0), b.globalCompositeOperation = "destination-in", b.globalAlpha = t.opacity / 100, b.drawImage(g, 0, 0);
|
|
1452
1452
|
}
|
|
1453
1453
|
} else
|
|
1454
|
-
|
|
1455
|
-
|
|
1454
|
+
b.globalCompositeOperation = T, b.globalAlpha = t.opacity / 100, b.drawImage(i, 0, 0, m, w);
|
|
1455
|
+
b.globalCompositeOperation = "source-over", b.globalAlpha = 1, e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(f, u, d, p), n && (e.fillStyle = n, e.fillRect(f, u, d, p)), e.drawImage(k, f, u), e.restore(), o.release(t.imageUrl);
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function vn(e) {
|
|
1458
1458
|
var t;
|
|
1459
|
-
return e ? ((t = e.shadow) == null ? void 0 : t.enabled) === !0 ||
|
|
1459
|
+
return e ? ((t = e.shadow) == null ? void 0 : t.enabled) === !0 || Ce(e.blendMode) : !1;
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1461
|
+
function Mn(e, t, r) {
|
|
1462
1462
|
var c;
|
|
1463
|
-
if (!
|
|
1463
|
+
if (!vn(t)) {
|
|
1464
1464
|
r(e);
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
1467
|
-
const n = (c = t.shadow) != null && c.enabled ? t.shadow : void 0, o =
|
|
1468
|
-
if (!
|
|
1467
|
+
const n = (c = t.shadow) != null && c.enabled ? t.shadow : void 0, o = Ce(t.blendMode) ? t.blendMode : void 0, i = e.canvas, a = e.getTransform(), l = Sn(i.width, i.height), s = l.getContext("2d");
|
|
1468
|
+
if (!s)
|
|
1469
1469
|
throw new Error(
|
|
1470
1470
|
"[canvas] renderWithLayerEffects: could not acquire a 2D context for the layer-effects raster"
|
|
1471
1471
|
);
|
|
1472
|
-
if (
|
|
1473
|
-
const h = Math.hypot(
|
|
1474
|
-
e.save(), e.globalAlpha = e.globalAlpha *
|
|
1472
|
+
if (s.setTransform(a), r(s), e.save(), e.setTransform(1, 0, 0, 1, 0, 0), o && (e.globalCompositeOperation = o), n) {
|
|
1473
|
+
const h = Math.hypot(a.a, a.b) || 1, f = i.width + 1;
|
|
1474
|
+
e.save(), e.globalAlpha = e.globalAlpha * En(n.opacity ?? 1), e.shadowColor = n.color, e.shadowBlur = n.blur * h, e.shadowOffsetX = n.offsetX * h + f, e.shadowOffsetY = n.offsetY * h, e.drawImage(l, -f, 0), e.restore();
|
|
1475
1475
|
}
|
|
1476
1476
|
e.drawImage(l, 0, 0), e.restore();
|
|
1477
1477
|
}
|
|
1478
|
-
function
|
|
1478
|
+
function En(e) {
|
|
1479
1479
|
return Math.min(1, Math.max(0, e));
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1481
|
+
function Sn(e, t) {
|
|
1482
1482
|
if (typeof OffscreenCanvas < "u")
|
|
1483
1483
|
return new OffscreenCanvas(e, t);
|
|
1484
1484
|
if (typeof document < "u") {
|
|
@@ -1487,7 +1487,7 @@ function En(e, t) {
|
|
|
1487
1487
|
}
|
|
1488
1488
|
throw new Error("No canvas context available");
|
|
1489
1489
|
}
|
|
1490
|
-
class
|
|
1490
|
+
class Cn {
|
|
1491
1491
|
constructor(t = Math.random()) {
|
|
1492
1492
|
this.perm = [];
|
|
1493
1493
|
for (let n = 0; n < 256; n++)
|
|
@@ -1511,73 +1511,73 @@ class Sn {
|
|
|
1511
1511
|
return r + t * (n - r);
|
|
1512
1512
|
}
|
|
1513
1513
|
grad(t, r, n) {
|
|
1514
|
-
const o = t & 15, i = o < 8 ? r : n,
|
|
1515
|
-
return ((o & 1) === 0 ? i : -i) + ((o & 2) === 0 ?
|
|
1514
|
+
const o = t & 15, i = o < 8 ? r : n, a = o < 4 ? n : o === 12 || o === 14 ? r : 0;
|
|
1515
|
+
return ((o & 1) === 0 ? i : -i) + ((o & 2) === 0 ? a : -a);
|
|
1516
1516
|
}
|
|
1517
1517
|
noise(t, r) {
|
|
1518
1518
|
const n = Math.floor(t) & 255, o = Math.floor(r) & 255;
|
|
1519
1519
|
t -= Math.floor(t), r -= Math.floor(r);
|
|
1520
|
-
const i = this.fade(t),
|
|
1520
|
+
const i = this.fade(t), a = this.fade(r), l = this.perm[n] + o, s = this.perm[n + 1] + o;
|
|
1521
1521
|
return this.lerp(
|
|
1522
|
-
|
|
1523
|
-
this.lerp(i, this.grad(this.perm[l], t, r), this.grad(this.perm[
|
|
1524
|
-
this.lerp(i, this.grad(this.perm[l + 1], t, r - 1), this.grad(this.perm[
|
|
1522
|
+
a,
|
|
1523
|
+
this.lerp(i, this.grad(this.perm[l], t, r), this.grad(this.perm[s], t - 1, r)),
|
|
1524
|
+
this.lerp(i, this.grad(this.perm[l + 1], t, r - 1), this.grad(this.perm[s + 1], t - 1, r - 1))
|
|
1525
1525
|
);
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1529
|
-
const
|
|
1528
|
+
function It(e, t, r, n = Date.now()) {
|
|
1529
|
+
const a = Et(e, t).getContext("2d").createImageData(e, t), l = a.data, s = new Cn(n), c = 0.02, h = 1 - r / 100;
|
|
1530
1530
|
for (let f = 0; f < t; f++)
|
|
1531
1531
|
for (let u = 0; u < e; u++) {
|
|
1532
1532
|
const d = (f * e + u) * 4;
|
|
1533
|
-
let
|
|
1534
|
-
|
|
1535
|
-
const
|
|
1536
|
-
|
|
1537
|
-
const
|
|
1538
|
-
l[d] = 255, l[d + 1] = 255, l[d + 2] = 255, l[d + 3] =
|
|
1533
|
+
let p = 0;
|
|
1534
|
+
p += s.noise(u * c, f * c) * 0.5, p += s.noise(u * c * 2, f * c * 2) * 0.25, p += s.noise(u * c * 4, f * c * 4) * 0.125, p = (p + 1) / 2;
|
|
1535
|
+
const m = Math.min(u / e, (e - u) / e) * 2, w = Math.min(f / t, (t - f) / t) * 2, k = Math.min(m, w);
|
|
1536
|
+
p *= 0.7 + k * 0.3;
|
|
1537
|
+
const b = p > h ? 255 : 0;
|
|
1538
|
+
l[d] = 255, l[d + 1] = 255, l[d + 2] = 255, l[d + 3] = b;
|
|
1539
1539
|
}
|
|
1540
|
-
return
|
|
1540
|
+
return a;
|
|
1541
1541
|
}
|
|
1542
|
-
function
|
|
1542
|
+
function Pn(e, t, r, n = Date.now()) {
|
|
1543
1543
|
const i = Et(e, t).getContext("2d");
|
|
1544
1544
|
i.clearRect(0, 0, e, t), i.strokeStyle = "#000000", i.lineWidth = 1 + r / 50, i.lineCap = "round";
|
|
1545
|
-
const
|
|
1546
|
-
for (let
|
|
1547
|
-
const c =
|
|
1548
|
-
|
|
1545
|
+
const a = Dt(n), l = Math.floor(r / 100 * 30 + 5);
|
|
1546
|
+
for (let s = 0; s < l; s++) {
|
|
1547
|
+
const c = a() * e, h = a() * t;
|
|
1548
|
+
$t(i, c, h, a() * Math.PI * 2, 50 + a() * 100, a, 0);
|
|
1549
1549
|
}
|
|
1550
1550
|
return i.getImageData(0, 0, e, t);
|
|
1551
1551
|
}
|
|
1552
|
-
function
|
|
1553
|
-
if (
|
|
1554
|
-
const l = t + Math.cos(n) * o,
|
|
1555
|
-
if (e.beginPath(), e.moveTo(t, r), e.lineTo(l,
|
|
1552
|
+
function $t(e, t, r, n, o, i, a) {
|
|
1553
|
+
if (a > 3 || o < 10) return;
|
|
1554
|
+
const l = t + Math.cos(n) * o, s = r + Math.sin(n) * o;
|
|
1555
|
+
if (e.beginPath(), e.moveTo(t, r), e.lineTo(l, s), e.stroke(), i() > 0.5) {
|
|
1556
1556
|
const c = n + (i() - 0.5) * Math.PI / 2;
|
|
1557
|
-
|
|
1557
|
+
$t(e, l, s, c, o * 0.6, i, a + 1);
|
|
1558
1558
|
}
|
|
1559
1559
|
if (i() > 0.7) {
|
|
1560
1560
|
const c = n - (i() - 0.5) * Math.PI / 2;
|
|
1561
|
-
|
|
1561
|
+
$t(e, l, s, c, o * 0.6, i, a + 1);
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
|
-
function
|
|
1565
|
-
const
|
|
1564
|
+
function ut(e, t, r, n = Date.now()) {
|
|
1565
|
+
const a = Et(e, t).getContext("2d").createImageData(e, t), l = a.data, s = Dt(n), c = r / 100 * 0.5;
|
|
1566
1566
|
for (let h = 0; h < t; h++)
|
|
1567
1567
|
for (let f = 0; f < e; f++) {
|
|
1568
|
-
const u = (h * e + f) * 4,
|
|
1569
|
-
l[u] = 0, l[u + 1] = 0, l[u + 2] = 0, l[u + 3] =
|
|
1568
|
+
const u = (h * e + f) * 4, p = s() < c ? 255 : 0;
|
|
1569
|
+
l[u] = 0, l[u + 1] = 0, l[u + 2] = 0, l[u + 3] = p;
|
|
1570
1570
|
}
|
|
1571
|
-
return
|
|
1571
|
+
return a;
|
|
1572
1572
|
}
|
|
1573
|
-
function
|
|
1573
|
+
function In(e, t, r, n = Date.now()) {
|
|
1574
1574
|
const i = Et(e, t).getContext("2d");
|
|
1575
1575
|
i.fillStyle = "#000000";
|
|
1576
|
-
const
|
|
1577
|
-
for (let c = 0; c < t; c +=
|
|
1578
|
-
for (let h = 0; h < e; h +=
|
|
1579
|
-
if (
|
|
1580
|
-
const f = l * (0.5 +
|
|
1576
|
+
const a = Dt(n), l = 4 + r / 100 * 6, s = l * 2;
|
|
1577
|
+
for (let c = 0; c < t; c += s)
|
|
1578
|
+
for (let h = 0; h < e; h += s)
|
|
1579
|
+
if (a() < r / 100) {
|
|
1580
|
+
const f = l * (0.5 + a() * 0.5);
|
|
1581
1581
|
i.beginPath(), i.arc(h, c, f / 2, 0, Math.PI * 2), i.fill();
|
|
1582
1582
|
}
|
|
1583
1583
|
return i.getImageData(0, 0, e, t);
|
|
@@ -1591,31 +1591,31 @@ function Et(e, t) {
|
|
|
1591
1591
|
}
|
|
1592
1592
|
throw new Error("No canvas context available");
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Dt(e) {
|
|
1595
1595
|
let t = Math.sin(e++) * 1e4;
|
|
1596
1596
|
return () => (t = Math.sin(e++) * 1e4, t - Math.floor(t));
|
|
1597
1597
|
}
|
|
1598
1598
|
const H = 42, z = 512, Z = 64;
|
|
1599
|
-
function
|
|
1599
|
+
function Ht(e) {
|
|
1600
1600
|
const t = e.data;
|
|
1601
1601
|
for (let r = 0; r < t.length; r += 4)
|
|
1602
1602
|
t[r] = 255, t[r + 1] = 255, t[r + 2] = 255;
|
|
1603
1603
|
return e;
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1605
|
+
function An(e, t) {
|
|
1606
1606
|
const r = e.data, n = t.data;
|
|
1607
1607
|
for (let o = 0; o < r.length; o += 4)
|
|
1608
1608
|
r[o] = 255, r[o + 1] = 255, r[o + 2] = 255, r[o + 3] = Math.min(255, r[o + 3] + n[o + 3]);
|
|
1609
1609
|
return e;
|
|
1610
1610
|
}
|
|
1611
|
-
const
|
|
1611
|
+
const Rn = [
|
|
1612
1612
|
{
|
|
1613
1613
|
id: "grunge-heavy",
|
|
1614
1614
|
name: "Heavy Grunge",
|
|
1615
1615
|
textureUrl: "builtin:grunge-heavy",
|
|
1616
1616
|
thumbnailUrl: "",
|
|
1617
1617
|
description: "Dense random splatters",
|
|
1618
|
-
generate: (e, t) =>
|
|
1618
|
+
generate: (e, t) => ut(e, t, 80, H)
|
|
1619
1619
|
},
|
|
1620
1620
|
{
|
|
1621
1621
|
id: "grunge-fine",
|
|
@@ -1623,7 +1623,7 @@ const In = [
|
|
|
1623
1623
|
textureUrl: "builtin:grunge-fine",
|
|
1624
1624
|
thumbnailUrl: "",
|
|
1625
1625
|
description: "Sparse fine grain",
|
|
1626
|
-
generate: (e, t) =>
|
|
1626
|
+
generate: (e, t) => ut(e, t, 25, H + 1)
|
|
1627
1627
|
},
|
|
1628
1628
|
{
|
|
1629
1629
|
id: "concrete",
|
|
@@ -1631,7 +1631,7 @@ const In = [
|
|
|
1631
1631
|
textureUrl: "builtin:concrete",
|
|
1632
1632
|
thumbnailUrl: "",
|
|
1633
1633
|
description: "Rough surface via Perlin noise",
|
|
1634
|
-
generate: (e, t) =>
|
|
1634
|
+
generate: (e, t) => It(e, t, 55, H + 2)
|
|
1635
1635
|
},
|
|
1636
1636
|
{
|
|
1637
1637
|
id: "paper",
|
|
@@ -1639,7 +1639,7 @@ const In = [
|
|
|
1639
1639
|
textureUrl: "builtin:paper",
|
|
1640
1640
|
thumbnailUrl: "",
|
|
1641
1641
|
description: "Subtle aging",
|
|
1642
|
-
generate: (e, t) =>
|
|
1642
|
+
generate: (e, t) => It(e, t, 20, H + 3)
|
|
1643
1643
|
},
|
|
1644
1644
|
{
|
|
1645
1645
|
id: "rust",
|
|
@@ -1648,8 +1648,8 @@ const In = [
|
|
|
1648
1648
|
thumbnailUrl: "",
|
|
1649
1649
|
description: "Noise + splatter combined",
|
|
1650
1650
|
generate: (e, t) => {
|
|
1651
|
-
const r =
|
|
1652
|
-
return
|
|
1651
|
+
const r = It(e, t, 45, H + 4), n = ut(e, t, 35, H + 5);
|
|
1652
|
+
return An(Ht(r), Ht(n));
|
|
1653
1653
|
}
|
|
1654
1654
|
},
|
|
1655
1655
|
{
|
|
@@ -1658,7 +1658,7 @@ const In = [
|
|
|
1658
1658
|
textureUrl: "builtin:scratches",
|
|
1659
1659
|
thumbnailUrl: "",
|
|
1660
1660
|
description: "Branching crack lines",
|
|
1661
|
-
generate: (e, t) =>
|
|
1661
|
+
generate: (e, t) => Pn(e, t, 55, H + 6)
|
|
1662
1662
|
},
|
|
1663
1663
|
{
|
|
1664
1664
|
id: "halftone",
|
|
@@ -1666,7 +1666,7 @@ const In = [
|
|
|
1666
1666
|
textureUrl: "builtin:halftone",
|
|
1667
1667
|
thumbnailUrl: "",
|
|
1668
1668
|
description: "Dot grid pattern",
|
|
1669
|
-
generate: (e, t) =>
|
|
1669
|
+
generate: (e, t) => In(e, t, 55, H + 7)
|
|
1670
1670
|
},
|
|
1671
1671
|
{
|
|
1672
1672
|
id: "spray",
|
|
@@ -1674,11 +1674,11 @@ const In = [
|
|
|
1674
1674
|
textureUrl: "builtin:spray",
|
|
1675
1675
|
thumbnailUrl: "",
|
|
1676
1676
|
description: "Medium random splatter",
|
|
1677
|
-
generate: (e, t) =>
|
|
1677
|
+
generate: (e, t) => ut(e, t, 55, H + 8)
|
|
1678
1678
|
}
|
|
1679
1679
|
];
|
|
1680
1680
|
let de = !1;
|
|
1681
|
-
function
|
|
1681
|
+
function Wn(e, t) {
|
|
1682
1682
|
if (typeof OffscreenCanvas < "u")
|
|
1683
1683
|
return new OffscreenCanvas(e, t);
|
|
1684
1684
|
const r = document.createElement("canvas");
|
|
@@ -1689,7 +1689,7 @@ function ue(e, t) {
|
|
|
1689
1689
|
const r = document.createElement("canvas");
|
|
1690
1690
|
return r.width = e, r.height = t, r;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function Fn(e) {
|
|
1693
1693
|
const t = ue(e.width, e.height);
|
|
1694
1694
|
if (!t) return "";
|
|
1695
1695
|
const r = t.getContext("2d");
|
|
@@ -1700,25 +1700,25 @@ function Rn(e) {
|
|
|
1700
1700
|
const o = n.getContext("2d");
|
|
1701
1701
|
if (!o) return "";
|
|
1702
1702
|
o.drawImage(t, 0, 0, e.width, e.height, 0, 0, Z, Z);
|
|
1703
|
-
const i = o.getImageData(0, 0, Z, Z),
|
|
1704
|
-
for (let l = 0; l <
|
|
1705
|
-
const
|
|
1706
|
-
|
|
1703
|
+
const i = o.getImageData(0, 0, Z, Z), a = i.data;
|
|
1704
|
+
for (let l = 0; l < a.length; l += 4) {
|
|
1705
|
+
const s = a[l + 3], c = 255 - Math.round(s / 255 * 195);
|
|
1706
|
+
a[l] = c, a[l + 1] = c, a[l + 2] = c, a[l + 3] = 255;
|
|
1707
1707
|
}
|
|
1708
1708
|
return o.putImageData(i, 0, 0), n.toDataURL("image/png");
|
|
1709
1709
|
}
|
|
1710
|
-
function
|
|
1710
|
+
function Un() {
|
|
1711
1711
|
if (!de) {
|
|
1712
1712
|
de = !0;
|
|
1713
|
-
for (const e of
|
|
1713
|
+
for (const e of Rn) {
|
|
1714
1714
|
const t = e.generate(z, z);
|
|
1715
|
-
|
|
1716
|
-
const r =
|
|
1717
|
-
n && (n.putImageData(t, 0, 0),
|
|
1715
|
+
Ht(t);
|
|
1716
|
+
const r = Wn(z, z), n = r.getContext("2d");
|
|
1717
|
+
n && (n.putImageData(t, 0, 0), Bn(e.textureUrl, r, z, z)), typeof document < "u" && (e.thumbnailUrl = Fn(t));
|
|
1718
1718
|
}
|
|
1719
1719
|
}
|
|
1720
1720
|
}
|
|
1721
|
-
const N = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new Map(),
|
|
1721
|
+
const N = /* @__PURE__ */ new Set(), X = /* @__PURE__ */ new Map(), yt = /* @__PURE__ */ new Map();
|
|
1722
1722
|
function ge(e, t) {
|
|
1723
1723
|
if (typeof OffscreenCanvas < "u")
|
|
1724
1724
|
return new OffscreenCanvas(e, t);
|
|
@@ -1732,74 +1732,74 @@ function me(e) {
|
|
|
1732
1732
|
const { width: t, height: r } = e, n = ge(t, r), o = pe(n);
|
|
1733
1733
|
if (!o) throw new Error("Failed to get 2d context for temp canvas");
|
|
1734
1734
|
o.drawImage(e, 0, 0);
|
|
1735
|
-
const i = o.getImageData(0, 0, t, r),
|
|
1736
|
-
for (let c = 0; c <
|
|
1737
|
-
const h =
|
|
1738
|
-
|
|
1735
|
+
const i = o.getImageData(0, 0, t, r), a = i.data;
|
|
1736
|
+
for (let c = 0; c < a.length; c += 4) {
|
|
1737
|
+
const h = a[c], f = a[c + 1], u = a[c + 2], p = 255 - (0.299 * h + 0.587 * f + 0.114 * u);
|
|
1738
|
+
a[c] = 255, a[c + 1] = 255, a[c + 2] = 255, a[c + 3] = p;
|
|
1739
1739
|
}
|
|
1740
|
-
const l = ge(t, r),
|
|
1741
|
-
if (!
|
|
1742
|
-
return
|
|
1740
|
+
const l = ge(t, r), s = pe(l);
|
|
1741
|
+
if (!s) throw new Error("Failed to get 2d context for mask canvas");
|
|
1742
|
+
return s.putImageData(i, 0, 0), { alphaMask: l, width: t, height: r };
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1744
|
+
function _e(e) {
|
|
1745
1745
|
const t = X.get(e);
|
|
1746
1746
|
if (t) return t;
|
|
1747
1747
|
if (e.startsWith("builtin:")) {
|
|
1748
|
-
|
|
1748
|
+
Un();
|
|
1749
1749
|
const r = X.get(e);
|
|
1750
1750
|
return r || null;
|
|
1751
1751
|
}
|
|
1752
|
-
return N.has(e) || (N.add(e),
|
|
1752
|
+
return N.has(e) || (N.add(e), Ne(e)), null;
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1754
|
+
function io(e) {
|
|
1755
1755
|
return X.has(e) ? Promise.resolve() : new Promise((t) => {
|
|
1756
1756
|
if (X.has(e)) {
|
|
1757
1757
|
t();
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
|
-
const r =
|
|
1761
|
-
r.push(t),
|
|
1760
|
+
const r = yt.get(e) || [];
|
|
1761
|
+
r.push(t), yt.set(e, r), N.has(e) || (N.add(e), Ne(e));
|
|
1762
1762
|
});
|
|
1763
1763
|
}
|
|
1764
|
-
function
|
|
1765
|
-
X.has(e) || (X.set(e, { alphaMask: t, width: r, height: n }),
|
|
1764
|
+
function Bn(e, t, r, n) {
|
|
1765
|
+
X.has(e) || (X.set(e, { alphaMask: t, width: r, height: n }), ot(e));
|
|
1766
1766
|
}
|
|
1767
|
-
function
|
|
1768
|
-
const t =
|
|
1769
|
-
t && (t.forEach((r) => r()),
|
|
1767
|
+
function ot(e) {
|
|
1768
|
+
const t = yt.get(e);
|
|
1769
|
+
t && (t.forEach((r) => r()), yt.delete(e));
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function Ne(e) {
|
|
1772
1772
|
if (typeof document < "u") {
|
|
1773
1773
|
const t = new Image();
|
|
1774
1774
|
t.crossOrigin = "anonymous", t.onload = () => {
|
|
1775
1775
|
const r = me(t);
|
|
1776
|
-
X.set(e, r), N.delete(e),
|
|
1776
|
+
X.set(e, r), N.delete(e), ot(e);
|
|
1777
1777
|
}, t.onerror = () => {
|
|
1778
|
-
N.delete(e),
|
|
1778
|
+
N.delete(e), ot(e);
|
|
1779
1779
|
}, t.src = e;
|
|
1780
1780
|
} else
|
|
1781
1781
|
fetch(e).then((t) => t.blob()).then((t) => createImageBitmap(t)).then((t) => {
|
|
1782
1782
|
const r = me(t);
|
|
1783
|
-
X.set(e, r), N.delete(e),
|
|
1783
|
+
X.set(e, r), N.delete(e), ot(e);
|
|
1784
1784
|
}).catch(() => {
|
|
1785
|
-
N.delete(e),
|
|
1785
|
+
N.delete(e), ot(e);
|
|
1786
1786
|
});
|
|
1787
1787
|
}
|
|
1788
|
-
function
|
|
1788
|
+
function Xe(e, t) {
|
|
1789
1789
|
if (typeof OffscreenCanvas < "u")
|
|
1790
1790
|
return new OffscreenCanvas(e, t);
|
|
1791
1791
|
const r = document.createElement("canvas");
|
|
1792
1792
|
return r.width = e, r.height = t, r;
|
|
1793
1793
|
}
|
|
1794
|
-
function
|
|
1794
|
+
function On(e, t, r, n) {
|
|
1795
1795
|
if (!t.enabled || !t.textureUrl || t.intensity <= 0) return;
|
|
1796
|
-
const o =
|
|
1796
|
+
const o = _e(t.textureUrl);
|
|
1797
1797
|
if (!o) return;
|
|
1798
|
-
const { x: i, y:
|
|
1799
|
-
if (
|
|
1800
|
-
const
|
|
1801
|
-
if (!
|
|
1802
|
-
|
|
1798
|
+
const { x: i, y: a, width: l, height: s } = r, c = e.getTransform(), h = c.a * i + c.e, f = c.d * a + c.f, u = c.a * l, d = c.d * s, p = Math.ceil(u), m = Math.ceil(d);
|
|
1799
|
+
if (p <= 0 || m <= 0) return;
|
|
1800
|
+
const w = Xe(p, m), k = w.getContext("2d");
|
|
1801
|
+
if (!k) return;
|
|
1802
|
+
k.drawImage(
|
|
1803
1803
|
e.canvas,
|
|
1804
1804
|
h,
|
|
1805
1805
|
f,
|
|
@@ -1807,70 +1807,70 @@ function Un(e, t, r, n) {
|
|
|
1807
1807
|
d,
|
|
1808
1808
|
0,
|
|
1809
1809
|
0,
|
|
1810
|
-
|
|
1811
|
-
|
|
1810
|
+
p,
|
|
1811
|
+
m
|
|
1812
1812
|
);
|
|
1813
|
-
const
|
|
1814
|
-
if (
|
|
1815
|
-
const
|
|
1816
|
-
for (let
|
|
1817
|
-
const
|
|
1818
|
-
for (let A = 0; A <
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1813
|
+
const b = o.alphaMask.getContext("2d");
|
|
1814
|
+
if (b) {
|
|
1815
|
+
const T = t.intensity / 100, g = b.getImageData(0, 0, o.width, o.height).data, y = o.width, S = o.height, C = k.getImageData(0, 0, p, m), P = C.data;
|
|
1816
|
+
for (let I = 0; I < m; I++) {
|
|
1817
|
+
const M = Math.floor(I / m * S);
|
|
1818
|
+
for (let A = 0; A < p; A++) {
|
|
1819
|
+
const E = Math.floor(A / p * y), v = g[(M * y + E) * 4 + 3] / 255, R = (I * p + A) * 4;
|
|
1820
|
+
P[R + 3] = Math.round(P[R + 3] * (1 - v * T));
|
|
1821
1821
|
}
|
|
1822
1822
|
}
|
|
1823
|
-
|
|
1823
|
+
k.putImageData(C, 0, 0);
|
|
1824
1824
|
} else
|
|
1825
|
-
|
|
1826
|
-
|
|
1825
|
+
k.globalCompositeOperation = "destination-out", k.globalAlpha = t.intensity / 100, k.drawImage(o.alphaMask, 0, 0, p, m), k.globalCompositeOperation = "source-over";
|
|
1826
|
+
k.globalAlpha = 1, e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(h, f, u, d), n && (e.fillStyle = n, e.fillRect(h, f, u, d)), e.drawImage(w, h, f), e.restore();
|
|
1827
1827
|
}
|
|
1828
1828
|
function ye(e, t, r, n) {
|
|
1829
1829
|
if (!t.enabled || t.style !== "custom" || !t.textureUrl) return;
|
|
1830
|
-
const o =
|
|
1830
|
+
const o = _e(t.textureUrl);
|
|
1831
1831
|
if (!o) {
|
|
1832
1832
|
n(e);
|
|
1833
1833
|
return;
|
|
1834
1834
|
}
|
|
1835
|
-
const i = t.textureOpacity ?? t.intensity / 100,
|
|
1835
|
+
const i = t.textureOpacity ?? t.intensity / 100, a = e.getTransform(), l = Math.sqrt(r.width ** 2 + r.height ** 2), s = (l - r.width) / 2, c = (l - r.height) / 2, h = 20, f = s + h, u = c + h, d = {
|
|
1836
1836
|
x: r.x - f,
|
|
1837
1837
|
y: r.y - u,
|
|
1838
1838
|
width: r.width + f * 2,
|
|
1839
1839
|
height: r.height + u * 2
|
|
1840
|
-
},
|
|
1841
|
-
if (
|
|
1840
|
+
}, p = a.a * d.x + a.e, m = a.d * d.y + a.f, w = a.a * d.width, k = a.d * d.height, b = Math.ceil(w), T = Math.ceil(k);
|
|
1841
|
+
if (b <= 0 || T <= 0) {
|
|
1842
1842
|
n(e);
|
|
1843
1843
|
return;
|
|
1844
1844
|
}
|
|
1845
|
-
const
|
|
1845
|
+
const g = Xe(b, T), y = g.getContext("2d");
|
|
1846
1846
|
if (!y) {
|
|
1847
1847
|
n(e);
|
|
1848
1848
|
return;
|
|
1849
1849
|
}
|
|
1850
1850
|
y.setTransform(
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1851
|
+
a.a,
|
|
1852
|
+
a.b,
|
|
1853
|
+
a.c,
|
|
1854
|
+
a.d,
|
|
1855
|
+
a.e - p,
|
|
1856
|
+
a.f - m
|
|
1857
1857
|
), n(y), y.setTransform(1, 0, 0, 1, 0, 0);
|
|
1858
|
-
const
|
|
1859
|
-
if (
|
|
1860
|
-
const
|
|
1861
|
-
for (let
|
|
1862
|
-
const
|
|
1863
|
-
for (let R = 0; R <
|
|
1864
|
-
const
|
|
1865
|
-
A[
|
|
1858
|
+
const S = o.alphaMask.getContext("2d");
|
|
1859
|
+
if (S) {
|
|
1860
|
+
const C = S.getImageData(0, 0, o.width, o.height).data, P = o.width, I = o.height, M = y.getImageData(0, 0, b, T), A = M.data;
|
|
1861
|
+
for (let E = 0; E < T; E++) {
|
|
1862
|
+
const v = Math.floor(E / T * I);
|
|
1863
|
+
for (let R = 0; R < b; R++) {
|
|
1864
|
+
const U = Math.floor(R / b * P), W = C[(v * P + U) * 4 + 3] / 255, F = (E * b + R) * 4;
|
|
1865
|
+
A[F + 3] = Math.round(A[F + 3] * (1 - W * i));
|
|
1866
1866
|
}
|
|
1867
1867
|
}
|
|
1868
|
-
y.putImageData(
|
|
1868
|
+
y.putImageData(M, 0, 0);
|
|
1869
1869
|
} else
|
|
1870
|
-
y.globalCompositeOperation = "destination-out", y.globalAlpha = i, y.drawImage(o.alphaMask, 0, 0,
|
|
1871
|
-
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(p, m
|
|
1870
|
+
y.globalCompositeOperation = "destination-out", y.globalAlpha = i, y.drawImage(o.alphaMask, 0, 0, b, T), y.globalCompositeOperation = "source-over", y.globalAlpha = 1;
|
|
1871
|
+
e.save(), e.setTransform(1, 0, 0, 1, 0, 0), e.drawImage(g, p, m), e.restore();
|
|
1872
1872
|
}
|
|
1873
|
-
class
|
|
1873
|
+
class wt {
|
|
1874
1874
|
/**
|
|
1875
1875
|
* Create an element instance from a JSON configuration
|
|
1876
1876
|
* TypeScript ensures all transform types are handled
|
|
@@ -1883,33 +1883,33 @@ class yt {
|
|
|
1883
1883
|
const { transformType: r } = t;
|
|
1884
1884
|
switch (r) {
|
|
1885
1885
|
case "custom":
|
|
1886
|
-
return new
|
|
1886
|
+
return new dr(t);
|
|
1887
1887
|
case "distort":
|
|
1888
1888
|
throw new Error("DistortTransform is not yet implemented");
|
|
1889
1889
|
case "circle":
|
|
1890
|
-
return new
|
|
1890
|
+
return new fr(t);
|
|
1891
1891
|
case "lean":
|
|
1892
|
-
return new
|
|
1892
|
+
return new hr(t);
|
|
1893
1893
|
case "arch":
|
|
1894
|
-
return new
|
|
1894
|
+
return new cr(t);
|
|
1895
1895
|
case "ascend":
|
|
1896
|
-
return new
|
|
1896
|
+
return new lr(t);
|
|
1897
1897
|
case "wave":
|
|
1898
|
-
return new
|
|
1898
|
+
return new ir(t);
|
|
1899
1899
|
case "flag":
|
|
1900
1900
|
return new sr(t);
|
|
1901
1901
|
case "image":
|
|
1902
|
-
return new
|
|
1902
|
+
return new Wt(t);
|
|
1903
1903
|
case "group": {
|
|
1904
1904
|
const o = (t.children || []).map(
|
|
1905
|
-
(
|
|
1906
|
-
), { children: i, ...
|
|
1907
|
-
return o.forEach((
|
|
1905
|
+
(s) => wt.createFromJSON(s)
|
|
1906
|
+
), { children: i, ...a } = t, l = new Vt(a);
|
|
1907
|
+
return o.forEach((s) => l.addChild(s)), l;
|
|
1908
1908
|
}
|
|
1909
1909
|
case "shape":
|
|
1910
|
-
return new
|
|
1910
|
+
return new ar(t);
|
|
1911
1911
|
case "path":
|
|
1912
|
-
return new
|
|
1912
|
+
return new or(t);
|
|
1913
1913
|
default:
|
|
1914
1914
|
const n = r;
|
|
1915
1915
|
throw new Error(`Unknown transform type: ${n}`);
|
|
@@ -2123,7 +2123,7 @@ class yt {
|
|
|
2123
2123
|
return this.createFromJSON(r);
|
|
2124
2124
|
}
|
|
2125
2125
|
}
|
|
2126
|
-
const we = j("ImportManager"),
|
|
2126
|
+
const we = j("ImportManager"), te = class te {
|
|
2127
2127
|
/**
|
|
2128
2128
|
* Import workspace from JSON file
|
|
2129
2129
|
*/
|
|
@@ -2137,24 +2137,24 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2137
2137
|
if (n.metadata.version === "1.0.0")
|
|
2138
2138
|
return this.migrateV1Document(n);
|
|
2139
2139
|
const o = [], i = [];
|
|
2140
|
-
return n.artboards.forEach((
|
|
2141
|
-
const l =
|
|
2142
|
-
id:
|
|
2143
|
-
name:
|
|
2144
|
-
x:
|
|
2145
|
-
y:
|
|
2146
|
-
width:
|
|
2147
|
-
height:
|
|
2148
|
-
backgroundColor:
|
|
2149
|
-
elementIds:
|
|
2150
|
-
}),
|
|
2140
|
+
return n.artboards.forEach((a) => {
|
|
2141
|
+
const l = re.fromJSON({
|
|
2142
|
+
id: a.id,
|
|
2143
|
+
name: a.name,
|
|
2144
|
+
x: a.x,
|
|
2145
|
+
y: a.y,
|
|
2146
|
+
width: a.width,
|
|
2147
|
+
height: a.height,
|
|
2148
|
+
backgroundColor: a.backgroundColor,
|
|
2149
|
+
elementIds: a.elements.map((c) => c.id || "")
|
|
2150
|
+
}), s = a.elements.map((c) => {
|
|
2151
2151
|
try {
|
|
2152
|
-
return
|
|
2152
|
+
return wt.createFromJSON(c);
|
|
2153
2153
|
} catch (h) {
|
|
2154
2154
|
return we.error("Failed to create element:", c, h), null;
|
|
2155
2155
|
}
|
|
2156
2156
|
}).filter((c) => c !== null);
|
|
2157
|
-
o.push(l), i.push(...
|
|
2157
|
+
o.push(l), i.push(...s);
|
|
2158
2158
|
}), await this.preloadAllImages(i), {
|
|
2159
2159
|
success: !0,
|
|
2160
2160
|
artboards: o,
|
|
@@ -2174,7 +2174,7 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2174
2174
|
static async migrateV1Document(t) {
|
|
2175
2175
|
var r, n, o;
|
|
2176
2176
|
try {
|
|
2177
|
-
const i = t.elements || [],
|
|
2177
|
+
const i = t.elements || [], a = new re({
|
|
2178
2178
|
id: "artboard-migrated",
|
|
2179
2179
|
name: "Artboard 1",
|
|
2180
2180
|
x: 0,
|
|
@@ -2182,20 +2182,20 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2182
2182
|
width: ((r = t.canvas) == null ? void 0 : r.width) || 1920,
|
|
2183
2183
|
height: ((n = t.canvas) == null ? void 0 : n.height) || 1080,
|
|
2184
2184
|
backgroundColor: ((o = t.canvas) == null ? void 0 : o.backgroundColor) || "#ffffff"
|
|
2185
|
-
}), l = i.map((
|
|
2185
|
+
}), l = i.map((s) => {
|
|
2186
2186
|
try {
|
|
2187
|
-
return
|
|
2187
|
+
return wt.createFromJSON(s);
|
|
2188
2188
|
} catch (c) {
|
|
2189
|
-
return we.error("Failed to create element:",
|
|
2189
|
+
return we.error("Failed to create element:", s, c), null;
|
|
2190
2190
|
}
|
|
2191
|
-
}).filter((
|
|
2192
|
-
return l.forEach((
|
|
2193
|
-
|
|
2191
|
+
}).filter((s) => s !== null);
|
|
2192
|
+
return l.forEach((s) => {
|
|
2193
|
+
a.addElementId(s.id);
|
|
2194
2194
|
}), await this.preloadAllImages(l), {
|
|
2195
2195
|
success: !0,
|
|
2196
|
-
artboards: [
|
|
2196
|
+
artboards: [a],
|
|
2197
2197
|
elements: l,
|
|
2198
|
-
activeArtboardId:
|
|
2198
|
+
activeArtboardId: a.id
|
|
2199
2199
|
};
|
|
2200
2200
|
} catch (i) {
|
|
2201
2201
|
return {
|
|
@@ -2252,8 +2252,8 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2252
2252
|
return new Promise((r, n) => {
|
|
2253
2253
|
const o = new FileReader();
|
|
2254
2254
|
o.onload = (i) => {
|
|
2255
|
-
var
|
|
2256
|
-
return r((
|
|
2255
|
+
var a;
|
|
2256
|
+
return r((a = i.target) == null ? void 0 : a.result);
|
|
2257
2257
|
}, o.onerror = () => n(new Error("Failed to read file")), o.readAsText(t);
|
|
2258
2258
|
});
|
|
2259
2259
|
}
|
|
@@ -2264,8 +2264,8 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2264
2264
|
return new Promise((r, n) => {
|
|
2265
2265
|
const o = new FileReader();
|
|
2266
2266
|
o.onload = (i) => {
|
|
2267
|
-
var
|
|
2268
|
-
return r((
|
|
2267
|
+
var a;
|
|
2268
|
+
return r((a = i.target) == null ? void 0 : a.result);
|
|
2269
2269
|
}, o.onerror = () => n(new Error("Failed to read file")), o.readAsDataURL(t);
|
|
2270
2270
|
});
|
|
2271
2271
|
}
|
|
@@ -2285,15 +2285,15 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2285
2285
|
*/
|
|
2286
2286
|
static validateImportedData(t, r) {
|
|
2287
2287
|
const n = [], o = /* @__PURE__ */ new Set();
|
|
2288
|
-
t.forEach((
|
|
2289
|
-
o.has(
|
|
2288
|
+
t.forEach((a) => {
|
|
2289
|
+
o.has(a.id) && n.push(`Duplicate artboard ID: ${a.id}`), o.add(a.id);
|
|
2290
2290
|
});
|
|
2291
2291
|
const i = /* @__PURE__ */ new Set();
|
|
2292
|
-
return r.forEach((
|
|
2293
|
-
i.has(
|
|
2294
|
-
}), t.forEach((
|
|
2295
|
-
|
|
2296
|
-
i.has(l) || n.push(`Artboard "${
|
|
2292
|
+
return r.forEach((a) => {
|
|
2293
|
+
i.has(a.id) && n.push(`Duplicate element ID: ${a.id}`), i.add(a.id);
|
|
2294
|
+
}), t.forEach((a) => {
|
|
2295
|
+
a.getElementIds().forEach((l) => {
|
|
2296
|
+
i.has(l) || n.push(`Artboard "${a.name}" references missing element: ${l}`);
|
|
2297
2297
|
});
|
|
2298
2298
|
}), {
|
|
2299
2299
|
valid: n.length === 0,
|
|
@@ -2318,33 +2318,33 @@ const we = j("ImportManager"), xt = class xt {
|
|
|
2318
2318
|
*/
|
|
2319
2319
|
static async preloadAllImages(t) {
|
|
2320
2320
|
const r = [], n = (i) => {
|
|
2321
|
-
i.transformType === "image" ? r.push(i) : i.transformType === "group" && "children" in i && i.children.forEach((
|
|
2321
|
+
i.transformType === "image" ? r.push(i) : i.transformType === "group" && "children" in i && i.children.forEach((a) => n(a));
|
|
2322
2322
|
};
|
|
2323
2323
|
t.forEach(n);
|
|
2324
|
-
const o = r.map((i) => new Promise((
|
|
2324
|
+
const o = r.map((i) => new Promise((a) => {
|
|
2325
2325
|
if (i.imageLoaded)
|
|
2326
|
-
|
|
2326
|
+
a();
|
|
2327
2327
|
else if (i.imageElement) {
|
|
2328
|
-
const l = i.imageElement,
|
|
2329
|
-
l.removeEventListener("load",
|
|
2328
|
+
const l = i.imageElement, s = () => {
|
|
2329
|
+
l.removeEventListener("load", s), l.removeEventListener("error", c), a();
|
|
2330
2330
|
}, c = () => {
|
|
2331
|
-
l.removeEventListener("load",
|
|
2331
|
+
l.removeEventListener("load", s), l.removeEventListener("error", c), a();
|
|
2332
2332
|
};
|
|
2333
|
-
l.addEventListener("load",
|
|
2333
|
+
l.addEventListener("load", s), l.addEventListener("error", c);
|
|
2334
2334
|
} else
|
|
2335
|
-
|
|
2335
|
+
a();
|
|
2336
2336
|
}));
|
|
2337
2337
|
await Promise.all(o);
|
|
2338
2338
|
}
|
|
2339
2339
|
};
|
|
2340
|
-
|
|
2341
|
-
let
|
|
2342
|
-
const
|
|
2343
|
-
function
|
|
2344
|
-
const r = t ?
|
|
2340
|
+
te.SUPPORTED_VERSIONS = ["1.0.0", "2.0.0"];
|
|
2341
|
+
let be = te;
|
|
2342
|
+
const ke = j("element-serializer"), Ge = 4e3, ht = /* @__PURE__ */ new Set();
|
|
2343
|
+
function Ln(e, t) {
|
|
2344
|
+
const r = t ? qn(t) : "no-src";
|
|
2345
2345
|
return `${e}:${r}`;
|
|
2346
2346
|
}
|
|
2347
|
-
function
|
|
2347
|
+
function qn(e) {
|
|
2348
2348
|
let t = 0;
|
|
2349
2349
|
for (let r = 0; r < e.length; r++) {
|
|
2350
2350
|
const n = e.charCodeAt(r);
|
|
@@ -2352,44 +2352,44 @@ function On(e) {
|
|
|
2352
2352
|
}
|
|
2353
2353
|
return t.toString(36);
|
|
2354
2354
|
}
|
|
2355
|
-
function
|
|
2356
|
-
|
|
2355
|
+
function jt() {
|
|
2356
|
+
ht.clear();
|
|
2357
2357
|
}
|
|
2358
|
-
function
|
|
2359
|
-
for (const t of
|
|
2360
|
-
t.startsWith(`${e}:`) &&
|
|
2358
|
+
function Ye(e) {
|
|
2359
|
+
for (const t of ht)
|
|
2360
|
+
t.startsWith(`${e}:`) && ht.delete(t);
|
|
2361
2361
|
}
|
|
2362
|
-
function
|
|
2363
|
-
|
|
2362
|
+
function $n(e) {
|
|
2363
|
+
ht.add(e);
|
|
2364
2364
|
}
|
|
2365
|
-
function
|
|
2366
|
-
return
|
|
2365
|
+
function Hn(e) {
|
|
2366
|
+
return ht.has(e);
|
|
2367
2367
|
}
|
|
2368
|
-
async function
|
|
2368
|
+
async function jn(e, t = Ge) {
|
|
2369
2369
|
const { naturalWidth: r, naturalHeight: n } = e;
|
|
2370
2370
|
if (r <= t && n <= t)
|
|
2371
2371
|
return createImageBitmap(e);
|
|
2372
|
-
const o = t / Math.max(r, n), i = Math.round(r * o),
|
|
2372
|
+
const o = t / Math.max(r, n), i = Math.round(r * o), a = Math.round(n * o);
|
|
2373
2373
|
return createImageBitmap(e, {
|
|
2374
2374
|
resizeWidth: i,
|
|
2375
|
-
resizeHeight:
|
|
2375
|
+
resizeHeight: a,
|
|
2376
2376
|
resizeQuality: "high"
|
|
2377
2377
|
});
|
|
2378
2378
|
}
|
|
2379
|
-
let
|
|
2380
|
-
function
|
|
2381
|
-
|
|
2379
|
+
let bt = null, kt = null;
|
|
2380
|
+
function _n(e, t) {
|
|
2381
|
+
bt = e, kt = t;
|
|
2382
2382
|
}
|
|
2383
|
-
function
|
|
2384
|
-
|
|
2383
|
+
function Nn() {
|
|
2384
|
+
bt = null, kt = null;
|
|
2385
2385
|
}
|
|
2386
|
-
function
|
|
2387
|
-
|
|
2386
|
+
function lo() {
|
|
2387
|
+
jt(), bt && bt();
|
|
2388
2388
|
}
|
|
2389
|
-
function
|
|
2390
|
-
|
|
2389
|
+
function co(e) {
|
|
2390
|
+
Ye(e), kt && kt(e);
|
|
2391
2391
|
}
|
|
2392
|
-
function
|
|
2392
|
+
function _t(e, t) {
|
|
2393
2393
|
const r = e;
|
|
2394
2394
|
if (typeof r.fontFamily == "string" && t.add(r.fontFamily), r.richText && typeof r.richText == "object") {
|
|
2395
2395
|
const n = r.richText;
|
|
@@ -2397,21 +2397,21 @@ function jt(e, t) {
|
|
|
2397
2397
|
for (const o of n.spans) {
|
|
2398
2398
|
const i = o;
|
|
2399
2399
|
if (i.style && typeof i.style == "object") {
|
|
2400
|
-
const
|
|
2401
|
-
typeof
|
|
2400
|
+
const a = i.style;
|
|
2401
|
+
typeof a.fontFamily == "string" && t.add(a.fontFamily);
|
|
2402
2402
|
}
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
2405
|
if (r.children && Array.isArray(r.children))
|
|
2406
2406
|
for (const n of r.children)
|
|
2407
|
-
|
|
2407
|
+
_t(n, t);
|
|
2408
2408
|
if (e.masks && Array.isArray(e.masks))
|
|
2409
2409
|
for (const n of e.masks)
|
|
2410
|
-
n.maskElement &&
|
|
2410
|
+
n.maskElement && _t(n.maskElement, t);
|
|
2411
2411
|
}
|
|
2412
2412
|
function Te(e) {
|
|
2413
2413
|
if (typeof document > "u") return e;
|
|
2414
|
-
const t =
|
|
2414
|
+
const t = vt.getInstance();
|
|
2415
2415
|
return e.map((r) => {
|
|
2416
2416
|
if (!(r != null && r.maskElement) || r.maskElement.transformType !== "image") return r;
|
|
2417
2417
|
const n = r.maskElement.imageUrl;
|
|
@@ -2427,42 +2427,42 @@ function Te(e) {
|
|
|
2427
2427
|
} : r;
|
|
2428
2428
|
});
|
|
2429
2429
|
}
|
|
2430
|
-
async function
|
|
2431
|
-
const n = t.filter((
|
|
2432
|
-
for (const
|
|
2433
|
-
if (
|
|
2434
|
-
const c =
|
|
2435
|
-
if (
|
|
2436
|
-
|
|
2430
|
+
async function Nt(e, t, r = Ge) {
|
|
2431
|
+
const n = t.filter((s) => e.hasElementId(s.id)), o = [], i = [], a = /* @__PURE__ */ new Set();
|
|
2432
|
+
for (const s of n) {
|
|
2433
|
+
if (s.visible === !1) continue;
|
|
2434
|
+
const c = s.toJSON();
|
|
2435
|
+
if (_t(c, a), s instanceof Wt && !s.imageElement) {
|
|
2436
|
+
ke.warn(`[element-serializer] Skipping image ${s.id}: image not loaded (state: ${s.imageLoadState})`);
|
|
2437
2437
|
continue;
|
|
2438
2438
|
}
|
|
2439
|
-
if (
|
|
2439
|
+
if (s instanceof Wt && s.imageElement)
|
|
2440
2440
|
try {
|
|
2441
|
-
const h =
|
|
2442
|
-
if (!
|
|
2443
|
-
const
|
|
2444
|
-
i.push({ cacheKey: h, bitmap:
|
|
2441
|
+
const h = Ln(s.id, s.imageUrl);
|
|
2442
|
+
if (!Hn(h)) {
|
|
2443
|
+
const g = await jn(s.imageElement, r);
|
|
2444
|
+
i.push({ cacheKey: h, bitmap: g }), $n(h);
|
|
2445
2445
|
}
|
|
2446
|
-
const u =
|
|
2447
|
-
id:
|
|
2446
|
+
const u = s.transformData || {}, d = Se(c), p = ur(u, d), m = u.width * p.cropWidth, w = u.height * p.cropHeight, k = {
|
|
2447
|
+
id: s.id,
|
|
2448
2448
|
type: "image",
|
|
2449
|
-
x:
|
|
2450
|
-
y:
|
|
2451
|
-
width:
|
|
2452
|
-
height:
|
|
2453
|
-
rotation:
|
|
2449
|
+
x: s.x,
|
|
2450
|
+
y: s.y,
|
|
2451
|
+
width: m,
|
|
2452
|
+
height: w,
|
|
2453
|
+
rotation: s.rotation || 0,
|
|
2454
2454
|
bitmapCacheKey: h
|
|
2455
2455
|
};
|
|
2456
|
-
if (!
|
|
2457
|
-
const
|
|
2458
|
-
let
|
|
2459
|
-
(
|
|
2456
|
+
if (!gr(p)) {
|
|
2457
|
+
const g = s.imageElement.naturalWidth, y = s.imageElement.naturalHeight;
|
|
2458
|
+
let S = 1;
|
|
2459
|
+
(g > r || y > r) && (S = r / Math.max(g, y)), k.cropX = p.cropX * g * S, k.cropY = p.cropY * y * S, k.cropWidth = p.cropWidth * g * S, k.cropHeight = p.cropHeight * y * S;
|
|
2460
2460
|
}
|
|
2461
|
-
u.flipHorizontal && (
|
|
2462
|
-
const
|
|
2463
|
-
|
|
2461
|
+
u.flipHorizontal && (k.flipHorizontal = u.flipHorizontal), u.flipVertical && (k.flipVertical = u.flipVertical), u.borderRadius && (k.borderRadius = u.borderRadius), pr(u.adjustments) || (k.adjustments = { ...u.adjustments }), s.opacity !== void 0 && (k.opacity = s.opacity);
|
|
2462
|
+
const T = k;
|
|
2463
|
+
s.distressEffect && (T.distressEffect = { ...s.distressEffect }), c.masks && c.masks.length > 0 && (T.masks = Te(c.masks)), c.blendMode && (T.blendMode = c.blendMode), c.knockoutParts && (T.knockoutParts = c.knockoutParts), c.shadow && (T.shadow = { ...c.shadow }), "getVisualBoundingBox" in s && typeof s.getVisualBoundingBox == "function" ? T._boundingBox = s.getVisualBoundingBox() : "getBoundingBox" in s && typeof s.getBoundingBox == "function" && (T._boundingBox = s.getBoundingBox()), o.push(T);
|
|
2464
2464
|
} catch (h) {
|
|
2465
|
-
|
|
2465
|
+
ke.error(`[element-serializer] Failed to create ImageBitmap for ${c.id}:`, h);
|
|
2466
2466
|
}
|
|
2467
2467
|
else {
|
|
2468
2468
|
const h = {
|
|
@@ -2470,19 +2470,19 @@ async function _t(e, t, r = Xe) {
|
|
|
2470
2470
|
type: c.transformType
|
|
2471
2471
|
// Map transformType to type for worker compatibility
|
|
2472
2472
|
};
|
|
2473
|
-
if (
|
|
2474
|
-
const f = await
|
|
2473
|
+
if (s instanceof Vt) {
|
|
2474
|
+
const f = await Nt(
|
|
2475
2475
|
{ ...e, hasElementId: () => !0 },
|
|
2476
|
-
|
|
2476
|
+
s.children,
|
|
2477
2477
|
r
|
|
2478
2478
|
);
|
|
2479
2479
|
h.children = f.data.elements, i.push(...f.newBitmaps);
|
|
2480
|
-
for (const u of f.data.fonts)
|
|
2480
|
+
for (const u of f.data.fonts) a.add(u);
|
|
2481
2481
|
}
|
|
2482
|
-
h.masks && Array.isArray(h.masks) && h.masks.length > 0 && (h.masks = Te(h.masks)), "getVisualBoundingBox" in
|
|
2482
|
+
h.masks && Array.isArray(h.masks) && h.masks.length > 0 && (h.masks = Te(h.masks)), "getVisualBoundingBox" in s && typeof s.getVisualBoundingBox == "function" ? h._boundingBox = s.getVisualBoundingBox() : "getBoundingBox" in s && typeof s.getBoundingBox == "function" && (h._boundingBox = s.getBoundingBox()), o.push(h);
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
2485
|
-
const l = Array.from(
|
|
2485
|
+
const l = Array.from(a);
|
|
2486
2486
|
return {
|
|
2487
2487
|
data: {
|
|
2488
2488
|
version: "1.0.0",
|
|
@@ -2504,7 +2504,7 @@ async function _t(e, t, r = Xe) {
|
|
|
2504
2504
|
newBitmaps: i
|
|
2505
2505
|
};
|
|
2506
2506
|
}
|
|
2507
|
-
async function
|
|
2507
|
+
async function Xn(e, t, r = fetch) {
|
|
2508
2508
|
try {
|
|
2509
2509
|
const n = await r(t.fontFileUrl, { mode: "cors" });
|
|
2510
2510
|
if (!n.ok) return null;
|
|
@@ -2517,10 +2517,10 @@ async function _n(e, t, r = fetch) {
|
|
|
2517
2517
|
function K(e) {
|
|
2518
2518
|
return e.trim().toLowerCase();
|
|
2519
2519
|
}
|
|
2520
|
-
function
|
|
2520
|
+
function xt(e) {
|
|
2521
2521
|
return `${K(e.family)}|${e.weight ?? 400}|${e.style ?? "normal"}`;
|
|
2522
2522
|
}
|
|
2523
|
-
class
|
|
2523
|
+
class Gn {
|
|
2524
2524
|
constructor() {
|
|
2525
2525
|
this.fonts = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Set(), this.snapshot = [], this.list = () => this.snapshot, this.subscribe = (t) => (this.listeners.add(t), () => {
|
|
2526
2526
|
this.listeners.delete(t);
|
|
@@ -2533,7 +2533,7 @@ class Nn {
|
|
|
2533
2533
|
register(t) {
|
|
2534
2534
|
let r = !1;
|
|
2535
2535
|
for (const n of t) {
|
|
2536
|
-
const o =
|
|
2536
|
+
const o = xt(n), i = this.fonts.get(o);
|
|
2537
2537
|
i && i.url === n.url && i.family === n.family || (this.fonts.set(o, { ...n }), r = !0);
|
|
2538
2538
|
}
|
|
2539
2539
|
if (r) {
|
|
@@ -2566,13 +2566,13 @@ class Nn {
|
|
|
2566
2566
|
for (const t of this.listeners) t();
|
|
2567
2567
|
}
|
|
2568
2568
|
}
|
|
2569
|
-
const
|
|
2570
|
-
function
|
|
2571
|
-
|
|
2569
|
+
const Xt = new Gn();
|
|
2570
|
+
function Yn(e) {
|
|
2571
|
+
Xt.register(e);
|
|
2572
2572
|
}
|
|
2573
|
-
const
|
|
2574
|
-
async function
|
|
2575
|
-
const r = await
|
|
2573
|
+
const Ve = /* @__PURE__ */ new Set();
|
|
2574
|
+
async function Vn(e, t = {}) {
|
|
2575
|
+
const r = await Xn(
|
|
2576
2576
|
e.family,
|
|
2577
2577
|
{
|
|
2578
2578
|
fontFileUrl: e.url,
|
|
@@ -2584,7 +2584,7 @@ async function Gn(e, t = {}) {
|
|
|
2584
2584
|
t.fetchImpl ?? fetch
|
|
2585
2585
|
);
|
|
2586
2586
|
if (!r)
|
|
2587
|
-
throw new
|
|
2587
|
+
throw new gt(
|
|
2588
2588
|
"E_FONT_LOAD_FAILED",
|
|
2589
2589
|
`Custom font "${e.family}" failed to load from ${e.url}. The URL must serve the font binary over a plain cross-origin GET (CORS). Verify the URL is reachable and sends Access-Control-Allow-Origin, then re-register the font. Custom fonts never fall back silently — the design would render with the wrong typeface.`,
|
|
2590
2590
|
{
|
|
@@ -2595,18 +2595,18 @@ async function Gn(e, t = {}) {
|
|
|
2595
2595
|
}
|
|
2596
2596
|
);
|
|
2597
2597
|
const n = t.fonts ?? (typeof document < "u" ? document.fonts : void 0);
|
|
2598
|
-
return n == null || n.add(r),
|
|
2598
|
+
return n == null || n.add(r), Ve.add(xt(e)), r;
|
|
2599
2599
|
}
|
|
2600
|
-
async function
|
|
2601
|
-
|
|
2600
|
+
async function ho(e, t = {}) {
|
|
2601
|
+
Yn(e);
|
|
2602
2602
|
const { onLoadError: r, ...n } = t;
|
|
2603
2603
|
await Promise.all(
|
|
2604
2604
|
e.map(async (o) => {
|
|
2605
|
-
if (!
|
|
2605
|
+
if (!Ve.has(xt(o)))
|
|
2606
2606
|
try {
|
|
2607
|
-
await
|
|
2607
|
+
await Vn(o, n);
|
|
2608
2608
|
} catch (i) {
|
|
2609
|
-
if (r && i instanceof
|
|
2609
|
+
if (r && i instanceof gt) {
|
|
2610
2610
|
r(i, o);
|
|
2611
2611
|
return;
|
|
2612
2612
|
}
|
|
@@ -2616,13 +2616,13 @@ async function io(e, t = {}) {
|
|
|
2616
2616
|
);
|
|
2617
2617
|
}
|
|
2618
2618
|
const O = j("WorkerExport");
|
|
2619
|
-
let
|
|
2620
|
-
function
|
|
2621
|
-
return
|
|
2622
|
-
throw
|
|
2623
|
-
})),
|
|
2619
|
+
let Gt = null, At = null;
|
|
2620
|
+
function Jn() {
|
|
2621
|
+
return At ?? (At = (typeof window > "u" ? Promise.reject(new Error("The export worker runs in a browser page only (no window here).")) : import("./export-worker.bundle.string-C6Zm9Wt-.js")).then((e) => Gt = e.default).catch((e) => {
|
|
2622
|
+
throw At = null, e;
|
|
2623
|
+
})), At;
|
|
2624
2624
|
}
|
|
2625
|
-
class
|
|
2625
|
+
class ft {
|
|
2626
2626
|
constructor() {
|
|
2627
2627
|
this.worker = null, this.workerBlobUrl = null, this.pendingRequests = /* @__PURE__ */ new Map(), this.requestQueue = [], this.blobRequestQueue = [], this.isProcessingQueue = !1, this.isReady = !1, this.readyPromise = null, this.initGeneration = 0, this.requestIdCounter = 0, this.workerCrashCount = 0, this.MAX_CRASHES_BEFORE_FALLBACK = 3, this.lastCrashTime = 0, this.CRASH_RESET_TIMEOUT = 6e4, this.progressListeners = /* @__PURE__ */ new Set(), this.idleTimeout = null, this.IDLE_TIMEOUT_MS = 3e4;
|
|
2628
2628
|
}
|
|
@@ -2684,7 +2684,7 @@ class dt {
|
|
|
2684
2684
|
* Call this when exiting editor mode to free memory.
|
|
2685
2685
|
*/
|
|
2686
2686
|
clearWorkerBitmapCache() {
|
|
2687
|
-
if (
|
|
2687
|
+
if (jt(), this.worker && this.isReady) {
|
|
2688
2688
|
const t = {
|
|
2689
2689
|
type: "clear-all-bitmaps"
|
|
2690
2690
|
};
|
|
@@ -2696,7 +2696,7 @@ class dt {
|
|
|
2696
2696
|
* Call this when an element is removed or its image source changes.
|
|
2697
2697
|
*/
|
|
2698
2698
|
clearWorkerBitmap(t) {
|
|
2699
|
-
if (
|
|
2699
|
+
if (Ye(t), this.worker && this.isReady) {
|
|
2700
2700
|
const r = {
|
|
2701
2701
|
type: "clear-bitmap",
|
|
2702
2702
|
elementId: t
|
|
@@ -2722,11 +2722,11 @@ class dt {
|
|
|
2722
2722
|
return this.readyPromise || Promise.resolve();
|
|
2723
2723
|
if (this.readyPromise)
|
|
2724
2724
|
return this.readyPromise;
|
|
2725
|
-
if (!
|
|
2725
|
+
if (!ft.supportsWorkerExport())
|
|
2726
2726
|
throw new Error("Browser does not support OffscreenCanvas or Web Workers");
|
|
2727
|
-
if (
|
|
2728
|
-
return this.readyPromise = this.startWorker(
|
|
2729
|
-
const t = this.initGeneration, r =
|
|
2727
|
+
if (Gt !== null)
|
|
2728
|
+
return this.readyPromise = this.startWorker(Gt), this.readyPromise;
|
|
2729
|
+
const t = this.initGeneration, r = Jn().then((n) => {
|
|
2730
2730
|
if (t !== this.initGeneration)
|
|
2731
2731
|
throw new Error("Worker terminated");
|
|
2732
2732
|
return this.startWorker(n);
|
|
@@ -2754,13 +2754,13 @@ class dt {
|
|
|
2754
2754
|
};
|
|
2755
2755
|
const i = setTimeout(() => {
|
|
2756
2756
|
n(new Error("Worker initialization timeout"));
|
|
2757
|
-
}, 15e3),
|
|
2758
|
-
l.data.type === "ready" && (clearTimeout(i), this.isReady = !0,
|
|
2757
|
+
}, 15e3), a = (l) => {
|
|
2758
|
+
l.data.type === "ready" && (clearTimeout(i), this.isReady = !0, _n(
|
|
2759
2759
|
() => this.clearWorkerBitmapCache(),
|
|
2760
|
-
(
|
|
2760
|
+
(s) => this.clearWorkerBitmap(s)
|
|
2761
2761
|
), r());
|
|
2762
2762
|
};
|
|
2763
|
-
this.worker.addEventListener("message",
|
|
2763
|
+
this.worker.addEventListener("message", a, { once: !0 });
|
|
2764
2764
|
} catch (o) {
|
|
2765
2765
|
O.error("Failed to create worker:", o), n(o);
|
|
2766
2766
|
}
|
|
@@ -2832,8 +2832,8 @@ class dt {
|
|
|
2832
2832
|
const { artboard: r, elements: n, config: o } = t;
|
|
2833
2833
|
if ((!this.worker || !this.isReady) && await this.initialize(), !this.worker)
|
|
2834
2834
|
throw new Error("Worker is not initialized");
|
|
2835
|
-
const i = `export-${++this.requestIdCounter}-${Date.now()}`,
|
|
2836
|
-
|
|
2835
|
+
const i = `export-${++this.requestIdCounter}-${Date.now()}`, a = performance.now(), { data: l, newBitmaps: s } = await Nt(r, n);
|
|
2836
|
+
s.length > 0 && this.registerBitmapsWithWorker(s);
|
|
2837
2837
|
const c = {
|
|
2838
2838
|
type: "export",
|
|
2839
2839
|
requestId: i,
|
|
@@ -2843,23 +2843,23 @@ class dt {
|
|
|
2843
2843
|
// Custom (brand) fonts among the used families — the worker loads
|
|
2844
2844
|
// these from their hosted URL instead of Google Fonts (deterministic
|
|
2845
2845
|
// shadowing; see utils/custom-fonts.ts).
|
|
2846
|
-
customFonts:
|
|
2846
|
+
customFonts: Xt.forFamilies(l.fonts ?? []),
|
|
2847
2847
|
scale: o.scale || 1,
|
|
2848
2848
|
format: o.format || "png",
|
|
2849
2849
|
quality: o.quality || 0.95
|
|
2850
|
-
}, h = new Promise((
|
|
2850
|
+
}, h = new Promise((p, m) => {
|
|
2851
2851
|
this.pendingRequests.set(i, {
|
|
2852
2852
|
requestId: i,
|
|
2853
|
-
resolve:
|
|
2854
|
-
reject:
|
|
2855
|
-
startTime:
|
|
2853
|
+
resolve: p,
|
|
2854
|
+
reject: m,
|
|
2855
|
+
startTime: a,
|
|
2856
2856
|
returnFormat: "dataUrl"
|
|
2857
2857
|
}), setTimeout(() => {
|
|
2858
|
-
this.pendingRequests.has(i) && (this.pendingRequests.delete(i),
|
|
2858
|
+
this.pendingRequests.has(i) && (this.pendingRequests.delete(i), m(new Error("Export request timeout")));
|
|
2859
2859
|
}, 3e4);
|
|
2860
2860
|
});
|
|
2861
2861
|
this.worker.postMessage(c);
|
|
2862
|
-
const f = await h, d = performance.now() -
|
|
2862
|
+
const f = await h, d = performance.now() - a;
|
|
2863
2863
|
return {
|
|
2864
2864
|
dataUrl: f.dataUrl,
|
|
2865
2865
|
artboardId: f.artboardId,
|
|
@@ -2893,8 +2893,8 @@ class dt {
|
|
|
2893
2893
|
const { artboard: r, elements: n, config: o } = t;
|
|
2894
2894
|
if ((!this.worker || !this.isReady) && await this.initialize(), !this.worker)
|
|
2895
2895
|
throw new Error("Worker is not initialized");
|
|
2896
|
-
const i = `export-blob-${++this.requestIdCounter}-${Date.now()}`,
|
|
2897
|
-
|
|
2896
|
+
const i = `export-blob-${++this.requestIdCounter}-${Date.now()}`, a = performance.now(), { data: l, newBitmaps: s } = await Nt(r, n);
|
|
2897
|
+
s.length > 0 && this.registerBitmapsWithWorker(s);
|
|
2898
2898
|
const c = {
|
|
2899
2899
|
type: "export",
|
|
2900
2900
|
requestId: i,
|
|
@@ -2902,24 +2902,24 @@ class dt {
|
|
|
2902
2902
|
elements: l.elements,
|
|
2903
2903
|
fonts: l.fonts,
|
|
2904
2904
|
// Same custom-font threading as the dataUrl path above.
|
|
2905
|
-
customFonts:
|
|
2905
|
+
customFonts: Xt.forFamilies(l.fonts ?? []),
|
|
2906
2906
|
scale: o.scale || 1,
|
|
2907
2907
|
format: o.format || "png",
|
|
2908
2908
|
quality: o.quality || 0.95,
|
|
2909
2909
|
returnFormat: "blob"
|
|
2910
|
-
}, h = new Promise((
|
|
2910
|
+
}, h = new Promise((m, w) => {
|
|
2911
2911
|
this.pendingRequests.set(i, {
|
|
2912
2912
|
requestId: i,
|
|
2913
|
-
resolve:
|
|
2914
|
-
reject:
|
|
2915
|
-
startTime:
|
|
2913
|
+
resolve: m,
|
|
2914
|
+
reject: w,
|
|
2915
|
+
startTime: a,
|
|
2916
2916
|
returnFormat: "blob"
|
|
2917
2917
|
}), setTimeout(() => {
|
|
2918
|
-
this.pendingRequests.has(i) && (this.pendingRequests.delete(i),
|
|
2918
|
+
this.pendingRequests.has(i) && (this.pendingRequests.delete(i), w(new Error("Export request timeout")));
|
|
2919
2919
|
}, 3e4);
|
|
2920
2920
|
});
|
|
2921
2921
|
this.worker.postMessage(c);
|
|
2922
|
-
const f = await h, d = performance.now() -
|
|
2922
|
+
const f = await h, d = performance.now() - a;
|
|
2923
2923
|
return {
|
|
2924
2924
|
blob: new Blob([f.blobData], { type: f.mimeType }),
|
|
2925
2925
|
artboardId: f.artboardId,
|
|
@@ -3009,7 +3009,7 @@ class dt {
|
|
|
3009
3009
|
r.reject(new Error("Worker terminated")), this.pendingRequests.delete(t);
|
|
3010
3010
|
for (; this.requestQueue.length > 0; )
|
|
3011
3011
|
this.requestQueue.shift().reject(new Error("Worker terminated"));
|
|
3012
|
-
this.worker.terminate(), this.worker = null, this.isReady = !1, this.readyPromise = null,
|
|
3012
|
+
this.worker.terminate(), this.worker = null, this.isReady = !1, this.readyPromise = null, jt(), Nn(), this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
|
|
3013
3013
|
}
|
|
3014
3014
|
}
|
|
3015
3015
|
/**
|
|
@@ -3024,32 +3024,35 @@ class dt {
|
|
|
3024
3024
|
};
|
|
3025
3025
|
}
|
|
3026
3026
|
}
|
|
3027
|
-
let
|
|
3028
|
-
function
|
|
3029
|
-
return
|
|
3027
|
+
let x = null;
|
|
3028
|
+
function fo() {
|
|
3029
|
+
return x || (x = new ft()), x;
|
|
3030
3030
|
}
|
|
3031
|
-
function
|
|
3032
|
-
|
|
3031
|
+
function uo() {
|
|
3032
|
+
x && (x.terminate(), x = null);
|
|
3033
3033
|
}
|
|
3034
|
-
|
|
3035
|
-
const _ = j("Export");
|
|
3036
|
-
function
|
|
3034
|
+
zt();
|
|
3035
|
+
const _ = j("Export"), ve = (e) => e === "jpg" || e === "jpeg" ? "image/jpeg" : e === "webp" ? "image/webp" : "image/png", Me = (e, t, r) => new Promise((n) => e.toBlob((o) => n(o), t, r));
|
|
3036
|
+
function Rt(e) {
|
|
3037
|
+
e.width = 0, e.height = 0;
|
|
3038
|
+
}
|
|
3039
|
+
function Yt(e, t) {
|
|
3037
3040
|
var r;
|
|
3038
3041
|
if (!(!e || typeof e != "object")) {
|
|
3039
3042
|
if (typeof e.fontFamily == "string" && e.fontFamily.trim() && t.add(e.fontFamily), e.richText && Array.isArray(e.richText.spans))
|
|
3040
3043
|
for (const n of e.richText.spans)
|
|
3041
3044
|
(r = n == null ? void 0 : n.style) != null && r.fontFamily && typeof n.style.fontFamily == "string" && t.add(n.style.fontFamily);
|
|
3042
3045
|
if (Array.isArray(e.children))
|
|
3043
|
-
for (const n of e.children)
|
|
3046
|
+
for (const n of e.children) Yt(n, t);
|
|
3044
3047
|
if (Array.isArray(e.masks))
|
|
3045
3048
|
for (const n of e.masks)
|
|
3046
|
-
n != null && n.maskElement &&
|
|
3049
|
+
n != null && n.maskElement && Yt(n.maskElement, t);
|
|
3047
3050
|
}
|
|
3048
3051
|
}
|
|
3049
|
-
async function
|
|
3052
|
+
async function Kn(e) {
|
|
3050
3053
|
if (typeof document > "u" || !document.fonts) return;
|
|
3051
3054
|
const t = /* @__PURE__ */ new Set();
|
|
3052
|
-
for (const n of e)
|
|
3055
|
+
for (const n of e) Yt(n, t);
|
|
3053
3056
|
if (t.size === 0) return;
|
|
3054
3057
|
const r = [];
|
|
3055
3058
|
for (const n of t)
|
|
@@ -3057,12 +3060,12 @@ async function ve(e) {
|
|
|
3057
3060
|
}));
|
|
3058
3061
|
await Promise.all(r), document.fonts.ready && await document.fonts.ready;
|
|
3059
3062
|
}
|
|
3060
|
-
const
|
|
3063
|
+
const lt = class lt {
|
|
3061
3064
|
/**
|
|
3062
3065
|
* Check if worker export is supported in this browser
|
|
3063
3066
|
*/
|
|
3064
3067
|
static supportsWorkerExport() {
|
|
3065
|
-
return
|
|
3068
|
+
return ft.supportsWorkerExport();
|
|
3066
3069
|
}
|
|
3067
3070
|
/**
|
|
3068
3071
|
* Get or initialize the worker manager
|
|
@@ -3070,7 +3073,7 @@ const ct = class ct {
|
|
|
3070
3073
|
static async getWorkerManager() {
|
|
3071
3074
|
return this.supportsWorkerExport() ? this.workerManager ? this.workerManager : this.workerInitPromise ? (await this.workerInitPromise, this.workerManager) : (this.workerInitPromise = (async () => {
|
|
3072
3075
|
try {
|
|
3073
|
-
this.workerManager = new
|
|
3076
|
+
this.workerManager = new ft(), await this.workerManager.initialize();
|
|
3074
3077
|
} catch (t) {
|
|
3075
3078
|
_.error("Failed to initialize worker:", t), this.workerManager = null;
|
|
3076
3079
|
}
|
|
@@ -3106,7 +3109,7 @@ const ct = class ct {
|
|
|
3106
3109
|
};
|
|
3107
3110
|
}),
|
|
3108
3111
|
activeArtboardId: n.getActiveArtboardId()
|
|
3109
|
-
},
|
|
3112
|
+
}, a = JSON.stringify(i, null, 2), l = new Blob([a], { type: "application/json" }), s = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").split("T")[0], c = o || `canvas-${s}.json`;
|
|
3110
3113
|
this.downloadBlob(l, c);
|
|
3111
3114
|
}
|
|
3112
3115
|
/**
|
|
@@ -3116,21 +3119,21 @@ const ct = class ct {
|
|
|
3116
3119
|
static async exportArtboardToImage(t, r, n, o = {}) {
|
|
3117
3120
|
const {
|
|
3118
3121
|
format: i = "png",
|
|
3119
|
-
quality:
|
|
3122
|
+
quality: a = 0.95,
|
|
3120
3123
|
scale: l = 1,
|
|
3121
|
-
transparentBackground:
|
|
3124
|
+
transparentBackground: s = !1,
|
|
3122
3125
|
backgroundColor: c = t.backgroundColor,
|
|
3123
3126
|
filename: h,
|
|
3124
3127
|
forceMainThread: f = !1
|
|
3125
3128
|
} = o, u = await this.exportArtboardToDataURL(t, r, n, {
|
|
3126
3129
|
format: i,
|
|
3127
|
-
quality:
|
|
3130
|
+
quality: a,
|
|
3128
3131
|
scale: l,
|
|
3129
|
-
transparentBackground:
|
|
3132
|
+
transparentBackground: s,
|
|
3130
3133
|
backgroundColor: c,
|
|
3131
3134
|
forceMainThread: f
|
|
3132
|
-
}), d = await this.dataUrlToBlob(u),
|
|
3133
|
-
this.downloadBlob(d,
|
|
3135
|
+
}), d = await this.dataUrlToBlob(u), p = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").split("T")[0], m = h || `${t.name}-${p}.${i}`;
|
|
3136
|
+
this.downloadBlob(d, m);
|
|
3134
3137
|
}
|
|
3135
3138
|
/**
|
|
3136
3139
|
* Export artboard to data URL (for preview/testing)
|
|
@@ -3139,9 +3142,9 @@ const ct = class ct {
|
|
|
3139
3142
|
static async exportArtboardToDataURL(t, r, n, o = {}) {
|
|
3140
3143
|
const {
|
|
3141
3144
|
format: i = "png",
|
|
3142
|
-
quality:
|
|
3145
|
+
quality: a = 0.95,
|
|
3143
3146
|
scale: l = 1,
|
|
3144
|
-
transparentBackground:
|
|
3147
|
+
transparentBackground: s = !1,
|
|
3145
3148
|
backgroundColor: c = t.backgroundColor,
|
|
3146
3149
|
forceMainThread: h = !1
|
|
3147
3150
|
} = o;
|
|
@@ -3149,11 +3152,11 @@ const ct = class ct {
|
|
|
3149
3152
|
try {
|
|
3150
3153
|
const f = await this.getWorkerManager();
|
|
3151
3154
|
if (f) {
|
|
3152
|
-
const u = new Set(t.getElementIds()), d = r.filter((
|
|
3155
|
+
const u = new Set(t.getElementIds()), d = r.filter((m) => u.has(m.id));
|
|
3153
3156
|
return (await f.exportArtboardToDataURL(t, d, {
|
|
3154
3157
|
scale: l,
|
|
3155
3158
|
format: i === "jpg" ? "jpeg" : i,
|
|
3156
|
-
quality:
|
|
3159
|
+
quality: a
|
|
3157
3160
|
})).dataUrl;
|
|
3158
3161
|
}
|
|
3159
3162
|
} catch (f) {
|
|
@@ -3161,9 +3164,9 @@ const ct = class ct {
|
|
|
3161
3164
|
}
|
|
3162
3165
|
return this.mainThreadExportToDataURL(t, r, n, {
|
|
3163
3166
|
format: i,
|
|
3164
|
-
quality:
|
|
3167
|
+
quality: a,
|
|
3165
3168
|
scale: l,
|
|
3166
|
-
transparentBackground:
|
|
3169
|
+
transparentBackground: s,
|
|
3167
3170
|
backgroundColor: c
|
|
3168
3171
|
});
|
|
3169
3172
|
}
|
|
@@ -3175,9 +3178,9 @@ const ct = class ct {
|
|
|
3175
3178
|
static async exportArtboardToBlob(t, r, n, o = {}) {
|
|
3176
3179
|
const {
|
|
3177
3180
|
format: i = "png",
|
|
3178
|
-
quality:
|
|
3181
|
+
quality: a = 0.95,
|
|
3179
3182
|
scale: l = 1,
|
|
3180
|
-
transparentBackground:
|
|
3183
|
+
transparentBackground: s = !1,
|
|
3181
3184
|
backgroundColor: c = t.backgroundColor,
|
|
3182
3185
|
forceMainThread: h = !1
|
|
3183
3186
|
} = o;
|
|
@@ -3185,11 +3188,11 @@ const ct = class ct {
|
|
|
3185
3188
|
try {
|
|
3186
3189
|
const f = await this.getWorkerManager();
|
|
3187
3190
|
if (f) {
|
|
3188
|
-
const u = new Set(t.getElementIds()), d = r.filter((
|
|
3191
|
+
const u = new Set(t.getElementIds()), d = r.filter((m) => u.has(m.id));
|
|
3189
3192
|
return (await f.exportArtboardToBlob(t, d, {
|
|
3190
3193
|
scale: l,
|
|
3191
3194
|
format: i === "jpg" ? "jpeg" : i,
|
|
3192
|
-
quality:
|
|
3195
|
+
quality: a
|
|
3193
3196
|
})).blob;
|
|
3194
3197
|
}
|
|
3195
3198
|
} catch (f) {
|
|
@@ -3197,9 +3200,9 @@ const ct = class ct {
|
|
|
3197
3200
|
}
|
|
3198
3201
|
return this.mainThreadExportToBlob(t, r, n, {
|
|
3199
3202
|
format: i,
|
|
3200
|
-
quality:
|
|
3203
|
+
quality: a,
|
|
3201
3204
|
scale: l,
|
|
3202
|
-
transparentBackground:
|
|
3205
|
+
transparentBackground: s,
|
|
3203
3206
|
backgroundColor: c
|
|
3204
3207
|
});
|
|
3205
3208
|
}
|
|
@@ -3210,67 +3213,14 @@ const ct = class ct {
|
|
|
3210
3213
|
* worker), so font readiness matters here even when no fallback occurred.
|
|
3211
3214
|
*/
|
|
3212
3215
|
static async mainThreadExportToBlob(t, r, n, o = {}) {
|
|
3213
|
-
const {
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
await ve(r);
|
|
3221
|
-
const h = document.createElement("canvas"), f = t.width * l, u = t.height * l;
|
|
3222
|
-
h.width = f, h.height = u;
|
|
3223
|
-
const d = h.getContext("2d");
|
|
3224
|
-
if (d.scale(l, l), !a && t.exportBackground) {
|
|
3225
|
-
if (d.save(), this.applyExportBackgroundClipPath(d, t), t.backgroundType === "texture" && t.backgroundTexture) {
|
|
3226
|
-
const p = D.getTexturePresetColor(t.backgroundTexture);
|
|
3227
|
-
d.fillStyle = p, d.fillRect(0, 0, t.width, t.height);
|
|
3228
|
-
const y = D.getTexture(t.backgroundTexture);
|
|
3229
|
-
y && y.complete && d.drawImage(y, 0, 0, t.width, t.height);
|
|
3230
|
-
} else
|
|
3231
|
-
d.fillStyle = c || t.backgroundColor, d.fillRect(0, 0, t.width, t.height);
|
|
3232
|
-
d.restore();
|
|
3216
|
+
const { format: i = "png", quality: a = 0.95 } = o, l = await this.renderOnMainThread(t, r, o);
|
|
3217
|
+
try {
|
|
3218
|
+
const s = await Me(l, ve(i), a);
|
|
3219
|
+
if (!s) throw new Error("Failed to create blob from canvas");
|
|
3220
|
+
return s;
|
|
3221
|
+
} finally {
|
|
3222
|
+
Rt(l);
|
|
3233
3223
|
}
|
|
3234
|
-
d.save(), d.translate(-t.x, -t.y), this.applyExportClipPath(d, t);
|
|
3235
|
-
const m = new Set(t.getElementIds()), g = r.filter((p) => m.has(p.id)), k = /* @__PURE__ */ new Map();
|
|
3236
|
-
g.forEach((p) => k.set(p.id, p));
|
|
3237
|
-
const T = (p, y) => {
|
|
3238
|
-
if (!y.id) return;
|
|
3239
|
-
const C = k.get(y.id);
|
|
3240
|
-
C && C.render(p, !1);
|
|
3241
|
-
}, w = g.map((p) => p.toJSON()), b = /* @__PURE__ */ new Set();
|
|
3242
|
-
return g.forEach((p, y) => {
|
|
3243
|
-
var C;
|
|
3244
|
-
if (p.blendMode === "knockout" || p.blendMode === "clip") {
|
|
3245
|
-
const M = w[y], S = p.blendMode === "knockout" ? "destination-out" : "destination-in", P = ((C = M.knockoutParts) == null ? void 0 : C.scope) || "group", v = w.findIndex((A) => A.id === M.id);
|
|
3246
|
-
if (v !== -1 && P === "artboard")
|
|
3247
|
-
for (let A = 0; A < v; A++) {
|
|
3248
|
-
const I = w[A].id;
|
|
3249
|
-
I && b.add(I);
|
|
3250
|
-
}
|
|
3251
|
-
Ut(
|
|
3252
|
-
d,
|
|
3253
|
-
M,
|
|
3254
|
-
w,
|
|
3255
|
-
T,
|
|
3256
|
-
a || !t.exportBackground ? void 0 : c,
|
|
3257
|
-
t,
|
|
3258
|
-
S
|
|
3259
|
-
), b.add(p.id);
|
|
3260
|
-
}
|
|
3261
|
-
}), g.forEach((p, y) => {
|
|
3262
|
-
b.has(p.id) || fe(d, w[y], (C) => {
|
|
3263
|
-
p.render(C, !1);
|
|
3264
|
-
});
|
|
3265
|
-
}), d.restore(), new Promise((p, y) => {
|
|
3266
|
-
h.toBlob(
|
|
3267
|
-
(C) => {
|
|
3268
|
-
C ? p(C) : y(new Error("Failed to create blob from canvas"));
|
|
3269
|
-
},
|
|
3270
|
-
i === "jpg" || i === "jpeg" ? "image/jpeg" : i === "webp" ? "image/webp" : "image/png",
|
|
3271
|
-
s
|
|
3272
|
-
);
|
|
3273
|
-
});
|
|
3274
3224
|
}
|
|
3275
3225
|
/**
|
|
3276
3226
|
* Main thread export to data URL (fallback/legacy method).
|
|
@@ -3279,110 +3229,148 @@ const ct = class ct {
|
|
|
3279
3229
|
* worker), so font readiness matters here even when no fallback occurred.
|
|
3280
3230
|
*/
|
|
3281
3231
|
static async mainThreadExportToDataURL(t, r, n, o = {}) {
|
|
3282
|
-
|
|
3232
|
+
const { format: i = "png", quality: a = 0.95 } = o, l = await this.renderOnMainThread(t, r, o);
|
|
3233
|
+
try {
|
|
3234
|
+
return l.toDataURL(ve(i), a);
|
|
3235
|
+
} finally {
|
|
3236
|
+
Rt(l);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
/**
|
|
3240
|
+
* One artboard's PRINT file: a lossless PNG of the artboard (or of `region`, a rect of it in artboard units) at
|
|
3241
|
+
* `scale` pixels per artboard unit, painted from every image's ORIGINAL pixels (the worker's 4,000 px bitmap cap,
|
|
3242
|
+
* `DEFAULT_MAX_BITMAP_DIMENSION`, keeps the live preview light; a print needs what the shopper uploaded).
|
|
3243
|
+
*
|
|
3244
|
+
* Painted on the main thread (the worker would cache an uncapped copy of every picture), one canvas, released as
|
|
3245
|
+
* soon as it is encoded: the caller asks for files one at a time, so a phone holds one print canvas at most.
|
|
3246
|
+
* Throws `E_PRINT_FILE_FAILED` (typed, with the size asked for) when the device could not hold or encode it.
|
|
3247
|
+
*/
|
|
3248
|
+
static async exportPrintFile(t, r, n) {
|
|
3249
|
+
const { scale: o, region: i } = n;
|
|
3250
|
+
if (!(o > 0) || !Number.isFinite(o))
|
|
3251
|
+
throw new gt("E_PRINT_FILE_FAILED", `scale must be a finite number above 0 (got ${o}).`, { artboard: t.name, scale: o });
|
|
3252
|
+
const a = await this.renderOnMainThread(t, r, { scale: o, transparentBackground: !0 }, i), l = a.width, s = a.height;
|
|
3253
|
+
try {
|
|
3254
|
+
const c = await Me(a, "image/png");
|
|
3255
|
+
if (!c || c.size === 0)
|
|
3256
|
+
throw new gt(
|
|
3257
|
+
"E_PRINT_FILE_FAILED",
|
|
3258
|
+
`the device could not make the ${l} x ${s} px print file of "${t.name}"${i ? ` (region ${i.id})` : ""}: its canvas was refused. Ask for a smaller scale for this device.`,
|
|
3259
|
+
{ artboard: t.name, region: i == null ? void 0 : i.id, width: l, height: s, scale: o }
|
|
3260
|
+
);
|
|
3261
|
+
return { blob: c, width: l, height: s, scale: o };
|
|
3262
|
+
} finally {
|
|
3263
|
+
Rt(a);
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* Paint an artboard (or a rect of it) on a detached main-thread canvas: background, compositing (knockout / clip),
|
|
3268
|
+
* every visible element with its masks / distress / layer effects, then the artboard's distress texture and image
|
|
3269
|
+
* mask. The one main-thread painter: the blob, data URL and print exports all use it (the blob path used to skip
|
|
3270
|
+
* masks, distress and the artboard effects the data URL path drew). A hidden layer is not part of the design and is
|
|
3271
|
+
* never painted (as the worker serializer drops it).
|
|
3272
|
+
*/
|
|
3273
|
+
static async renderOnMainThread(t, r, n, o) {
|
|
3274
|
+
var b, T;
|
|
3283
3275
|
const {
|
|
3284
|
-
|
|
3285
|
-
quality: s = 0.95,
|
|
3286
|
-
scale: l = 1,
|
|
3276
|
+
scale: i = 1,
|
|
3287
3277
|
transparentBackground: a = !1,
|
|
3288
|
-
backgroundColor:
|
|
3289
|
-
} =
|
|
3290
|
-
await
|
|
3291
|
-
const
|
|
3292
|
-
h.width =
|
|
3293
|
-
const
|
|
3294
|
-
if (
|
|
3295
|
-
if (
|
|
3296
|
-
const
|
|
3297
|
-
|
|
3298
|
-
const
|
|
3299
|
-
|
|
3278
|
+
backgroundColor: l = t.backgroundColor
|
|
3279
|
+
} = n, s = r.filter((g) => g.visible !== !1);
|
|
3280
|
+
await Kn(s);
|
|
3281
|
+
const c = o ?? { x: 0, y: 0, width: t.width, height: t.height }, h = document.createElement("canvas");
|
|
3282
|
+
h.width = Math.max(1, Math.round(c.width * i)), h.height = Math.max(1, Math.round(c.height * i));
|
|
3283
|
+
const f = h.getContext("2d");
|
|
3284
|
+
if (f.scale(i, i), (c.x !== 0 || c.y !== 0) && f.translate(-c.x, -c.y), !a && t.exportBackground) {
|
|
3285
|
+
if (f.save(), this.applyExportBackgroundClipPath(f, t), t.backgroundType === "texture" && t.backgroundTexture) {
|
|
3286
|
+
const g = pt.getTexturePresetColor(t.backgroundTexture);
|
|
3287
|
+
f.fillStyle = g, f.fillRect(0, 0, t.width, t.height);
|
|
3288
|
+
const y = pt.getTexture(t.backgroundTexture);
|
|
3289
|
+
y && y.complete ? f.drawImage(y, 0, 0, t.width, t.height) : _.warn("Texture not loaded for export:", t.backgroundTexture);
|
|
3300
3290
|
} else
|
|
3301
|
-
|
|
3302
|
-
|
|
3291
|
+
f.fillStyle = l || t.backgroundColor, f.fillRect(0, 0, t.width, t.height);
|
|
3292
|
+
f.restore();
|
|
3303
3293
|
}
|
|
3304
|
-
|
|
3305
|
-
const
|
|
3306
|
-
|
|
3307
|
-
const
|
|
3308
|
-
if (!
|
|
3309
|
-
const
|
|
3310
|
-
|
|
3311
|
-
}, w =
|
|
3312
|
-
|
|
3313
|
-
var
|
|
3314
|
-
if (
|
|
3315
|
-
const
|
|
3316
|
-
if (
|
|
3317
|
-
for (let
|
|
3318
|
-
const
|
|
3319
|
-
|
|
3294
|
+
f.save(), f.translate(-t.x, -t.y), this.applyExportClipPath(f, t);
|
|
3295
|
+
const u = new Set(t.getElementIds()), d = s.filter((g) => u.has(g.id)), p = /* @__PURE__ */ new Map();
|
|
3296
|
+
d.forEach((g) => p.set(g.id, g));
|
|
3297
|
+
const m = (g, y) => {
|
|
3298
|
+
if (!y.id) return;
|
|
3299
|
+
const S = p.get(y.id);
|
|
3300
|
+
S ? S.render(g, !1) : _.warn("Element not found in map:", y.id);
|
|
3301
|
+
}, w = d.map((g) => g.toJSON()), k = /* @__PURE__ */ new Set();
|
|
3302
|
+
return d.forEach((g, y) => {
|
|
3303
|
+
var S;
|
|
3304
|
+
if (g.blendMode === "knockout" || g.blendMode === "clip") {
|
|
3305
|
+
const C = w[y], P = g.blendMode === "knockout" ? "destination-out" : "destination-in", I = ((S = C.knockoutParts) == null ? void 0 : S.scope) || "group", M = w.findIndex((A) => A.id === C.id);
|
|
3306
|
+
if (M !== -1 && I === "artboard")
|
|
3307
|
+
for (let A = 0; A < M; A++) {
|
|
3308
|
+
const E = w[A].id;
|
|
3309
|
+
E && k.add(E);
|
|
3320
3310
|
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3311
|
+
qe(
|
|
3312
|
+
f,
|
|
3313
|
+
C,
|
|
3324
3314
|
w,
|
|
3325
|
-
|
|
3326
|
-
a || !t.exportBackground ? void 0 :
|
|
3315
|
+
m,
|
|
3316
|
+
a || !t.exportBackground ? void 0 : l,
|
|
3327
3317
|
t,
|
|
3328
|
-
|
|
3329
|
-
),
|
|
3318
|
+
P
|
|
3319
|
+
), k.add(g.id);
|
|
3330
3320
|
}
|
|
3331
|
-
}),
|
|
3332
|
-
var
|
|
3333
|
-
if (!
|
|
3334
|
-
const
|
|
3335
|
-
|
|
3321
|
+
}), d.forEach((g, y) => {
|
|
3322
|
+
var S;
|
|
3323
|
+
if (!k.has(g.id)) {
|
|
3324
|
+
const C = w[y], P = ((S = C == null ? void 0 : C.distressEffect) == null ? void 0 : S.enabled) && C.distressEffect.style === "custom" && C.distressEffect.textureUrl, I = (C == null ? void 0 : C.masks) && C.masks.length > 0, M = (A) => {
|
|
3325
|
+
g.render(A, !1);
|
|
3336
3326
|
};
|
|
3337
|
-
|
|
3338
|
-
if (I &&
|
|
3339
|
-
|
|
3340
|
-
const
|
|
3341
|
-
ye(
|
|
3327
|
+
Mn(f, C, (A) => {
|
|
3328
|
+
if (I && P)
|
|
3329
|
+
fe(A, C, (E) => {
|
|
3330
|
+
const v = g.getVisualBoundingBox();
|
|
3331
|
+
ye(E, C.distressEffect, v, M);
|
|
3342
3332
|
});
|
|
3343
3333
|
else if (I)
|
|
3344
|
-
|
|
3345
|
-
else if (
|
|
3346
|
-
const
|
|
3347
|
-
ye(
|
|
3334
|
+
fe(A, C, M);
|
|
3335
|
+
else if (P) {
|
|
3336
|
+
const E = g.getVisualBoundingBox();
|
|
3337
|
+
ye(A, C.distressEffect, E, M);
|
|
3348
3338
|
} else
|
|
3349
|
-
|
|
3339
|
+
g.render(A, !1);
|
|
3350
3340
|
});
|
|
3351
3341
|
}
|
|
3352
|
-
}), (
|
|
3342
|
+
}), (b = t.distressTexture) != null && b.enabled && On(f, t.distressTexture, {
|
|
3353
3343
|
x: t.x,
|
|
3354
3344
|
y: t.y,
|
|
3355
3345
|
width: t.width,
|
|
3356
3346
|
height: t.height
|
|
3357
|
-
}), (
|
|
3347
|
+
}), (T = t.imageMask) != null && T.enabled && Tn(f, t.imageMask, {
|
|
3358
3348
|
x: t.x,
|
|
3359
3349
|
y: t.y,
|
|
3360
3350
|
width: t.width,
|
|
3361
3351
|
height: t.height
|
|
3362
|
-
}),
|
|
3363
|
-
const p = i === "png" ? "image/png" : i === "webp" ? "image/webp" : "image/jpeg";
|
|
3364
|
-
return h.toDataURL(p, s);
|
|
3352
|
+
}), f.restore(), h;
|
|
3365
3353
|
}
|
|
3366
3354
|
/**
|
|
3367
3355
|
* Apply clip path for export background (uses 0,0 as origin since background is drawn before translate)
|
|
3368
3356
|
*/
|
|
3369
3357
|
static applyExportBackgroundClipPath(t, r) {
|
|
3370
|
-
const { width: n, height: o, clipShape: i } = r,
|
|
3358
|
+
const { width: n, height: o, clipShape: i } = r, a = 0, l = 0;
|
|
3371
3359
|
if (t.beginPath(), !i || i === "rectangle")
|
|
3372
|
-
t.rect(
|
|
3360
|
+
t.rect(a, l, n, o);
|
|
3373
3361
|
else if (i === "circle") {
|
|
3374
|
-
const
|
|
3375
|
-
t.arc(
|
|
3362
|
+
const s = a + n / 2, c = l + o / 2, h = Math.min(n, o) / 2;
|
|
3363
|
+
t.arc(s, c, h, 0, Math.PI * 2);
|
|
3376
3364
|
} else if (typeof i == "object" && i.type === "rounded") {
|
|
3377
|
-
const
|
|
3378
|
-
typeof t.roundRect == "function" ? t.roundRect(
|
|
3365
|
+
const s = Math.min(i.radius, Math.min(n, o) / 2);
|
|
3366
|
+
typeof t.roundRect == "function" ? t.roundRect(a, l, n, o, s) : (t.moveTo(a + s, l), t.lineTo(a + n - s, l), t.arcTo(a + n, l, a + n, l + s, s), t.lineTo(a + n, l + o - s), t.arcTo(a + n, l + o, a + n - s, l + o, s), t.lineTo(a + s, l + o), t.arcTo(a, l + o, a, l + o - s, s), t.lineTo(a, l + s), t.arcTo(a, l, a + s, l, s));
|
|
3379
3367
|
} else if (typeof i == "object" && i.type === "path")
|
|
3380
3368
|
try {
|
|
3381
|
-
const
|
|
3382
|
-
t.clip(
|
|
3369
|
+
const s = new Path2D(i.d);
|
|
3370
|
+
t.clip(s);
|
|
3383
3371
|
return;
|
|
3384
|
-
} catch (
|
|
3385
|
-
_.warn("Invalid SVG path, falling back to rectangle:",
|
|
3372
|
+
} catch (s) {
|
|
3373
|
+
_.warn("Invalid SVG path, falling back to rectangle:", s), t.rect(a, l, n, o);
|
|
3386
3374
|
}
|
|
3387
3375
|
t.clip();
|
|
3388
3376
|
}
|
|
@@ -3391,22 +3379,22 @@ const ct = class ct {
|
|
|
3391
3379
|
* This creates the clip region for the given artboard during export
|
|
3392
3380
|
*/
|
|
3393
3381
|
static applyExportClipPath(t, r) {
|
|
3394
|
-
const { x: n, y: o, width: i, height:
|
|
3382
|
+
const { x: n, y: o, width: i, height: a, clipShape: l } = r;
|
|
3395
3383
|
if (t.beginPath(), !l || l === "rectangle")
|
|
3396
|
-
t.rect(n, o, i,
|
|
3384
|
+
t.rect(n, o, i, a);
|
|
3397
3385
|
else if (l === "circle") {
|
|
3398
|
-
const
|
|
3399
|
-
t.arc(
|
|
3386
|
+
const s = n + i / 2, c = o + a / 2, h = Math.min(i, a) / 2;
|
|
3387
|
+
t.arc(s, c, h, 0, Math.PI * 2);
|
|
3400
3388
|
} else if (typeof l == "object" && l.type === "rounded") {
|
|
3401
|
-
const
|
|
3402
|
-
typeof t.roundRect == "function" ? t.roundRect(n, o, i,
|
|
3389
|
+
const s = Math.min(l.radius, Math.min(i, a) / 2);
|
|
3390
|
+
typeof t.roundRect == "function" ? t.roundRect(n, o, i, a, s) : (t.moveTo(n + s, o), t.lineTo(n + i - s, o), t.arcTo(n + i, o, n + i, o + s, s), t.lineTo(n + i, o + a - s), t.arcTo(n + i, o + a, n + i - s, o + a, s), t.lineTo(n + s, o + a), t.arcTo(n, o + a, n, o + a - s, s), t.lineTo(n, o + s), t.arcTo(n, o, n + s, o, s));
|
|
3403
3391
|
} else if (typeof l == "object" && l.type === "path")
|
|
3404
3392
|
try {
|
|
3405
|
-
const
|
|
3406
|
-
t.translate(n, o), t.clip(
|
|
3393
|
+
const s = new Path2D(l.d);
|
|
3394
|
+
t.translate(n, o), t.clip(s), t.translate(-n, -o);
|
|
3407
3395
|
return;
|
|
3408
|
-
} catch (
|
|
3409
|
-
_.warn("Invalid SVG path, falling back to rectangle:",
|
|
3396
|
+
} catch (s) {
|
|
3397
|
+
_.warn("Invalid SVG path, falling back to rectangle:", s), t.rect(n, o, i, a);
|
|
3410
3398
|
}
|
|
3411
3399
|
t.clip();
|
|
3412
3400
|
}
|
|
@@ -3415,9 +3403,9 @@ const ct = class ct {
|
|
|
3415
3403
|
*/
|
|
3416
3404
|
static async exportAllArtboardsToImages(t, r, n, o = {}) {
|
|
3417
3405
|
const i = t.map(
|
|
3418
|
-
(
|
|
3406
|
+
(a) => this.exportArtboardToImage(a, r, n, {
|
|
3419
3407
|
...o,
|
|
3420
|
-
filename: o.filename ? `${o.filename}-${
|
|
3408
|
+
filename: o.filename ? `${o.filename}-${a.name}.${o.format || "png"}` : void 0
|
|
3421
3409
|
})
|
|
3422
3410
|
);
|
|
3423
3411
|
await Promise.all(i);
|
|
@@ -3439,11 +3427,11 @@ const ct = class ct {
|
|
|
3439
3427
|
* Get export summary (for UI display)
|
|
3440
3428
|
*/
|
|
3441
3429
|
static getExportSummary(t, r) {
|
|
3442
|
-
const n = t.length, o = r.length, l = n * 200 + o * 500,
|
|
3430
|
+
const n = t.length, o = r.length, l = n * 200 + o * 500, s = Math.ceil(l / 1024);
|
|
3443
3431
|
return {
|
|
3444
3432
|
artboardCount: n,
|
|
3445
3433
|
totalElementCount: o,
|
|
3446
|
-
estimatedFileSize:
|
|
3434
|
+
estimatedFileSize: s < 1024 ? `${s} KB` : `${(s / 1024).toFixed(1)} MB`
|
|
3447
3435
|
};
|
|
3448
3436
|
}
|
|
3449
3437
|
/**
|
|
@@ -3451,14 +3439,14 @@ const ct = class ct {
|
|
|
3451
3439
|
* Returns timing data for both methods
|
|
3452
3440
|
*/
|
|
3453
3441
|
static async benchmarkExport(t, r, n, o = {}) {
|
|
3454
|
-
const i = performance.now(),
|
|
3442
|
+
const i = performance.now(), a = await this.exportArtboardToDataURL(t, r, n, {
|
|
3455
3443
|
...o,
|
|
3456
3444
|
forceMainThread: !0
|
|
3457
|
-
}), l = performance.now() - i,
|
|
3445
|
+
}), l = performance.now() - i, s = {
|
|
3458
3446
|
workerSupported: this.supportsWorkerExport(),
|
|
3459
3447
|
mainThread: {
|
|
3460
3448
|
time: l,
|
|
3461
|
-
dataUrl:
|
|
3449
|
+
dataUrl: a
|
|
3462
3450
|
},
|
|
3463
3451
|
recommendation: ""
|
|
3464
3452
|
};
|
|
@@ -3466,28 +3454,28 @@ const ct = class ct {
|
|
|
3466
3454
|
try {
|
|
3467
3455
|
const c = performance.now(), h = await this.getWorkerManager();
|
|
3468
3456
|
if (h) {
|
|
3469
|
-
const f = new Set(t.getElementIds()), u = r.filter((
|
|
3457
|
+
const f = new Set(t.getElementIds()), u = r.filter((w) => f.has(w.id)), d = await h.exportArtboardToDataURL(t, u, {
|
|
3470
3458
|
scale: o.scale || 1,
|
|
3471
3459
|
format: (o.format === "jpg" ? "jpeg" : o.format) || "png",
|
|
3472
3460
|
quality: o.quality || 0.95
|
|
3473
|
-
}),
|
|
3461
|
+
}), p = performance.now() - c, m = l / p;
|
|
3474
3462
|
return {
|
|
3475
|
-
...
|
|
3463
|
+
...s,
|
|
3476
3464
|
worker: {
|
|
3477
|
-
time:
|
|
3465
|
+
time: p,
|
|
3478
3466
|
dataUrl: d.dataUrl,
|
|
3479
3467
|
mainThreadBlockTime: d.mainThreadBlockTime
|
|
3480
3468
|
},
|
|
3481
|
-
speedup:
|
|
3482
|
-
recommendation:
|
|
3469
|
+
speedup: m,
|
|
3470
|
+
recommendation: m > 1.2 ? `Worker export is ${m.toFixed(2)}x faster - recommended for continuous export` : m < 0.8 ? `Main thread export is ${(1 / m).toFixed(2)}x faster - worker overhead not worth it for single exports` : "Performance is similar, but worker keeps UI responsive during export"
|
|
3483
3471
|
};
|
|
3484
3472
|
}
|
|
3485
3473
|
} catch (c) {
|
|
3486
|
-
_.error("Worker benchmark failed:", c),
|
|
3474
|
+
_.error("Worker benchmark failed:", c), s.recommendation = "Worker export not available - using main thread export";
|
|
3487
3475
|
}
|
|
3488
3476
|
else
|
|
3489
|
-
|
|
3490
|
-
return
|
|
3477
|
+
s.recommendation = "Worker export not supported in this browser - using main thread export";
|
|
3478
|
+
return s;
|
|
3491
3479
|
}
|
|
3492
3480
|
/**
|
|
3493
3481
|
* Performance benchmark: Test continuous exports to measure UI impact
|
|
@@ -3497,31 +3485,31 @@ const ct = class ct {
|
|
|
3497
3485
|
const {
|
|
3498
3486
|
duration: i = 5e3,
|
|
3499
3487
|
// 5 seconds
|
|
3500
|
-
interval:
|
|
3488
|
+
interval: a = 500,
|
|
3501
3489
|
// Every 500ms
|
|
3502
3490
|
useWorker: l = this.supportsWorkerExport()
|
|
3503
|
-
} = o,
|
|
3491
|
+
} = o, s = [];
|
|
3504
3492
|
let c = 0, h = !0;
|
|
3505
3493
|
for (setTimeout(() => {
|
|
3506
3494
|
h = !1;
|
|
3507
3495
|
}, i); h; ) {
|
|
3508
|
-
const
|
|
3496
|
+
const b = performance.now();
|
|
3509
3497
|
await this.exportArtboardToDataURL(t, r, n, {
|
|
3510
3498
|
forceMainThread: !l
|
|
3511
3499
|
});
|
|
3512
|
-
const
|
|
3513
|
-
|
|
3500
|
+
const T = performance.now() - b;
|
|
3501
|
+
s.push(T), l || (c += T), await new Promise((g) => setTimeout(g, Math.max(0, a - T)));
|
|
3514
3502
|
}
|
|
3515
|
-
const f =
|
|
3503
|
+
const f = s.length, u = s.reduce((b, T) => b + T, 0) / f, d = Math.min(...s), p = Math.max(...s), m = f / i * 1e3, w = c / i * 100, k = w > 20 ? `Main thread blocked ${w.toFixed(1)}% of the time - STRONGLY recommend worker export` : w > 10 ? `Main thread blocked ${w.toFixed(1)}% of the time - consider worker export` : `Main thread blocked ${w.toFixed(1)}% of the time - performance is acceptable`;
|
|
3516
3504
|
return {
|
|
3517
3505
|
totalExports: f,
|
|
3518
3506
|
duration: i,
|
|
3519
3507
|
averageTime: u,
|
|
3520
3508
|
minTime: d,
|
|
3521
|
-
maxTime:
|
|
3509
|
+
maxTime: p,
|
|
3522
3510
|
totalMainThreadBlockTime: c,
|
|
3523
|
-
exportsPerSecond:
|
|
3524
|
-
recommendation:
|
|
3511
|
+
exportsPerSecond: m,
|
|
3512
|
+
recommendation: k
|
|
3525
3513
|
};
|
|
3526
3514
|
}
|
|
3527
3515
|
/**
|
|
@@ -3593,66 +3581,66 @@ const ct = class ct {
|
|
|
3593
3581
|
return "previewBackgroundColor" in r && delete r.previewBackgroundColor, r;
|
|
3594
3582
|
}
|
|
3595
3583
|
};
|
|
3596
|
-
|
|
3597
|
-
let
|
|
3598
|
-
const
|
|
3584
|
+
lt.CURRENT_VERSION = "2.0.0", lt.workerManager = null, lt.workerInitPromise = null;
|
|
3585
|
+
let Tt = lt;
|
|
3586
|
+
const go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3599
3587
|
__proto__: null,
|
|
3600
|
-
ExportManager:
|
|
3601
|
-
default:
|
|
3588
|
+
ExportManager: Tt,
|
|
3589
|
+
default: Tt
|
|
3602
3590
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3603
3591
|
export {
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3592
|
+
fe as A,
|
|
3593
|
+
uo as B,
|
|
3594
|
+
Ye as C,
|
|
3595
|
+
Ge as D,
|
|
3596
|
+
wt as E,
|
|
3597
|
+
Wr as F,
|
|
3598
|
+
Xt as G,
|
|
3599
|
+
ho as H,
|
|
3600
|
+
be as I,
|
|
3601
|
+
Vn as J,
|
|
3602
|
+
Yn as K,
|
|
3603
|
+
qe as L,
|
|
3604
|
+
Mn as M,
|
|
3605
|
+
On as N,
|
|
3606
|
+
Tn as O,
|
|
3607
|
+
zt as P,
|
|
3620
3608
|
ye as Q,
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3609
|
+
zn as R,
|
|
3610
|
+
Un as S,
|
|
3611
|
+
pt as T,
|
|
3612
|
+
Rn as U,
|
|
3613
|
+
io as V,
|
|
3614
|
+
ft as W,
|
|
3615
|
+
dn as X,
|
|
3616
|
+
fn as Y,
|
|
3629
3617
|
kr as Z,
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3618
|
+
go as _,
|
|
3619
|
+
Tt as a,
|
|
3620
|
+
eo as b,
|
|
3633
3621
|
Ie as c,
|
|
3634
3622
|
q as d,
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3623
|
+
lo as e,
|
|
3624
|
+
so as f,
|
|
3625
|
+
jt as g,
|
|
3626
|
+
Dn as h,
|
|
3627
|
+
Mr as i,
|
|
3628
|
+
xn as j,
|
|
3629
|
+
Zn as k,
|
|
3630
|
+
ct as l,
|
|
3631
|
+
fo as m,
|
|
3632
|
+
ao as n,
|
|
3633
|
+
Jn as o,
|
|
3634
|
+
ae as p,
|
|
3635
|
+
co as q,
|
|
3636
|
+
Cr as r,
|
|
3637
|
+
Ut as s,
|
|
3638
|
+
ro as t,
|
|
3639
|
+
to as u,
|
|
3640
|
+
Ar as v,
|
|
3641
|
+
no as w,
|
|
3642
|
+
Rr as x,
|
|
3655
3643
|
Ae as y,
|
|
3656
|
-
|
|
3644
|
+
oo as z
|
|
3657
3645
|
};
|
|
3658
|
-
//# sourceMappingURL=ExportManager-
|
|
3646
|
+
//# sourceMappingURL=ExportManager-vAuaoF5Q.js.map
|