@camstack/addon-pipeline-orchestrator 0.1.27 → 0.2.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.
Files changed (72) hide show
  1. package/dist/_stub.js +982 -1057
  2. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-BujnAycE.mjs +186 -0
  3. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DTMQMZQR.mjs +26 -0
  4. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CnELcfi3.mjs +26 -0
  5. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BiLBDmU5.mjs +26 -0
  6. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-CBokMOYQ.mjs +26 -0
  7. package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs +26 -0
  8. package/dist/dist-CYZr2fwk.mjs +2726 -0
  9. package/dist/hostInit-DQm6ksLo.mjs +147 -0
  10. package/dist/index.js +25596 -18552
  11. package/dist/index.mjs +25592 -18556
  12. package/dist/remoteEntry.js +134 -2973
  13. package/dist/remoteEntry.ssr.js +33 -0
  14. package/dist/virtualExposes-Bv3e5bey.mjs +27 -0
  15. package/dist/virtual_mf-exposes-ssr___mfe_internal__addon_pipeline_orchestrator_widgets__remoteEntry_js-DGpOm1yU.mjs +10 -0
  16. package/package.json +8 -9
  17. package/dist/@mf-types/compiled-types/widgets/PipelineQuickStats.d.ts +0 -3
  18. package/dist/@mf-types/compiled-types/widgets/PipelineQuickStats.d.ts.map +0 -1
  19. package/dist/@mf-types/compiled-types/widgets/ZoneEditor.d.ts +0 -17
  20. package/dist/@mf-types/compiled-types/widgets/ZoneEditor.d.ts.map +0 -1
  21. package/dist/@mf-types/compiled-types/widgets/ZonesTab.d.ts +0 -7
  22. package/dist/@mf-types/compiled-types/widgets/ZonesTab.d.ts.map +0 -1
  23. package/dist/@mf-types/compiled-types/widgets/index.d.ts +0 -13
  24. package/dist/@mf-types/compiled-types/widgets/index.d.ts.map +0 -1
  25. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneForm.d.ts +0 -23
  26. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneForm.d.ts.map +0 -1
  27. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts +0 -15
  28. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts.map +0 -1
  29. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneOverlay.d.ts +0 -19
  30. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneOverlay.d.ts.map +0 -1
  31. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneRulesEditor.d.ts +0 -9
  32. package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneRulesEditor.d.ts.map +0 -1
  33. package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts +0 -33
  34. package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts.map +0 -1
  35. package/dist/@mf-types/widgets.d.ts +0 -2
  36. package/dist/@mf-types.d.ts +0 -3
  37. package/dist/@mf-types.zip +0 -0
  38. package/dist/ReactKonva-BpqYt5jc.mjs +0 -7267
  39. package/dist/_CoreInternals-B7PHssO3.mjs +0 -3808
  40. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-h5aXOPSA.mjs +0 -12
  41. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CP1zJ0aB.mjs +0 -20
  42. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-B1VWqPID.mjs +0 -35
  43. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs +0 -104
  44. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-D4eEXltm.mjs +0 -85
  45. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-CVrnrGED.mjs +0 -62
  46. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__konva__loadShare__.mjs-C4PYo-VP.mjs +0 -30
  47. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-ZXZUECVq.mjs +0 -88
  48. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-WhBt7NtJ.mjs +0 -29
  49. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs +0 -36
  50. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs-Dp8hqYOB.mjs +0 -45
  51. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-DF7SvkCe.mjs +0 -6
  52. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BBmNf5hf.mjs +0 -34
  53. package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-BjxkVuVo.mjs +0 -65
  54. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-zq9nTFza.mjs +0 -186
  55. package/dist/client-BOhSywdX.mjs +0 -9836
  56. package/dist/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +0 -211
  57. package/dist/hostInit-Cn3hiNRr.mjs +0 -196
  58. package/dist/index-3tmcVweY.mjs +0 -435
  59. package/dist/index-Bx39JFVr.mjs +0 -2603
  60. package/dist/index-C52WDzRJ.mjs +0 -3842
  61. package/dist/index-CWkKuNLr.mjs +0 -232
  62. package/dist/index-C_khSbT0.mjs +0 -1655
  63. package/dist/index-D4m79gq7.mjs +0 -185
  64. package/dist/index-D_QOQy3W.mjs +0 -22990
  65. package/dist/index-Dy2V7VOm.mjs +0 -14379
  66. package/dist/index-kp_mtnZv.mjs +0 -725
  67. package/dist/index-xncRG7-x.mjs +0 -2713
  68. package/dist/index.js.map +0 -1
  69. package/dist/index.mjs.map +0 -1
  70. package/dist/jsx-runtime-ChcQDQxt.mjs +0 -55
  71. package/dist/schemas-ClCuS4qa.mjs +0 -3594
  72. package/dist/virtualExposes-8FzWTdq3.mjs +0 -42
@@ -1,3842 +0,0 @@
1
- import { S as $, K as j, _ as V, F as u, g as T, a as Gt, b as re, U as O, c as yt, G as At, A as oe, d as Ut, e as ae, T as ct, N as B, R as jt, f as Et } from "./_CoreInternals-B7PHssO3.mjs";
2
- class J extends $ {
3
- _sceneFunc(t) {
4
- const e = j.getAngle(this.angle()), i = this.clockwise();
5
- t.beginPath(), t.arc(0, 0, this.outerRadius(), 0, e, i), t.arc(0, 0, this.innerRadius(), e, 0, !i), t.closePath(), t.fillStrokeShape(this);
6
- }
7
- getWidth() {
8
- return this.outerRadius() * 2;
9
- }
10
- getHeight() {
11
- return this.outerRadius() * 2;
12
- }
13
- setWidth(t) {
14
- this.outerRadius(t / 2);
15
- }
16
- setHeight(t) {
17
- this.outerRadius(t / 2);
18
- }
19
- getSelfRect() {
20
- const t = this.innerRadius(), e = this.outerRadius(), i = this.clockwise(), n = j.getAngle(i ? 360 - this.angle() : this.angle()), r = Math.cos(Math.min(n, Math.PI)), o = 1, s = Math.sin(Math.min(Math.max(Math.PI, n), 3 * Math.PI / 2)), a = Math.sin(Math.min(n, Math.PI / 2)), d = r * (r > 0 ? t : e), l = o * e, g = s * (s > 0 ? t : e), c = a * (a > 0 ? e : t);
21
- return {
22
- x: d,
23
- y: i ? -1 * c : g,
24
- width: l - d,
25
- height: c - g
26
- };
27
- }
28
- }
29
- J.prototype._centroid = !0;
30
- J.prototype.className = "Arc";
31
- J.prototype._attrsAffectingSize = [
32
- "innerRadius",
33
- "outerRadius",
34
- "angle",
35
- "clockwise"
36
- ];
37
- V(J);
38
- u.addGetterSetter(J, "innerRadius", 0, T());
39
- u.addGetterSetter(J, "outerRadius", 0, T());
40
- u.addGetterSetter(J, "angle", 0, T());
41
- u.addGetterSetter(J, "clockwise", !1, Gt());
42
- function wt(h, t, e, i, n, r, o) {
43
- const s = Math.sqrt(Math.pow(e - h, 2) + Math.pow(i - t, 2)), a = Math.sqrt(Math.pow(n - e, 2) + Math.pow(r - i, 2)), d = o * s / (s + a), l = o * a / (s + a), g = e - d * (n - h), c = i - d * (r - t), p = e + l * (n - h), f = i + l * (r - t);
44
- return [g, c, p, f];
45
- }
46
- function Nt(h, t) {
47
- const e = h.length, i = [];
48
- for (let n = 2; n < e - 2; n += 2) {
49
- const r = wt(h[n - 2], h[n - 1], h[n], h[n + 1], h[n + 2], h[n + 3], t);
50
- isNaN(r[0]) || (i.push(r[0]), i.push(r[1]), i.push(h[n]), i.push(h[n + 1]), i.push(r[2]), i.push(r[3]));
51
- }
52
- return i;
53
- }
54
- function he(h) {
55
- const t = [
56
- [h[0], h[2], h[4], h[6]],
57
- [h[1], h[3], h[5], h[7]]
58
- ], e = [];
59
- for (const i of t) {
60
- const n = -3 * i[0] + 9 * i[1] - 9 * i[2] + 3 * i[3];
61
- if (n !== 0) {
62
- const r = 6 * i[0] - 12 * i[1] + 6 * i[2], o = -3 * i[0] + 3 * i[1], s = r * r - 4 * n * o;
63
- if (s >= 0) {
64
- const a = Math.sqrt(s);
65
- e.push((-r + a) / (2 * n)), e.push((-r - a) / (2 * n));
66
- }
67
- }
68
- }
69
- return e.filter((i) => i > 0 && i < 1).flatMap((i) => t.map((n) => {
70
- const r = 1 - i;
71
- return r * r * r * n[0] + 3 * r * r * i * n[1] + 3 * r * i * i * n[2] + i * i * i * n[3];
72
- }));
73
- }
74
- class tt extends $ {
75
- constructor(t) {
76
- super(t), this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva", function() {
77
- this._clearCache("tensionPoints");
78
- });
79
- }
80
- _sceneFunc(t) {
81
- const e = this.points(), i = e.length, n = this.tension(), r = this.closed(), o = this.bezier();
82
- if (!i)
83
- return;
84
- let s = 0;
85
- if (t.beginPath(), t.moveTo(e[0], e[1]), n !== 0 && i > 4) {
86
- const a = this.getTensionPoints(), d = a.length;
87
- for (s = r ? 0 : 4, r || t.quadraticCurveTo(a[0], a[1], a[2], a[3]); s < d - 2; )
88
- t.bezierCurveTo(a[s++], a[s++], a[s++], a[s++], a[s++], a[s++]);
89
- r || t.quadraticCurveTo(a[d - 2], a[d - 1], e[i - 2], e[i - 1]);
90
- } else if (o)
91
- for (s = 2; s < i; )
92
- t.bezierCurveTo(e[s++], e[s++], e[s++], e[s++], e[s++], e[s++]);
93
- else
94
- for (s = 2; s < i; s += 2)
95
- t.lineTo(e[s], e[s + 1]);
96
- r ? (t.closePath(), t.fillStrokeShape(this)) : t.strokeShape(this);
97
- }
98
- getTensionPoints() {
99
- return this._getCache("tensionPoints", this._getTensionPoints);
100
- }
101
- _getTensionPoints() {
102
- return this.closed() ? this._getTensionPointsClosed() : Nt(this.points(), this.tension());
103
- }
104
- _getTensionPointsClosed() {
105
- const t = this.points(), e = t.length, i = this.tension(), n = wt(t[e - 2], t[e - 1], t[0], t[1], t[2], t[3], i), r = wt(t[e - 4], t[e - 3], t[e - 2], t[e - 1], t[0], t[1], i), o = Nt(t, i);
106
- return [n[2], n[3]].concat(o).concat([
107
- r[0],
108
- r[1],
109
- t[e - 2],
110
- t[e - 1],
111
- r[2],
112
- r[3],
113
- n[0],
114
- n[1],
115
- t[0],
116
- t[1]
117
- ]);
118
- }
119
- getWidth() {
120
- return this.getSelfRect().width;
121
- }
122
- getHeight() {
123
- return this.getSelfRect().height;
124
- }
125
- getSelfRect() {
126
- let t = this.points();
127
- if (t.length < 4)
128
- return {
129
- x: t[0] || 0,
130
- y: t[1] || 0,
131
- width: 0,
132
- height: 0
133
- };
134
- this.tension() !== 0 ? t = [
135
- t[0],
136
- t[1],
137
- ...this._getTensionPoints(),
138
- t[t.length - 2],
139
- t[t.length - 1]
140
- ] : this.bezier() ? t = [
141
- t[0],
142
- t[1],
143
- ...he(this.points()),
144
- t[t.length - 2],
145
- t[t.length - 1]
146
- ] : t = this.points();
147
- let e = t[0], i = t[0], n = t[1], r = t[1], o, s;
148
- for (let a = 0; a < t.length / 2; a++)
149
- o = t[a * 2], s = t[a * 2 + 1], e = Math.min(e, o), i = Math.max(i, o), n = Math.min(n, s), r = Math.max(r, s);
150
- return {
151
- x: e,
152
- y: n,
153
- width: i - e,
154
- height: r - n
155
- };
156
- }
157
- }
158
- tt.prototype.className = "Line";
159
- tt.prototype._attrsAffectingSize = ["points", "bezier", "tension"];
160
- V(tt);
161
- u.addGetterSetter(tt, "closed", !1);
162
- u.addGetterSetter(tt, "bezier", !1);
163
- u.addGetterSetter(tt, "tension", 0, T());
164
- u.addGetterSetter(tt, "points", [], re());
165
- const le = [
166
- [],
167
- [],
168
- [
169
- -0.5773502691896257,
170
- 0.5773502691896257
171
- ],
172
- [
173
- 0,
174
- -0.7745966692414834,
175
- 0.7745966692414834
176
- ],
177
- [
178
- -0.33998104358485626,
179
- 0.33998104358485626,
180
- -0.8611363115940526,
181
- 0.8611363115940526
182
- ],
183
- [
184
- 0,
185
- -0.5384693101056831,
186
- 0.5384693101056831,
187
- -0.906179845938664,
188
- 0.906179845938664
189
- ],
190
- [
191
- 0.6612093864662645,
192
- -0.6612093864662645,
193
- -0.2386191860831969,
194
- 0.2386191860831969,
195
- -0.932469514203152,
196
- 0.932469514203152
197
- ],
198
- [
199
- 0,
200
- 0.4058451513773972,
201
- -0.4058451513773972,
202
- -0.7415311855993945,
203
- 0.7415311855993945,
204
- -0.9491079123427585,
205
- 0.9491079123427585
206
- ],
207
- [
208
- -0.1834346424956498,
209
- 0.1834346424956498,
210
- -0.525532409916329,
211
- 0.525532409916329,
212
- -0.7966664774136267,
213
- 0.7966664774136267,
214
- -0.9602898564975363,
215
- 0.9602898564975363
216
- ],
217
- [
218
- 0,
219
- -0.8360311073266358,
220
- 0.8360311073266358,
221
- -0.9681602395076261,
222
- 0.9681602395076261,
223
- -0.3242534234038089,
224
- 0.3242534234038089,
225
- -0.6133714327005904,
226
- 0.6133714327005904
227
- ],
228
- [
229
- -0.14887433898163122,
230
- 0.14887433898163122,
231
- -0.4333953941292472,
232
- 0.4333953941292472,
233
- -0.6794095682990244,
234
- 0.6794095682990244,
235
- -0.8650633666889845,
236
- 0.8650633666889845,
237
- -0.9739065285171717,
238
- 0.9739065285171717
239
- ],
240
- [
241
- 0,
242
- -0.26954315595234496,
243
- 0.26954315595234496,
244
- -0.5190961292068118,
245
- 0.5190961292068118,
246
- -0.7301520055740494,
247
- 0.7301520055740494,
248
- -0.8870625997680953,
249
- 0.8870625997680953,
250
- -0.978228658146057,
251
- 0.978228658146057
252
- ],
253
- [
254
- -0.1252334085114689,
255
- 0.1252334085114689,
256
- -0.3678314989981802,
257
- 0.3678314989981802,
258
- -0.5873179542866175,
259
- 0.5873179542866175,
260
- -0.7699026741943047,
261
- 0.7699026741943047,
262
- -0.9041172563704749,
263
- 0.9041172563704749,
264
- -0.9815606342467192,
265
- 0.9815606342467192
266
- ],
267
- [
268
- 0,
269
- -0.2304583159551348,
270
- 0.2304583159551348,
271
- -0.44849275103644687,
272
- 0.44849275103644687,
273
- -0.6423493394403402,
274
- 0.6423493394403402,
275
- -0.8015780907333099,
276
- 0.8015780907333099,
277
- -0.9175983992229779,
278
- 0.9175983992229779,
279
- -0.9841830547185881,
280
- 0.9841830547185881
281
- ],
282
- [
283
- -0.10805494870734367,
284
- 0.10805494870734367,
285
- -0.31911236892788974,
286
- 0.31911236892788974,
287
- -0.5152486363581541,
288
- 0.5152486363581541,
289
- -0.6872929048116855,
290
- 0.6872929048116855,
291
- -0.827201315069765,
292
- 0.827201315069765,
293
- -0.9284348836635735,
294
- 0.9284348836635735,
295
- -0.9862838086968123,
296
- 0.9862838086968123
297
- ],
298
- [
299
- 0,
300
- -0.20119409399743451,
301
- 0.20119409399743451,
302
- -0.3941513470775634,
303
- 0.3941513470775634,
304
- -0.5709721726085388,
305
- 0.5709721726085388,
306
- -0.7244177313601701,
307
- 0.7244177313601701,
308
- -0.8482065834104272,
309
- 0.8482065834104272,
310
- -0.937273392400706,
311
- 0.937273392400706,
312
- -0.9879925180204854,
313
- 0.9879925180204854
314
- ],
315
- [
316
- -0.09501250983763744,
317
- 0.09501250983763744,
318
- -0.2816035507792589,
319
- 0.2816035507792589,
320
- -0.45801677765722737,
321
- 0.45801677765722737,
322
- -0.6178762444026438,
323
- 0.6178762444026438,
324
- -0.755404408355003,
325
- 0.755404408355003,
326
- -0.8656312023878318,
327
- 0.8656312023878318,
328
- -0.9445750230732326,
329
- 0.9445750230732326,
330
- -0.9894009349916499,
331
- 0.9894009349916499
332
- ],
333
- [
334
- 0,
335
- -0.17848418149584785,
336
- 0.17848418149584785,
337
- -0.3512317634538763,
338
- 0.3512317634538763,
339
- -0.5126905370864769,
340
- 0.5126905370864769,
341
- -0.6576711592166907,
342
- 0.6576711592166907,
343
- -0.7815140038968014,
344
- 0.7815140038968014,
345
- -0.8802391537269859,
346
- 0.8802391537269859,
347
- -0.9506755217687678,
348
- 0.9506755217687678,
349
- -0.9905754753144174,
350
- 0.9905754753144174
351
- ],
352
- [
353
- -0.0847750130417353,
354
- 0.0847750130417353,
355
- -0.2518862256915055,
356
- 0.2518862256915055,
357
- -0.41175116146284263,
358
- 0.41175116146284263,
359
- -0.5597708310739475,
360
- 0.5597708310739475,
361
- -0.6916870430603532,
362
- 0.6916870430603532,
363
- -0.8037049589725231,
364
- 0.8037049589725231,
365
- -0.8926024664975557,
366
- 0.8926024664975557,
367
- -0.9558239495713977,
368
- 0.9558239495713977,
369
- -0.9915651684209309,
370
- 0.9915651684209309
371
- ],
372
- [
373
- 0,
374
- -0.16035864564022537,
375
- 0.16035864564022537,
376
- -0.31656409996362983,
377
- 0.31656409996362983,
378
- -0.46457074137596094,
379
- 0.46457074137596094,
380
- -0.600545304661681,
381
- 0.600545304661681,
382
- -0.7209661773352294,
383
- 0.7209661773352294,
384
- -0.8227146565371428,
385
- 0.8227146565371428,
386
- -0.9031559036148179,
387
- 0.9031559036148179,
388
- -0.96020815213483,
389
- 0.96020815213483,
390
- -0.9924068438435844,
391
- 0.9924068438435844
392
- ],
393
- [
394
- -0.07652652113349734,
395
- 0.07652652113349734,
396
- -0.22778585114164507,
397
- 0.22778585114164507,
398
- -0.37370608871541955,
399
- 0.37370608871541955,
400
- -0.5108670019508271,
401
- 0.5108670019508271,
402
- -0.636053680726515,
403
- 0.636053680726515,
404
- -0.7463319064601508,
405
- 0.7463319064601508,
406
- -0.8391169718222188,
407
- 0.8391169718222188,
408
- -0.912234428251326,
409
- 0.912234428251326,
410
- -0.9639719272779138,
411
- 0.9639719272779138,
412
- -0.9931285991850949,
413
- 0.9931285991850949
414
- ],
415
- [
416
- 0,
417
- -0.1455618541608951,
418
- 0.1455618541608951,
419
- -0.2880213168024011,
420
- 0.2880213168024011,
421
- -0.4243421202074388,
422
- 0.4243421202074388,
423
- -0.5516188358872198,
424
- 0.5516188358872198,
425
- -0.6671388041974123,
426
- 0.6671388041974123,
427
- -0.7684399634756779,
428
- 0.7684399634756779,
429
- -0.8533633645833173,
430
- 0.8533633645833173,
431
- -0.9200993341504008,
432
- 0.9200993341504008,
433
- -0.9672268385663063,
434
- 0.9672268385663063,
435
- -0.9937521706203895,
436
- 0.9937521706203895
437
- ],
438
- [
439
- -0.06973927331972223,
440
- 0.06973927331972223,
441
- -0.20786042668822127,
442
- 0.20786042668822127,
443
- -0.34193582089208424,
444
- 0.34193582089208424,
445
- -0.469355837986757,
446
- 0.469355837986757,
447
- -0.5876404035069116,
448
- 0.5876404035069116,
449
- -0.6944872631866827,
450
- 0.6944872631866827,
451
- -0.7878168059792081,
452
- 0.7878168059792081,
453
- -0.8658125777203002,
454
- 0.8658125777203002,
455
- -0.926956772187174,
456
- 0.926956772187174,
457
- -0.9700604978354287,
458
- 0.9700604978354287,
459
- -0.9942945854823992,
460
- 0.9942945854823992
461
- ],
462
- [
463
- 0,
464
- -0.1332568242984661,
465
- 0.1332568242984661,
466
- -0.26413568097034495,
467
- 0.26413568097034495,
468
- -0.3903010380302908,
469
- 0.3903010380302908,
470
- -0.5095014778460075,
471
- 0.5095014778460075,
472
- -0.6196098757636461,
473
- 0.6196098757636461,
474
- -0.7186613631319502,
475
- 0.7186613631319502,
476
- -0.8048884016188399,
477
- 0.8048884016188399,
478
- -0.8767523582704416,
479
- 0.8767523582704416,
480
- -0.9329710868260161,
481
- 0.9329710868260161,
482
- -0.9725424712181152,
483
- 0.9725424712181152,
484
- -0.9947693349975522,
485
- 0.9947693349975522
486
- ],
487
- [
488
- -0.06405689286260563,
489
- 0.06405689286260563,
490
- -0.1911188674736163,
491
- 0.1911188674736163,
492
- -0.3150426796961634,
493
- 0.3150426796961634,
494
- -0.4337935076260451,
495
- 0.4337935076260451,
496
- -0.5454214713888396,
497
- 0.5454214713888396,
498
- -0.6480936519369755,
499
- 0.6480936519369755,
500
- -0.7401241915785544,
501
- 0.7401241915785544,
502
- -0.820001985973903,
503
- 0.820001985973903,
504
- -0.8864155270044011,
505
- 0.8864155270044011,
506
- -0.9382745520027328,
507
- 0.9382745520027328,
508
- -0.9747285559713095,
509
- 0.9747285559713095,
510
- -0.9951872199970213,
511
- 0.9951872199970213
512
- ]
513
- ], de = [
514
- [],
515
- [],
516
- [1, 1],
517
- [
518
- 0.8888888888888888,
519
- 0.5555555555555556,
520
- 0.5555555555555556
521
- ],
522
- [
523
- 0.6521451548625461,
524
- 0.6521451548625461,
525
- 0.34785484513745385,
526
- 0.34785484513745385
527
- ],
528
- [
529
- 0.5688888888888889,
530
- 0.47862867049936647,
531
- 0.47862867049936647,
532
- 0.23692688505618908,
533
- 0.23692688505618908
534
- ],
535
- [
536
- 0.3607615730481386,
537
- 0.3607615730481386,
538
- 0.46791393457269104,
539
- 0.46791393457269104,
540
- 0.17132449237917036,
541
- 0.17132449237917036
542
- ],
543
- [
544
- 0.4179591836734694,
545
- 0.3818300505051189,
546
- 0.3818300505051189,
547
- 0.27970539148927664,
548
- 0.27970539148927664,
549
- 0.1294849661688697,
550
- 0.1294849661688697
551
- ],
552
- [
553
- 0.362683783378362,
554
- 0.362683783378362,
555
- 0.31370664587788727,
556
- 0.31370664587788727,
557
- 0.22238103445337448,
558
- 0.22238103445337448,
559
- 0.10122853629037626,
560
- 0.10122853629037626
561
- ],
562
- [
563
- 0.3302393550012598,
564
- 0.1806481606948574,
565
- 0.1806481606948574,
566
- 0.08127438836157441,
567
- 0.08127438836157441,
568
- 0.31234707704000286,
569
- 0.31234707704000286,
570
- 0.26061069640293544,
571
- 0.26061069640293544
572
- ],
573
- [
574
- 0.29552422471475287,
575
- 0.29552422471475287,
576
- 0.26926671930999635,
577
- 0.26926671930999635,
578
- 0.21908636251598204,
579
- 0.21908636251598204,
580
- 0.1494513491505806,
581
- 0.1494513491505806,
582
- 0.06667134430868814,
583
- 0.06667134430868814
584
- ],
585
- [
586
- 0.2729250867779006,
587
- 0.26280454451024665,
588
- 0.26280454451024665,
589
- 0.23319376459199048,
590
- 0.23319376459199048,
591
- 0.18629021092773426,
592
- 0.18629021092773426,
593
- 0.1255803694649046,
594
- 0.1255803694649046,
595
- 0.05566856711617366,
596
- 0.05566856711617366
597
- ],
598
- [
599
- 0.24914704581340277,
600
- 0.24914704581340277,
601
- 0.2334925365383548,
602
- 0.2334925365383548,
603
- 0.20316742672306592,
604
- 0.20316742672306592,
605
- 0.16007832854334622,
606
- 0.16007832854334622,
607
- 0.10693932599531843,
608
- 0.10693932599531843,
609
- 0.04717533638651183,
610
- 0.04717533638651183
611
- ],
612
- [
613
- 0.2325515532308739,
614
- 0.22628318026289723,
615
- 0.22628318026289723,
616
- 0.2078160475368885,
617
- 0.2078160475368885,
618
- 0.17814598076194574,
619
- 0.17814598076194574,
620
- 0.13887351021978725,
621
- 0.13887351021978725,
622
- 0.09212149983772845,
623
- 0.09212149983772845,
624
- 0.04048400476531588,
625
- 0.04048400476531588
626
- ],
627
- [
628
- 0.2152638534631578,
629
- 0.2152638534631578,
630
- 0.2051984637212956,
631
- 0.2051984637212956,
632
- 0.18553839747793782,
633
- 0.18553839747793782,
634
- 0.15720316715819355,
635
- 0.15720316715819355,
636
- 0.12151857068790319,
637
- 0.12151857068790319,
638
- 0.08015808715976021,
639
- 0.08015808715976021,
640
- 0.03511946033175186,
641
- 0.03511946033175186
642
- ],
643
- [
644
- 0.2025782419255613,
645
- 0.19843148532711158,
646
- 0.19843148532711158,
647
- 0.1861610000155622,
648
- 0.1861610000155622,
649
- 0.16626920581699392,
650
- 0.16626920581699392,
651
- 0.13957067792615432,
652
- 0.13957067792615432,
653
- 0.10715922046717194,
654
- 0.10715922046717194,
655
- 0.07036604748810812,
656
- 0.07036604748810812,
657
- 0.03075324199611727,
658
- 0.03075324199611727
659
- ],
660
- [
661
- 0.1894506104550685,
662
- 0.1894506104550685,
663
- 0.18260341504492358,
664
- 0.18260341504492358,
665
- 0.16915651939500254,
666
- 0.16915651939500254,
667
- 0.14959598881657674,
668
- 0.14959598881657674,
669
- 0.12462897125553388,
670
- 0.12462897125553388,
671
- 0.09515851168249279,
672
- 0.09515851168249279,
673
- 0.062253523938647894,
674
- 0.062253523938647894,
675
- 0.027152459411754096,
676
- 0.027152459411754096
677
- ],
678
- [
679
- 0.17944647035620653,
680
- 0.17656270536699264,
681
- 0.17656270536699264,
682
- 0.16800410215645004,
683
- 0.16800410215645004,
684
- 0.15404576107681028,
685
- 0.15404576107681028,
686
- 0.13513636846852548,
687
- 0.13513636846852548,
688
- 0.11188384719340397,
689
- 0.11188384719340397,
690
- 0.08503614831717918,
691
- 0.08503614831717918,
692
- 0.0554595293739872,
693
- 0.0554595293739872,
694
- 0.02414830286854793,
695
- 0.02414830286854793
696
- ],
697
- [
698
- 0.1691423829631436,
699
- 0.1691423829631436,
700
- 0.16427648374583273,
701
- 0.16427648374583273,
702
- 0.15468467512626524,
703
- 0.15468467512626524,
704
- 0.14064291467065065,
705
- 0.14064291467065065,
706
- 0.12255520671147846,
707
- 0.12255520671147846,
708
- 0.10094204410628717,
709
- 0.10094204410628717,
710
- 0.07642573025488905,
711
- 0.07642573025488905,
712
- 0.0497145488949698,
713
- 0.0497145488949698,
714
- 0.02161601352648331,
715
- 0.02161601352648331
716
- ],
717
- [
718
- 0.1610544498487837,
719
- 0.15896884339395434,
720
- 0.15896884339395434,
721
- 0.15276604206585967,
722
- 0.15276604206585967,
723
- 0.1426067021736066,
724
- 0.1426067021736066,
725
- 0.12875396253933621,
726
- 0.12875396253933621,
727
- 0.11156664554733399,
728
- 0.11156664554733399,
729
- 0.09149002162245,
730
- 0.09149002162245,
731
- 0.06904454273764123,
732
- 0.06904454273764123,
733
- 0.0448142267656996,
734
- 0.0448142267656996,
735
- 0.019461788229726478,
736
- 0.019461788229726478
737
- ],
738
- [
739
- 0.15275338713072584,
740
- 0.15275338713072584,
741
- 0.14917298647260374,
742
- 0.14917298647260374,
743
- 0.14209610931838204,
744
- 0.14209610931838204,
745
- 0.13168863844917664,
746
- 0.13168863844917664,
747
- 0.11819453196151841,
748
- 0.11819453196151841,
749
- 0.10193011981724044,
750
- 0.10193011981724044,
751
- 0.08327674157670475,
752
- 0.08327674157670475,
753
- 0.06267204833410907,
754
- 0.06267204833410907,
755
- 0.04060142980038694,
756
- 0.04060142980038694,
757
- 0.017614007139152118,
758
- 0.017614007139152118
759
- ],
760
- [
761
- 0.14608113364969041,
762
- 0.14452440398997005,
763
- 0.14452440398997005,
764
- 0.13988739479107315,
765
- 0.13988739479107315,
766
- 0.13226893863333747,
767
- 0.13226893863333747,
768
- 0.12183141605372853,
769
- 0.12183141605372853,
770
- 0.10879729916714838,
771
- 0.10879729916714838,
772
- 0.09344442345603386,
773
- 0.09344442345603386,
774
- 0.0761001136283793,
775
- 0.0761001136283793,
776
- 0.057134425426857205,
777
- 0.057134425426857205,
778
- 0.036953789770852494,
779
- 0.036953789770852494,
780
- 0.016017228257774335,
781
- 0.016017228257774335
782
- ],
783
- [
784
- 0.13925187285563198,
785
- 0.13925187285563198,
786
- 0.13654149834601517,
787
- 0.13654149834601517,
788
- 0.13117350478706238,
789
- 0.13117350478706238,
790
- 0.12325237681051242,
791
- 0.12325237681051242,
792
- 0.11293229608053922,
793
- 0.11293229608053922,
794
- 0.10041414444288096,
795
- 0.10041414444288096,
796
- 0.08594160621706773,
797
- 0.08594160621706773,
798
- 0.06979646842452049,
799
- 0.06979646842452049,
800
- 0.052293335152683286,
801
- 0.052293335152683286,
802
- 0.03377490158481415,
803
- 0.03377490158481415,
804
- 0.0146279952982722,
805
- 0.0146279952982722
806
- ],
807
- [
808
- 0.13365457218610619,
809
- 0.1324620394046966,
810
- 0.1324620394046966,
811
- 0.12890572218808216,
812
- 0.12890572218808216,
813
- 0.12304908430672953,
814
- 0.12304908430672953,
815
- 0.11499664022241136,
816
- 0.11499664022241136,
817
- 0.10489209146454141,
818
- 0.10489209146454141,
819
- 0.09291576606003515,
820
- 0.09291576606003515,
821
- 0.07928141177671895,
822
- 0.07928141177671895,
823
- 0.06423242140852585,
824
- 0.06423242140852585,
825
- 0.04803767173108467,
826
- 0.04803767173108467,
827
- 0.030988005856979445,
828
- 0.030988005856979445,
829
- 0.013411859487141771,
830
- 0.013411859487141771
831
- ],
832
- [
833
- 0.12793819534675216,
834
- 0.12793819534675216,
835
- 0.1258374563468283,
836
- 0.1258374563468283,
837
- 0.12167047292780339,
838
- 0.12167047292780339,
839
- 0.1155056680537256,
840
- 0.1155056680537256,
841
- 0.10744427011596563,
842
- 0.10744427011596563,
843
- 0.09761865210411388,
844
- 0.09761865210411388,
845
- 0.08619016153195327,
846
- 0.08619016153195327,
847
- 0.0733464814110803,
848
- 0.0733464814110803,
849
- 0.05929858491543678,
850
- 0.05929858491543678,
851
- 0.04427743881741981,
852
- 0.04427743881741981,
853
- 0.028531388628933663,
854
- 0.028531388628933663,
855
- 0.0123412297999872,
856
- 0.0123412297999872
857
- ]
858
- ], ce = [[1], [1, 1], [1, 2, 1], [1, 3, 3, 1]], It = (h, t, e) => {
859
- let i, n;
860
- const o = e / 2;
861
- i = 0;
862
- for (let s = 0; s < 20; s++)
863
- n = o * le[20][s] + o, i += de[20][s] * fe(h, t, n);
864
- return o * i;
865
- }, Ft = (h, t, e) => {
866
- e === void 0 && (e = 1);
867
- const i = h[0] - 2 * h[1] + h[2], n = t[0] - 2 * t[1] + t[2], r = 2 * h[1] - 2 * h[0], o = 2 * t[1] - 2 * t[0], s = 4 * (i * i + n * n), a = 4 * (i * r + n * o), d = r * r + o * o;
868
- if (s === 0)
869
- return e * Math.sqrt(Math.pow(h[2] - h[0], 2) + Math.pow(t[2] - t[0], 2));
870
- const l = a / (2 * s), g = d / s, c = e + l, p = g - l * l, f = c * c + p > 0 ? Math.sqrt(c * c + p) : 0, S = l * l + p > 0 ? Math.sqrt(l * l + p) : 0, _ = l + Math.sqrt(l * l + p) !== 0 ? p * Math.log(Math.abs((c + f) / (l + S))) : 0;
871
- return Math.sqrt(s) / 2 * (c * f - l * S + _);
872
- };
873
- function fe(h, t, e) {
874
- const i = Tt(1, e, h), n = Tt(1, e, t), r = i * i + n * n;
875
- return Math.sqrt(r);
876
- }
877
- const Tt = (h, t, e) => {
878
- const i = e.length - 1;
879
- let n, r;
880
- if (i === 0)
881
- return 0;
882
- if (h === 0) {
883
- r = 0;
884
- for (let o = 0; o <= i; o++)
885
- r += ce[i][o] * Math.pow(1 - t, i - o) * Math.pow(t, o) * e[o];
886
- return r;
887
- } else {
888
- n = new Array(i);
889
- for (let o = 0; o < i; o++)
890
- n[o] = i * (e[o + 1] - e[o]);
891
- return Tt(h - 1, t, n);
892
- }
893
- }, Bt = (h, t, e) => {
894
- let i = 1, n = h / t, r = (h - e(n)) / t, o = 0;
895
- for (; i > 1e-3; ) {
896
- const s = e(n + r), a = Math.abs(h - s) / t;
897
- if (a < i)
898
- i = a, n += r;
899
- else {
900
- const d = e(n - r), l = Math.abs(h - d) / t;
901
- l < i ? (i = l, n -= r) : r /= 2;
902
- }
903
- if (o++, o > 500)
904
- break;
905
- }
906
- return n;
907
- };
908
- class H extends $ {
909
- constructor(t) {
910
- super(t), this.dataArray = [], this.pathLength = 0, this._readDataAttribute(), this.on("dataChange.konva", function() {
911
- this._readDataAttribute();
912
- });
913
- }
914
- _readDataAttribute() {
915
- this.dataArray = H.parsePathData(this.data()), this.pathLength = H.getPathLength(this.dataArray);
916
- }
917
- _sceneFunc(t) {
918
- const e = this.dataArray;
919
- t.beginPath();
920
- let i = !1;
921
- for (let n = 0; n < e.length; n++) {
922
- const r = e[n].command, o = e[n].points;
923
- switch (r) {
924
- case "L":
925
- t.lineTo(o[0], o[1]);
926
- break;
927
- case "M":
928
- t.moveTo(o[0], o[1]);
929
- break;
930
- case "C":
931
- t.bezierCurveTo(o[0], o[1], o[2], o[3], o[4], o[5]);
932
- break;
933
- case "Q":
934
- t.quadraticCurveTo(o[0], o[1], o[2], o[3]);
935
- break;
936
- case "A":
937
- const s = o[0], a = o[1], d = o[2], l = o[3], g = o[4], c = o[5], p = o[6], f = o[7], S = d > l ? d : l, _ = d > l ? 1 : d / l, b = d > l ? l / d : 1;
938
- t.translate(s, a), t.rotate(p), t.scale(_, b), t.arc(0, 0, S, g, g + c, 1 - f), t.scale(1 / _, 1 / b), t.rotate(-p), t.translate(-s, -a);
939
- break;
940
- case "z":
941
- i = !0, t.closePath();
942
- break;
943
- }
944
- }
945
- !i && !this.hasFill() ? t.strokeShape(this) : t.fillStrokeShape(this);
946
- }
947
- getSelfRect() {
948
- let t = [];
949
- this.dataArray.forEach(function(a) {
950
- if (a.command === "A") {
951
- const d = a.points[4], l = a.points[5], g = a.points[4] + l;
952
- let c = Math.PI / 180;
953
- if (Math.abs(d - g) < c && (c = Math.abs(d - g)), l < 0)
954
- for (let p = d - c; p > g; p -= c) {
955
- const f = H.getPointOnEllipticalArc(a.points[0], a.points[1], a.points[2], a.points[3], p, 0);
956
- t.push(f.x, f.y);
957
- }
958
- else
959
- for (let p = d + c; p < g; p += c) {
960
- const f = H.getPointOnEllipticalArc(a.points[0], a.points[1], a.points[2], a.points[3], p, 0);
961
- t.push(f.x, f.y);
962
- }
963
- } else if (a.command === "C")
964
- for (let d = 0; d <= 1; d += 0.01) {
965
- const l = H.getPointOnCubicBezier(d, a.start.x, a.start.y, a.points[0], a.points[1], a.points[2], a.points[3], a.points[4], a.points[5]);
966
- t.push(l.x, l.y);
967
- }
968
- else
969
- t = t.concat(a.points);
970
- });
971
- let e = t[0], i = t[0], n = t[1], r = t[1], o, s;
972
- for (let a = 0; a < t.length / 2; a++)
973
- o = t[a * 2], s = t[a * 2 + 1], isNaN(o) || (e = Math.min(e, o), i = Math.max(i, o)), isNaN(s) || (n = Math.min(n, s), r = Math.max(r, s));
974
- return {
975
- x: e,
976
- y: n,
977
- width: i - e,
978
- height: r - n
979
- };
980
- }
981
- getLength() {
982
- return this.pathLength;
983
- }
984
- getPointAtLength(t) {
985
- return H.getPointAtLengthOfDataArray(t, this.dataArray);
986
- }
987
- static getLineLength(t, e, i, n) {
988
- return Math.sqrt((i - t) * (i - t) + (n - e) * (n - e));
989
- }
990
- static getPathLength(t) {
991
- let e = 0;
992
- for (let i = 0; i < t.length; ++i)
993
- e += t[i].pathLength;
994
- return e;
995
- }
996
- static getPointAtLengthOfDataArray(t, e) {
997
- let i, n = 0, r = e.length;
998
- if (!r)
999
- return null;
1000
- for (; n < r && t > e[n].pathLength; )
1001
- t -= e[n].pathLength, ++n;
1002
- if (n === r)
1003
- return i = e[n - 1].points.slice(-2), {
1004
- x: i[0],
1005
- y: i[1]
1006
- };
1007
- if (t < 0.01)
1008
- return e[n].command === "M" ? (i = e[n].points.slice(0, 2), {
1009
- x: i[0],
1010
- y: i[1]
1011
- }) : {
1012
- x: e[n].start.x,
1013
- y: e[n].start.y
1014
- };
1015
- const o = e[n], s = o.points;
1016
- switch (o.command) {
1017
- case "L":
1018
- return H.getPointOnLine(t, o.start.x, o.start.y, s[0], s[1]);
1019
- case "C":
1020
- return H.getPointOnCubicBezier(Bt(t, H.getPathLength(e), (S) => It([o.start.x, s[0], s[2], s[4]], [o.start.y, s[1], s[3], s[5]], S)), o.start.x, o.start.y, s[0], s[1], s[2], s[3], s[4], s[5]);
1021
- case "Q":
1022
- return H.getPointOnQuadraticBezier(Bt(t, H.getPathLength(e), (S) => Ft([o.start.x, s[0], s[2]], [o.start.y, s[1], s[3]], S)), o.start.x, o.start.y, s[0], s[1], s[2], s[3]);
1023
- case "A":
1024
- const a = s[0], d = s[1], l = s[2], g = s[3], c = s[5], p = s[6];
1025
- let f = s[4];
1026
- return f += c * t / o.pathLength, H.getPointOnEllipticalArc(a, d, l, g, f, p);
1027
- }
1028
- return null;
1029
- }
1030
- static getPointOnLine(t, e, i, n, r, o, s) {
1031
- o = o ?? e, s = s ?? i;
1032
- const a = this.getLineLength(e, i, n, r);
1033
- if (a < 1e-10)
1034
- return { x: e, y: i };
1035
- if (n === e)
1036
- return { x: o, y: s + (r > i ? t : -t) };
1037
- const d = (r - i) / (n - e), l = Math.sqrt(t * t / (1 + d * d)) * (n < e ? -1 : 1), g = d * l;
1038
- if (Math.abs(s - i - d * (o - e)) < 1e-10)
1039
- return { x: o + l, y: s + g };
1040
- const c = ((o - e) * (n - e) + (s - i) * (r - i)) / (a * a), p = e + c * (n - e), f = i + c * (r - i), S = this.getLineLength(o, s, p, f), _ = Math.sqrt(t * t - S * S), b = Math.sqrt(_ * _ / (1 + d * d)) * (n < e ? -1 : 1), m = d * b;
1041
- return { x: p + b, y: f + m };
1042
- }
1043
- static getPointOnCubicBezier(t, e, i, n, r, o, s, a, d) {
1044
- function l(_) {
1045
- return _ * _ * _;
1046
- }
1047
- function g(_) {
1048
- return 3 * _ * _ * (1 - _);
1049
- }
1050
- function c(_) {
1051
- return 3 * _ * (1 - _) * (1 - _);
1052
- }
1053
- function p(_) {
1054
- return (1 - _) * (1 - _) * (1 - _);
1055
- }
1056
- const f = a * l(t) + o * g(t) + n * c(t) + e * p(t), S = d * l(t) + s * g(t) + r * c(t) + i * p(t);
1057
- return { x: f, y: S };
1058
- }
1059
- static getPointOnQuadraticBezier(t, e, i, n, r, o, s) {
1060
- function a(p) {
1061
- return p * p;
1062
- }
1063
- function d(p) {
1064
- return 2 * p * (1 - p);
1065
- }
1066
- function l(p) {
1067
- return (1 - p) * (1 - p);
1068
- }
1069
- const g = o * a(t) + n * d(t) + e * l(t), c = s * a(t) + r * d(t) + i * l(t);
1070
- return { x: g, y: c };
1071
- }
1072
- static getPointOnEllipticalArc(t, e, i, n, r, o) {
1073
- const s = Math.cos(o), a = Math.sin(o), d = {
1074
- x: i * Math.cos(r),
1075
- y: n * Math.sin(r)
1076
- };
1077
- return {
1078
- x: t + (d.x * s - d.y * a),
1079
- y: e + (d.x * a + d.y * s)
1080
- };
1081
- }
1082
- static parsePathData(t) {
1083
- if (!t)
1084
- return [];
1085
- let e = t;
1086
- const i = [
1087
- "m",
1088
- "M",
1089
- "l",
1090
- "L",
1091
- "v",
1092
- "V",
1093
- "h",
1094
- "H",
1095
- "z",
1096
- "Z",
1097
- "c",
1098
- "C",
1099
- "q",
1100
- "Q",
1101
- "t",
1102
- "T",
1103
- "s",
1104
- "S",
1105
- "a",
1106
- "A"
1107
- ];
1108
- e = e.replace(new RegExp(" ", "g"), ",");
1109
- for (let g = 0; g < i.length; g++)
1110
- e = e.replace(new RegExp(i[g], "g"), "|" + i[g]);
1111
- const n = e.split("|"), r = [], o = [];
1112
- let s = 0, a = 0;
1113
- const d = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;
1114
- let l;
1115
- for (let g = 1; g < n.length; g++) {
1116
- let c = n[g], p = c.charAt(0);
1117
- for (c = c.slice(1), o.length = 0; l = d.exec(c); )
1118
- o.push(l[0]);
1119
- let f = [], S = p === "A" || p === "a" ? 0 : -1;
1120
- for (let _ = 0, b = o.length; _ < b; _++) {
1121
- const m = o[_];
1122
- if (m === "00") {
1123
- f.push(0, 0), S >= 0 && (S += 2, S >= 7 && (S -= 7));
1124
- continue;
1125
- }
1126
- if (S >= 0) {
1127
- if (S === 3) {
1128
- if (/^[01]{2}\d+(?:\.\d+)?$/.test(m)) {
1129
- f.push(parseInt(m[0], 10)), f.push(parseInt(m[1], 10)), f.push(parseFloat(m.slice(2))), S += 3, S >= 7 && (S -= 7);
1130
- continue;
1131
- }
1132
- if (m === "11" || m === "10" || m === "01") {
1133
- f.push(parseInt(m[0], 10)), f.push(parseInt(m[1], 10)), S += 2, S >= 7 && (S -= 7);
1134
- continue;
1135
- }
1136
- if (m === "0" || m === "1") {
1137
- f.push(parseInt(m, 10)), S += 1, S >= 7 && (S -= 7);
1138
- continue;
1139
- }
1140
- } else if (S === 4) {
1141
- if (/^[01]\d+(?:\.\d+)?$/.test(m)) {
1142
- f.push(parseInt(m[0], 10)), f.push(parseFloat(m.slice(1))), S += 2, S >= 7 && (S -= 7);
1143
- continue;
1144
- }
1145
- if (m === "0" || m === "1") {
1146
- f.push(parseInt(m, 10)), S += 1, S >= 7 && (S -= 7);
1147
- continue;
1148
- }
1149
- }
1150
- const x = parseFloat(m);
1151
- isNaN(x) ? f.push(0) : f.push(x), S += 1, S >= 7 && (S -= 7);
1152
- } else {
1153
- const x = parseFloat(m);
1154
- isNaN(x) ? f.push(0) : f.push(x);
1155
- }
1156
- }
1157
- for (; f.length > 0 && !isNaN(f[0]); ) {
1158
- let _ = "", b = [];
1159
- const m = s, x = a;
1160
- let y, v, M, C, A, k, G, I, P, F;
1161
- switch (p) {
1162
- case "l":
1163
- s += f.shift(), a += f.shift(), _ = "L", b.push(s, a);
1164
- break;
1165
- case "L":
1166
- s = f.shift(), a = f.shift(), b.push(s, a);
1167
- break;
1168
- case "m":
1169
- const E = f.shift(), L = f.shift();
1170
- if (s += E, a += L, _ = "M", r.length > 2 && r[r.length - 1].command === "z") {
1171
- for (let w = r.length - 2; w >= 0; w--)
1172
- if (r[w].command === "M") {
1173
- s = r[w].points[0] + E, a = r[w].points[1] + L;
1174
- break;
1175
- }
1176
- }
1177
- b.push(s, a), p = "l";
1178
- break;
1179
- case "M":
1180
- s = f.shift(), a = f.shift(), _ = "M", b.push(s, a), p = "L";
1181
- break;
1182
- case "h":
1183
- s += f.shift(), _ = "L", b.push(s, a);
1184
- break;
1185
- case "H":
1186
- s = f.shift(), _ = "L", b.push(s, a);
1187
- break;
1188
- case "v":
1189
- a += f.shift(), _ = "L", b.push(s, a);
1190
- break;
1191
- case "V":
1192
- a = f.shift(), _ = "L", b.push(s, a);
1193
- break;
1194
- case "C":
1195
- b.push(f.shift(), f.shift(), f.shift(), f.shift()), s = f.shift(), a = f.shift(), b.push(s, a);
1196
- break;
1197
- case "c":
1198
- b.push(s + f.shift(), a + f.shift(), s + f.shift(), a + f.shift()), s += f.shift(), a += f.shift(), _ = "C", b.push(s, a);
1199
- break;
1200
- case "S":
1201
- v = s, M = a, y = r[r.length - 1], y.command === "C" && (v = s + (s - y.points[2]), M = a + (a - y.points[3])), b.push(v, M, f.shift(), f.shift()), s = f.shift(), a = f.shift(), _ = "C", b.push(s, a);
1202
- break;
1203
- case "s":
1204
- v = s, M = a, y = r[r.length - 1], y.command === "C" && (v = s + (s - y.points[2]), M = a + (a - y.points[3])), b.push(v, M, s + f.shift(), a + f.shift()), s += f.shift(), a += f.shift(), _ = "C", b.push(s, a);
1205
- break;
1206
- case "Q":
1207
- b.push(f.shift(), f.shift()), s = f.shift(), a = f.shift(), b.push(s, a);
1208
- break;
1209
- case "q":
1210
- b.push(s + f.shift(), a + f.shift()), s += f.shift(), a += f.shift(), _ = "Q", b.push(s, a);
1211
- break;
1212
- case "T":
1213
- v = s, M = a, y = r[r.length - 1], y.command === "Q" && (v = s + (s - y.points[0]), M = a + (a - y.points[1])), s = f.shift(), a = f.shift(), _ = "Q", b.push(v, M, s, a);
1214
- break;
1215
- case "t":
1216
- v = s, M = a, y = r[r.length - 1], y.command === "Q" && (v = s + (s - y.points[0]), M = a + (a - y.points[1])), s += f.shift(), a += f.shift(), _ = "Q", b.push(v, M, s, a);
1217
- break;
1218
- case "A":
1219
- C = f.shift(), A = f.shift(), k = f.shift(), G = f.shift(), I = f.shift(), P = s, F = a, s = f.shift(), a = f.shift(), _ = "A", b = this.convertEndpointToCenterParameterization(P, F, s, a, G, I, C, A, k);
1220
- break;
1221
- case "a":
1222
- C = f.shift(), A = f.shift(), k = f.shift(), G = f.shift(), I = f.shift(), P = s, F = a, s += f.shift(), a += f.shift(), _ = "A", b = this.convertEndpointToCenterParameterization(P, F, s, a, G, I, C, A, k);
1223
- break;
1224
- }
1225
- r.push({
1226
- command: _ || p,
1227
- points: b,
1228
- start: {
1229
- x: m,
1230
- y: x
1231
- },
1232
- pathLength: this.calcLength(m, x, _ || p, b)
1233
- });
1234
- }
1235
- (p === "z" || p === "Z") && r.push({
1236
- command: "z",
1237
- points: [],
1238
- start: void 0,
1239
- pathLength: 0
1240
- });
1241
- }
1242
- return r;
1243
- }
1244
- static calcLength(t, e, i, n) {
1245
- let r, o, s, a;
1246
- const d = H;
1247
- switch (i) {
1248
- case "L":
1249
- return d.getLineLength(t, e, n[0], n[1]);
1250
- case "C":
1251
- return It([t, n[0], n[2], n[4]], [e, n[1], n[3], n[5]], 1);
1252
- case "Q":
1253
- return Ft([t, n[0], n[2]], [e, n[1], n[3]], 1);
1254
- case "A":
1255
- r = 0;
1256
- const l = n[4], g = n[5], c = n[4] + g;
1257
- let p = Math.PI / 180;
1258
- if (Math.abs(l - c) < p && (p = Math.abs(l - c)), o = d.getPointOnEllipticalArc(n[0], n[1], n[2], n[3], l, 0), g < 0)
1259
- for (a = l - p; a > c; a -= p)
1260
- s = d.getPointOnEllipticalArc(n[0], n[1], n[2], n[3], a, 0), r += d.getLineLength(o.x, o.y, s.x, s.y), o = s;
1261
- else
1262
- for (a = l + p; a < c; a += p)
1263
- s = d.getPointOnEllipticalArc(n[0], n[1], n[2], n[3], a, 0), r += d.getLineLength(o.x, o.y, s.x, s.y), o = s;
1264
- return s = d.getPointOnEllipticalArc(n[0], n[1], n[2], n[3], c, 0), r += d.getLineLength(o.x, o.y, s.x, s.y), r;
1265
- }
1266
- return 0;
1267
- }
1268
- static convertEndpointToCenterParameterization(t, e, i, n, r, o, s, a, d) {
1269
- const l = d * (Math.PI / 180), g = Math.cos(l) * (t - i) / 2 + Math.sin(l) * (e - n) / 2, c = -1 * Math.sin(l) * (t - i) / 2 + Math.cos(l) * (e - n) / 2, p = g * g / (s * s) + c * c / (a * a);
1270
- p > 1 && (s *= Math.sqrt(p), a *= Math.sqrt(p));
1271
- let f = Math.sqrt((s * s * (a * a) - s * s * (c * c) - a * a * (g * g)) / (s * s * (c * c) + a * a * (g * g)));
1272
- r === o && (f *= -1), isNaN(f) && (f = 0);
1273
- const S = f * s * c / a, _ = f * -a * g / s, b = (t + i) / 2 + Math.cos(l) * S - Math.sin(l) * _, m = (e + n) / 2 + Math.sin(l) * S + Math.cos(l) * _, x = function(G) {
1274
- return Math.sqrt(G[0] * G[0] + G[1] * G[1]);
1275
- }, y = function(G, I) {
1276
- return (G[0] * I[0] + G[1] * I[1]) / (x(G) * x(I));
1277
- }, v = function(G, I) {
1278
- return (G[0] * I[1] < G[1] * I[0] ? -1 : 1) * Math.acos(y(G, I));
1279
- }, M = v([1, 0], [(g - S) / s, (c - _) / a]), C = [(g - S) / s, (c - _) / a], A = [(-1 * g - S) / s, (-1 * c - _) / a];
1280
- let k = v(C, A);
1281
- return y(C, A) <= -1 && (k = Math.PI), y(C, A) >= 1 && (k = 0), o === 0 && k > 0 && (k = k - 2 * Math.PI), o === 1 && k < 0 && (k = k + 2 * Math.PI), [b, m, s, a, M, k, l, o];
1282
- }
1283
- }
1284
- H.prototype.className = "Path";
1285
- H.prototype._attrsAffectingSize = ["data"];
1286
- V(H);
1287
- u.addGetterSetter(H, "data");
1288
- class ot extends tt {
1289
- _sceneFunc(t) {
1290
- super._sceneFunc(t);
1291
- const e = Math.PI * 2, i = this.points();
1292
- let n = i;
1293
- const r = this.tension() !== 0 && i.length > 4;
1294
- r && (n = this.getTensionPoints());
1295
- const o = this.pointerLength(), s = i.length;
1296
- let a, d;
1297
- if (r) {
1298
- const c = [
1299
- n[n.length - 4],
1300
- n[n.length - 3],
1301
- n[n.length - 2],
1302
- n[n.length - 1],
1303
- i[s - 2],
1304
- i[s - 1]
1305
- ], p = H.calcLength(n[n.length - 4], n[n.length - 3], "C", c), f = H.getPointOnQuadraticBezier(Math.min(1, 1 - o / p), c[0], c[1], c[2], c[3], c[4], c[5]);
1306
- a = i[s - 2] - f.x, d = i[s - 1] - f.y;
1307
- } else
1308
- a = i[s - 2] - i[s - 4], d = i[s - 1] - i[s - 3];
1309
- const l = (Math.atan2(d, a) + e) % e, g = this.pointerWidth();
1310
- this.pointerAtEnding() && (t.save(), t.beginPath(), t.translate(i[s - 2], i[s - 1]), t.rotate(l), t.moveTo(0, 0), t.lineTo(-o, g / 2), t.lineTo(-o, -g / 2), t.closePath(), t.restore(), this.__fillStroke(t)), this.pointerAtBeginning() && (t.save(), t.beginPath(), t.translate(i[0], i[1]), r ? (a = (n[0] + n[2]) / 2 - i[0], d = (n[1] + n[3]) / 2 - i[1]) : (a = i[2] - i[0], d = i[3] - i[1]), t.rotate((Math.atan2(-d, -a) + e) % e), t.moveTo(0, 0), t.lineTo(-o, g / 2), t.lineTo(-o, -g / 2), t.closePath(), t.restore(), this.__fillStroke(t));
1311
- }
1312
- __fillStroke(t) {
1313
- const e = this.dashEnabled();
1314
- e && (this.attrs.dashEnabled = !1, t.setLineDash([])), t.fillStrokeShape(this), e && (this.attrs.dashEnabled = !0);
1315
- }
1316
- getSelfRect() {
1317
- const t = super.getSelfRect(), e = this.pointerWidth() / 2;
1318
- return {
1319
- x: t.x,
1320
- y: t.y - e,
1321
- width: t.width,
1322
- height: t.height + e * 2
1323
- };
1324
- }
1325
- }
1326
- ot.prototype.className = "Arrow";
1327
- V(ot);
1328
- u.addGetterSetter(ot, "pointerLength", 10, T());
1329
- u.addGetterSetter(ot, "pointerWidth", 10, T());
1330
- u.addGetterSetter(ot, "pointerAtBeginning", !1);
1331
- u.addGetterSetter(ot, "pointerAtEnding", !0);
1332
- class dt extends $ {
1333
- _sceneFunc(t) {
1334
- t.beginPath(), t.arc(0, 0, this.attrs.radius || 0, 0, Math.PI * 2, !1), t.closePath(), t.fillStrokeShape(this);
1335
- }
1336
- getWidth() {
1337
- return this.radius() * 2;
1338
- }
1339
- getHeight() {
1340
- return this.radius() * 2;
1341
- }
1342
- setWidth(t) {
1343
- this.radius() !== t / 2 && this.radius(t / 2);
1344
- }
1345
- setHeight(t) {
1346
- this.radius() !== t / 2 && this.radius(t / 2);
1347
- }
1348
- }
1349
- dt.prototype._centroid = !0;
1350
- dt.prototype.className = "Circle";
1351
- dt.prototype._attrsAffectingSize = ["radius"];
1352
- V(dt);
1353
- u.addGetterSetter(dt, "radius", 0, T());
1354
- class nt extends $ {
1355
- _sceneFunc(t) {
1356
- const e = this.radiusX(), i = this.radiusY();
1357
- t.beginPath(), t.save(), e !== i && t.scale(1, i / e), t.arc(0, 0, e, 0, Math.PI * 2, !1), t.restore(), t.closePath(), t.fillStrokeShape(this);
1358
- }
1359
- getWidth() {
1360
- return this.radiusX() * 2;
1361
- }
1362
- getHeight() {
1363
- return this.radiusY() * 2;
1364
- }
1365
- setWidth(t) {
1366
- this.radiusX(t / 2);
1367
- }
1368
- setHeight(t) {
1369
- this.radiusY(t / 2);
1370
- }
1371
- }
1372
- nt.prototype.className = "Ellipse";
1373
- nt.prototype._centroid = !0;
1374
- nt.prototype._attrsAffectingSize = ["radiusX", "radiusY"];
1375
- V(nt);
1376
- u.addComponentsGetterSetter(nt, "radius", ["x", "y"]);
1377
- u.addGetterSetter(nt, "radiusX", 0, T());
1378
- u.addGetterSetter(nt, "radiusY", 0, T());
1379
- class K extends $ {
1380
- constructor(t) {
1381
- super(t), this._loadListener = () => {
1382
- this._requestDraw();
1383
- }, this.on("imageChange.konva", (e) => {
1384
- this._removeImageLoad(e.oldVal), this._setImageLoad();
1385
- }), this._setImageLoad();
1386
- }
1387
- _setImageLoad() {
1388
- const t = this.image();
1389
- t && t.complete || t && t.readyState === 4 || t && t.addEventListener && t.addEventListener("load", this._loadListener);
1390
- }
1391
- _removeImageLoad(t) {
1392
- t && t.removeEventListener && t.removeEventListener("load", this._loadListener);
1393
- }
1394
- destroy() {
1395
- return this._removeImageLoad(this.image()), super.destroy(), this;
1396
- }
1397
- _useBufferCanvas() {
1398
- const t = !!this.cornerRadius(), e = this.hasShadow();
1399
- return t && e ? !0 : super._useBufferCanvas(!0);
1400
- }
1401
- _sceneFunc(t) {
1402
- const e = this.getWidth(), i = this.getHeight(), n = this.cornerRadius(), r = this.attrs.image;
1403
- let o;
1404
- if (r) {
1405
- const s = this.attrs.cropWidth, a = this.attrs.cropHeight;
1406
- s && a ? o = [
1407
- r,
1408
- this.cropX(),
1409
- this.cropY(),
1410
- s,
1411
- a,
1412
- 0,
1413
- 0,
1414
- e,
1415
- i
1416
- ] : o = [r, 0, 0, e, i];
1417
- }
1418
- (this.hasFill() || this.hasStroke() || n) && (t.beginPath(), n ? O.drawRoundedRectPath(t, e, i, n) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this)), r && (n && t.clip(), t.drawImage.apply(t, o));
1419
- }
1420
- _hitFunc(t) {
1421
- const e = this.width(), i = this.height(), n = this.cornerRadius();
1422
- t.beginPath(), n ? O.drawRoundedRectPath(t, e, i, n) : t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this);
1423
- }
1424
- getWidth() {
1425
- var t, e, i;
1426
- return (i = (t = this.attrs.width) !== null && t !== void 0 ? t : (e = this.image()) === null || e === void 0 ? void 0 : e.width) !== null && i !== void 0 ? i : 0;
1427
- }
1428
- getHeight() {
1429
- var t, e, i;
1430
- return (i = (t = this.attrs.height) !== null && t !== void 0 ? t : (e = this.image()) === null || e === void 0 ? void 0 : e.height) !== null && i !== void 0 ? i : 0;
1431
- }
1432
- static fromURL(t, e, i = null) {
1433
- const n = O.createImageElement();
1434
- n.onload = function() {
1435
- const r = new K({
1436
- image: n
1437
- });
1438
- e(r);
1439
- }, n.onerror = i, n.crossOrigin = "Anonymous", n.src = t;
1440
- }
1441
- }
1442
- K.prototype.className = "Image";
1443
- K.prototype._attrsAffectingSize = ["image"];
1444
- V(K);
1445
- u.addGetterSetter(K, "cornerRadius", 0, yt(4));
1446
- u.addGetterSetter(K, "image");
1447
- u.addComponentsGetterSetter(K, "crop", ["x", "y", "width", "height"]);
1448
- u.addGetterSetter(K, "cropX", 0, T());
1449
- u.addGetterSetter(K, "cropY", 0, T());
1450
- u.addGetterSetter(K, "cropWidth", 0, T());
1451
- u.addGetterSetter(K, "cropHeight", 0, T());
1452
- const Vt = [
1453
- "fontFamily",
1454
- "fontSize",
1455
- "fontStyle",
1456
- "padding",
1457
- "lineHeight",
1458
- "text",
1459
- "width",
1460
- "height",
1461
- "pointerDirection",
1462
- "pointerWidth",
1463
- "pointerHeight"
1464
- ], ge = "Change.konva", ue = "none", Ct = "up", kt = "right", Rt = "down", Pt = "left", pe = Vt.length;
1465
- class Ot extends At {
1466
- constructor(t) {
1467
- super(t), this.on("add.konva", function(e) {
1468
- this._addListeners(e.child), this._sync();
1469
- });
1470
- }
1471
- getText() {
1472
- return this.find("Text")[0];
1473
- }
1474
- getTag() {
1475
- return this.find("Tag")[0];
1476
- }
1477
- _addListeners(t) {
1478
- let e = this, i;
1479
- const n = function() {
1480
- e._sync();
1481
- };
1482
- for (i = 0; i < pe; i++)
1483
- t.on(Vt[i] + ge, n);
1484
- }
1485
- getWidth() {
1486
- return this.getText().width();
1487
- }
1488
- getHeight() {
1489
- return this.getText().height();
1490
- }
1491
- _sync() {
1492
- let t = this.getText(), e = this.getTag(), i, n, r, o, s, a, d;
1493
- if (t && e) {
1494
- switch (i = t.width(), n = t.height(), r = e.pointerDirection(), o = e.pointerWidth(), d = e.pointerHeight(), s = 0, a = 0, r) {
1495
- case Ct:
1496
- s = i / 2, a = -1 * d;
1497
- break;
1498
- case kt:
1499
- s = i + o, a = n / 2;
1500
- break;
1501
- case Rt:
1502
- s = i / 2, a = n + d;
1503
- break;
1504
- case Pt:
1505
- s = -1 * o, a = n / 2;
1506
- break;
1507
- }
1508
- e.setAttrs({
1509
- x: -1 * s,
1510
- y: -1 * a,
1511
- width: i,
1512
- height: n
1513
- }), t.setAttrs({
1514
- x: -1 * s,
1515
- y: -1 * a
1516
- });
1517
- }
1518
- }
1519
- }
1520
- Ot.prototype.className = "Label";
1521
- V(Ot);
1522
- class at extends $ {
1523
- _sceneFunc(t) {
1524
- const e = this.width(), i = this.height(), n = this.pointerDirection(), r = this.pointerWidth(), o = this.pointerHeight(), s = this.cornerRadius();
1525
- let a = 0, d = 0, l = 0, g = 0;
1526
- typeof s == "number" ? a = d = l = g = Math.min(s, e / 2, i / 2) : (a = Math.min(s[0] || 0, e / 2, i / 2), d = Math.min(s[1] || 0, e / 2, i / 2), g = Math.min(s[2] || 0, e / 2, i / 2), l = Math.min(s[3] || 0, e / 2, i / 2)), t.beginPath(), t.moveTo(a, 0), n === Ct && (t.lineTo((e - r) / 2, 0), t.lineTo(e / 2, -1 * o), t.lineTo((e + r) / 2, 0)), t.lineTo(e - d, 0), t.arc(e - d, d, d, Math.PI * 3 / 2, 0, !1), n === kt && (t.lineTo(e, (i - o) / 2), t.lineTo(e + r, i / 2), t.lineTo(e, (i + o) / 2)), t.lineTo(e, i - g), t.arc(e - g, i - g, g, 0, Math.PI / 2, !1), n === Rt && (t.lineTo((e + r) / 2, i), t.lineTo(e / 2, i + o), t.lineTo((e - r) / 2, i)), t.lineTo(l, i), t.arc(l, i - l, l, Math.PI / 2, Math.PI, !1), n === Pt && (t.lineTo(0, (i + o) / 2), t.lineTo(-1 * r, i / 2), t.lineTo(0, (i - o) / 2)), t.lineTo(0, a), t.arc(a, a, a, Math.PI, Math.PI * 3 / 2, !1), t.closePath(), t.fillStrokeShape(this);
1527
- }
1528
- getSelfRect() {
1529
- let t = 0, e = 0, i = this.pointerWidth(), n = this.pointerHeight(), r = this.pointerDirection(), o = this.width(), s = this.height();
1530
- return r === Ct ? (e -= n, s += n) : r === Rt ? s += n : r === Pt ? (t -= i * 1.5, o += i) : r === kt && (o += i * 1.5), {
1531
- x: t,
1532
- y: e,
1533
- width: o,
1534
- height: s
1535
- };
1536
- }
1537
- }
1538
- at.prototype.className = "Tag";
1539
- V(at);
1540
- u.addGetterSetter(at, "pointerDirection", ue);
1541
- u.addGetterSetter(at, "pointerWidth", 0, T());
1542
- u.addGetterSetter(at, "pointerHeight", 0, T());
1543
- u.addGetterSetter(at, "cornerRadius", 0, yt(4));
1544
- class pt extends $ {
1545
- _sceneFunc(t) {
1546
- const e = this.cornerRadius(), i = this.width(), n = this.height();
1547
- t.beginPath(), e ? O.drawRoundedRectPath(t, i, n, e) : t.rect(0, 0, i, n), t.closePath(), t.fillStrokeShape(this);
1548
- }
1549
- }
1550
- pt.prototype.className = "Rect";
1551
- V(pt);
1552
- u.addGetterSetter(pt, "cornerRadius", 0, yt(4));
1553
- class st extends $ {
1554
- _sceneFunc(t) {
1555
- const e = this._getPoints(), i = this.radius(), n = this.sides(), r = this.cornerRadius();
1556
- if (t.beginPath(), r)
1557
- O.drawRoundedPolygonPath(t, e, n, i, r);
1558
- else {
1559
- t.moveTo(e[0].x, e[0].y);
1560
- for (let o = 1; o < e.length; o++)
1561
- t.lineTo(e[o].x, e[o].y);
1562
- }
1563
- t.closePath(), t.fillStrokeShape(this);
1564
- }
1565
- _getPoints() {
1566
- const t = this.attrs.sides, e = this.attrs.radius || 0, i = [];
1567
- for (let n = 0; n < t; n++)
1568
- i.push({
1569
- x: e * Math.sin(n * 2 * Math.PI / t),
1570
- y: -1 * e * Math.cos(n * 2 * Math.PI / t)
1571
- });
1572
- return i;
1573
- }
1574
- getSelfRect() {
1575
- const t = this._getPoints();
1576
- let e = t[0].x, i = t[0].x, n = t[0].y, r = t[0].y;
1577
- return t.forEach((o) => {
1578
- e = Math.min(e, o.x), i = Math.max(i, o.x), n = Math.min(n, o.y), r = Math.max(r, o.y);
1579
- }), {
1580
- x: e,
1581
- y: n,
1582
- width: i - e,
1583
- height: r - n
1584
- };
1585
- }
1586
- getWidth() {
1587
- return this.radius() * 2;
1588
- }
1589
- getHeight() {
1590
- return this.radius() * 2;
1591
- }
1592
- setWidth(t) {
1593
- this.radius(t / 2);
1594
- }
1595
- setHeight(t) {
1596
- this.radius(t / 2);
1597
- }
1598
- }
1599
- st.prototype.className = "RegularPolygon";
1600
- st.prototype._centroid = !0;
1601
- st.prototype._attrsAffectingSize = ["radius"];
1602
- V(st);
1603
- u.addGetterSetter(st, "radius", 0, T());
1604
- u.addGetterSetter(st, "sides", 0, T());
1605
- u.addGetterSetter(st, "cornerRadius", 0, yt(4));
1606
- const zt = Math.PI * 2;
1607
- class ht extends $ {
1608
- _sceneFunc(t) {
1609
- t.beginPath(), t.arc(0, 0, this.innerRadius(), 0, zt, !1), t.moveTo(this.outerRadius(), 0), t.arc(0, 0, this.outerRadius(), zt, 0, !0), t.closePath(), t.fillStrokeShape(this);
1610
- }
1611
- getWidth() {
1612
- return this.outerRadius() * 2;
1613
- }
1614
- getHeight() {
1615
- return this.outerRadius() * 2;
1616
- }
1617
- setWidth(t) {
1618
- this.outerRadius(t / 2);
1619
- }
1620
- setHeight(t) {
1621
- this.outerRadius(t / 2);
1622
- }
1623
- }
1624
- ht.prototype.className = "Ring";
1625
- ht.prototype._centroid = !0;
1626
- ht.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"];
1627
- V(ht);
1628
- u.addGetterSetter(ht, "innerRadius", 0, T());
1629
- u.addGetterSetter(ht, "outerRadius", 0, T());
1630
- class Z extends $ {
1631
- constructor(t) {
1632
- super(t), this._updated = !0, this.anim = new oe(() => {
1633
- const e = this._updated;
1634
- return this._updated = !1, e;
1635
- }), this.on("animationChange.konva", function() {
1636
- this.frameIndex(0);
1637
- }), this.on("frameIndexChange.konva", function() {
1638
- this._updated = !0;
1639
- }), this.on("frameRateChange.konva", function() {
1640
- this.anim.isRunning() && (clearInterval(this.interval), this._setInterval());
1641
- });
1642
- }
1643
- _sceneFunc(t) {
1644
- const e = this.animation(), i = this.frameIndex(), n = i * 4, r = this.animations()[e], o = this.frameOffsets(), s = r[n + 0], a = r[n + 1], d = r[n + 2], l = r[n + 3], g = this.image();
1645
- if ((this.hasFill() || this.hasStroke()) && (t.beginPath(), t.rect(0, 0, d, l), t.closePath(), t.fillStrokeShape(this)), g)
1646
- if (o) {
1647
- const c = o[e], p = i * 2;
1648
- t.drawImage(g, s, a, d, l, c[p + 0], c[p + 1], d, l);
1649
- } else
1650
- t.drawImage(g, s, a, d, l, 0, 0, d, l);
1651
- }
1652
- _hitFunc(t) {
1653
- const e = this.animation(), i = this.frameIndex(), n = i * 4, r = this.animations()[e], o = this.frameOffsets(), s = r[n + 2], a = r[n + 3];
1654
- if (t.beginPath(), o) {
1655
- const d = o[e], l = i * 2;
1656
- t.rect(d[l + 0], d[l + 1], s, a);
1657
- } else
1658
- t.rect(0, 0, s, a);
1659
- t.closePath(), t.fillShape(this);
1660
- }
1661
- _useBufferCanvas() {
1662
- return super._useBufferCanvas(!0);
1663
- }
1664
- _setInterval() {
1665
- const t = this;
1666
- this.interval = setInterval(function() {
1667
- t._updateIndex();
1668
- }, 1e3 / this.frameRate());
1669
- }
1670
- start() {
1671
- if (this.isRunning())
1672
- return;
1673
- const t = this.getLayer();
1674
- this.anim.setLayers(t), this._setInterval(), this.anim.start();
1675
- }
1676
- stop() {
1677
- this.anim.stop(), clearInterval(this.interval);
1678
- }
1679
- isRunning() {
1680
- return this.anim.isRunning();
1681
- }
1682
- _updateIndex() {
1683
- const t = this.frameIndex(), e = this.animation(), i = this.animations(), n = i[e], r = n.length / 4;
1684
- t < r - 1 ? this.frameIndex(t + 1) : this.frameIndex(0);
1685
- }
1686
- }
1687
- Z.prototype.className = "Sprite";
1688
- V(Z);
1689
- u.addGetterSetter(Z, "animation");
1690
- u.addGetterSetter(Z, "animations");
1691
- u.addGetterSetter(Z, "frameOffsets");
1692
- u.addGetterSetter(Z, "image");
1693
- u.addGetterSetter(Z, "frameIndex", 0, T());
1694
- u.addGetterSetter(Z, "frameRate", 17, T());
1695
- u.backCompat(Z, {
1696
- index: "frameIndex",
1697
- getIndex: "getFrameIndex",
1698
- setIndex: "setFrameIndex"
1699
- });
1700
- class rt extends $ {
1701
- _sceneFunc(t) {
1702
- const e = this.innerRadius(), i = this.outerRadius(), n = this.numPoints();
1703
- t.beginPath(), t.moveTo(0, 0 - i);
1704
- for (let r = 1; r < n * 2; r++) {
1705
- const o = r % 2 === 0 ? i : e, s = o * Math.sin(r * Math.PI / n), a = -1 * o * Math.cos(r * Math.PI / n);
1706
- t.lineTo(s, a);
1707
- }
1708
- t.closePath(), t.fillStrokeShape(this);
1709
- }
1710
- getWidth() {
1711
- return this.outerRadius() * 2;
1712
- }
1713
- getHeight() {
1714
- return this.outerRadius() * 2;
1715
- }
1716
- setWidth(t) {
1717
- this.outerRadius(t / 2);
1718
- }
1719
- setHeight(t) {
1720
- this.outerRadius(t / 2);
1721
- }
1722
- }
1723
- rt.prototype.className = "Star";
1724
- rt.prototype._centroid = !0;
1725
- rt.prototype._attrsAffectingSize = ["innerRadius", "outerRadius"];
1726
- V(rt);
1727
- u.addGetterSetter(rt, "numPoints", 5, T());
1728
- u.addGetterSetter(rt, "innerRadius", 0, T());
1729
- u.addGetterSetter(rt, "outerRadius", 0, T());
1730
- function it(h) {
1731
- return [...h].reduce((t, e, i, n) => {
1732
- if (/\p{Emoji}/u.test(e)) {
1733
- const r = n[i + 1];
1734
- r && /\p{Emoji_Modifier}|\u200D/u.test(r) ? (t.push(e + r), n[i + 1] = "") : t.push(e);
1735
- } else /\p{Regional_Indicator}{2}/u.test(e + (n[i + 1] || "")) ? t.push(e + n[i + 1]) : i > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(e) ? t[t.length - 1] += e : e && t.push(e);
1736
- return t;
1737
- }, []);
1738
- }
1739
- const lt = "auto", me = "center", $t = "inherit", ft = "justify", Se = "Change.konva", Qt = "2d", Wt = "-", Kt = "left", _e = "text", be = "Text", ye = "top", xe = "bottom", Dt = "middle", Zt = "normal", Me = "px ", mt = " ", ve = "right", Ht = "rtl", Ae = "word", we = "char", Xt = "none", xt = "…", Jt = [
1740
- "direction",
1741
- "fontFamily",
1742
- "fontSize",
1743
- "fontStyle",
1744
- "fontVariant",
1745
- "padding",
1746
- "align",
1747
- "verticalAlign",
1748
- "lineHeight",
1749
- "text",
1750
- "width",
1751
- "height",
1752
- "wrap",
1753
- "ellipsis",
1754
- "letterSpacing"
1755
- ], Te = Jt.length;
1756
- let gt = null;
1757
- function Ce() {
1758
- if (gt !== null)
1759
- return gt;
1760
- gt = !1;
1761
- try {
1762
- const h = document.createElement("canvas");
1763
- h.width = 10, h.height = 10;
1764
- const t = h.getContext(Qt);
1765
- if (t) {
1766
- t.globalAlpha = 0, t.shadowColor = "black", t.shadowBlur = 5, t.shadowOffsetX = 5, t.shadowOffsetY = 5, t.fillStyle = "black", t.font = "10px Arial", t.fillText("X", 0, 10);
1767
- const e = t.getImageData(0, 0, 10, 10).data;
1768
- for (let i = 3; i < e.length; i += 4)
1769
- if (e[i] > 0) {
1770
- gt = !0;
1771
- break;
1772
- }
1773
- }
1774
- } catch {
1775
- }
1776
- return gt;
1777
- }
1778
- function ke(h) {
1779
- return h.split(",").map((t) => {
1780
- t = t.trim();
1781
- const e = t.indexOf(" ") >= 0, i = t.indexOf('"') >= 0 || t.indexOf("'") >= 0;
1782
- return e && !i && (t = `"${t}"`), t;
1783
- }).join(", ");
1784
- }
1785
- let St;
1786
- function Mt() {
1787
- return St || (St = O.createCanvasElement().getContext(Qt), St);
1788
- }
1789
- function Re(h) {
1790
- h.fillText(this._partialText, this._partialTextX, this._partialTextY);
1791
- }
1792
- function Pe(h) {
1793
- h.setAttr("miterLimit", 2), h.strokeText(this._partialText, this._partialTextX, this._partialTextY);
1794
- }
1795
- function Le(h) {
1796
- return h = h || {}, !h.fillLinearGradientColorStops && !h.fillRadialGradientColorStops && !h.fillPatternImage && (h.fill = h.fill || "black"), h;
1797
- }
1798
- class X extends $ {
1799
- constructor(t) {
1800
- super(Le(t)), this._partialTextX = 0, this._partialTextY = 0;
1801
- for (let e = 0; e < Te; e++)
1802
- this.on(Jt[e] + Se, this._setTextData);
1803
- this._setTextData();
1804
- }
1805
- _sceneFunc(t) {
1806
- var e, i;
1807
- const n = this.textArr, r = n.length;
1808
- if (!this.text())
1809
- return;
1810
- let o = this.padding(), s = this.fontSize(), a = this.lineHeight() * s, d = this.verticalAlign(), l = this.direction(), g = 0, c = this.align(), p = this.getWidth(), f = this.letterSpacing(), S = this.charRenderFunc(), _ = this.fill(), b = this.textDecoration(), m = this.underlineOffset(), x = b.indexOf("underline") !== -1, y = b.indexOf("line-through") !== -1, v;
1811
- l = l === $t ? t.direction : l;
1812
- let M = a / 2, C = Dt;
1813
- if (!j.legacyTextRendering) {
1814
- const A = this.measureSize("M");
1815
- C = "alphabetic";
1816
- const k = (e = A.fontBoundingBoxAscent) !== null && e !== void 0 ? e : A.actualBoundingBoxAscent, G = (i = A.fontBoundingBoxDescent) !== null && i !== void 0 ? i : A.actualBoundingBoxDescent;
1817
- M = (k - G) / 2 + a / 2;
1818
- }
1819
- for (l === Ht && t.setAttr("direction", l), t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", C), t.setAttr("textAlign", Kt), d === Dt ? g = (this.getHeight() - r * a - o * 2) / 2 : d === xe && (g = this.getHeight() - r * a - o * 2), t.translate(o, g + o), v = 0; v < r; v++) {
1820
- let A = 0, k = 0;
1821
- const G = n[v], I = G.text, P = G.width, F = G.lastInParagraph;
1822
- if (t.save(), c === ve ? A += p - P - o * 2 : c === me && (A += (p - P - o * 2) / 2), x) {
1823
- t.save(), t.beginPath();
1824
- const L = m ?? (j.legacyTextRendering ? Math.round(s / 2) : Math.round(s / 4)), w = A, D = M + k + L;
1825
- t.moveTo(w, D);
1826
- const R = c === ft && !F ? p - o * 2 : P;
1827
- t.lineTo(w + Math.round(R), D), t.lineWidth = s / 15;
1828
- const W = this._getLinearGradient();
1829
- t.strokeStyle = W || _, t.stroke(), t.restore();
1830
- }
1831
- const E = A;
1832
- if (l !== Ht && (f !== 0 || c === ft || S)) {
1833
- const L = I.split(" ").length - 1, w = it(I);
1834
- for (let D = 0; D < w.length; D++) {
1835
- const R = w[D];
1836
- if (R === " " && !F && c === ft && (A += (p - o * 2 - P) / L), this._partialTextX = A, this._partialTextY = M + k, this._partialText = R, S) {
1837
- t.save();
1838
- const U = n.slice(0, v).reduce((Y, Q) => Y + it(Q.text).length, 0), z = D + U;
1839
- S({
1840
- char: R,
1841
- index: z,
1842
- x: A,
1843
- y: M + k,
1844
- lineIndex: v,
1845
- column: D,
1846
- isLastInLine: F,
1847
- width: this.measureSize(R).width,
1848
- context: t
1849
- });
1850
- }
1851
- t.fillStrokeShape(this), S && t.restore(), A += this.measureSize(R).width + f;
1852
- }
1853
- } else
1854
- f !== 0 && t.setAttr("letterSpacing", `${f}px`), this._partialTextX = A, this._partialTextY = M + k, this._partialText = I, t.fillStrokeShape(this);
1855
- if (y) {
1856
- t.save(), t.beginPath();
1857
- const L = j.legacyTextRendering ? 0 : -Math.round(s / 4), w = E;
1858
- t.moveTo(w, M + k + L);
1859
- const D = c === ft && !F ? p - o * 2 : P;
1860
- t.lineTo(w + Math.round(D), M + k + L), t.lineWidth = s / 15;
1861
- const R = this._getLinearGradient();
1862
- t.strokeStyle = R || _, t.stroke(), t.restore();
1863
- }
1864
- t.restore(), r > 1 && (M += a);
1865
- }
1866
- }
1867
- _hitFunc(t) {
1868
- const e = this.getWidth(), i = this.getHeight();
1869
- t.beginPath(), t.rect(0, 0, e, i), t.closePath(), t.fillStrokeShape(this);
1870
- }
1871
- setText(t) {
1872
- const e = O._isString(t) ? t : t == null ? "" : t + "";
1873
- return this._setAttr(_e, e), this;
1874
- }
1875
- getWidth() {
1876
- return this.attrs.width === lt || this.attrs.width === void 0 ? this.getTextWidth() + this.padding() * 2 : this.attrs.width;
1877
- }
1878
- getHeight() {
1879
- return this.attrs.height === lt || this.attrs.height === void 0 ? this.fontSize() * this.textArr.length * this.lineHeight() + this.padding() * 2 : this.attrs.height;
1880
- }
1881
- getTextWidth() {
1882
- return this.textWidth;
1883
- }
1884
- getTextHeight() {
1885
- return O.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
1886
- }
1887
- measureSize(t) {
1888
- var e, i, n, r, o, s, a, d, l, g, c;
1889
- let p = Mt(), f = this.fontSize(), S;
1890
- p.save(), p.font = this._getContextFont(), S = p.measureText(t), p.restore();
1891
- const _ = f / 100;
1892
- return {
1893
- actualBoundingBoxAscent: (e = S.actualBoundingBoxAscent) !== null && e !== void 0 ? e : 71.58203125 * _,
1894
- actualBoundingBoxDescent: (i = S.actualBoundingBoxDescent) !== null && i !== void 0 ? i : 0,
1895
- actualBoundingBoxLeft: (n = S.actualBoundingBoxLeft) !== null && n !== void 0 ? n : -7.421875 * _,
1896
- actualBoundingBoxRight: (r = S.actualBoundingBoxRight) !== null && r !== void 0 ? r : 75.732421875 * _,
1897
- alphabeticBaseline: (o = S.alphabeticBaseline) !== null && o !== void 0 ? o : 0,
1898
- emHeightAscent: (s = S.emHeightAscent) !== null && s !== void 0 ? s : 100 * _,
1899
- emHeightDescent: (a = S.emHeightDescent) !== null && a !== void 0 ? a : -20 * _,
1900
- fontBoundingBoxAscent: (d = S.fontBoundingBoxAscent) !== null && d !== void 0 ? d : 91 * _,
1901
- fontBoundingBoxDescent: (l = S.fontBoundingBoxDescent) !== null && l !== void 0 ? l : 21 * _,
1902
- hangingBaseline: (g = S.hangingBaseline) !== null && g !== void 0 ? g : 72.80000305175781 * _,
1903
- ideographicBaseline: (c = S.ideographicBaseline) !== null && c !== void 0 ? c : -21 * _,
1904
- width: S.width,
1905
- height: f
1906
- };
1907
- }
1908
- _getContextFont() {
1909
- return this.fontStyle() + mt + this.fontVariant() + mt + (this.fontSize() + Me) + ke(this.fontFamily());
1910
- }
1911
- _addTextLine(t) {
1912
- this.align() === ft && (t = t.trim());
1913
- const i = this._getTextWidth(t);
1914
- return this.textArr.push({
1915
- text: t,
1916
- width: i,
1917
- lastInParagraph: !1
1918
- });
1919
- }
1920
- _getTextWidth(t) {
1921
- const e = this.letterSpacing(), i = t.length;
1922
- return Mt().measureText(t).width + e * i;
1923
- }
1924
- _setTextData() {
1925
- let t = this.text().split(`
1926
- `), e = +this.fontSize(), i = 0, n = this.lineHeight() * e, r = this.attrs.width, o = this.attrs.height, s = r !== lt && r !== void 0, a = o !== lt && o !== void 0, d = this.padding(), l = r - d * 2, g = o - d * 2, c = 0, p = this.wrap(), f = p !== Xt, S = p !== we && f, _ = this.ellipsis();
1927
- this.textArr = [], Mt().font = this._getContextFont();
1928
- const b = _ ? this._getTextWidth(xt) : 0;
1929
- for (let m = 0, x = t.length; m < x; ++m) {
1930
- let y = t[m], v = this._getTextWidth(y);
1931
- if (s && v > l)
1932
- for (; y.length > 0; ) {
1933
- let M = 0, C = it(y).length, A = "", k = 0;
1934
- for (; M < C; ) {
1935
- const G = M + C >>> 1, I = it(y), P = I.slice(0, G + 1).join(""), F = this._getTextWidth(P);
1936
- (_ && a && c + n > g ? F + b : F) <= l ? (M = G + 1, A = P, k = F) : C = G;
1937
- }
1938
- if (A) {
1939
- if (S) {
1940
- const P = it(y), F = it(A), E = P[F.length], L = E === mt || E === Wt;
1941
- let w;
1942
- if (L && k <= l)
1943
- w = F.length;
1944
- else {
1945
- const D = F.lastIndexOf(mt), R = F.lastIndexOf(Wt);
1946
- w = Math.max(D, R) + 1;
1947
- }
1948
- w > 0 && (M = w, A = P.slice(0, M).join(""), k = this._getTextWidth(A));
1949
- }
1950
- if (A = A.trimRight(), this._addTextLine(A), i = Math.max(i, k), c += n, this._shouldHandleEllipsis(c)) {
1951
- this._tryToAddEllipsisToLastLine();
1952
- break;
1953
- }
1954
- if (y = it(y).slice(M).join("").trimLeft(), y.length > 0 && (v = this._getTextWidth(y), v <= l)) {
1955
- this._addTextLine(y), c += n, i = Math.max(i, v);
1956
- break;
1957
- }
1958
- } else
1959
- break;
1960
- }
1961
- else
1962
- this._addTextLine(y), c += n, i = Math.max(i, v), this._shouldHandleEllipsis(c) && m < x - 1 && this._tryToAddEllipsisToLastLine();
1963
- if (this.textArr[this.textArr.length - 1] && (this.textArr[this.textArr.length - 1].lastInParagraph = !0), a && c + n > g)
1964
- break;
1965
- }
1966
- this.textHeight = e, this.textWidth = i;
1967
- }
1968
- _shouldHandleEllipsis(t) {
1969
- const e = +this.fontSize(), i = this.lineHeight() * e, n = this.attrs.height, r = n !== lt && n !== void 0, o = this.padding(), s = n - o * 2;
1970
- return !(this.wrap() !== Xt) || r && t + i > s;
1971
- }
1972
- _tryToAddEllipsisToLastLine() {
1973
- const t = this.attrs.width, e = t !== lt && t !== void 0, i = this.padding(), n = t - i * 2, r = this.ellipsis(), o = this.textArr[this.textArr.length - 1];
1974
- !o || !r || (e && (this._getTextWidth(o.text + xt) < n || (o.text = o.text.slice(0, o.text.length - 3))), this.textArr.splice(this.textArr.length - 1, 1), this._addTextLine(o.text + xt));
1975
- }
1976
- getStrokeScaleEnabled() {
1977
- return !0;
1978
- }
1979
- _useBufferCanvas() {
1980
- const t = this.textDecoration().indexOf("underline") !== -1 || this.textDecoration().indexOf("line-through") !== -1, e = this.hasShadow();
1981
- return t && e || e && this.getAbsoluteOpacity() !== 1 && Ce() ? !0 : super._useBufferCanvas();
1982
- }
1983
- }
1984
- X.prototype._fillFunc = Re;
1985
- X.prototype._strokeFunc = Pe;
1986
- X.prototype.className = be;
1987
- X.prototype._attrsAffectingSize = [
1988
- "text",
1989
- "fontSize",
1990
- "padding",
1991
- "wrap",
1992
- "lineHeight",
1993
- "letterSpacing"
1994
- ];
1995
- V(X);
1996
- u.overWriteSetter(X, "width", Ut());
1997
- u.overWriteSetter(X, "height", Ut());
1998
- u.addGetterSetter(X, "direction", $t);
1999
- u.addGetterSetter(X, "fontFamily", "Arial");
2000
- u.addGetterSetter(X, "fontSize", 12, T());
2001
- u.addGetterSetter(X, "fontStyle", Zt);
2002
- u.addGetterSetter(X, "fontVariant", Zt);
2003
- u.addGetterSetter(X, "padding", 0, T());
2004
- u.addGetterSetter(X, "align", Kt);
2005
- u.addGetterSetter(X, "verticalAlign", ye);
2006
- u.addGetterSetter(X, "lineHeight", 1, T());
2007
- u.addGetterSetter(X, "wrap", Ae);
2008
- u.addGetterSetter(X, "ellipsis", !1, Gt());
2009
- u.addGetterSetter(X, "letterSpacing", 0, T());
2010
- u.addGetterSetter(X, "text", "", ae());
2011
- u.addGetterSetter(X, "textDecoration", "");
2012
- u.addGetterSetter(X, "underlineOffset", void 0, T());
2013
- u.addGetterSetter(X, "charRenderFunc", void 0);
2014
- const Ge = "", te = "normal";
2015
- function ee(h) {
2016
- h.fillText(this.partialText, 0, 0);
2017
- }
2018
- function ie(h) {
2019
- h.strokeText(this.partialText, 0, 0);
2020
- }
2021
- class q extends $ {
2022
- constructor(t) {
2023
- super(t), this.dummyCanvas = O.createCanvasElement(), this.dataArray = [], this._readDataAttribute(), this.on("dataChange.konva", function() {
2024
- this._readDataAttribute(), this._setTextData();
2025
- }), this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva", this._setTextData), this._setTextData();
2026
- }
2027
- _getTextPathLength() {
2028
- return H.getPathLength(this.dataArray);
2029
- }
2030
- _getPointAtLength(t) {
2031
- if (!this.attrs.data)
2032
- return null;
2033
- const e = this.pathLength;
2034
- return t > e ? null : H.getPointAtLengthOfDataArray(t, this.dataArray);
2035
- }
2036
- _readDataAttribute() {
2037
- this.dataArray = H.parsePathData(this.attrs.data), this.pathLength = this._getTextPathLength();
2038
- }
2039
- _sceneFunc(t) {
2040
- t.setAttr("font", this._getContextFont()), t.setAttr("textBaseline", this.textBaseline()), t.setAttr("textAlign", "left"), t.save();
2041
- const e = this.textDecoration(), i = this.fill(), n = this.fontSize(), r = this.glyphInfo, o = e.indexOf("underline") !== -1, s = e.indexOf("line-through") !== -1;
2042
- o && t.beginPath();
2043
- for (let a = 0; a < r.length; a++) {
2044
- t.save();
2045
- const d = r[a].p0;
2046
- t.translate(d.x, d.y), t.rotate(r[a].rotation), this.partialText = r[a].text, t.fillStrokeShape(this), o && (a === 0 && t.moveTo(0, n / 2 + 1), t.lineTo(r[a].width, n / 2 + 1)), t.restore();
2047
- }
2048
- if (o && (t.strokeStyle = i, t.lineWidth = n / 20, t.stroke()), s) {
2049
- t.beginPath();
2050
- for (let a = 0; a < r.length; a++) {
2051
- t.save();
2052
- const d = r[a].p0;
2053
- t.translate(d.x, d.y), t.rotate(r[a].rotation), a === 0 && t.moveTo(0, 0), t.lineTo(r[a].width, 0), t.restore();
2054
- }
2055
- t.strokeStyle = i, t.lineWidth = n / 20, t.stroke();
2056
- }
2057
- t.restore();
2058
- }
2059
- _hitFunc(t) {
2060
- t.beginPath();
2061
- const e = this.glyphInfo;
2062
- if (e.length >= 1) {
2063
- const i = e[0].p0;
2064
- t.moveTo(i.x, i.y);
2065
- }
2066
- for (let i = 0; i < e.length; i++) {
2067
- const n = e[i].p1;
2068
- t.lineTo(n.x, n.y);
2069
- }
2070
- t.setAttr("lineWidth", this.fontSize()), t.setAttr("strokeStyle", this.colorKey), t.stroke();
2071
- }
2072
- getTextWidth() {
2073
- return this.textWidth;
2074
- }
2075
- getTextHeight() {
2076
- return O.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."), this.textHeight;
2077
- }
2078
- setText(t) {
2079
- return X.prototype.setText.call(this, t);
2080
- }
2081
- _getContextFont() {
2082
- return X.prototype._getContextFont.call(this);
2083
- }
2084
- _getTextSize(t) {
2085
- const i = this.dummyCanvas.getContext("2d");
2086
- i.save(), i.font = this._getContextFont();
2087
- const n = i.measureText(t);
2088
- return i.restore(), {
2089
- width: n.width,
2090
- height: parseInt(`${this.fontSize()}`, 10)
2091
- };
2092
- }
2093
- _setTextData() {
2094
- const t = it(this.text());
2095
- this.direction() === "rtl" && t.reverse();
2096
- const e = [];
2097
- let i = 0;
2098
- for (let p = 0; p < t.length; p++)
2099
- e.push({
2100
- char: t[p],
2101
- width: this._getTextSize(t[p]).width
2102
- }), i += e[p].width;
2103
- const { width: n, height: r } = this._getTextSize(this.attrs.text);
2104
- if (this.textWidth = i, this.textHeight = r, this.glyphInfo = [], !this.attrs.data)
2105
- return null;
2106
- const o = this.letterSpacing(), s = this.align(), a = this.kerningFunc(), d = Math.max(0, i - n), l = Math.max(this.textWidth + ((this.attrs.text || "").length - 1) * o, 0);
2107
- let g = 0;
2108
- s === "center" && (g = Math.max(0, this.pathLength / 2 - l / 2)), s === "right" && (g = Math.max(0, this.pathLength - l));
2109
- let c = g;
2110
- for (let p = 0; p < e.length; p++) {
2111
- const f = this._getPointAtLength(c);
2112
- if (!f)
2113
- return;
2114
- const S = e[p].char;
2115
- let _ = e[p].width + o;
2116
- if (S === " " && s === "justify") {
2117
- const C = this.text().split(" ").length - 1;
2118
- _ += (this.pathLength - l) / C;
2119
- }
2120
- const b = c + _, m = this._getPointAtLength(b > this.pathLength && b - this.pathLength <= d ? this.pathLength : b);
2121
- if (!m)
2122
- return;
2123
- const x = H.getLineLength(f.x, f.y, m.x, m.y);
2124
- let y = 0;
2125
- if (a)
2126
- try {
2127
- y = a(e[p - 1].char, S) * this.fontSize();
2128
- } catch {
2129
- y = 0;
2130
- }
2131
- f.x += y, m.x += y, this.textWidth += y;
2132
- const v = H.getPointOnLine(y + x / 2, f.x, f.y, m.x, m.y), M = Math.atan2(m.y - f.y, m.x - f.x);
2133
- this.glyphInfo.push({
2134
- transposeX: v.x,
2135
- transposeY: v.y,
2136
- text: t[p],
2137
- rotation: M,
2138
- p0: f,
2139
- p1: m,
2140
- width: x
2141
- }), c += _;
2142
- }
2143
- }
2144
- getSelfRect() {
2145
- if (!this.glyphInfo.length)
2146
- return {
2147
- x: 0,
2148
- y: 0,
2149
- width: 0,
2150
- height: 0
2151
- };
2152
- const t = [];
2153
- this.glyphInfo.forEach(function(d) {
2154
- t.push(d.p0.x), t.push(d.p0.y), t.push(d.p1.x), t.push(d.p1.y);
2155
- });
2156
- let e = t[0] || 0, i = t[0] || 0, n = t[1] || 0, r = t[1] || 0, o, s;
2157
- for (let d = 0; d < t.length / 2; d++)
2158
- o = t[d * 2], s = t[d * 2 + 1], e = Math.min(e, o), i = Math.max(i, o), n = Math.min(n, s), r = Math.max(r, s);
2159
- const a = this.fontSize();
2160
- return {
2161
- x: e - a / 2,
2162
- y: n - a / 2,
2163
- width: i - e + a,
2164
- height: r - n + a
2165
- };
2166
- }
2167
- destroy() {
2168
- return O.releaseCanvas(this.dummyCanvas), super.destroy();
2169
- }
2170
- }
2171
- q.prototype._fillFunc = ee;
2172
- q.prototype._strokeFunc = ie;
2173
- q.prototype._fillFuncHit = ee;
2174
- q.prototype._strokeFuncHit = ie;
2175
- q.prototype.className = "TextPath";
2176
- q.prototype._attrsAffectingSize = ["text", "fontSize", "data"];
2177
- V(q);
2178
- u.addGetterSetter(q, "data");
2179
- u.addGetterSetter(q, "fontFamily", "Arial");
2180
- u.addGetterSetter(q, "fontSize", 12, T());
2181
- u.addGetterSetter(q, "fontStyle", te);
2182
- u.addGetterSetter(q, "align", "left");
2183
- u.addGetterSetter(q, "letterSpacing", 0, T());
2184
- u.addGetterSetter(q, "textBaseline", "middle");
2185
- u.addGetterSetter(q, "fontVariant", te);
2186
- u.addGetterSetter(q, "text", Ge);
2187
- u.addGetterSetter(q, "textDecoration", "");
2188
- u.addGetterSetter(q, "kerningFunc", void 0);
2189
- u.addGetterSetter(q, "direction", "inherit");
2190
- const ne = "tr-konva", Oe = [
2191
- "resizeEnabledChange",
2192
- "rotateAnchorOffsetChange",
2193
- "rotateAnchorAngleChange",
2194
- "rotateEnabledChange",
2195
- "enabledAnchorsChange",
2196
- "anchorSizeChange",
2197
- "borderEnabledChange",
2198
- "borderStrokeChange",
2199
- "borderStrokeWidthChange",
2200
- "borderDashChange",
2201
- "anchorStrokeChange",
2202
- "anchorStrokeWidthChange",
2203
- "anchorFillChange",
2204
- "anchorCornerRadiusChange",
2205
- "ignoreStrokeChange",
2206
- "anchorStyleFuncChange"
2207
- ].map((h) => h + `.${ne}`).join(" "), Yt = "nodesRect", Ee = [
2208
- "widthChange",
2209
- "heightChange",
2210
- "scaleXChange",
2211
- "scaleYChange",
2212
- "skewXChange",
2213
- "skewYChange",
2214
- "rotationChange",
2215
- "offsetXChange",
2216
- "offsetYChange",
2217
- "transformsEnabledChange",
2218
- "strokeWidthChange",
2219
- "draggableChange"
2220
- ], Ne = {
2221
- "top-left": -45,
2222
- "top-center": 0,
2223
- "top-right": 45,
2224
- "middle-right": -90,
2225
- "middle-left": 90,
2226
- "bottom-left": -135,
2227
- "bottom-center": 180,
2228
- "bottom-right": 135
2229
- }, Ie = "ontouchstart" in j._global;
2230
- function Fe(h, t, e) {
2231
- if (h === "rotater")
2232
- return e;
2233
- t += O.degToRad(Ne[h] || 0);
2234
- const i = (O.radToDeg(t) % 360 + 360) % 360;
2235
- return O._inRange(i, 315 + 22.5, 360) || O._inRange(i, 0, 22.5) ? "ns-resize" : O._inRange(i, 45 - 22.5, 45 + 22.5) ? "nesw-resize" : O._inRange(i, 90 - 22.5, 90 + 22.5) ? "ew-resize" : O._inRange(i, 135 - 22.5, 135 + 22.5) ? "nwse-resize" : O._inRange(i, 180 - 22.5, 180 + 22.5) ? "ns-resize" : O._inRange(i, 225 - 22.5, 225 + 22.5) ? "nesw-resize" : O._inRange(i, 270 - 22.5, 270 + 22.5) ? "ew-resize" : O._inRange(i, 315 - 22.5, 315 + 22.5) ? "nwse-resize" : (O.error("Transformer has unknown angle for cursor detection: " + i), "pointer");
2236
- }
2237
- const bt = [
2238
- "top-left",
2239
- "top-center",
2240
- "top-right",
2241
- "middle-right",
2242
- "middle-left",
2243
- "bottom-left",
2244
- "bottom-center",
2245
- "bottom-right"
2246
- ];
2247
- function Be(h) {
2248
- return {
2249
- x: h.x + h.width / 2 * Math.cos(h.rotation) + h.height / 2 * Math.sin(-h.rotation),
2250
- y: h.y + h.height / 2 * Math.cos(h.rotation) + h.width / 2 * Math.sin(h.rotation)
2251
- };
2252
- }
2253
- function se(h, t, e) {
2254
- const i = e.x + (h.x - e.x) * Math.cos(t) - (h.y - e.y) * Math.sin(t), n = e.y + (h.x - e.x) * Math.sin(t) + (h.y - e.y) * Math.cos(t);
2255
- return {
2256
- ...h,
2257
- rotation: h.rotation + t,
2258
- x: i,
2259
- y: n
2260
- };
2261
- }
2262
- function ze(h, t) {
2263
- const e = Be(h);
2264
- return se(h, t, e);
2265
- }
2266
- function We(h, t, e) {
2267
- let i = t;
2268
- for (let n = 0; n < h.length; n++) {
2269
- const r = j.getAngle(h[n]), o = Math.abs(r - t) % (Math.PI * 2);
2270
- Math.min(o, Math.PI * 2 - o) < e && (i = r);
2271
- }
2272
- return i;
2273
- }
2274
- let Lt = 0;
2275
- class N extends At {
2276
- constructor(t) {
2277
- super(t), this._movingAnchorName = null, this._transforming = !1, this._elementsCreated = !1, this._createElements(), this._handleMouseMove = this._handleMouseMove.bind(this), this._handleMouseUp = this._handleMouseUp.bind(this), this.update = this.update.bind(this), this.on(Oe, this.update), this.getNode() && this.update();
2278
- }
2279
- attachTo(t) {
2280
- return this.setNode(t), this;
2281
- }
2282
- setNode(t) {
2283
- return O.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."), this.setNodes([t]);
2284
- }
2285
- getNode() {
2286
- return this._nodes && this._nodes[0];
2287
- }
2288
- _getEventNamespace() {
2289
- return ne + this._id;
2290
- }
2291
- setNodes(t = []) {
2292
- this._nodes && this._nodes.length && this.detach();
2293
- const e = t.filter((n) => n.isAncestorOf(this) ? (O.error("Konva.Transformer cannot be an a child of the node you are trying to attach"), !1) : !0);
2294
- return this._nodes = t = e, t.length === 1 && this.useSingleNodeRotation() ? this.rotation(t[0].getAbsoluteRotation()) : this.rotation(0), this._nodes.forEach((n) => {
2295
- const r = () => {
2296
- this.nodes().length === 1 && this.useSingleNodeRotation() && this.rotation(this.nodes()[0].getAbsoluteRotation()), this._resetTransformCache(), !this._transforming && !this.isDragging() && this.update();
2297
- };
2298
- if (n._attrsAffectingSize.length) {
2299
- const o = n._attrsAffectingSize.map((s) => s + "Change." + this._getEventNamespace()).join(" ");
2300
- n.on(o, r);
2301
- }
2302
- n.on(Ee.map((o) => o + `.${this._getEventNamespace()}`).join(" "), r), n.on(`absoluteTransformChange.${this._getEventNamespace()}`, r), this._proxyDrag(n);
2303
- }), this._resetTransformCache(), !!this.findOne(".top-left") && this.update(), this;
2304
- }
2305
- _proxyDrag(t) {
2306
- let e;
2307
- t.on(`dragstart.${this._getEventNamespace()}`, (i) => {
2308
- e = t.getAbsolutePosition(), !this.isDragging() && t !== this.findOne(".back") && this.startDrag(i, !1);
2309
- }), t.on(`dragmove.${this._getEventNamespace()}`, (i) => {
2310
- if (!e)
2311
- return;
2312
- const n = t.getAbsolutePosition(), r = n.x - e.x, o = n.y - e.y;
2313
- this.nodes().forEach((s) => {
2314
- if (s === t || s.isDragging())
2315
- return;
2316
- const a = s.getAbsolutePosition();
2317
- s.setAbsolutePosition({
2318
- x: a.x + r,
2319
- y: a.y + o
2320
- }), s.startDrag(i);
2321
- }), e = null;
2322
- });
2323
- }
2324
- getNodes() {
2325
- return this._nodes || [];
2326
- }
2327
- getActiveAnchor() {
2328
- return this._movingAnchorName;
2329
- }
2330
- detach() {
2331
- this._nodes && this._nodes.forEach((t) => {
2332
- t.off("." + this._getEventNamespace());
2333
- }), this._nodes = [], this._resetTransformCache();
2334
- }
2335
- _resetTransformCache() {
2336
- this._clearCache(Yt), this._clearCache("transform"), this._clearSelfAndDescendantCache("absoluteTransform");
2337
- }
2338
- _getNodeRect() {
2339
- return this._getCache(Yt, this.__getNodeRect);
2340
- }
2341
- __getNodeShape(t, e = this.rotation(), i) {
2342
- const n = t.getClientRect({
2343
- skipTransform: !0,
2344
- skipShadow: !0,
2345
- skipStroke: this.ignoreStroke()
2346
- }), r = t.getAbsoluteScale(i), o = t.getAbsolutePosition(i), s = n.x * r.x - t.offsetX() * r.x, a = n.y * r.y - t.offsetY() * r.y, d = (j.getAngle(t.getAbsoluteRotation()) + Math.PI * 2) % (Math.PI * 2), l = {
2347
- x: o.x + s * Math.cos(d) + a * Math.sin(-d),
2348
- y: o.y + a * Math.cos(d) + s * Math.sin(d),
2349
- width: n.width * r.x,
2350
- height: n.height * r.y,
2351
- rotation: d
2352
- };
2353
- return se(l, -j.getAngle(e), {
2354
- x: 0,
2355
- y: 0
2356
- });
2357
- }
2358
- __getNodeRect() {
2359
- if (!this.getNode())
2360
- return {
2361
- x: -1e8,
2362
- y: -1e8,
2363
- width: 0,
2364
- height: 0,
2365
- rotation: 0
2366
- };
2367
- const e = [];
2368
- this.nodes().map((d) => {
2369
- const l = d.getClientRect({
2370
- skipTransform: !0,
2371
- skipShadow: !0,
2372
- skipStroke: this.ignoreStroke()
2373
- }), g = [
2374
- { x: l.x, y: l.y },
2375
- { x: l.x + l.width, y: l.y },
2376
- { x: l.x + l.width, y: l.y + l.height },
2377
- { x: l.x, y: l.y + l.height }
2378
- ], c = d.getAbsoluteTransform();
2379
- g.forEach(function(p) {
2380
- const f = c.point(p);
2381
- e.push(f);
2382
- });
2383
- });
2384
- const i = new ct();
2385
- i.rotate(-j.getAngle(this.rotation()));
2386
- let n = 1 / 0, r = 1 / 0, o = -1 / 0, s = -1 / 0;
2387
- e.forEach(function(d) {
2388
- const l = i.point(d);
2389
- n === void 0 && (n = o = l.x, r = s = l.y), n = Math.min(n, l.x), r = Math.min(r, l.y), o = Math.max(o, l.x), s = Math.max(s, l.y);
2390
- }), i.invert();
2391
- const a = i.point({ x: n, y: r });
2392
- return {
2393
- x: a.x,
2394
- y: a.y,
2395
- width: o - n,
2396
- height: s - r,
2397
- rotation: j.getAngle(this.rotation())
2398
- };
2399
- }
2400
- getX() {
2401
- return this._getNodeRect().x;
2402
- }
2403
- getY() {
2404
- return this._getNodeRect().y;
2405
- }
2406
- getWidth() {
2407
- return this._getNodeRect().width;
2408
- }
2409
- getHeight() {
2410
- return this._getNodeRect().height;
2411
- }
2412
- _createElements() {
2413
- this._createBack(), bt.forEach((t) => {
2414
- this._createAnchor(t);
2415
- }), this._createAnchor("rotater"), this._elementsCreated = !0;
2416
- }
2417
- _createAnchor(t) {
2418
- const e = new pt({
2419
- stroke: "rgb(0, 161, 255)",
2420
- fill: "white",
2421
- strokeWidth: 1,
2422
- name: t + " _anchor",
2423
- dragDistance: 0,
2424
- draggable: !0,
2425
- hitStrokeWidth: Ie ? 10 : "auto"
2426
- }), i = this;
2427
- e.on("mousedown touchstart", function(n) {
2428
- i._handleMouseDown(n);
2429
- }), e.on("dragstart", (n) => {
2430
- e.stopDrag(), n.cancelBubble = !0;
2431
- }), e.on("dragend", (n) => {
2432
- n.cancelBubble = !0;
2433
- }), e.on("mouseenter", () => {
2434
- const n = j.getAngle(this.rotation()), r = this.rotateAnchorCursor(), o = Fe(t, n, r);
2435
- e.getStage().content && (e.getStage().content.style.cursor = o), this._cursorChange = !0;
2436
- }), e.on("mouseout", () => {
2437
- e.getStage().content && (e.getStage().content.style.cursor = ""), this._cursorChange = !1;
2438
- }), this.add(e);
2439
- }
2440
- _createBack() {
2441
- const t = new $({
2442
- name: "back",
2443
- width: 0,
2444
- height: 0,
2445
- sceneFunc(e, i) {
2446
- const n = i.getParent(), r = n.padding(), o = i.width(), s = i.height();
2447
- if (e.beginPath(), e.rect(-r, -r, o + r * 2, s + r * 2), n.rotateEnabled() && n.rotateLineVisible()) {
2448
- const a = n.rotateAnchorAngle(), d = n.rotateAnchorOffset(), l = O.degToRad(a), g = Math.sin(l), c = -Math.cos(l), p = o / 2, f = s / 2;
2449
- let S = 1 / 0;
2450
- c < 0 ? S = Math.min(S, -f / c) : c > 0 && (S = Math.min(S, (s - f) / c)), g < 0 ? S = Math.min(S, -p / g) : g > 0 && (S = Math.min(S, (o - p) / g));
2451
- const _ = p + g * S, b = f + c * S, m = O._sign(s), x = _ + g * d * m, y = b + c * d * m;
2452
- e.moveTo(_, b), e.lineTo(x, y);
2453
- }
2454
- e.fillStrokeShape(i);
2455
- },
2456
- hitFunc: (e, i) => {
2457
- if (!this.shouldOverdrawWholeArea())
2458
- return;
2459
- const n = this.padding();
2460
- e.beginPath(), e.rect(-n, -n, i.width() + n * 2, i.height() + n * 2), e.fillStrokeShape(i);
2461
- }
2462
- });
2463
- this.add(t), this._proxyDrag(t), t.on("dragstart", (e) => {
2464
- e.cancelBubble = !0;
2465
- }), t.on("dragmove", (e) => {
2466
- e.cancelBubble = !0;
2467
- }), t.on("dragend", (e) => {
2468
- e.cancelBubble = !0;
2469
- }), this.on("dragmove", (e) => {
2470
- this.update();
2471
- });
2472
- }
2473
- _handleMouseDown(t) {
2474
- if (this._transforming)
2475
- return;
2476
- this._movingAnchorName = t.target.name().split(" ")[0];
2477
- const e = this._getNodeRect(), i = e.width, n = e.height, r = Math.sqrt(Math.pow(i, 2) + Math.pow(n, 2));
2478
- this.sin = Math.abs(n / r), this.cos = Math.abs(i / r), typeof window < "u" && (window.addEventListener("mousemove", this._handleMouseMove), window.addEventListener("touchmove", this._handleMouseMove), window.addEventListener("mouseup", this._handleMouseUp, !0), window.addEventListener("touchend", this._handleMouseUp, !0)), this._transforming = !0;
2479
- const o = t.target.getAbsolutePosition(), s = t.target.getStage().getPointerPosition();
2480
- this._anchorDragOffset = {
2481
- x: s.x - o.x,
2482
- y: s.y - o.y
2483
- }, Lt++, this._fire("transformstart", { evt: t.evt, target: this.getNode() }), this._nodes.forEach((a) => {
2484
- a._fire("transformstart", { evt: t.evt, target: a });
2485
- });
2486
- }
2487
- _handleMouseMove(t) {
2488
- let e, i, n;
2489
- const r = this.findOne("." + this._movingAnchorName), o = r.getStage();
2490
- o.setPointersPositions(t);
2491
- const s = o.getPointerPosition();
2492
- let a = {
2493
- x: s.x - this._anchorDragOffset.x,
2494
- y: s.y - this._anchorDragOffset.y
2495
- };
2496
- const d = r.getAbsolutePosition();
2497
- this.anchorDragBoundFunc() && (a = this.anchorDragBoundFunc()(d, a, t)), r.setAbsolutePosition(a);
2498
- const l = r.getAbsolutePosition();
2499
- if (d.x === l.x && d.y === l.y)
2500
- return;
2501
- if (this._movingAnchorName === "rotater") {
2502
- const m = this._getNodeRect();
2503
- e = r.x() - m.width / 2, i = -r.y() + m.height / 2;
2504
- const x = j.getAngle(this.rotateAnchorAngle());
2505
- let y = Math.atan2(-i, e) + Math.PI / 2 - x;
2506
- m.height < 0 && (y -= Math.PI);
2507
- const M = j.getAngle(this.rotation()) + y, C = j.getAngle(this.rotationSnapTolerance()), k = We(this.rotationSnaps(), M, C) - m.rotation, G = ze(m, k);
2508
- this._fitNodesInto(G, t);
2509
- return;
2510
- }
2511
- const g = this.shiftBehavior();
2512
- let c;
2513
- g === "inverted" ? c = this.keepRatio() && !t.shiftKey : g === "none" ? c = this.keepRatio() : c = this.keepRatio() || t.shiftKey;
2514
- let p = this.centeredScaling() || t.altKey;
2515
- if (this._movingAnchorName === "top-left") {
2516
- if (c) {
2517
- const m = p ? {
2518
- x: this.width() / 2,
2519
- y: this.height() / 2
2520
- } : {
2521
- x: this.findOne(".bottom-right").x(),
2522
- y: this.findOne(".bottom-right").y()
2523
- };
2524
- n = Math.sqrt(Math.pow(m.x - r.x(), 2) + Math.pow(m.y - r.y(), 2));
2525
- const x = this.findOne(".top-left").x() > m.x ? -1 : 1, y = this.findOne(".top-left").y() > m.y ? -1 : 1;
2526
- e = n * this.cos * x, i = n * this.sin * y, this.findOne(".top-left").x(m.x - e), this.findOne(".top-left").y(m.y - i);
2527
- }
2528
- } else if (this._movingAnchorName === "top-center")
2529
- this.findOne(".top-left").y(r.y());
2530
- else if (this._movingAnchorName === "top-right") {
2531
- if (c) {
2532
- const m = p ? {
2533
- x: this.width() / 2,
2534
- y: this.height() / 2
2535
- } : {
2536
- x: this.findOne(".bottom-left").x(),
2537
- y: this.findOne(".bottom-left").y()
2538
- };
2539
- n = Math.sqrt(Math.pow(r.x() - m.x, 2) + Math.pow(m.y - r.y(), 2));
2540
- const x = this.findOne(".top-right").x() < m.x ? -1 : 1, y = this.findOne(".top-right").y() > m.y ? -1 : 1;
2541
- e = n * this.cos * x, i = n * this.sin * y, this.findOne(".top-right").x(m.x + e), this.findOne(".top-right").y(m.y - i);
2542
- }
2543
- var f = r.position();
2544
- this.findOne(".top-left").y(f.y), this.findOne(".bottom-right").x(f.x);
2545
- } else if (this._movingAnchorName === "middle-left")
2546
- this.findOne(".top-left").x(r.x());
2547
- else if (this._movingAnchorName === "middle-right")
2548
- this.findOne(".bottom-right").x(r.x());
2549
- else if (this._movingAnchorName === "bottom-left") {
2550
- if (c) {
2551
- const m = p ? {
2552
- x: this.width() / 2,
2553
- y: this.height() / 2
2554
- } : {
2555
- x: this.findOne(".top-right").x(),
2556
- y: this.findOne(".top-right").y()
2557
- };
2558
- n = Math.sqrt(Math.pow(m.x - r.x(), 2) + Math.pow(r.y() - m.y, 2));
2559
- const x = m.x < r.x() ? -1 : 1, y = r.y() < m.y ? -1 : 1;
2560
- e = n * this.cos * x, i = n * this.sin * y, r.x(m.x - e), r.y(m.y + i);
2561
- }
2562
- f = r.position(), this.findOne(".top-left").x(f.x), this.findOne(".bottom-right").y(f.y);
2563
- } else if (this._movingAnchorName === "bottom-center")
2564
- this.findOne(".bottom-right").y(r.y());
2565
- else if (this._movingAnchorName === "bottom-right") {
2566
- if (c) {
2567
- const m = p ? {
2568
- x: this.width() / 2,
2569
- y: this.height() / 2
2570
- } : {
2571
- x: this.findOne(".top-left").x(),
2572
- y: this.findOne(".top-left").y()
2573
- };
2574
- n = Math.sqrt(Math.pow(r.x() - m.x, 2) + Math.pow(r.y() - m.y, 2));
2575
- const x = this.findOne(".bottom-right").x() < m.x ? -1 : 1, y = this.findOne(".bottom-right").y() < m.y ? -1 : 1;
2576
- e = n * this.cos * x, i = n * this.sin * y, this.findOne(".bottom-right").x(m.x + e), this.findOne(".bottom-right").y(m.y + i);
2577
- }
2578
- } else
2579
- console.error(new Error("Wrong position argument of selection resizer: " + this._movingAnchorName));
2580
- if (p = this.centeredScaling() || t.altKey, p) {
2581
- const m = this.findOne(".top-left"), x = this.findOne(".bottom-right"), y = m.x(), v = m.y(), M = this.getWidth() - x.x(), C = this.getHeight() - x.y();
2582
- x.move({
2583
- x: -y,
2584
- y: -v
2585
- }), m.move({
2586
- x: M,
2587
- y: C
2588
- });
2589
- }
2590
- const S = this.findOne(".top-left").getAbsolutePosition();
2591
- e = S.x, i = S.y;
2592
- const _ = this.findOne(".bottom-right").x() - this.findOne(".top-left").x(), b = this.findOne(".bottom-right").y() - this.findOne(".top-left").y();
2593
- this._fitNodesInto({
2594
- x: e,
2595
- y: i,
2596
- width: _,
2597
- height: b,
2598
- rotation: j.getAngle(this.rotation())
2599
- }, t);
2600
- }
2601
- _handleMouseUp(t) {
2602
- this._removeEvents(t);
2603
- }
2604
- getAbsoluteTransform() {
2605
- return this.getTransform();
2606
- }
2607
- _removeEvents(t) {
2608
- var e;
2609
- if (this._transforming) {
2610
- this._transforming = !1, typeof window < "u" && (window.removeEventListener("mousemove", this._handleMouseMove), window.removeEventListener("touchmove", this._handleMouseMove), window.removeEventListener("mouseup", this._handleMouseUp, !0), window.removeEventListener("touchend", this._handleMouseUp, !0));
2611
- const i = this.getNode();
2612
- Lt--, this._fire("transformend", { evt: t, target: i }), (e = this.getLayer()) === null || e === void 0 || e.batchDraw(), i && this._nodes.forEach((n) => {
2613
- var r;
2614
- n._fire("transformend", { evt: t, target: n }), (r = n.getLayer()) === null || r === void 0 || r.batchDraw();
2615
- }), this._movingAnchorName = null;
2616
- }
2617
- }
2618
- _fitNodesInto(t, e) {
2619
- const i = this._getNodeRect(), n = 1;
2620
- if (O._inRange(t.width, -this.padding() * 2 - n, n)) {
2621
- this.update();
2622
- return;
2623
- }
2624
- if (O._inRange(t.height, -this.padding() * 2 - n, n)) {
2625
- this.update();
2626
- return;
2627
- }
2628
- const r = new ct();
2629
- if (r.rotate(j.getAngle(this.rotation())), this._movingAnchorName && t.width < 0 && this._movingAnchorName.indexOf("left") >= 0) {
2630
- const c = r.point({
2631
- x: -this.padding() * 2,
2632
- y: 0
2633
- });
2634
- t.x += c.x, t.y += c.y, t.width += this.padding() * 2, this._movingAnchorName = this._movingAnchorName.replace("left", "right"), this._anchorDragOffset.x -= c.x, this._anchorDragOffset.y -= c.y;
2635
- } else if (this._movingAnchorName && t.width < 0 && this._movingAnchorName.indexOf("right") >= 0) {
2636
- const c = r.point({
2637
- x: this.padding() * 2,
2638
- y: 0
2639
- });
2640
- this._movingAnchorName = this._movingAnchorName.replace("right", "left"), this._anchorDragOffset.x -= c.x, this._anchorDragOffset.y -= c.y, t.width += this.padding() * 2;
2641
- }
2642
- if (this._movingAnchorName && t.height < 0 && this._movingAnchorName.indexOf("top") >= 0) {
2643
- const c = r.point({
2644
- x: 0,
2645
- y: -this.padding() * 2
2646
- });
2647
- t.x += c.x, t.y += c.y, this._movingAnchorName = this._movingAnchorName.replace("top", "bottom"), this._anchorDragOffset.x -= c.x, this._anchorDragOffset.y -= c.y, t.height += this.padding() * 2;
2648
- } else if (this._movingAnchorName && t.height < 0 && this._movingAnchorName.indexOf("bottom") >= 0) {
2649
- const c = r.point({
2650
- x: 0,
2651
- y: this.padding() * 2
2652
- });
2653
- this._movingAnchorName = this._movingAnchorName.replace("bottom", "top"), this._anchorDragOffset.x -= c.x, this._anchorDragOffset.y -= c.y, t.height += this.padding() * 2;
2654
- }
2655
- if (this.boundBoxFunc()) {
2656
- const c = this.boundBoxFunc()(i, t);
2657
- c ? t = c : O.warn("boundBoxFunc returned falsy. You should return new bound rect from it!");
2658
- }
2659
- const o = 1e7, s = new ct();
2660
- s.translate(i.x, i.y), s.rotate(i.rotation), s.scale(i.width / o, i.height / o);
2661
- const a = new ct(), d = t.width / o, l = t.height / o;
2662
- this.flipEnabled() === !1 ? (a.translate(t.x, t.y), a.rotate(t.rotation), a.translate(t.width < 0 ? t.width : 0, t.height < 0 ? t.height : 0), a.scale(Math.abs(d), Math.abs(l))) : (a.translate(t.x, t.y), a.rotate(t.rotation), a.scale(d, l));
2663
- const g = a.multiply(s.invert());
2664
- this._nodes.forEach((c) => {
2665
- var p;
2666
- if (!c.getStage())
2667
- return;
2668
- const f = c.getParent().getAbsoluteTransform(), S = c.getTransform().copy();
2669
- S.translate(c.offsetX(), c.offsetY());
2670
- const _ = new ct();
2671
- _.multiply(f.copy().invert()).multiply(g).multiply(f).multiply(S);
2672
- const b = _.decompose();
2673
- c.setAttrs(b), (p = c.getLayer()) === null || p === void 0 || p.batchDraw();
2674
- }), this.rotation(O._getRotation(t.rotation)), this._nodes.forEach((c) => {
2675
- this._fire("transform", { evt: e, target: c }), c._fire("transform", { evt: e, target: c });
2676
- }), this._resetTransformCache(), this.update(), this.getLayer().batchDraw();
2677
- }
2678
- forceUpdate() {
2679
- this._resetTransformCache(), this.update();
2680
- }
2681
- _batchChangeChild(t, e) {
2682
- this.findOne(t).setAttrs(e);
2683
- }
2684
- update() {
2685
- var t;
2686
- const e = this._getNodeRect();
2687
- this.rotation(O._getRotation(e.rotation));
2688
- const i = e.width, n = e.height, r = this.enabledAnchors(), o = this.resizeEnabled(), s = this.padding(), a = this.anchorSize(), d = this.find("._anchor");
2689
- d.forEach((M) => {
2690
- M.setAttrs({
2691
- width: a,
2692
- height: a,
2693
- offsetX: a / 2,
2694
- offsetY: a / 2,
2695
- stroke: this.anchorStroke(),
2696
- strokeWidth: this.anchorStrokeWidth(),
2697
- fill: this.anchorFill(),
2698
- cornerRadius: this.anchorCornerRadius()
2699
- });
2700
- }), this._batchChangeChild(".top-left", {
2701
- x: 0,
2702
- y: 0,
2703
- offsetX: a / 2 + s,
2704
- offsetY: a / 2 + s,
2705
- visible: o && r.indexOf("top-left") >= 0
2706
- }), this._batchChangeChild(".top-center", {
2707
- x: i / 2,
2708
- y: 0,
2709
- offsetY: a / 2 + s,
2710
- visible: o && r.indexOf("top-center") >= 0
2711
- }), this._batchChangeChild(".top-right", {
2712
- x: i,
2713
- y: 0,
2714
- offsetX: a / 2 - s,
2715
- offsetY: a / 2 + s,
2716
- visible: o && r.indexOf("top-right") >= 0
2717
- }), this._batchChangeChild(".middle-left", {
2718
- x: 0,
2719
- y: n / 2,
2720
- offsetX: a / 2 + s,
2721
- visible: o && r.indexOf("middle-left") >= 0
2722
- }), this._batchChangeChild(".middle-right", {
2723
- x: i,
2724
- y: n / 2,
2725
- offsetX: a / 2 - s,
2726
- visible: o && r.indexOf("middle-right") >= 0
2727
- }), this._batchChangeChild(".bottom-left", {
2728
- x: 0,
2729
- y: n,
2730
- offsetX: a / 2 + s,
2731
- offsetY: a / 2 - s,
2732
- visible: o && r.indexOf("bottom-left") >= 0
2733
- }), this._batchChangeChild(".bottom-center", {
2734
- x: i / 2,
2735
- y: n,
2736
- offsetY: a / 2 - s,
2737
- visible: o && r.indexOf("bottom-center") >= 0
2738
- }), this._batchChangeChild(".bottom-right", {
2739
- x: i,
2740
- y: n,
2741
- offsetX: a / 2 - s,
2742
- offsetY: a / 2 - s,
2743
- visible: o && r.indexOf("bottom-right") >= 0
2744
- });
2745
- const l = this.rotateAnchorAngle(), g = this.rotateAnchorOffset(), c = O.degToRad(l), p = Math.sin(c), f = -Math.cos(c), S = i / 2, _ = n / 2;
2746
- let b = 1 / 0;
2747
- f < 0 ? b = Math.min(b, -_ / f) : f > 0 && (b = Math.min(b, (n - _) / f)), p < 0 ? b = Math.min(b, -S / p) : p > 0 && (b = Math.min(b, (i - S) / p));
2748
- const m = S + p * b, x = _ + f * b, y = O._sign(n);
2749
- this._batchChangeChild(".rotater", {
2750
- x: m + p * g * y,
2751
- y: x + f * g * y - s * f,
2752
- visible: this.rotateEnabled()
2753
- }), this._batchChangeChild(".back", {
2754
- width: i,
2755
- height: n,
2756
- visible: this.borderEnabled(),
2757
- stroke: this.borderStroke(),
2758
- strokeWidth: this.borderStrokeWidth(),
2759
- dash: this.borderDash(),
2760
- draggable: this.nodes().some((M) => M.draggable()),
2761
- x: 0,
2762
- y: 0
2763
- });
2764
- const v = this.anchorStyleFunc();
2765
- v && d.forEach((M) => {
2766
- v(M);
2767
- }), (t = this.getLayer()) === null || t === void 0 || t.batchDraw();
2768
- }
2769
- isTransforming() {
2770
- return this._transforming;
2771
- }
2772
- stopTransform() {
2773
- if (this._transforming) {
2774
- this._removeEvents();
2775
- const t = this.findOne("." + this._movingAnchorName);
2776
- t && t.stopDrag();
2777
- }
2778
- }
2779
- destroy() {
2780
- return this.getStage() && this._cursorChange && this.getStage().content && (this.getStage().content.style.cursor = ""), At.prototype.destroy.call(this), this.detach(), this._removeEvents(), this;
2781
- }
2782
- add(...t) {
2783
- return this._elementsCreated ? (O.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."), this) : super.add(...t);
2784
- }
2785
- toObject() {
2786
- return B.prototype.toObject.call(this);
2787
- }
2788
- clone(t) {
2789
- return B.prototype.clone.call(this, t);
2790
- }
2791
- getClientRect() {
2792
- return this.nodes().length > 0 ? super.getClientRect() : { x: 0, y: 0, width: 0, height: 0 };
2793
- }
2794
- }
2795
- N.isTransforming = () => Lt > 0;
2796
- function De(h) {
2797
- return h instanceof Array || O.warn("enabledAnchors value should be an array"), h instanceof Array && h.forEach(function(t) {
2798
- bt.indexOf(t) === -1 && O.warn("Unknown anchor name: " + t + ". Available names are: " + bt.join(", "));
2799
- }), h || [];
2800
- }
2801
- N.prototype.className = "Transformer";
2802
- V(N);
2803
- u.addGetterSetter(N, "enabledAnchors", bt, De);
2804
- u.addGetterSetter(N, "flipEnabled", !0, Gt());
2805
- u.addGetterSetter(N, "resizeEnabled", !0);
2806
- u.addGetterSetter(N, "anchorSize", 10, T());
2807
- u.addGetterSetter(N, "rotateEnabled", !0);
2808
- u.addGetterSetter(N, "rotateLineVisible", !0);
2809
- u.addGetterSetter(N, "rotationSnaps", []);
2810
- u.addGetterSetter(N, "rotateAnchorOffset", 50, T());
2811
- u.addGetterSetter(N, "rotateAnchorAngle", 0, T());
2812
- u.addGetterSetter(N, "rotateAnchorCursor", "crosshair");
2813
- u.addGetterSetter(N, "rotationSnapTolerance", 5, T());
2814
- u.addGetterSetter(N, "borderEnabled", !0);
2815
- u.addGetterSetter(N, "anchorStroke", "rgb(0, 161, 255)");
2816
- u.addGetterSetter(N, "anchorStrokeWidth", 1, T());
2817
- u.addGetterSetter(N, "anchorFill", "white");
2818
- u.addGetterSetter(N, "anchorCornerRadius", 0, T());
2819
- u.addGetterSetter(N, "borderStroke", "rgb(0, 161, 255)");
2820
- u.addGetterSetter(N, "borderStrokeWidth", 1, T());
2821
- u.addGetterSetter(N, "borderDash");
2822
- u.addGetterSetter(N, "keepRatio", !0);
2823
- u.addGetterSetter(N, "shiftBehavior", "default");
2824
- u.addGetterSetter(N, "centeredScaling", !1);
2825
- u.addGetterSetter(N, "ignoreStroke", !1);
2826
- u.addGetterSetter(N, "padding", 0, T());
2827
- u.addGetterSetter(N, "nodes");
2828
- u.addGetterSetter(N, "node");
2829
- u.addGetterSetter(N, "boundBoxFunc");
2830
- u.addGetterSetter(N, "anchorDragBoundFunc");
2831
- u.addGetterSetter(N, "anchorStyleFunc");
2832
- u.addGetterSetter(N, "shouldOverdrawWholeArea", !1);
2833
- u.addGetterSetter(N, "useSingleNodeRotation", !0);
2834
- u.backCompat(N, {
2835
- lineEnabled: "borderEnabled",
2836
- rotateHandlerOffset: "rotateAnchorOffset",
2837
- enabledHandlers: "enabledAnchors"
2838
- });
2839
- class et extends $ {
2840
- _sceneFunc(t) {
2841
- t.beginPath(), t.arc(0, 0, this.radius(), 0, j.getAngle(this.angle()), this.clockwise()), t.lineTo(0, 0), t.closePath(), t.fillStrokeShape(this);
2842
- }
2843
- getWidth() {
2844
- return this.radius() * 2;
2845
- }
2846
- getHeight() {
2847
- return this.radius() * 2;
2848
- }
2849
- setWidth(t) {
2850
- this.radius(t / 2);
2851
- }
2852
- setHeight(t) {
2853
- this.radius(t / 2);
2854
- }
2855
- }
2856
- et.prototype.className = "Wedge";
2857
- et.prototype._centroid = !0;
2858
- et.prototype._attrsAffectingSize = ["radius"];
2859
- V(et);
2860
- u.addGetterSetter(et, "radius", 0, T());
2861
- u.addGetterSetter(et, "angle", 0, T());
2862
- u.addGetterSetter(et, "clockwise", !1);
2863
- u.backCompat(et, {
2864
- angleDeg: "angle",
2865
- getAngleDeg: "getAngle",
2866
- setAngleDeg: "setAngle"
2867
- });
2868
- function qt() {
2869
- this.r = 0, this.g = 0, this.b = 0, this.a = 0, this.next = null;
2870
- }
2871
- const He = [
2872
- 512,
2873
- 512,
2874
- 456,
2875
- 512,
2876
- 328,
2877
- 456,
2878
- 335,
2879
- 512,
2880
- 405,
2881
- 328,
2882
- 271,
2883
- 456,
2884
- 388,
2885
- 335,
2886
- 292,
2887
- 512,
2888
- 454,
2889
- 405,
2890
- 364,
2891
- 328,
2892
- 298,
2893
- 271,
2894
- 496,
2895
- 456,
2896
- 420,
2897
- 388,
2898
- 360,
2899
- 335,
2900
- 312,
2901
- 292,
2902
- 273,
2903
- 512,
2904
- 482,
2905
- 454,
2906
- 428,
2907
- 405,
2908
- 383,
2909
- 364,
2910
- 345,
2911
- 328,
2912
- 312,
2913
- 298,
2914
- 284,
2915
- 271,
2916
- 259,
2917
- 496,
2918
- 475,
2919
- 456,
2920
- 437,
2921
- 420,
2922
- 404,
2923
- 388,
2924
- 374,
2925
- 360,
2926
- 347,
2927
- 335,
2928
- 323,
2929
- 312,
2930
- 302,
2931
- 292,
2932
- 282,
2933
- 273,
2934
- 265,
2935
- 512,
2936
- 497,
2937
- 482,
2938
- 468,
2939
- 454,
2940
- 441,
2941
- 428,
2942
- 417,
2943
- 405,
2944
- 394,
2945
- 383,
2946
- 373,
2947
- 364,
2948
- 354,
2949
- 345,
2950
- 337,
2951
- 328,
2952
- 320,
2953
- 312,
2954
- 305,
2955
- 298,
2956
- 291,
2957
- 284,
2958
- 278,
2959
- 271,
2960
- 265,
2961
- 259,
2962
- 507,
2963
- 496,
2964
- 485,
2965
- 475,
2966
- 465,
2967
- 456,
2968
- 446,
2969
- 437,
2970
- 428,
2971
- 420,
2972
- 412,
2973
- 404,
2974
- 396,
2975
- 388,
2976
- 381,
2977
- 374,
2978
- 367,
2979
- 360,
2980
- 354,
2981
- 347,
2982
- 341,
2983
- 335,
2984
- 329,
2985
- 323,
2986
- 318,
2987
- 312,
2988
- 307,
2989
- 302,
2990
- 297,
2991
- 292,
2992
- 287,
2993
- 282,
2994
- 278,
2995
- 273,
2996
- 269,
2997
- 265,
2998
- 261,
2999
- 512,
3000
- 505,
3001
- 497,
3002
- 489,
3003
- 482,
3004
- 475,
3005
- 468,
3006
- 461,
3007
- 454,
3008
- 447,
3009
- 441,
3010
- 435,
3011
- 428,
3012
- 422,
3013
- 417,
3014
- 411,
3015
- 405,
3016
- 399,
3017
- 394,
3018
- 389,
3019
- 383,
3020
- 378,
3021
- 373,
3022
- 368,
3023
- 364,
3024
- 359,
3025
- 354,
3026
- 350,
3027
- 345,
3028
- 341,
3029
- 337,
3030
- 332,
3031
- 328,
3032
- 324,
3033
- 320,
3034
- 316,
3035
- 312,
3036
- 309,
3037
- 305,
3038
- 301,
3039
- 298,
3040
- 294,
3041
- 291,
3042
- 287,
3043
- 284,
3044
- 281,
3045
- 278,
3046
- 274,
3047
- 271,
3048
- 268,
3049
- 265,
3050
- 262,
3051
- 259,
3052
- 257,
3053
- 507,
3054
- 501,
3055
- 496,
3056
- 491,
3057
- 485,
3058
- 480,
3059
- 475,
3060
- 470,
3061
- 465,
3062
- 460,
3063
- 456,
3064
- 451,
3065
- 446,
3066
- 442,
3067
- 437,
3068
- 433,
3069
- 428,
3070
- 424,
3071
- 420,
3072
- 416,
3073
- 412,
3074
- 408,
3075
- 404,
3076
- 400,
3077
- 396,
3078
- 392,
3079
- 388,
3080
- 385,
3081
- 381,
3082
- 377,
3083
- 374,
3084
- 370,
3085
- 367,
3086
- 363,
3087
- 360,
3088
- 357,
3089
- 354,
3090
- 350,
3091
- 347,
3092
- 344,
3093
- 341,
3094
- 338,
3095
- 335,
3096
- 332,
3097
- 329,
3098
- 326,
3099
- 323,
3100
- 320,
3101
- 318,
3102
- 315,
3103
- 312,
3104
- 310,
3105
- 307,
3106
- 304,
3107
- 302,
3108
- 299,
3109
- 297,
3110
- 294,
3111
- 292,
3112
- 289,
3113
- 287,
3114
- 285,
3115
- 282,
3116
- 280,
3117
- 278,
3118
- 275,
3119
- 273,
3120
- 271,
3121
- 269,
3122
- 267,
3123
- 265,
3124
- 263,
3125
- 261,
3126
- 259
3127
- ], Xe = [
3128
- 9,
3129
- 11,
3130
- 12,
3131
- 13,
3132
- 13,
3133
- 14,
3134
- 14,
3135
- 15,
3136
- 15,
3137
- 15,
3138
- 15,
3139
- 16,
3140
- 16,
3141
- 16,
3142
- 16,
3143
- 17,
3144
- 17,
3145
- 17,
3146
- 17,
3147
- 17,
3148
- 17,
3149
- 17,
3150
- 18,
3151
- 18,
3152
- 18,
3153
- 18,
3154
- 18,
3155
- 18,
3156
- 18,
3157
- 18,
3158
- 18,
3159
- 19,
3160
- 19,
3161
- 19,
3162
- 19,
3163
- 19,
3164
- 19,
3165
- 19,
3166
- 19,
3167
- 19,
3168
- 19,
3169
- 19,
3170
- 19,
3171
- 19,
3172
- 19,
3173
- 20,
3174
- 20,
3175
- 20,
3176
- 20,
3177
- 20,
3178
- 20,
3179
- 20,
3180
- 20,
3181
- 20,
3182
- 20,
3183
- 20,
3184
- 20,
3185
- 20,
3186
- 20,
3187
- 20,
3188
- 20,
3189
- 20,
3190
- 20,
3191
- 21,
3192
- 21,
3193
- 21,
3194
- 21,
3195
- 21,
3196
- 21,
3197
- 21,
3198
- 21,
3199
- 21,
3200
- 21,
3201
- 21,
3202
- 21,
3203
- 21,
3204
- 21,
3205
- 21,
3206
- 21,
3207
- 21,
3208
- 21,
3209
- 21,
3210
- 21,
3211
- 21,
3212
- 21,
3213
- 21,
3214
- 21,
3215
- 21,
3216
- 21,
3217
- 21,
3218
- 22,
3219
- 22,
3220
- 22,
3221
- 22,
3222
- 22,
3223
- 22,
3224
- 22,
3225
- 22,
3226
- 22,
3227
- 22,
3228
- 22,
3229
- 22,
3230
- 22,
3231
- 22,
3232
- 22,
3233
- 22,
3234
- 22,
3235
- 22,
3236
- 22,
3237
- 22,
3238
- 22,
3239
- 22,
3240
- 22,
3241
- 22,
3242
- 22,
3243
- 22,
3244
- 22,
3245
- 22,
3246
- 22,
3247
- 22,
3248
- 22,
3249
- 22,
3250
- 22,
3251
- 22,
3252
- 22,
3253
- 22,
3254
- 22,
3255
- 23,
3256
- 23,
3257
- 23,
3258
- 23,
3259
- 23,
3260
- 23,
3261
- 23,
3262
- 23,
3263
- 23,
3264
- 23,
3265
- 23,
3266
- 23,
3267
- 23,
3268
- 23,
3269
- 23,
3270
- 23,
3271
- 23,
3272
- 23,
3273
- 23,
3274
- 23,
3275
- 23,
3276
- 23,
3277
- 23,
3278
- 23,
3279
- 23,
3280
- 23,
3281
- 23,
3282
- 23,
3283
- 23,
3284
- 23,
3285
- 23,
3286
- 23,
3287
- 23,
3288
- 23,
3289
- 23,
3290
- 23,
3291
- 23,
3292
- 23,
3293
- 23,
3294
- 23,
3295
- 23,
3296
- 23,
3297
- 23,
3298
- 23,
3299
- 23,
3300
- 23,
3301
- 23,
3302
- 23,
3303
- 23,
3304
- 23,
3305
- 23,
3306
- 23,
3307
- 23,
3308
- 23,
3309
- 24,
3310
- 24,
3311
- 24,
3312
- 24,
3313
- 24,
3314
- 24,
3315
- 24,
3316
- 24,
3317
- 24,
3318
- 24,
3319
- 24,
3320
- 24,
3321
- 24,
3322
- 24,
3323
- 24,
3324
- 24,
3325
- 24,
3326
- 24,
3327
- 24,
3328
- 24,
3329
- 24,
3330
- 24,
3331
- 24,
3332
- 24,
3333
- 24,
3334
- 24,
3335
- 24,
3336
- 24,
3337
- 24,
3338
- 24,
3339
- 24,
3340
- 24,
3341
- 24,
3342
- 24,
3343
- 24,
3344
- 24,
3345
- 24,
3346
- 24,
3347
- 24,
3348
- 24,
3349
- 24,
3350
- 24,
3351
- 24,
3352
- 24,
3353
- 24,
3354
- 24,
3355
- 24,
3356
- 24,
3357
- 24,
3358
- 24,
3359
- 24,
3360
- 24,
3361
- 24,
3362
- 24,
3363
- 24,
3364
- 24,
3365
- 24,
3366
- 24,
3367
- 24,
3368
- 24,
3369
- 24,
3370
- 24,
3371
- 24,
3372
- 24,
3373
- 24,
3374
- 24,
3375
- 24,
3376
- 24,
3377
- 24,
3378
- 24,
3379
- 24,
3380
- 24,
3381
- 24,
3382
- 24
3383
- ];
3384
- function Ye(h, t) {
3385
- const e = h.data, i = h.width, n = h.height;
3386
- let r, o, s, a, d, l, g, c, p, f, S, _, b, m, x, y, v, M, C, A;
3387
- const k = t + t + 1, G = i - 1, I = n - 1, P = t + 1, F = P * (P + 1) / 2, E = new qt(), L = He[t], w = Xe[t];
3388
- let D = null, R = E, W = null, U = null;
3389
- for (let z = 1; z < k; z++)
3390
- R = R.next = new qt(), z === P && (D = R);
3391
- R.next = E, s = o = 0;
3392
- for (let z = 0; z < n; z++) {
3393
- _ = b = m = x = a = d = l = g = 0, c = P * (y = e[o]), p = P * (v = e[o + 1]), f = P * (M = e[o + 2]), S = P * (C = e[o + 3]), a += F * y, d += F * v, l += F * M, g += F * C, R = E;
3394
- for (let Y = 0; Y < P; Y++)
3395
- R.r = y, R.g = v, R.b = M, R.a = C, R = R.next;
3396
- for (let Y = 1; Y < P; Y++)
3397
- r = o + ((G < Y ? G : Y) << 2), a += (R.r = y = e[r]) * (A = P - Y), d += (R.g = v = e[r + 1]) * A, l += (R.b = M = e[r + 2]) * A, g += (R.a = C = e[r + 3]) * A, _ += y, b += v, m += M, x += C, R = R.next;
3398
- W = E, U = D;
3399
- for (let Y = 0; Y < i; Y++)
3400
- e[o + 3] = C = g * L >> w, C !== 0 ? (C = 255 / C, e[o] = (a * L >> w) * C, e[o + 1] = (d * L >> w) * C, e[o + 2] = (l * L >> w) * C) : e[o] = e[o + 1] = e[o + 2] = 0, a -= c, d -= p, l -= f, g -= S, c -= W.r, p -= W.g, f -= W.b, S -= W.a, r = s + ((r = Y + t + 1) < G ? r : G) << 2, _ += W.r = e[r], b += W.g = e[r + 1], m += W.b = e[r + 2], x += W.a = e[r + 3], a += _, d += b, l += m, g += x, W = W.next, c += y = U.r, p += v = U.g, f += M = U.b, S += C = U.a, _ -= y, b -= v, m -= M, x -= C, U = U.next, o += 4;
3401
- s += i;
3402
- }
3403
- for (let z = 0; z < i; z++) {
3404
- b = m = x = _ = d = l = g = a = 0, o = z << 2, c = P * (y = e[o]), p = P * (v = e[o + 1]), f = P * (M = e[o + 2]), S = P * (C = e[o + 3]), a += F * y, d += F * v, l += F * M, g += F * C, R = E;
3405
- for (let Q = 0; Q < P; Q++)
3406
- R.r = y, R.g = v, R.b = M, R.a = C, R = R.next;
3407
- let Y = i;
3408
- for (let Q = 1; Q <= t; Q++)
3409
- o = Y + z << 2, a += (R.r = y = e[o]) * (A = P - Q), d += (R.g = v = e[o + 1]) * A, l += (R.b = M = e[o + 2]) * A, g += (R.a = C = e[o + 3]) * A, _ += y, b += v, m += M, x += C, R = R.next, Q < I && (Y += i);
3410
- o = z, W = E, U = D;
3411
- for (let Q = 0; Q < n; Q++)
3412
- r = o << 2, e[r + 3] = C = g * L >> w, C > 0 ? (C = 255 / C, e[r] = (a * L >> w) * C, e[r + 1] = (d * L >> w) * C, e[r + 2] = (l * L >> w) * C) : e[r] = e[r + 1] = e[r + 2] = 0, a -= c, d -= p, l -= f, g -= S, c -= W.r, p -= W.g, f -= W.b, S -= W.a, r = z + ((r = Q + P) < I ? r : I) * i << 2, a += _ += W.r = e[r], d += b += W.g = e[r + 1], l += m += W.b = e[r + 2], g += x += W.a = e[r + 3], W = W.next, c += y = U.r, p += v = U.g, f += M = U.b, S += C = U.a, _ -= y, b -= v, m -= M, x -= C, U = U.next, o += i;
3413
- }
3414
- }
3415
- const qe = function(t) {
3416
- const e = Math.round(this.blurRadius());
3417
- e > 0 && Ye(t, e);
3418
- };
3419
- u.addGetterSetter(B, "blurRadius", 0, T(), u.afterSetFilter);
3420
- const Ue = function(h) {
3421
- const t = this.brightness() * 255, e = h.data, i = e.length;
3422
- for (let n = 0; n < i; n += 4)
3423
- e[n] += t, e[n + 1] += t, e[n + 2] += t;
3424
- };
3425
- u.addGetterSetter(B, "brightness", 0, T(), u.afterSetFilter);
3426
- const je = function(h) {
3427
- const t = this.brightness(), e = h.data, i = e.length;
3428
- for (let n = 0; n < i; n += 4)
3429
- e[n] = Math.min(255, e[n] * t), e[n + 1] = Math.min(255, e[n + 1] * t), e[n + 2] = Math.min(255, e[n + 2] * t);
3430
- }, Ve = function(h) {
3431
- const t = Math.pow((this.contrast() + 100) / 100, 2), e = h.data, i = e.length;
3432
- let n = 150, r = 150, o = 150;
3433
- for (let s = 0; s < i; s += 4)
3434
- n = e[s], r = e[s + 1], o = e[s + 2], n /= 255, n -= 0.5, n *= t, n += 0.5, n *= 255, r /= 255, r -= 0.5, r *= t, r += 0.5, r *= 255, o /= 255, o -= 0.5, o *= t, o += 0.5, o *= 255, n = n < 0 ? 0 : n > 255 ? 255 : n, r = r < 0 ? 0 : r > 255 ? 255 : r, o = o < 0 ? 0 : o > 255 ? 255 : o, e[s] = n, e[s + 1] = r, e[s + 2] = o;
3435
- };
3436
- u.addGetterSetter(B, "contrast", 0, T(), u.afterSetFilter);
3437
- const $e = function(h) {
3438
- var t, e, i, n, r, o, s, a, d;
3439
- const l = h.data, g = h.width, c = h.height, p = Math.min(1, Math.max(0, (e = (t = this.embossStrength) === null || t === void 0 ? void 0 : t.call(this)) !== null && e !== void 0 ? e : 0.5)), f = Math.min(1, Math.max(0, (n = (i = this.embossWhiteLevel) === null || i === void 0 ? void 0 : i.call(this)) !== null && n !== void 0 ? n : 0.5)), _ = (s = {
3440
- "top-left": 315,
3441
- top: 270,
3442
- "top-right": 225,
3443
- right: 180,
3444
- "bottom-right": 135,
3445
- bottom: 90,
3446
- "bottom-left": 45,
3447
- left: 0
3448
- }[(o = (r = this.embossDirection) === null || r === void 0 ? void 0 : r.call(this)) !== null && o !== void 0 ? o : "top-left"]) !== null && s !== void 0 ? s : 315, b = !!((d = (a = this.embossBlend) === null || a === void 0 ? void 0 : a.call(this)) !== null && d !== void 0 && d), m = p * 10, x = f * 255, y = _ * Math.PI / 180, v = Math.cos(y), M = Math.sin(y), C = 128 / 1020 * m, A = new Uint8ClampedArray(l), k = new Float32Array(g * c);
3449
- for (let E = 0, L = 0; L < l.length; L += 4, E++)
3450
- k[E] = 0.2126 * A[L] + 0.7152 * A[L + 1] + 0.0722 * A[L + 2];
3451
- const G = [-1, 0, 1, -2, 0, 2, -1, 0, 1], I = [-1, -2, -1, 0, 0, 0, 1, 2, 1], P = [-g - 1, -g, -g + 1, -1, 0, 1, g - 1, g, g + 1], F = (E) => E < 0 ? 0 : E > 255 ? 255 : E;
3452
- for (let E = 1; E < c - 1; E++)
3453
- for (let L = 1; L < g - 1; L++) {
3454
- const w = E * g + L;
3455
- let D = 0, R = 0;
3456
- D += k[w + P[0]] * G[0], R += k[w + P[0]] * I[0], D += k[w + P[1]] * G[1], R += k[w + P[1]] * I[1], D += k[w + P[2]] * G[2], R += k[w + P[2]] * I[2], D += k[w + P[3]] * G[3], R += k[w + P[3]] * I[3], D += k[w + P[5]] * G[5], R += k[w + P[5]] * I[5], D += k[w + P[6]] * G[6], R += k[w + P[6]] * I[6], D += k[w + P[7]] * G[7], R += k[w + P[7]] * I[7], D += k[w + P[8]] * G[8], R += k[w + P[8]] * I[8];
3457
- const W = v * D + M * R, U = F(x + W * C), z = w * 4;
3458
- if (b) {
3459
- const Y = U - x;
3460
- l[z] = F(A[z] + Y), l[z + 1] = F(A[z + 1] + Y), l[z + 2] = F(A[z + 2] + Y), l[z + 3] = A[z + 3];
3461
- } else
3462
- l[z] = l[z + 1] = l[z + 2] = U, l[z + 3] = A[z + 3];
3463
- }
3464
- for (let E = 0; E < g; E++) {
3465
- let L = E * 4, w = ((c - 1) * g + E) * 4;
3466
- l[L] = A[L], l[L + 1] = A[L + 1], l[L + 2] = A[L + 2], l[L + 3] = A[L + 3], l[w] = A[w], l[w + 1] = A[w + 1], l[w + 2] = A[w + 2], l[w + 3] = A[w + 3];
3467
- }
3468
- for (let E = 1; E < c - 1; E++) {
3469
- let L = E * g * 4, w = (E * g + (g - 1)) * 4;
3470
- l[L] = A[L], l[L + 1] = A[L + 1], l[L + 2] = A[L + 2], l[L + 3] = A[L + 3], l[w] = A[w], l[w + 1] = A[w + 1], l[w + 2] = A[w + 2], l[w + 3] = A[w + 3];
3471
- }
3472
- return h;
3473
- };
3474
- u.addGetterSetter(B, "embossStrength", 0.5, T(), u.afterSetFilter);
3475
- u.addGetterSetter(B, "embossWhiteLevel", 0.5, T(), u.afterSetFilter);
3476
- u.addGetterSetter(B, "embossDirection", "top-left", void 0, u.afterSetFilter);
3477
- u.addGetterSetter(B, "embossBlend", !1, void 0, u.afterSetFilter);
3478
- function vt(h, t, e, i, n) {
3479
- const r = e - t, o = n - i;
3480
- if (r === 0)
3481
- return i + o / 2;
3482
- if (o === 0)
3483
- return i;
3484
- let s = (h - t) / r;
3485
- return s = o * s + i, s;
3486
- }
3487
- const Qe = function(h) {
3488
- const t = h.data, e = t.length;
3489
- let i = t[0], n = i, r, o = t[1], s = o, a, d = t[2], l = d, g;
3490
- const c = this.enhance();
3491
- if (c === 0)
3492
- return;
3493
- for (let x = 0; x < e; x += 4)
3494
- r = t[x + 0], r < i ? i = r : r > n && (n = r), a = t[x + 1], a < o ? o = a : a > s && (s = a), g = t[x + 2], g < d ? d = g : g > l && (l = g);
3495
- n === i && (n = 255, i = 0), s === o && (s = 255, o = 0), l === d && (l = 255, d = 0);
3496
- let p, f, S, _, b, m;
3497
- if (c > 0)
3498
- p = n + c * (255 - n), f = i - c * (i - 0), S = s + c * (255 - s), _ = o - c * (o - 0), b = l + c * (255 - l), m = d - c * (d - 0);
3499
- else {
3500
- const x = (n + i) * 0.5;
3501
- p = n + c * (n - x), f = i + c * (i - x);
3502
- const y = (s + o) * 0.5;
3503
- S = s + c * (s - y), _ = o + c * (o - y);
3504
- const v = (l + d) * 0.5;
3505
- b = l + c * (l - v), m = d + c * (d - v);
3506
- }
3507
- for (let x = 0; x < e; x += 4)
3508
- t[x + 0] = vt(t[x + 0], i, n, f, p), t[x + 1] = vt(t[x + 1], o, s, _, S), t[x + 2] = vt(t[x + 2], d, l, m, b);
3509
- };
3510
- u.addGetterSetter(B, "enhance", 0, T(), u.afterSetFilter);
3511
- const Ke = function(h) {
3512
- const t = h.data, e = t.length;
3513
- for (let i = 0; i < e; i += 4) {
3514
- const n = 0.34 * t[i] + 0.5 * t[i + 1] + 0.16 * t[i + 2];
3515
- t[i] = n, t[i + 1] = n, t[i + 2] = n;
3516
- }
3517
- };
3518
- u.addGetterSetter(B, "hue", 0, T(), u.afterSetFilter);
3519
- u.addGetterSetter(B, "saturation", 0, T(), u.afterSetFilter);
3520
- u.addGetterSetter(B, "luminance", 0, T(), u.afterSetFilter);
3521
- const Ze = function(h) {
3522
- const t = h.data, e = t.length, i = 1, n = Math.pow(2, this.saturation()), r = Math.abs(this.hue() + 360) % 360, o = this.luminance() * 127, s = i * n * Math.cos(r * Math.PI / 180), a = i * n * Math.sin(r * Math.PI / 180), d = 0.299 * i + 0.701 * s + 0.167 * a, l = 0.587 * i - 0.587 * s + 0.33 * a, g = 0.114 * i - 0.114 * s - 0.497 * a, c = 0.299 * i - 0.299 * s - 0.328 * a, p = 0.587 * i + 0.413 * s + 0.035 * a, f = 0.114 * i - 0.114 * s + 0.293 * a, S = 0.299 * i - 0.3 * s + 1.25 * a, _ = 0.587 * i - 0.586 * s - 1.05 * a, b = 0.114 * i + 0.886 * s - 0.2 * a;
3523
- let m, x, y, v;
3524
- for (let M = 0; M < e; M += 4)
3525
- m = t[M + 0], x = t[M + 1], y = t[M + 2], v = t[M + 3], t[M + 0] = d * m + l * x + g * y + o, t[M + 1] = c * m + p * x + f * y + o, t[M + 2] = S * m + _ * x + b * y + o, t[M + 3] = v;
3526
- }, Je = function(h) {
3527
- const t = h.data, e = t.length, i = Math.pow(2, this.value()), n = Math.pow(2, this.saturation()), r = Math.abs(this.hue() + 360) % 360, o = i * n * Math.cos(r * Math.PI / 180), s = i * n * Math.sin(r * Math.PI / 180), a = 0.299 * i + 0.701 * o + 0.167 * s, d = 0.587 * i - 0.587 * o + 0.33 * s, l = 0.114 * i - 0.114 * o - 0.497 * s, g = 0.299 * i - 0.299 * o - 0.328 * s, c = 0.587 * i + 0.413 * o + 0.035 * s, p = 0.114 * i - 0.114 * o + 0.293 * s, f = 0.299 * i - 0.3 * o + 1.25 * s, S = 0.587 * i - 0.586 * o - 1.05 * s, _ = 0.114 * i + 0.886 * o - 0.2 * s;
3528
- for (let b = 0; b < e; b += 4) {
3529
- const m = t[b + 0], x = t[b + 1], y = t[b + 2], v = t[b + 3];
3530
- t[b + 0] = a * m + d * x + l * y, t[b + 1] = g * m + c * x + p * y, t[b + 2] = f * m + S * x + _ * y, t[b + 3] = v;
3531
- }
3532
- };
3533
- u.addGetterSetter(B, "hue", 0, T(), u.afterSetFilter);
3534
- u.addGetterSetter(B, "saturation", 0, T(), u.afterSetFilter);
3535
- u.addGetterSetter(B, "value", 0, T(), u.afterSetFilter);
3536
- const t0 = function(h) {
3537
- const t = h.data, e = t.length;
3538
- for (let i = 0; i < e; i += 4)
3539
- t[i] = 255 - t[i], t[i + 1] = 255 - t[i + 1], t[i + 2] = 255 - t[i + 2];
3540
- }, e0 = function(h, t, e) {
3541
- const i = h.data, n = t.data, r = h.width, o = h.height, s = e.polarCenterX || r / 2, a = e.polarCenterY || o / 2;
3542
- let d = Math.sqrt(s * s + a * a), l = r - s, g = o - a;
3543
- const c = Math.sqrt(l * l + g * g);
3544
- d = c > d ? c : d;
3545
- const p = o, f = r, S = 360 / f * Math.PI / 180;
3546
- for (let _ = 0; _ < f; _ += 1) {
3547
- const b = Math.sin(_ * S), m = Math.cos(_ * S);
3548
- for (let x = 0; x < p; x += 1) {
3549
- l = Math.floor(s + d * x / p * m), g = Math.floor(a + d * x / p * b);
3550
- let y = (g * r + l) * 4;
3551
- const v = i[y + 0], M = i[y + 1], C = i[y + 2], A = i[y + 3];
3552
- y = (_ + x * r) * 4, n[y + 0] = v, n[y + 1] = M, n[y + 2] = C, n[y + 3] = A;
3553
- }
3554
- }
3555
- }, i0 = function(h, t, e) {
3556
- const i = h.data, n = t.data, r = h.width, o = h.height, s = e.polarCenterX || r / 2, a = e.polarCenterY || o / 2;
3557
- let d = Math.sqrt(s * s + a * a), l = r - s, g = o - a;
3558
- const c = Math.sqrt(l * l + g * g);
3559
- d = c > d ? c : d;
3560
- const p = o, f = r, S = 0;
3561
- let _, b;
3562
- for (l = 0; l < r; l += 1)
3563
- for (g = 0; g < o; g += 1) {
3564
- const m = l - s, x = g - a, y = Math.sqrt(m * m + x * x) * p / d;
3565
- let v = (Math.atan2(x, m) * 180 / Math.PI + 360 + S) % 360;
3566
- v = v * f / 360, _ = Math.floor(v), b = Math.floor(y);
3567
- let M = (b * r + _) * 4;
3568
- const C = i[M + 0], A = i[M + 1], k = i[M + 2], G = i[M + 3];
3569
- M = (g * r + l) * 4, n[M + 0] = C, n[M + 1] = A, n[M + 2] = k, n[M + 3] = G;
3570
- }
3571
- }, n0 = function(h) {
3572
- const t = h.width, e = h.height;
3573
- let i, n, r, o, s, a, d, l, g, c, p = Math.round(this.kaleidoscopePower());
3574
- const f = Math.round(this.kaleidoscopeAngle()), S = Math.floor(t * (f % 360) / 360);
3575
- if (p < 1)
3576
- return;
3577
- const _ = O.createCanvasElement();
3578
- _.width = t, _.height = e;
3579
- const b = _.getContext("2d").getImageData(0, 0, t, e);
3580
- O.releaseCanvas(_), e0(h, b, {
3581
- polarCenterX: t / 2,
3582
- polarCenterY: e / 2
3583
- });
3584
- let m = t / Math.pow(2, p);
3585
- for (; m <= 8; )
3586
- m = m * 2, p -= 1;
3587
- m = Math.ceil(m);
3588
- let x = m, y = 0, v = x, M = 1;
3589
- for (S + m > t && (y = x, v = 0, M = -1), n = 0; n < e; n += 1)
3590
- for (i = y; i !== v; i += M)
3591
- r = Math.round(i + S) % t, g = (t * n + r) * 4, s = b.data[g + 0], a = b.data[g + 1], d = b.data[g + 2], l = b.data[g + 3], c = (t * n + i) * 4, b.data[c + 0] = s, b.data[c + 1] = a, b.data[c + 2] = d, b.data[c + 3] = l;
3592
- for (n = 0; n < e; n += 1)
3593
- for (x = Math.floor(m), o = 0; o < p; o += 1) {
3594
- for (i = 0; i < x + 1; i += 1)
3595
- g = (t * n + i) * 4, s = b.data[g + 0], a = b.data[g + 1], d = b.data[g + 2], l = b.data[g + 3], c = (t * n + x * 2 - i - 1) * 4, b.data[c + 0] = s, b.data[c + 1] = a, b.data[c + 2] = d, b.data[c + 3] = l;
3596
- x *= 2;
3597
- }
3598
- i0(b, h, {});
3599
- };
3600
- u.addGetterSetter(B, "kaleidoscopePower", 2, T(), u.afterSetFilter);
3601
- u.addGetterSetter(B, "kaleidoscopeAngle", 0, T(), u.afterSetFilter);
3602
- function _t(h, t, e) {
3603
- let i = (e * h.width + t) * 4;
3604
- const n = [];
3605
- return n.push(h.data[i++], h.data[i++], h.data[i++], h.data[i++]), n;
3606
- }
3607
- function ut(h, t) {
3608
- return Math.sqrt(Math.pow(h[0] - t[0], 2) + Math.pow(h[1] - t[1], 2) + Math.pow(h[2] - t[2], 2));
3609
- }
3610
- function s0(h) {
3611
- const t = [0, 0, 0];
3612
- for (let e = 0; e < h.length; e++)
3613
- t[0] += h[e][0], t[1] += h[e][1], t[2] += h[e][2];
3614
- return t[0] /= h.length, t[1] /= h.length, t[2] /= h.length, t;
3615
- }
3616
- function r0(h, t) {
3617
- const e = _t(h, 0, 0), i = _t(h, h.width - 1, 0), n = _t(h, 0, h.height - 1), r = _t(h, h.width - 1, h.height - 1), o = t || 10;
3618
- if (ut(e, i) < o && ut(i, r) < o && ut(r, n) < o && ut(n, e) < o) {
3619
- const s = s0([i, e, r, n]), a = [];
3620
- for (let d = 0; d < h.width * h.height; d++) {
3621
- const l = ut(s, [
3622
- h.data[d * 4],
3623
- h.data[d * 4 + 1],
3624
- h.data[d * 4 + 2]
3625
- ]);
3626
- a[d] = l < o ? 0 : 255;
3627
- }
3628
- return a;
3629
- }
3630
- }
3631
- function o0(h, t) {
3632
- for (let e = 0; e < h.width * h.height; e++)
3633
- h.data[4 * e + 3] = t[e];
3634
- }
3635
- function a0(h, t, e) {
3636
- const i = [1, 1, 1, 1, 0, 1, 1, 1, 1], n = Math.round(Math.sqrt(i.length)), r = Math.floor(n / 2), o = [];
3637
- for (let s = 0; s < e; s++)
3638
- for (let a = 0; a < t; a++) {
3639
- const d = s * t + a;
3640
- let l = 0;
3641
- for (let g = 0; g < n; g++)
3642
- for (let c = 0; c < n; c++) {
3643
- const p = s + g - r, f = a + c - r;
3644
- if (p >= 0 && p < e && f >= 0 && f < t) {
3645
- const S = p * t + f, _ = i[g * n + c];
3646
- l += h[S] * _;
3647
- }
3648
- }
3649
- o[d] = l === 2040 ? 255 : 0;
3650
- }
3651
- return o;
3652
- }
3653
- function h0(h, t, e) {
3654
- const i = [1, 1, 1, 1, 1, 1, 1, 1, 1], n = Math.round(Math.sqrt(i.length)), r = Math.floor(n / 2), o = [];
3655
- for (let s = 0; s < e; s++)
3656
- for (let a = 0; a < t; a++) {
3657
- const d = s * t + a;
3658
- let l = 0;
3659
- for (let g = 0; g < n; g++)
3660
- for (let c = 0; c < n; c++) {
3661
- const p = s + g - r, f = a + c - r;
3662
- if (p >= 0 && p < e && f >= 0 && f < t) {
3663
- const S = p * t + f, _ = i[g * n + c];
3664
- l += h[S] * _;
3665
- }
3666
- }
3667
- o[d] = l >= 1020 ? 255 : 0;
3668
- }
3669
- return o;
3670
- }
3671
- function l0(h, t, e) {
3672
- const i = [
3673
- 0.1111111111111111,
3674
- 0.1111111111111111,
3675
- 0.1111111111111111,
3676
- 0.1111111111111111,
3677
- 0.1111111111111111,
3678
- 0.1111111111111111,
3679
- 0.1111111111111111,
3680
- 0.1111111111111111,
3681
- 0.1111111111111111
3682
- ], n = Math.round(Math.sqrt(i.length)), r = Math.floor(n / 2), o = [];
3683
- for (let s = 0; s < e; s++)
3684
- for (let a = 0; a < t; a++) {
3685
- const d = s * t + a;
3686
- let l = 0;
3687
- for (let g = 0; g < n; g++)
3688
- for (let c = 0; c < n; c++) {
3689
- const p = s + g - r, f = a + c - r;
3690
- if (p >= 0 && p < e && f >= 0 && f < t) {
3691
- const S = p * t + f, _ = i[g * n + c];
3692
- l += h[S] * _;
3693
- }
3694
- }
3695
- o[d] = l;
3696
- }
3697
- return o;
3698
- }
3699
- const d0 = function(h) {
3700
- const t = this.threshold();
3701
- let e = r0(h, t);
3702
- return e && (e = a0(e, h.width, h.height), e = h0(e, h.width, h.height), e = l0(e, h.width, h.height), o0(h, e)), h;
3703
- };
3704
- u.addGetterSetter(B, "threshold", 0, T(), u.afterSetFilter);
3705
- const c0 = function(h) {
3706
- const t = this.noise() * 255, e = h.data, i = e.length, n = t / 2;
3707
- for (let r = 0; r < i; r += 4)
3708
- e[r + 0] += n - 2 * n * Math.random(), e[r + 1] += n - 2 * n * Math.random(), e[r + 2] += n - 2 * n * Math.random();
3709
- };
3710
- u.addGetterSetter(B, "noise", 0.2, T(), u.afterSetFilter);
3711
- const f0 = function(h) {
3712
- let t = Math.ceil(this.pixelSize()), e = h.width, i = h.height, n = Math.ceil(e / t), r = Math.ceil(i / t), o = h.data;
3713
- if (t <= 0) {
3714
- O.error("pixelSize value can not be <= 0");
3715
- return;
3716
- }
3717
- for (let s = 0; s < n; s += 1)
3718
- for (let a = 0; a < r; a += 1) {
3719
- let d = 0, l = 0, g = 0, c = 0;
3720
- const p = s * t, f = p + t, S = a * t, _ = S + t;
3721
- let b = 0;
3722
- for (let m = p; m < f; m += 1)
3723
- if (!(m >= e))
3724
- for (let x = S; x < _; x += 1) {
3725
- if (x >= i)
3726
- continue;
3727
- const y = (e * x + m) * 4;
3728
- d += o[y + 0], l += o[y + 1], g += o[y + 2], c += o[y + 3], b += 1;
3729
- }
3730
- d = d / b, l = l / b, g = g / b, c = c / b;
3731
- for (let m = p; m < f; m += 1)
3732
- if (!(m >= e))
3733
- for (let x = S; x < _; x += 1) {
3734
- if (x >= i)
3735
- continue;
3736
- const y = (e * x + m) * 4;
3737
- o[y + 0] = d, o[y + 1] = l, o[y + 2] = g, o[y + 3] = c;
3738
- }
3739
- }
3740
- };
3741
- u.addGetterSetter(B, "pixelSize", 8, T(), u.afterSetFilter);
3742
- const g0 = function(h) {
3743
- const t = Math.round(this.levels() * 254) + 1, e = h.data, i = e.length, n = 255 / t;
3744
- for (let r = 0; r < i; r += 1)
3745
- e[r] = Math.floor(e[r] / n) * n;
3746
- };
3747
- u.addGetterSetter(B, "levels", 0.5, T(), u.afterSetFilter);
3748
- const u0 = function(h) {
3749
- const t = h.data, e = t.length, i = this.red(), n = this.green(), r = this.blue();
3750
- for (let o = 0; o < e; o += 4) {
3751
- const s = (0.34 * t[o] + 0.5 * t[o + 1] + 0.16 * t[o + 2]) / 255;
3752
- t[o] = s * i, t[o + 1] = s * n, t[o + 2] = s * r, t[o + 3] = t[o + 3];
3753
- }
3754
- };
3755
- u.addGetterSetter(B, "red", 0, function(h) {
3756
- return this._filterUpToDate = !1, h > 255 ? 255 : h < 0 ? 0 : Math.round(h);
3757
- });
3758
- u.addGetterSetter(B, "green", 0, function(h) {
3759
- return this._filterUpToDate = !1, h > 255 ? 255 : h < 0 ? 0 : Math.round(h);
3760
- });
3761
- u.addGetterSetter(B, "blue", 0, jt, u.afterSetFilter);
3762
- const p0 = function(h) {
3763
- const t = h.data, e = t.length, i = this.red(), n = this.green(), r = this.blue(), o = this.alpha();
3764
- for (let s = 0; s < e; s += 4) {
3765
- const a = 1 - o;
3766
- t[s] = i * o + t[s] * a, t[s + 1] = n * o + t[s + 1] * a, t[s + 2] = r * o + t[s + 2] * a;
3767
- }
3768
- };
3769
- u.addGetterSetter(B, "red", 0, function(h) {
3770
- return this._filterUpToDate = !1, h > 255 ? 255 : h < 0 ? 0 : Math.round(h);
3771
- });
3772
- u.addGetterSetter(B, "green", 0, function(h) {
3773
- return this._filterUpToDate = !1, h > 255 ? 255 : h < 0 ? 0 : Math.round(h);
3774
- });
3775
- u.addGetterSetter(B, "blue", 0, jt, u.afterSetFilter);
3776
- u.addGetterSetter(B, "alpha", 1, function(h) {
3777
- return this._filterUpToDate = !1, h > 1 ? 1 : h < 0 ? 0 : h;
3778
- });
3779
- const m0 = function(h) {
3780
- const t = h.data, e = t.length;
3781
- for (let i = 0; i < e; i += 4) {
3782
- const n = t[i + 0], r = t[i + 1], o = t[i + 2];
3783
- t[i + 0] = Math.min(255, n * 0.393 + r * 0.769 + o * 0.189), t[i + 1] = Math.min(255, n * 0.349 + r * 0.686 + o * 0.168), t[i + 2] = Math.min(255, n * 0.272 + r * 0.534 + o * 0.131);
3784
- }
3785
- }, S0 = function(h) {
3786
- const e = h.data;
3787
- for (let i = 0; i < e.length; i += 4) {
3788
- const n = e[i], r = e[i + 1], o = e[i + 2];
3789
- 0.2126 * n + 0.7152 * r + 0.0722 * o >= 128 && (e[i] = 255 - n, e[i + 1] = 255 - r, e[i + 2] = 255 - o);
3790
- }
3791
- return h;
3792
- }, _0 = function(h) {
3793
- const t = this.threshold() * 255, e = h.data, i = e.length;
3794
- for (let n = 0; n < i; n += 1)
3795
- e[n] = e[n] < t ? 0 : 255;
3796
- };
3797
- u.addGetterSetter(B, "threshold", 0.5, T(), u.afterSetFilter);
3798
- const y0 = Et.Util._assign(Et, {
3799
- Arc: J,
3800
- Arrow: ot,
3801
- Circle: dt,
3802
- Ellipse: nt,
3803
- Image: K,
3804
- Label: Ot,
3805
- Tag: at,
3806
- Line: tt,
3807
- Path: H,
3808
- Rect: pt,
3809
- RegularPolygon: st,
3810
- Ring: ht,
3811
- Sprite: Z,
3812
- Star: rt,
3813
- Text: X,
3814
- TextPath: q,
3815
- Transformer: N,
3816
- Wedge: et,
3817
- Filters: {
3818
- Blur: qe,
3819
- Brightness: je,
3820
- Brighten: Ue,
3821
- Contrast: Ve,
3822
- Emboss: $e,
3823
- Enhance: Qe,
3824
- Grayscale: Ke,
3825
- HSL: Ze,
3826
- HSV: Je,
3827
- Invert: t0,
3828
- Kaleidoscope: n0,
3829
- Mask: d0,
3830
- Noise: c0,
3831
- Pixelate: f0,
3832
- Posterize: g0,
3833
- RGB: u0,
3834
- RGBA: p0,
3835
- Sepia: m0,
3836
- Solarize: S0,
3837
- Threshold: _0
3838
- }
3839
- });
3840
- export {
3841
- y0 as default
3842
- };