@ninesstudios/whiteboard 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/whiteboard.css +1 -0
- package/dist/whiteboard.es.js +4145 -0
- package/dist/whiteboard.umd.js +54 -0
- package/package.json +41 -0
|
@@ -0,0 +1,4145 @@
|
|
|
1
|
+
import * as re from "react";
|
|
2
|
+
import ue, { createContext as un, useContext as dn, useState as G, useEffect as le, useRef as xe, forwardRef as fn, useImperativeHandle as hn, useCallback as H } from "react";
|
|
3
|
+
var nt = { exports: {} }, Re = {};
|
|
4
|
+
/**
|
|
5
|
+
* @license React
|
|
6
|
+
* react-jsx-runtime.production.js
|
|
7
|
+
*
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
var sr;
|
|
14
|
+
function pn() {
|
|
15
|
+
if (sr) return Re;
|
|
16
|
+
sr = 1;
|
|
17
|
+
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
18
|
+
function r(n, o, s) {
|
|
19
|
+
var l = null;
|
|
20
|
+
if (s !== void 0 && (l = "" + s), o.key !== void 0 && (l = "" + o.key), "key" in o) {
|
|
21
|
+
s = {};
|
|
22
|
+
for (var a in o)
|
|
23
|
+
a !== "key" && (s[a] = o[a]);
|
|
24
|
+
} else s = o;
|
|
25
|
+
return o = s.ref, {
|
|
26
|
+
$$typeof: e,
|
|
27
|
+
type: n,
|
|
28
|
+
key: l,
|
|
29
|
+
ref: o !== void 0 ? o : null,
|
|
30
|
+
props: s
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return Re.Fragment = t, Re.jsx = r, Re.jsxs = r, Re;
|
|
34
|
+
}
|
|
35
|
+
var ze = {};
|
|
36
|
+
/**
|
|
37
|
+
* @license React
|
|
38
|
+
* react-jsx-runtime.development.js
|
|
39
|
+
*
|
|
40
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
41
|
+
*
|
|
42
|
+
* This source code is licensed under the MIT license found in the
|
|
43
|
+
* LICENSE file in the root directory of this source tree.
|
|
44
|
+
*/
|
|
45
|
+
var ar;
|
|
46
|
+
function yn() {
|
|
47
|
+
return ar || (ar = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
48
|
+
function e(b) {
|
|
49
|
+
if (b == null) return null;
|
|
50
|
+
if (typeof b == "function")
|
|
51
|
+
return b.$$typeof === oe ? null : b.displayName || b.name || null;
|
|
52
|
+
if (typeof b == "string") return b;
|
|
53
|
+
switch (b) {
|
|
54
|
+
case N:
|
|
55
|
+
return "Fragment";
|
|
56
|
+
case x:
|
|
57
|
+
return "Profiler";
|
|
58
|
+
case P:
|
|
59
|
+
return "StrictMode";
|
|
60
|
+
case O:
|
|
61
|
+
return "Suspense";
|
|
62
|
+
case F:
|
|
63
|
+
return "SuspenseList";
|
|
64
|
+
case X:
|
|
65
|
+
return "Activity";
|
|
66
|
+
}
|
|
67
|
+
if (typeof b == "object")
|
|
68
|
+
switch (typeof b.tag == "number" && console.error(
|
|
69
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
70
|
+
), b.$$typeof) {
|
|
71
|
+
case j:
|
|
72
|
+
return "Portal";
|
|
73
|
+
case m:
|
|
74
|
+
return b.displayName || "Context";
|
|
75
|
+
case z:
|
|
76
|
+
return (b._context.displayName || "Context") + ".Consumer";
|
|
77
|
+
case v:
|
|
78
|
+
var D = b.render;
|
|
79
|
+
return b = b.displayName, b || (b = D.displayName || D.name || "", b = b !== "" ? "ForwardRef(" + b + ")" : "ForwardRef"), b;
|
|
80
|
+
case U:
|
|
81
|
+
return D = b.displayName || null, D !== null ? D : e(b.type) || "Memo";
|
|
82
|
+
case L:
|
|
83
|
+
D = b._payload, b = b._init;
|
|
84
|
+
try {
|
|
85
|
+
return e(b(D));
|
|
86
|
+
} catch {
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
function t(b) {
|
|
92
|
+
return "" + b;
|
|
93
|
+
}
|
|
94
|
+
function r(b) {
|
|
95
|
+
try {
|
|
96
|
+
t(b);
|
|
97
|
+
var D = !1;
|
|
98
|
+
} catch {
|
|
99
|
+
D = !0;
|
|
100
|
+
}
|
|
101
|
+
if (D) {
|
|
102
|
+
D = console;
|
|
103
|
+
var A = D.error, B = typeof Symbol == "function" && Symbol.toStringTag && b[Symbol.toStringTag] || b.constructor.name || "Object";
|
|
104
|
+
return A.call(
|
|
105
|
+
D,
|
|
106
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
107
|
+
B
|
|
108
|
+
), t(b);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function n(b) {
|
|
112
|
+
if (b === N) return "<>";
|
|
113
|
+
if (typeof b == "object" && b !== null && b.$$typeof === L)
|
|
114
|
+
return "<...>";
|
|
115
|
+
try {
|
|
116
|
+
var D = e(b);
|
|
117
|
+
return D ? "<" + D + ">" : "<...>";
|
|
118
|
+
} catch {
|
|
119
|
+
return "<...>";
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function o() {
|
|
123
|
+
var b = de.A;
|
|
124
|
+
return b === null ? null : b.getOwner();
|
|
125
|
+
}
|
|
126
|
+
function s() {
|
|
127
|
+
return Error("react-stack-top-frame");
|
|
128
|
+
}
|
|
129
|
+
function l(b) {
|
|
130
|
+
if (Oe.call(b, "key")) {
|
|
131
|
+
var D = Object.getOwnPropertyDescriptor(b, "key").get;
|
|
132
|
+
if (D && D.isReactWarning) return !1;
|
|
133
|
+
}
|
|
134
|
+
return b.key !== void 0;
|
|
135
|
+
}
|
|
136
|
+
function a(b, D) {
|
|
137
|
+
function A() {
|
|
138
|
+
Se || (Se = !0, console.error(
|
|
139
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
140
|
+
D
|
|
141
|
+
));
|
|
142
|
+
}
|
|
143
|
+
A.isReactWarning = !0, Object.defineProperty(b, "key", {
|
|
144
|
+
get: A,
|
|
145
|
+
configurable: !0
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function y() {
|
|
149
|
+
var b = e(this.type);
|
|
150
|
+
return Ne[b] || (Ne[b] = !0, console.error(
|
|
151
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
152
|
+
)), b = this.props.ref, b !== void 0 ? b : null;
|
|
153
|
+
}
|
|
154
|
+
function h(b, D, A, B, Me, fe) {
|
|
155
|
+
var V = A.ref;
|
|
156
|
+
return b = {
|
|
157
|
+
$$typeof: M,
|
|
158
|
+
type: b,
|
|
159
|
+
key: D,
|
|
160
|
+
props: A,
|
|
161
|
+
_owner: B
|
|
162
|
+
}, (V !== void 0 ? V : null) !== null ? Object.defineProperty(b, "ref", {
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
get: y
|
|
165
|
+
}) : Object.defineProperty(b, "ref", { enumerable: !1, value: null }), b._store = {}, Object.defineProperty(b._store, "validated", {
|
|
166
|
+
configurable: !1,
|
|
167
|
+
enumerable: !1,
|
|
168
|
+
writable: !0,
|
|
169
|
+
value: 0
|
|
170
|
+
}), Object.defineProperty(b, "_debugInfo", {
|
|
171
|
+
configurable: !1,
|
|
172
|
+
enumerable: !1,
|
|
173
|
+
writable: !0,
|
|
174
|
+
value: null
|
|
175
|
+
}), Object.defineProperty(b, "_debugStack", {
|
|
176
|
+
configurable: !1,
|
|
177
|
+
enumerable: !1,
|
|
178
|
+
writable: !0,
|
|
179
|
+
value: Me
|
|
180
|
+
}), Object.defineProperty(b, "_debugTask", {
|
|
181
|
+
configurable: !1,
|
|
182
|
+
enumerable: !1,
|
|
183
|
+
writable: !0,
|
|
184
|
+
value: fe
|
|
185
|
+
}), Object.freeze && (Object.freeze(b.props), Object.freeze(b)), b;
|
|
186
|
+
}
|
|
187
|
+
function w(b, D, A, B, Me, fe) {
|
|
188
|
+
var V = D.children;
|
|
189
|
+
if (V !== void 0)
|
|
190
|
+
if (B)
|
|
191
|
+
if (Te(V)) {
|
|
192
|
+
for (B = 0; B < V.length; B++)
|
|
193
|
+
d(V[B]);
|
|
194
|
+
Object.freeze && Object.freeze(V);
|
|
195
|
+
} else
|
|
196
|
+
console.error(
|
|
197
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
198
|
+
);
|
|
199
|
+
else d(V);
|
|
200
|
+
if (Oe.call(D, "key")) {
|
|
201
|
+
V = e(b);
|
|
202
|
+
var se = Object.keys(D).filter(function(Be) {
|
|
203
|
+
return Be !== "key";
|
|
204
|
+
});
|
|
205
|
+
B = 0 < se.length ? "{key: someKey, " + se.join(": ..., ") + ": ...}" : "{key: someKey}", De[V + B] || (se = 0 < se.length ? "{" + se.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
206
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
207
|
+
let props = %s;
|
|
208
|
+
<%s {...props} />
|
|
209
|
+
React keys must be passed directly to JSX without using spread:
|
|
210
|
+
let props = %s;
|
|
211
|
+
<%s key={someKey} {...props} />`,
|
|
212
|
+
B,
|
|
213
|
+
V,
|
|
214
|
+
se,
|
|
215
|
+
V
|
|
216
|
+
), De[V + B] = !0);
|
|
217
|
+
}
|
|
218
|
+
if (V = null, A !== void 0 && (r(A), V = "" + A), l(D) && (r(D.key), V = "" + D.key), "key" in D) {
|
|
219
|
+
A = {};
|
|
220
|
+
for (var me in D)
|
|
221
|
+
me !== "key" && (A[me] = D[me]);
|
|
222
|
+
} else A = D;
|
|
223
|
+
return V && a(
|
|
224
|
+
A,
|
|
225
|
+
typeof b == "function" ? b.displayName || b.name || "Unknown" : b
|
|
226
|
+
), h(
|
|
227
|
+
b,
|
|
228
|
+
V,
|
|
229
|
+
A,
|
|
230
|
+
o(),
|
|
231
|
+
Me,
|
|
232
|
+
fe
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
function d(b) {
|
|
236
|
+
g(b) ? b._store && (b._store.validated = 1) : typeof b == "object" && b !== null && b.$$typeof === L && (b._payload.status === "fulfilled" ? g(b._payload.value) && b._payload.value._store && (b._payload.value._store.validated = 1) : b._store && (b._store.validated = 1));
|
|
237
|
+
}
|
|
238
|
+
function g(b) {
|
|
239
|
+
return typeof b == "object" && b !== null && b.$$typeof === M;
|
|
240
|
+
}
|
|
241
|
+
var k = ue, M = Symbol.for("react.transitional.element"), j = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), x = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), m = Symbol.for("react.context"), v = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), U = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), X = Symbol.for("react.activity"), oe = Symbol.for("react.client.reference"), de = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Oe = Object.prototype.hasOwnProperty, Te = Array.isArray, Ee = console.createTask ? console.createTask : function() {
|
|
242
|
+
return null;
|
|
243
|
+
};
|
|
244
|
+
k = {
|
|
245
|
+
react_stack_bottom_frame: function(b) {
|
|
246
|
+
return b();
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
var Se, Ne = {}, Pe = k.react_stack_bottom_frame.bind(
|
|
250
|
+
k,
|
|
251
|
+
s
|
|
252
|
+
)(), Xe = Ee(n(s)), De = {};
|
|
253
|
+
ze.Fragment = N, ze.jsx = function(b, D, A) {
|
|
254
|
+
var B = 1e4 > de.recentlyCreatedOwnerStacks++;
|
|
255
|
+
return w(
|
|
256
|
+
b,
|
|
257
|
+
D,
|
|
258
|
+
A,
|
|
259
|
+
!1,
|
|
260
|
+
B ? Error("react-stack-top-frame") : Pe,
|
|
261
|
+
B ? Ee(n(b)) : Xe
|
|
262
|
+
);
|
|
263
|
+
}, ze.jsxs = function(b, D, A) {
|
|
264
|
+
var B = 1e4 > de.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return w(
|
|
266
|
+
b,
|
|
267
|
+
D,
|
|
268
|
+
A,
|
|
269
|
+
!0,
|
|
270
|
+
B ? Error("react-stack-top-frame") : Pe,
|
|
271
|
+
B ? Ee(n(b)) : Xe
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
})()), ze;
|
|
275
|
+
}
|
|
276
|
+
var cr;
|
|
277
|
+
function gn() {
|
|
278
|
+
return cr || (cr = 1, process.env.NODE_ENV === "production" ? nt.exports = pn() : nt.exports = yn()), nt.exports;
|
|
279
|
+
}
|
|
280
|
+
var u = gn(), ot = { exports: {} }, Tt = {};
|
|
281
|
+
/**
|
|
282
|
+
* @license React
|
|
283
|
+
* use-sync-external-store-with-selector.production.js
|
|
284
|
+
*
|
|
285
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
286
|
+
*
|
|
287
|
+
* This source code is licensed under the MIT license found in the
|
|
288
|
+
* LICENSE file in the root directory of this source tree.
|
|
289
|
+
*/
|
|
290
|
+
var lr;
|
|
291
|
+
function mn() {
|
|
292
|
+
if (lr) return Tt;
|
|
293
|
+
lr = 1;
|
|
294
|
+
var e = ue;
|
|
295
|
+
function t(y, h) {
|
|
296
|
+
return y === h && (y !== 0 || 1 / y === 1 / h) || y !== y && h !== h;
|
|
297
|
+
}
|
|
298
|
+
var r = typeof Object.is == "function" ? Object.is : t, n = e.useSyncExternalStore, o = e.useRef, s = e.useEffect, l = e.useMemo, a = e.useDebugValue;
|
|
299
|
+
return Tt.useSyncExternalStoreWithSelector = function(y, h, w, d, g) {
|
|
300
|
+
var k = o(null);
|
|
301
|
+
if (k.current === null) {
|
|
302
|
+
var M = { hasValue: !1, value: null };
|
|
303
|
+
k.current = M;
|
|
304
|
+
} else M = k.current;
|
|
305
|
+
k = l(
|
|
306
|
+
function() {
|
|
307
|
+
function N(v) {
|
|
308
|
+
if (!P) {
|
|
309
|
+
if (P = !0, x = v, v = d(v), g !== void 0 && M.hasValue) {
|
|
310
|
+
var O = M.value;
|
|
311
|
+
if (g(O, v))
|
|
312
|
+
return z = O;
|
|
313
|
+
}
|
|
314
|
+
return z = v;
|
|
315
|
+
}
|
|
316
|
+
if (O = z, r(x, v)) return O;
|
|
317
|
+
var F = d(v);
|
|
318
|
+
return g !== void 0 && g(O, F) ? (x = v, O) : (x = v, z = F);
|
|
319
|
+
}
|
|
320
|
+
var P = !1, x, z, m = w === void 0 ? null : w;
|
|
321
|
+
return [
|
|
322
|
+
function() {
|
|
323
|
+
return N(h());
|
|
324
|
+
},
|
|
325
|
+
m === null ? void 0 : function() {
|
|
326
|
+
return N(m());
|
|
327
|
+
}
|
|
328
|
+
];
|
|
329
|
+
},
|
|
330
|
+
[h, w, d, g]
|
|
331
|
+
);
|
|
332
|
+
var j = n(y, k[0], k[1]);
|
|
333
|
+
return s(
|
|
334
|
+
function() {
|
|
335
|
+
M.hasValue = !0, M.value = j;
|
|
336
|
+
},
|
|
337
|
+
[j]
|
|
338
|
+
), a(j), j;
|
|
339
|
+
}, Tt;
|
|
340
|
+
}
|
|
341
|
+
var Pt = {};
|
|
342
|
+
/**
|
|
343
|
+
* @license React
|
|
344
|
+
* use-sync-external-store-with-selector.development.js
|
|
345
|
+
*
|
|
346
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
347
|
+
*
|
|
348
|
+
* This source code is licensed under the MIT license found in the
|
|
349
|
+
* LICENSE file in the root directory of this source tree.
|
|
350
|
+
*/
|
|
351
|
+
var ur;
|
|
352
|
+
function wn() {
|
|
353
|
+
return ur || (ur = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
354
|
+
function e(y, h) {
|
|
355
|
+
return y === h && (y !== 0 || 1 / y === 1 / h) || y !== y && h !== h;
|
|
356
|
+
}
|
|
357
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
358
|
+
var t = ue, r = typeof Object.is == "function" ? Object.is : e, n = t.useSyncExternalStore, o = t.useRef, s = t.useEffect, l = t.useMemo, a = t.useDebugValue;
|
|
359
|
+
Pt.useSyncExternalStoreWithSelector = function(y, h, w, d, g) {
|
|
360
|
+
var k = o(null);
|
|
361
|
+
if (k.current === null) {
|
|
362
|
+
var M = { hasValue: !1, value: null };
|
|
363
|
+
k.current = M;
|
|
364
|
+
} else M = k.current;
|
|
365
|
+
k = l(
|
|
366
|
+
function() {
|
|
367
|
+
function N(v) {
|
|
368
|
+
if (!P) {
|
|
369
|
+
if (P = !0, x = v, v = d(v), g !== void 0 && M.hasValue) {
|
|
370
|
+
var O = M.value;
|
|
371
|
+
if (g(O, v))
|
|
372
|
+
return z = O;
|
|
373
|
+
}
|
|
374
|
+
return z = v;
|
|
375
|
+
}
|
|
376
|
+
if (O = z, r(x, v))
|
|
377
|
+
return O;
|
|
378
|
+
var F = d(v);
|
|
379
|
+
return g !== void 0 && g(O, F) ? (x = v, O) : (x = v, z = F);
|
|
380
|
+
}
|
|
381
|
+
var P = !1, x, z, m = w === void 0 ? null : w;
|
|
382
|
+
return [
|
|
383
|
+
function() {
|
|
384
|
+
return N(h());
|
|
385
|
+
},
|
|
386
|
+
m === null ? void 0 : function() {
|
|
387
|
+
return N(m());
|
|
388
|
+
}
|
|
389
|
+
];
|
|
390
|
+
},
|
|
391
|
+
[h, w, d, g]
|
|
392
|
+
);
|
|
393
|
+
var j = n(y, k[0], k[1]);
|
|
394
|
+
return s(
|
|
395
|
+
function() {
|
|
396
|
+
M.hasValue = !0, M.value = j;
|
|
397
|
+
},
|
|
398
|
+
[j]
|
|
399
|
+
), a(j), j;
|
|
400
|
+
}, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
401
|
+
})()), Pt;
|
|
402
|
+
}
|
|
403
|
+
var dr;
|
|
404
|
+
function vn() {
|
|
405
|
+
return dr || (dr = 1, process.env.NODE_ENV === "production" ? ot.exports = mn() : ot.exports = wn()), ot.exports;
|
|
406
|
+
}
|
|
407
|
+
var xn = vn();
|
|
408
|
+
function bn(e) {
|
|
409
|
+
e();
|
|
410
|
+
}
|
|
411
|
+
function En() {
|
|
412
|
+
let e = null, t = null;
|
|
413
|
+
return {
|
|
414
|
+
clear() {
|
|
415
|
+
e = null, t = null;
|
|
416
|
+
},
|
|
417
|
+
notify() {
|
|
418
|
+
bn(() => {
|
|
419
|
+
let r = e;
|
|
420
|
+
for (; r; )
|
|
421
|
+
r.callback(), r = r.next;
|
|
422
|
+
});
|
|
423
|
+
},
|
|
424
|
+
get() {
|
|
425
|
+
const r = [];
|
|
426
|
+
let n = e;
|
|
427
|
+
for (; n; )
|
|
428
|
+
r.push(n), n = n.next;
|
|
429
|
+
return r;
|
|
430
|
+
},
|
|
431
|
+
subscribe(r) {
|
|
432
|
+
let n = !0;
|
|
433
|
+
const o = t = {
|
|
434
|
+
callback: r,
|
|
435
|
+
next: null,
|
|
436
|
+
prev: t
|
|
437
|
+
};
|
|
438
|
+
return o.prev ? o.prev.next = o : e = o, function() {
|
|
439
|
+
!n || e === null || (n = !1, o.next ? o.next.prev = o.prev : t = o.prev, o.prev ? o.prev.next = o.next : e = o.next);
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
var fr = {
|
|
445
|
+
notify() {
|
|
446
|
+
},
|
|
447
|
+
get: () => []
|
|
448
|
+
};
|
|
449
|
+
function _n(e, t) {
|
|
450
|
+
let r, n = fr, o = 0, s = !1;
|
|
451
|
+
function l(j) {
|
|
452
|
+
w();
|
|
453
|
+
const N = n.subscribe(j);
|
|
454
|
+
let P = !1;
|
|
455
|
+
return () => {
|
|
456
|
+
P || (P = !0, N(), d());
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function a() {
|
|
460
|
+
n.notify();
|
|
461
|
+
}
|
|
462
|
+
function y() {
|
|
463
|
+
M.onStateChange && M.onStateChange();
|
|
464
|
+
}
|
|
465
|
+
function h() {
|
|
466
|
+
return s;
|
|
467
|
+
}
|
|
468
|
+
function w() {
|
|
469
|
+
o++, r || (r = e.subscribe(y), n = En());
|
|
470
|
+
}
|
|
471
|
+
function d() {
|
|
472
|
+
o--, r && o === 0 && (r(), r = void 0, n.clear(), n = fr);
|
|
473
|
+
}
|
|
474
|
+
function g() {
|
|
475
|
+
s || (s = !0, w());
|
|
476
|
+
}
|
|
477
|
+
function k() {
|
|
478
|
+
s && (s = !1, d());
|
|
479
|
+
}
|
|
480
|
+
const M = {
|
|
481
|
+
addNestedSub: l,
|
|
482
|
+
notifyNestedSubs: a,
|
|
483
|
+
handleChangeWrapper: y,
|
|
484
|
+
isSubscribed: h,
|
|
485
|
+
trySubscribe: g,
|
|
486
|
+
tryUnsubscribe: k,
|
|
487
|
+
getListeners: () => n
|
|
488
|
+
};
|
|
489
|
+
return M;
|
|
490
|
+
}
|
|
491
|
+
var Cn = () => typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", kn = /* @__PURE__ */ Cn(), Sn = () => typeof navigator < "u" && navigator.product === "ReactNative", Nn = /* @__PURE__ */ Sn(), Mn = () => kn || Nn ? re.useLayoutEffect : re.useEffect, jn = /* @__PURE__ */ Mn(), Dt = /* @__PURE__ */ Symbol.for("react-redux-context"), Rt = typeof globalThis < "u" ? globalThis : (
|
|
492
|
+
/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
|
|
493
|
+
{}
|
|
494
|
+
);
|
|
495
|
+
function On() {
|
|
496
|
+
if (!re.createContext) return {};
|
|
497
|
+
const e = Rt[Dt] ?? (Rt[Dt] = /* @__PURE__ */ new Map());
|
|
498
|
+
let t = e.get(re.createContext);
|
|
499
|
+
return t || (t = re.createContext(
|
|
500
|
+
null
|
|
501
|
+
), process.env.NODE_ENV !== "production" && (t.displayName = "ReactRedux"), e.set(re.createContext, t)), t;
|
|
502
|
+
}
|
|
503
|
+
var be = /* @__PURE__ */ On();
|
|
504
|
+
function Tn(e) {
|
|
505
|
+
const { children: t, context: r, serverState: n, store: o } = e, s = re.useMemo(() => {
|
|
506
|
+
const y = _n(o), h = {
|
|
507
|
+
store: o,
|
|
508
|
+
subscription: y,
|
|
509
|
+
getServerState: n ? () => n : void 0
|
|
510
|
+
};
|
|
511
|
+
if (process.env.NODE_ENV === "production")
|
|
512
|
+
return h;
|
|
513
|
+
{
|
|
514
|
+
const { identityFunctionCheck: w = "once", stabilityCheck: d = "once" } = e;
|
|
515
|
+
return /* @__PURE__ */ Object.assign(h, {
|
|
516
|
+
stabilityCheck: d,
|
|
517
|
+
identityFunctionCheck: w
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
}, [o, n]), l = re.useMemo(() => o.getState(), [o]);
|
|
521
|
+
jn(() => {
|
|
522
|
+
const { subscription: y } = s;
|
|
523
|
+
return y.onStateChange = y.notifyNestedSubs, y.trySubscribe(), l !== o.getState() && y.notifyNestedSubs(), () => {
|
|
524
|
+
y.tryUnsubscribe(), y.onStateChange = void 0;
|
|
525
|
+
};
|
|
526
|
+
}, [s, l]);
|
|
527
|
+
const a = r || be;
|
|
528
|
+
return /* @__PURE__ */ re.createElement(a.Provider, { value: s }, t);
|
|
529
|
+
}
|
|
530
|
+
var Pn = Tn;
|
|
531
|
+
function Gt(e = be) {
|
|
532
|
+
return function() {
|
|
533
|
+
const r = re.useContext(e);
|
|
534
|
+
if (process.env.NODE_ENV !== "production" && !r)
|
|
535
|
+
throw new Error(
|
|
536
|
+
"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
|
|
537
|
+
);
|
|
538
|
+
return r;
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
var jr = /* @__PURE__ */ Gt();
|
|
542
|
+
function Or(e = be) {
|
|
543
|
+
const t = e === be ? jr : (
|
|
544
|
+
// @ts-ignore
|
|
545
|
+
Gt(e)
|
|
546
|
+
), r = () => {
|
|
547
|
+
const { store: n } = t();
|
|
548
|
+
return n;
|
|
549
|
+
};
|
|
550
|
+
return Object.assign(r, {
|
|
551
|
+
withTypes: () => r
|
|
552
|
+
}), r;
|
|
553
|
+
}
|
|
554
|
+
var Dn = /* @__PURE__ */ Or();
|
|
555
|
+
function Rn(e = be) {
|
|
556
|
+
const t = e === be ? Dn : Or(e), r = () => t().dispatch;
|
|
557
|
+
return Object.assign(r, {
|
|
558
|
+
withTypes: () => r
|
|
559
|
+
}), r;
|
|
560
|
+
}
|
|
561
|
+
var qt = /* @__PURE__ */ Rn(), zn = (e, t) => e === t;
|
|
562
|
+
function In(e = be) {
|
|
563
|
+
const t = e === be ? jr : Gt(e), r = (n, o = {}) => {
|
|
564
|
+
const { equalityFn: s = zn } = typeof o == "function" ? { equalityFn: o } : o;
|
|
565
|
+
if (process.env.NODE_ENV !== "production") {
|
|
566
|
+
if (!n)
|
|
567
|
+
throw new Error("You must pass a selector to useSelector");
|
|
568
|
+
if (typeof n != "function")
|
|
569
|
+
throw new Error("You must pass a function as a selector to useSelector");
|
|
570
|
+
if (typeof s != "function")
|
|
571
|
+
throw new Error(
|
|
572
|
+
"You must pass a function as an equality function to useSelector"
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
const l = t(), { store: a, subscription: y, getServerState: h } = l, w = re.useRef(!0), d = re.useCallback(
|
|
576
|
+
{
|
|
577
|
+
[n.name](k) {
|
|
578
|
+
const M = n(k);
|
|
579
|
+
if (process.env.NODE_ENV !== "production") {
|
|
580
|
+
const { devModeChecks: j = {} } = typeof o == "function" ? {} : o, { identityFunctionCheck: N, stabilityCheck: P } = l, {
|
|
581
|
+
identityFunctionCheck: x,
|
|
582
|
+
stabilityCheck: z
|
|
583
|
+
} = {
|
|
584
|
+
stabilityCheck: P,
|
|
585
|
+
identityFunctionCheck: N,
|
|
586
|
+
...j
|
|
587
|
+
};
|
|
588
|
+
if (z === "always" || z === "once" && w.current) {
|
|
589
|
+
const m = n(k);
|
|
590
|
+
if (!s(M, m)) {
|
|
591
|
+
let v;
|
|
592
|
+
try {
|
|
593
|
+
throw new Error();
|
|
594
|
+
} catch (O) {
|
|
595
|
+
({ stack: v } = O);
|
|
596
|
+
}
|
|
597
|
+
console.warn(
|
|
598
|
+
"Selector " + (n.name || "unknown") + ` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
|
|
599
|
+
Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,
|
|
600
|
+
{
|
|
601
|
+
state: k,
|
|
602
|
+
selected: M,
|
|
603
|
+
selected2: m,
|
|
604
|
+
stack: v
|
|
605
|
+
}
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if ((x === "always" || x === "once" && w.current) && M === k) {
|
|
610
|
+
let m;
|
|
611
|
+
try {
|
|
612
|
+
throw new Error();
|
|
613
|
+
} catch (v) {
|
|
614
|
+
({ stack: m } = v);
|
|
615
|
+
}
|
|
616
|
+
console.warn(
|
|
617
|
+
"Selector " + (n.name || "unknown") + ` returned the root state when called. This can lead to unnecessary rerenders.
|
|
618
|
+
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,
|
|
619
|
+
{ stack: m }
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
w.current && (w.current = !1);
|
|
623
|
+
}
|
|
624
|
+
return M;
|
|
625
|
+
}
|
|
626
|
+
}[n.name],
|
|
627
|
+
[n]
|
|
628
|
+
), g = xn.useSyncExternalStoreWithSelector(
|
|
629
|
+
y.addNestedSub,
|
|
630
|
+
a.getState,
|
|
631
|
+
h || a.getState,
|
|
632
|
+
d,
|
|
633
|
+
s
|
|
634
|
+
);
|
|
635
|
+
return re.useDebugValue(g), g;
|
|
636
|
+
};
|
|
637
|
+
return Object.assign(r, {
|
|
638
|
+
withTypes: () => r
|
|
639
|
+
}), r;
|
|
640
|
+
}
|
|
641
|
+
var Q = /* @__PURE__ */ In();
|
|
642
|
+
const An = {
|
|
643
|
+
en: {
|
|
644
|
+
// Toolbar tooltips
|
|
645
|
+
pointer: "Pointer",
|
|
646
|
+
text: "Text",
|
|
647
|
+
image: "Image",
|
|
648
|
+
pencil: "Pencil",
|
|
649
|
+
rectangle: "Rectangle",
|
|
650
|
+
circle: "Circle",
|
|
651
|
+
eraser: "Eraser",
|
|
652
|
+
fitToView: "Fit to view",
|
|
653
|
+
exportAsPng: "Export as PNG",
|
|
654
|
+
moreShapes: "More Shapes",
|
|
655
|
+
// Shape names
|
|
656
|
+
triangle: "Triangle",
|
|
657
|
+
diamond: "Diamond",
|
|
658
|
+
star: "Star",
|
|
659
|
+
heart: "Heart",
|
|
660
|
+
hexagon: "Hexagon",
|
|
661
|
+
octagon: "Octagon",
|
|
662
|
+
arrow: "Arrow",
|
|
663
|
+
// PropTools labels
|
|
664
|
+
fontSize: "Font Size",
|
|
665
|
+
fontColor: "Font Color",
|
|
666
|
+
layerOrder: "Layer Order",
|
|
667
|
+
bringToFront: "Bring to Front",
|
|
668
|
+
sendToBack: "Send to Back",
|
|
669
|
+
brushColor: "Brush Color",
|
|
670
|
+
brushSize: "Brush Size",
|
|
671
|
+
strokeColor: "Stroke Color",
|
|
672
|
+
fillColor: "Fill Color",
|
|
673
|
+
strokeWidth: "Stroke Width",
|
|
674
|
+
// Language selector
|
|
675
|
+
language: "Language",
|
|
676
|
+
english: "English",
|
|
677
|
+
turkish: "Turkish"
|
|
678
|
+
},
|
|
679
|
+
tr: {
|
|
680
|
+
// Toolbar tooltips
|
|
681
|
+
pointer: "İşaretçi",
|
|
682
|
+
text: "Metin",
|
|
683
|
+
image: "Resim",
|
|
684
|
+
pencil: "Kalem",
|
|
685
|
+
rectangle: "Dikdörtgen",
|
|
686
|
+
circle: "Daire",
|
|
687
|
+
eraser: "Silgi",
|
|
688
|
+
fitToView: "Ekrana sığdır",
|
|
689
|
+
exportAsPng: "PNG olarak dışa aktar",
|
|
690
|
+
moreShapes: "Daha Fazla Şekil",
|
|
691
|
+
// Shape names
|
|
692
|
+
triangle: "Üçgen",
|
|
693
|
+
diamond: "Elmas",
|
|
694
|
+
star: "Yıldız",
|
|
695
|
+
heart: "Kalp",
|
|
696
|
+
hexagon: "Altıgen",
|
|
697
|
+
octagon: "Sekizgen",
|
|
698
|
+
arrow: "Ok",
|
|
699
|
+
// PropTools labels
|
|
700
|
+
fontSize: "Yazı Boyutu",
|
|
701
|
+
fontColor: "Yazı Rengi",
|
|
702
|
+
layerOrder: "Katman Sırası",
|
|
703
|
+
bringToFront: "Öne Getir",
|
|
704
|
+
sendToBack: "Arkaya Gönder",
|
|
705
|
+
brushColor: "Fırça Rengi",
|
|
706
|
+
brushSize: "Fırça Boyutu",
|
|
707
|
+
strokeColor: "Çizgi Rengi",
|
|
708
|
+
fillColor: "Dolgu Rengi",
|
|
709
|
+
strokeWidth: "Çizgi Kalınlığı",
|
|
710
|
+
// Language selector
|
|
711
|
+
language: "Dil",
|
|
712
|
+
english: "İngilizce",
|
|
713
|
+
turkish: "Türkçe"
|
|
714
|
+
}
|
|
715
|
+
}, Tr = un(), Pr = "whiteboard-language", Wn = () => (navigator.language || navigator.userLanguage).startsWith("tr") ? "tr" : "en", Vn = () => {
|
|
716
|
+
const e = localStorage.getItem(Pr);
|
|
717
|
+
return e && (e === "en" || e === "tr") ? e : Wn();
|
|
718
|
+
}, Ln = ({ children: e }) => {
|
|
719
|
+
const [t, r] = G(Vn);
|
|
720
|
+
le(() => {
|
|
721
|
+
localStorage.setItem(Pr, t);
|
|
722
|
+
}, [t]);
|
|
723
|
+
const n = (s) => An[t][s] || s, o = (s) => {
|
|
724
|
+
(s === "en" || s === "tr") && r(s);
|
|
725
|
+
};
|
|
726
|
+
return /* @__PURE__ */ u.jsx(Tr.Provider, { value: { language: t, t: n, changeLanguage: o }, children: e });
|
|
727
|
+
}, Dr = () => {
|
|
728
|
+
const e = dn(Tr);
|
|
729
|
+
if (!e)
|
|
730
|
+
throw new Error("useLanguage must be used within a LanguageProvider");
|
|
731
|
+
return e;
|
|
732
|
+
};
|
|
733
|
+
function q(e) {
|
|
734
|
+
return `Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `;
|
|
735
|
+
}
|
|
736
|
+
var Yn = typeof Symbol == "function" && Symbol.observable || "@@observable", hr = Yn, zt = () => Math.random().toString(36).substring(7).split("").join("."), Fn = {
|
|
737
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ zt()}`,
|
|
738
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ zt()}`,
|
|
739
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${zt()}`
|
|
740
|
+
}, Ce = Fn;
|
|
741
|
+
function Ye(e) {
|
|
742
|
+
if (typeof e != "object" || e === null)
|
|
743
|
+
return !1;
|
|
744
|
+
let t = e;
|
|
745
|
+
for (; Object.getPrototypeOf(t) !== null; )
|
|
746
|
+
t = Object.getPrototypeOf(t);
|
|
747
|
+
return Object.getPrototypeOf(e) === t || Object.getPrototypeOf(e) === null;
|
|
748
|
+
}
|
|
749
|
+
function Xn(e) {
|
|
750
|
+
if (e === void 0)
|
|
751
|
+
return "undefined";
|
|
752
|
+
if (e === null)
|
|
753
|
+
return "null";
|
|
754
|
+
const t = typeof e;
|
|
755
|
+
switch (t) {
|
|
756
|
+
case "boolean":
|
|
757
|
+
case "string":
|
|
758
|
+
case "number":
|
|
759
|
+
case "symbol":
|
|
760
|
+
case "function":
|
|
761
|
+
return t;
|
|
762
|
+
}
|
|
763
|
+
if (Array.isArray(e))
|
|
764
|
+
return "array";
|
|
765
|
+
if (Un(e))
|
|
766
|
+
return "date";
|
|
767
|
+
if ($n(e))
|
|
768
|
+
return "error";
|
|
769
|
+
const r = Bn(e);
|
|
770
|
+
switch (r) {
|
|
771
|
+
case "Symbol":
|
|
772
|
+
case "Promise":
|
|
773
|
+
case "WeakMap":
|
|
774
|
+
case "WeakSet":
|
|
775
|
+
case "Map":
|
|
776
|
+
case "Set":
|
|
777
|
+
return r;
|
|
778
|
+
}
|
|
779
|
+
return Object.prototype.toString.call(e).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
780
|
+
}
|
|
781
|
+
function Bn(e) {
|
|
782
|
+
return typeof e.constructor == "function" ? e.constructor.name : null;
|
|
783
|
+
}
|
|
784
|
+
function $n(e) {
|
|
785
|
+
return e instanceof Error || typeof e.message == "string" && e.constructor && typeof e.constructor.stackTraceLimit == "number";
|
|
786
|
+
}
|
|
787
|
+
function Un(e) {
|
|
788
|
+
return e instanceof Date ? !0 : typeof e.toDateString == "function" && typeof e.getDate == "function" && typeof e.setDate == "function";
|
|
789
|
+
}
|
|
790
|
+
function ve(e) {
|
|
791
|
+
let t = typeof e;
|
|
792
|
+
return process.env.NODE_ENV !== "production" && (t = Xn(e)), t;
|
|
793
|
+
}
|
|
794
|
+
function Rr(e, t, r) {
|
|
795
|
+
if (typeof e != "function")
|
|
796
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(2) : `Expected the root reducer to be a function. Instead, received: '${ve(e)}'`);
|
|
797
|
+
if (typeof t == "function" && typeof r == "function" || typeof r == "function" && typeof arguments[3] == "function")
|
|
798
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
|
|
799
|
+
if (typeof t == "function" && typeof r > "u" && (r = t, t = void 0), typeof r < "u") {
|
|
800
|
+
if (typeof r != "function")
|
|
801
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(1) : `Expected the enhancer to be a function. Instead, received: '${ve(r)}'`);
|
|
802
|
+
return r(Rr)(e, t);
|
|
803
|
+
}
|
|
804
|
+
let n = e, o = t, s = /* @__PURE__ */ new Map(), l = s, a = 0, y = !1;
|
|
805
|
+
function h() {
|
|
806
|
+
l === s && (l = /* @__PURE__ */ new Map(), s.forEach((N, P) => {
|
|
807
|
+
l.set(P, N);
|
|
808
|
+
}));
|
|
809
|
+
}
|
|
810
|
+
function w() {
|
|
811
|
+
if (y)
|
|
812
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
|
|
813
|
+
return o;
|
|
814
|
+
}
|
|
815
|
+
function d(N) {
|
|
816
|
+
if (typeof N != "function")
|
|
817
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(4) : `Expected the listener to be a function. Instead, received: '${ve(N)}'`);
|
|
818
|
+
if (y)
|
|
819
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
820
|
+
let P = !0;
|
|
821
|
+
h();
|
|
822
|
+
const x = a++;
|
|
823
|
+
return l.set(x, N), function() {
|
|
824
|
+
if (P) {
|
|
825
|
+
if (y)
|
|
826
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
827
|
+
P = !1, h(), l.delete(x), s = null;
|
|
828
|
+
}
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
function g(N) {
|
|
832
|
+
if (!Ye(N))
|
|
833
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(7) : `Actions must be plain objects. Instead, the actual type was: '${ve(N)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);
|
|
834
|
+
if (typeof N.type > "u")
|
|
835
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
836
|
+
if (typeof N.type != "string")
|
|
837
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(17) : `Action "type" property must be a string. Instead, the actual type was: '${ve(N.type)}'. Value was: '${N.type}' (stringified)`);
|
|
838
|
+
if (y)
|
|
839
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(9) : "Reducers may not dispatch actions.");
|
|
840
|
+
try {
|
|
841
|
+
y = !0, o = n(o, N);
|
|
842
|
+
} finally {
|
|
843
|
+
y = !1;
|
|
844
|
+
}
|
|
845
|
+
return (s = l).forEach((x) => {
|
|
846
|
+
x();
|
|
847
|
+
}), N;
|
|
848
|
+
}
|
|
849
|
+
function k(N) {
|
|
850
|
+
if (typeof N != "function")
|
|
851
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(10) : `Expected the nextReducer to be a function. Instead, received: '${ve(N)}`);
|
|
852
|
+
n = N, g({
|
|
853
|
+
type: Ce.REPLACE
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
function M() {
|
|
857
|
+
const N = d;
|
|
858
|
+
return {
|
|
859
|
+
/**
|
|
860
|
+
* The minimal observable subscription method.
|
|
861
|
+
* @param observer Any object that can be used as an observer.
|
|
862
|
+
* The observer object should have a `next` method.
|
|
863
|
+
* @returns An object with an `unsubscribe` method that can
|
|
864
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
865
|
+
* emission of values from the observable.
|
|
866
|
+
*/
|
|
867
|
+
subscribe(P) {
|
|
868
|
+
if (typeof P != "object" || P === null)
|
|
869
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(11) : `Expected the observer to be an object. Instead, received: '${ve(P)}'`);
|
|
870
|
+
function x() {
|
|
871
|
+
const m = P;
|
|
872
|
+
m.next && m.next(w());
|
|
873
|
+
}
|
|
874
|
+
return x(), {
|
|
875
|
+
unsubscribe: N(x)
|
|
876
|
+
};
|
|
877
|
+
},
|
|
878
|
+
[hr]() {
|
|
879
|
+
return this;
|
|
880
|
+
}
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
return g({
|
|
884
|
+
type: Ce.INIT
|
|
885
|
+
}), {
|
|
886
|
+
dispatch: g,
|
|
887
|
+
subscribe: d,
|
|
888
|
+
getState: w,
|
|
889
|
+
replaceReducer: k,
|
|
890
|
+
[hr]: M
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
function pr(e) {
|
|
894
|
+
typeof console < "u" && typeof console.error == "function" && console.error(e);
|
|
895
|
+
try {
|
|
896
|
+
throw new Error(e);
|
|
897
|
+
} catch {
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
function Hn(e, t, r, n) {
|
|
901
|
+
const o = Object.keys(t), s = r && r.type === Ce.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
902
|
+
if (o.length === 0)
|
|
903
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
904
|
+
if (!Ye(e))
|
|
905
|
+
return `The ${s} has unexpected type of "${ve(e)}". Expected argument to be an object with the following keys: "${o.join('", "')}"`;
|
|
906
|
+
const l = Object.keys(e).filter((a) => !t.hasOwnProperty(a) && !n[a]);
|
|
907
|
+
if (l.forEach((a) => {
|
|
908
|
+
n[a] = !0;
|
|
909
|
+
}), !(r && r.type === Ce.REPLACE) && l.length > 0)
|
|
910
|
+
return `Unexpected ${l.length > 1 ? "keys" : "key"} "${l.join('", "')}" found in ${s}. Expected to find one of the known reducer keys instead: "${o.join('", "')}". Unexpected keys will be ignored.`;
|
|
911
|
+
}
|
|
912
|
+
function Gn(e) {
|
|
913
|
+
Object.keys(e).forEach((t) => {
|
|
914
|
+
const r = e[t];
|
|
915
|
+
if (typeof r(void 0, {
|
|
916
|
+
type: Ce.INIT
|
|
917
|
+
}) > "u")
|
|
918
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(12) : `The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
919
|
+
if (typeof r(void 0, {
|
|
920
|
+
type: Ce.PROBE_UNKNOWN_ACTION()
|
|
921
|
+
}) > "u")
|
|
922
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(13) : `The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${Ce.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
function qn(e) {
|
|
926
|
+
const t = Object.keys(e), r = {};
|
|
927
|
+
for (let l = 0; l < t.length; l++) {
|
|
928
|
+
const a = t[l];
|
|
929
|
+
process.env.NODE_ENV !== "production" && typeof e[a] > "u" && pr(`No reducer provided for key "${a}"`), typeof e[a] == "function" && (r[a] = e[a]);
|
|
930
|
+
}
|
|
931
|
+
const n = Object.keys(r);
|
|
932
|
+
let o;
|
|
933
|
+
process.env.NODE_ENV !== "production" && (o = {});
|
|
934
|
+
let s;
|
|
935
|
+
try {
|
|
936
|
+
Gn(r);
|
|
937
|
+
} catch (l) {
|
|
938
|
+
s = l;
|
|
939
|
+
}
|
|
940
|
+
return function(a = {}, y) {
|
|
941
|
+
if (s)
|
|
942
|
+
throw s;
|
|
943
|
+
if (process.env.NODE_ENV !== "production") {
|
|
944
|
+
const d = Hn(a, r, y, o);
|
|
945
|
+
d && pr(d);
|
|
946
|
+
}
|
|
947
|
+
let h = !1;
|
|
948
|
+
const w = {};
|
|
949
|
+
for (let d = 0; d < n.length; d++) {
|
|
950
|
+
const g = n[d], k = r[g], M = a[g], j = k(M, y);
|
|
951
|
+
if (typeof j > "u") {
|
|
952
|
+
const N = y && y.type;
|
|
953
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(14) : `When called with an action of type ${N ? `"${String(N)}"` : "(unknown type)"}, the slice reducer for key "${g}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
954
|
+
}
|
|
955
|
+
w[g] = j, h = h || j !== M;
|
|
956
|
+
}
|
|
957
|
+
return h = h || n.length !== Object.keys(a).length, h ? w : a;
|
|
958
|
+
};
|
|
959
|
+
}
|
|
960
|
+
function ft(...e) {
|
|
961
|
+
return e.length === 0 ? (t) => t : e.length === 1 ? e[0] : e.reduce((t, r) => (...n) => t(r(...n)));
|
|
962
|
+
}
|
|
963
|
+
function Kn(...e) {
|
|
964
|
+
return (t) => (r, n) => {
|
|
965
|
+
const o = t(r, n);
|
|
966
|
+
let s = () => {
|
|
967
|
+
throw new Error(process.env.NODE_ENV === "production" ? q(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
|
968
|
+
};
|
|
969
|
+
const l = {
|
|
970
|
+
getState: o.getState,
|
|
971
|
+
dispatch: (y, ...h) => s(y, ...h)
|
|
972
|
+
}, a = e.map((y) => y(l));
|
|
973
|
+
return s = ft(...a)(o.dispatch), {
|
|
974
|
+
...o,
|
|
975
|
+
dispatch: s
|
|
976
|
+
};
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
function zr(e) {
|
|
980
|
+
return Ye(e) && "type" in e && typeof e.type == "string";
|
|
981
|
+
}
|
|
982
|
+
var Ir = Symbol.for("immer-nothing"), yr = Symbol.for("immer-draftable"), K = Symbol.for("immer-state"), Zn = process.env.NODE_ENV !== "production" ? [
|
|
983
|
+
// All error codes, starting by 0:
|
|
984
|
+
function(e) {
|
|
985
|
+
return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
|
|
986
|
+
},
|
|
987
|
+
function(e) {
|
|
988
|
+
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
|
|
989
|
+
},
|
|
990
|
+
"This object has been frozen and should not be mutated",
|
|
991
|
+
function(e) {
|
|
992
|
+
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
|
|
993
|
+
},
|
|
994
|
+
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
995
|
+
"Immer forbids circular references",
|
|
996
|
+
"The first or second argument to `produce` must be a function",
|
|
997
|
+
"The third argument to `produce` must be a function or undefined",
|
|
998
|
+
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
999
|
+
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
1000
|
+
function(e) {
|
|
1001
|
+
return `'current' expects a draft, got: ${e}`;
|
|
1002
|
+
},
|
|
1003
|
+
"Object.defineProperty() cannot be used on an Immer draft",
|
|
1004
|
+
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
1005
|
+
"Immer only supports deleting array indices",
|
|
1006
|
+
"Immer only supports setting array indices and the 'length' property",
|
|
1007
|
+
function(e) {
|
|
1008
|
+
return `'original' expects a draft, got: ${e}`;
|
|
1009
|
+
}
|
|
1010
|
+
// Note: if more errors are added, the errorOffset in Patches.ts should be increased
|
|
1011
|
+
// See Patches.ts for additional errors
|
|
1012
|
+
] : [];
|
|
1013
|
+
function te(e, ...t) {
|
|
1014
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1015
|
+
const r = Zn[e], n = _e(r) ? r.apply(null, t) : r;
|
|
1016
|
+
throw new Error(`[Immer] ${n}`);
|
|
1017
|
+
}
|
|
1018
|
+
throw new Error(
|
|
1019
|
+
`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
var ne = Object, je = ne.getPrototypeOf, ht = "constructor", bt = "prototype", Wt = "configurable", pt = "enumerable", lt = "writable", We = "value", ge = (e) => !!e && !!e[K];
|
|
1023
|
+
function ce(e) {
|
|
1024
|
+
var t;
|
|
1025
|
+
return e ? Ar(e) || _t(e) || !!e[yr] || !!((t = e[ht]) != null && t[yr]) || Ct(e) || kt(e) : !1;
|
|
1026
|
+
}
|
|
1027
|
+
var Jn = ne[bt][ht].toString(), gr = /* @__PURE__ */ new WeakMap();
|
|
1028
|
+
function Ar(e) {
|
|
1029
|
+
if (!e || !Kt(e))
|
|
1030
|
+
return !1;
|
|
1031
|
+
const t = je(e);
|
|
1032
|
+
if (t === null || t === ne[bt])
|
|
1033
|
+
return !0;
|
|
1034
|
+
const r = ne.hasOwnProperty.call(t, ht) && t[ht];
|
|
1035
|
+
if (r === Object)
|
|
1036
|
+
return !0;
|
|
1037
|
+
if (!_e(r))
|
|
1038
|
+
return !1;
|
|
1039
|
+
let n = gr.get(r);
|
|
1040
|
+
return n === void 0 && (n = Function.toString.call(r), gr.set(r, n)), n === Jn;
|
|
1041
|
+
}
|
|
1042
|
+
function Et(e, t, r = !0) {
|
|
1043
|
+
Fe(e) === 0 ? (r ? Reflect.ownKeys(e) : ne.keys(e)).forEach((o) => {
|
|
1044
|
+
t(o, e[o], e);
|
|
1045
|
+
}) : e.forEach((n, o) => t(o, n, e));
|
|
1046
|
+
}
|
|
1047
|
+
function Fe(e) {
|
|
1048
|
+
const t = e[K];
|
|
1049
|
+
return t ? t.type_ : _t(e) ? 1 : Ct(e) ? 2 : kt(e) ? 3 : 0;
|
|
1050
|
+
}
|
|
1051
|
+
var mr = (e, t, r = Fe(e)) => r === 2 ? e.has(t) : ne[bt].hasOwnProperty.call(e, t), Vt = (e, t, r = Fe(e)) => (
|
|
1052
|
+
// @ts-ignore
|
|
1053
|
+
r === 2 ? e.get(t) : e[t]
|
|
1054
|
+
), yt = (e, t, r, n = Fe(e)) => {
|
|
1055
|
+
n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
|
|
1056
|
+
};
|
|
1057
|
+
function Qn(e, t) {
|
|
1058
|
+
return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
|
|
1059
|
+
}
|
|
1060
|
+
var _t = Array.isArray, Ct = (e) => e instanceof Map, kt = (e) => e instanceof Set, Kt = (e) => typeof e == "object", _e = (e) => typeof e == "function", It = (e) => typeof e == "boolean";
|
|
1061
|
+
function eo(e) {
|
|
1062
|
+
const t = +e;
|
|
1063
|
+
return Number.isInteger(t) && String(t) === e;
|
|
1064
|
+
}
|
|
1065
|
+
var ye = (e) => e.copy_ || e.base_, Zt = (e) => e.modified_ ? e.copy_ : e.base_;
|
|
1066
|
+
function Lt(e, t) {
|
|
1067
|
+
if (Ct(e))
|
|
1068
|
+
return new Map(e);
|
|
1069
|
+
if (kt(e))
|
|
1070
|
+
return new Set(e);
|
|
1071
|
+
if (_t(e))
|
|
1072
|
+
return Array[bt].slice.call(e);
|
|
1073
|
+
const r = Ar(e);
|
|
1074
|
+
if (t === !0 || t === "class_only" && !r) {
|
|
1075
|
+
const n = ne.getOwnPropertyDescriptors(e);
|
|
1076
|
+
delete n[K];
|
|
1077
|
+
let o = Reflect.ownKeys(n);
|
|
1078
|
+
for (let s = 0; s < o.length; s++) {
|
|
1079
|
+
const l = o[s], a = n[l];
|
|
1080
|
+
a[lt] === !1 && (a[lt] = !0, a[Wt] = !0), (a.get || a.set) && (n[l] = {
|
|
1081
|
+
[Wt]: !0,
|
|
1082
|
+
[lt]: !0,
|
|
1083
|
+
// could live with !!desc.set as well here...
|
|
1084
|
+
[pt]: a[pt],
|
|
1085
|
+
[We]: e[l]
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
return ne.create(je(e), n);
|
|
1089
|
+
} else {
|
|
1090
|
+
const n = je(e);
|
|
1091
|
+
if (n !== null && r)
|
|
1092
|
+
return { ...e };
|
|
1093
|
+
const o = ne.create(n);
|
|
1094
|
+
return ne.assign(o, e);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
function Jt(e, t = !1) {
|
|
1098
|
+
return St(e) || ge(e) || !ce(e) || (Fe(e) > 1 && ne.defineProperties(e, {
|
|
1099
|
+
set: it,
|
|
1100
|
+
add: it,
|
|
1101
|
+
clear: it,
|
|
1102
|
+
delete: it
|
|
1103
|
+
}), ne.freeze(e), t && Et(
|
|
1104
|
+
e,
|
|
1105
|
+
(r, n) => {
|
|
1106
|
+
Jt(n, !0);
|
|
1107
|
+
},
|
|
1108
|
+
!1
|
|
1109
|
+
)), e;
|
|
1110
|
+
}
|
|
1111
|
+
function to() {
|
|
1112
|
+
te(2);
|
|
1113
|
+
}
|
|
1114
|
+
var it = {
|
|
1115
|
+
[We]: to
|
|
1116
|
+
};
|
|
1117
|
+
function St(e) {
|
|
1118
|
+
return e === null || !Kt(e) ? !0 : ne.isFrozen(e);
|
|
1119
|
+
}
|
|
1120
|
+
var gt = "MapSet", Yt = "Patches", wr = "ArrayMethods", Wr = {};
|
|
1121
|
+
function ke(e) {
|
|
1122
|
+
const t = Wr[e];
|
|
1123
|
+
return t || te(0, e), t;
|
|
1124
|
+
}
|
|
1125
|
+
var vr = (e) => !!Wr[e], Ve, Vr = () => Ve, ro = (e, t) => ({
|
|
1126
|
+
drafts_: [],
|
|
1127
|
+
parent_: e,
|
|
1128
|
+
immer_: t,
|
|
1129
|
+
// Whenever the modified draft contains a draft from another scope, we
|
|
1130
|
+
// need to prevent auto-freezing so the unowned draft can be finalized.
|
|
1131
|
+
canAutoFreeze_: !0,
|
|
1132
|
+
unfinalizedDrafts_: 0,
|
|
1133
|
+
handledSet_: /* @__PURE__ */ new Set(),
|
|
1134
|
+
processedForPatches_: /* @__PURE__ */ new Set(),
|
|
1135
|
+
mapSetPlugin_: vr(gt) ? ke(gt) : void 0,
|
|
1136
|
+
arrayMethodsPlugin_: vr(wr) ? ke(wr) : void 0
|
|
1137
|
+
});
|
|
1138
|
+
function xr(e, t) {
|
|
1139
|
+
t && (e.patchPlugin_ = ke(Yt), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
|
|
1140
|
+
}
|
|
1141
|
+
function Ft(e) {
|
|
1142
|
+
Xt(e), e.drafts_.forEach(no), e.drafts_ = null;
|
|
1143
|
+
}
|
|
1144
|
+
function Xt(e) {
|
|
1145
|
+
e === Ve && (Ve = e.parent_);
|
|
1146
|
+
}
|
|
1147
|
+
var br = (e) => Ve = ro(Ve, e);
|
|
1148
|
+
function no(e) {
|
|
1149
|
+
const t = e[K];
|
|
1150
|
+
t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
|
|
1151
|
+
}
|
|
1152
|
+
function Er(e, t) {
|
|
1153
|
+
t.unfinalizedDrafts_ = t.drafts_.length;
|
|
1154
|
+
const r = t.drafts_[0];
|
|
1155
|
+
if (e !== void 0 && e !== r) {
|
|
1156
|
+
r[K].modified_ && (Ft(t), te(4)), ce(e) && (e = _r(t, e));
|
|
1157
|
+
const { patchPlugin_: o } = t;
|
|
1158
|
+
o && o.generateReplacementPatches_(
|
|
1159
|
+
r[K].base_,
|
|
1160
|
+
e,
|
|
1161
|
+
t
|
|
1162
|
+
);
|
|
1163
|
+
} else
|
|
1164
|
+
e = _r(t, r);
|
|
1165
|
+
return oo(t, e, !0), Ft(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Ir ? e : void 0;
|
|
1166
|
+
}
|
|
1167
|
+
function _r(e, t) {
|
|
1168
|
+
if (St(t))
|
|
1169
|
+
return t;
|
|
1170
|
+
const r = t[K];
|
|
1171
|
+
if (!r)
|
|
1172
|
+
return mt(t, e.handledSet_, e);
|
|
1173
|
+
if (!Nt(r, e))
|
|
1174
|
+
return t;
|
|
1175
|
+
if (!r.modified_)
|
|
1176
|
+
return r.base_;
|
|
1177
|
+
if (!r.finalized_) {
|
|
1178
|
+
const { callbacks_: n } = r;
|
|
1179
|
+
if (n)
|
|
1180
|
+
for (; n.length > 0; )
|
|
1181
|
+
n.pop()(e);
|
|
1182
|
+
Fr(r, e);
|
|
1183
|
+
}
|
|
1184
|
+
return r.copy_;
|
|
1185
|
+
}
|
|
1186
|
+
function oo(e, t, r = !1) {
|
|
1187
|
+
!e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && Jt(t, r);
|
|
1188
|
+
}
|
|
1189
|
+
function Lr(e) {
|
|
1190
|
+
e.finalized_ = !0, e.scope_.unfinalizedDrafts_--;
|
|
1191
|
+
}
|
|
1192
|
+
var Nt = (e, t) => e.scope_ === t, io = [];
|
|
1193
|
+
function Yr(e, t, r, n) {
|
|
1194
|
+
const o = ye(e), s = e.type_;
|
|
1195
|
+
if (n !== void 0 && Vt(o, n, s) === t) {
|
|
1196
|
+
yt(o, n, r, s);
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
if (!e.draftLocations_) {
|
|
1200
|
+
const a = e.draftLocations_ = /* @__PURE__ */ new Map();
|
|
1201
|
+
Et(o, (y, h) => {
|
|
1202
|
+
if (ge(h)) {
|
|
1203
|
+
const w = a.get(h) || [];
|
|
1204
|
+
w.push(y), a.set(h, w);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
const l = e.draftLocations_.get(t) ?? io;
|
|
1209
|
+
for (const a of l)
|
|
1210
|
+
yt(o, a, r, s);
|
|
1211
|
+
}
|
|
1212
|
+
function so(e, t, r) {
|
|
1213
|
+
e.callbacks_.push(function(o) {
|
|
1214
|
+
var a;
|
|
1215
|
+
const s = t;
|
|
1216
|
+
if (!s || !Nt(s, o))
|
|
1217
|
+
return;
|
|
1218
|
+
(a = o.mapSetPlugin_) == null || a.fixSetContents(s);
|
|
1219
|
+
const l = Zt(s);
|
|
1220
|
+
Yr(e, s.draft_ ?? s, l, r), Fr(s, o);
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
function Fr(e, t) {
|
|
1224
|
+
var n;
|
|
1225
|
+
if (e.modified_ && !e.finalized_ && (e.type_ === 3 || e.type_ === 1 && e.allIndicesReassigned_ || (((n = e.assigned_) == null ? void 0 : n.size) ?? 0) > 0)) {
|
|
1226
|
+
const { patchPlugin_: o } = t;
|
|
1227
|
+
if (o) {
|
|
1228
|
+
const s = o.getPath(e);
|
|
1229
|
+
s && o.generatePatches_(e, s, t);
|
|
1230
|
+
}
|
|
1231
|
+
Lr(e);
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
function ao(e, t, r) {
|
|
1235
|
+
const { scope_: n } = e;
|
|
1236
|
+
if (ge(r)) {
|
|
1237
|
+
const o = r[K];
|
|
1238
|
+
Nt(o, n) && o.callbacks_.push(function() {
|
|
1239
|
+
ut(e);
|
|
1240
|
+
const l = Zt(o);
|
|
1241
|
+
Yr(e, r, l, t);
|
|
1242
|
+
});
|
|
1243
|
+
} else ce(r) && e.callbacks_.push(function() {
|
|
1244
|
+
const s = ye(e);
|
|
1245
|
+
e.type_ === 3 ? s.has(r) && mt(r, n.handledSet_, n) : Vt(s, t, e.type_) === r && n.drafts_.length > 1 && (e.assigned_.get(t) ?? !1) === !0 && e.copy_ && mt(
|
|
1246
|
+
Vt(e.copy_, t, e.type_),
|
|
1247
|
+
n.handledSet_,
|
|
1248
|
+
n
|
|
1249
|
+
);
|
|
1250
|
+
});
|
|
1251
|
+
}
|
|
1252
|
+
function mt(e, t, r) {
|
|
1253
|
+
return !r.immer_.autoFreeze_ && r.unfinalizedDrafts_ < 1 || ge(e) || t.has(e) || !ce(e) || St(e) || (t.add(e), Et(e, (n, o) => {
|
|
1254
|
+
if (ge(o)) {
|
|
1255
|
+
const s = o[K];
|
|
1256
|
+
if (Nt(s, r)) {
|
|
1257
|
+
const l = Zt(s);
|
|
1258
|
+
yt(e, n, l, e.type_), Lr(s);
|
|
1259
|
+
}
|
|
1260
|
+
} else ce(o) && mt(o, t, r);
|
|
1261
|
+
})), e;
|
|
1262
|
+
}
|
|
1263
|
+
function co(e, t) {
|
|
1264
|
+
const r = _t(e), n = {
|
|
1265
|
+
type_: r ? 1 : 0,
|
|
1266
|
+
// Track which produce call this is associated with.
|
|
1267
|
+
scope_: t ? t.scope_ : Vr(),
|
|
1268
|
+
// True for both shallow and deep changes.
|
|
1269
|
+
modified_: !1,
|
|
1270
|
+
// Used during finalization.
|
|
1271
|
+
finalized_: !1,
|
|
1272
|
+
// Track which properties have been assigned (true) or deleted (false).
|
|
1273
|
+
// actually instantiated in `prepareCopy()`
|
|
1274
|
+
assigned_: void 0,
|
|
1275
|
+
// The parent draft state.
|
|
1276
|
+
parent_: t,
|
|
1277
|
+
// The base state.
|
|
1278
|
+
base_: e,
|
|
1279
|
+
// The base proxy.
|
|
1280
|
+
draft_: null,
|
|
1281
|
+
// set below
|
|
1282
|
+
// The base copy with any updated values.
|
|
1283
|
+
copy_: null,
|
|
1284
|
+
// Called by the `produce` function.
|
|
1285
|
+
revoke_: null,
|
|
1286
|
+
isManual_: !1,
|
|
1287
|
+
// `callbacks` actually gets assigned in `createProxy`
|
|
1288
|
+
callbacks_: void 0
|
|
1289
|
+
};
|
|
1290
|
+
let o = n, s = wt;
|
|
1291
|
+
r && (o = [n], s = Le);
|
|
1292
|
+
const { revoke: l, proxy: a } = Proxy.revocable(o, s);
|
|
1293
|
+
return n.draft_ = a, n.revoke_ = l, [a, n];
|
|
1294
|
+
}
|
|
1295
|
+
var wt = {
|
|
1296
|
+
get(e, t) {
|
|
1297
|
+
if (t === K)
|
|
1298
|
+
return e;
|
|
1299
|
+
let r = e.scope_.arrayMethodsPlugin_;
|
|
1300
|
+
const n = e.type_ === 1 && typeof t == "string";
|
|
1301
|
+
if (n && r != null && r.isArrayOperationMethod(t))
|
|
1302
|
+
return r.createMethodInterceptor(e, t);
|
|
1303
|
+
const o = ye(e);
|
|
1304
|
+
if (!mr(o, t, e.type_))
|
|
1305
|
+
return lo(e, o, t);
|
|
1306
|
+
const s = o[t];
|
|
1307
|
+
if (e.finalized_ || !ce(s) || n && e.operationMethod && (r != null && r.isMutatingArrayMethod(
|
|
1308
|
+
e.operationMethod
|
|
1309
|
+
)) && eo(t))
|
|
1310
|
+
return s;
|
|
1311
|
+
if (s === At(e.base_, t)) {
|
|
1312
|
+
ut(e);
|
|
1313
|
+
const l = e.type_ === 1 ? +t : t, a = $t(e.scope_, s, e, l);
|
|
1314
|
+
return e.copy_[l] = a;
|
|
1315
|
+
}
|
|
1316
|
+
return s;
|
|
1317
|
+
},
|
|
1318
|
+
has(e, t) {
|
|
1319
|
+
return t in ye(e);
|
|
1320
|
+
},
|
|
1321
|
+
ownKeys(e) {
|
|
1322
|
+
return Reflect.ownKeys(ye(e));
|
|
1323
|
+
},
|
|
1324
|
+
set(e, t, r) {
|
|
1325
|
+
const n = Xr(ye(e), t);
|
|
1326
|
+
if (n != null && n.set)
|
|
1327
|
+
return n.set.call(e.draft_, r), !0;
|
|
1328
|
+
if (!e.modified_) {
|
|
1329
|
+
const o = At(ye(e), t), s = o == null ? void 0 : o[K];
|
|
1330
|
+
if (s && s.base_ === r)
|
|
1331
|
+
return e.copy_[t] = r, e.assigned_.set(t, !1), !0;
|
|
1332
|
+
if (Qn(r, o) && (r !== void 0 || mr(e.base_, t, e.type_)))
|
|
1333
|
+
return !0;
|
|
1334
|
+
ut(e), Bt(e);
|
|
1335
|
+
}
|
|
1336
|
+
return e.copy_[t] === r && // special case: handle new props with value 'undefined'
|
|
1337
|
+
(r !== void 0 || t in e.copy_) || // special case: NaN
|
|
1338
|
+
Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_.set(t, !0), ao(e, t, r)), !0;
|
|
1339
|
+
},
|
|
1340
|
+
deleteProperty(e, t) {
|
|
1341
|
+
return ut(e), At(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_.set(t, !1), Bt(e)) : e.assigned_.delete(t), e.copy_ && delete e.copy_[t], !0;
|
|
1342
|
+
},
|
|
1343
|
+
// Note: We never coerce `desc.value` into an Immer draft, because we can't make
|
|
1344
|
+
// the same guarantee in ES5 mode.
|
|
1345
|
+
getOwnPropertyDescriptor(e, t) {
|
|
1346
|
+
const r = ye(e), n = Reflect.getOwnPropertyDescriptor(r, t);
|
|
1347
|
+
return n && {
|
|
1348
|
+
[lt]: !0,
|
|
1349
|
+
[Wt]: e.type_ !== 1 || t !== "length",
|
|
1350
|
+
[pt]: n[pt],
|
|
1351
|
+
[We]: r[t]
|
|
1352
|
+
};
|
|
1353
|
+
},
|
|
1354
|
+
defineProperty() {
|
|
1355
|
+
te(11);
|
|
1356
|
+
},
|
|
1357
|
+
getPrototypeOf(e) {
|
|
1358
|
+
return je(e.base_);
|
|
1359
|
+
},
|
|
1360
|
+
setPrototypeOf() {
|
|
1361
|
+
te(12);
|
|
1362
|
+
}
|
|
1363
|
+
}, Le = {};
|
|
1364
|
+
for (let e in wt) {
|
|
1365
|
+
let t = wt[e];
|
|
1366
|
+
Le[e] = function() {
|
|
1367
|
+
const r = arguments;
|
|
1368
|
+
return r[0] = r[0][0], t.apply(this, r);
|
|
1369
|
+
};
|
|
1370
|
+
}
|
|
1371
|
+
Le.deleteProperty = function(e, t) {
|
|
1372
|
+
return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && te(13), Le.set.call(this, e, t, void 0);
|
|
1373
|
+
};
|
|
1374
|
+
Le.set = function(e, t, r) {
|
|
1375
|
+
return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && te(14), wt.set.call(this, e[0], t, r, e[0]);
|
|
1376
|
+
};
|
|
1377
|
+
function At(e, t) {
|
|
1378
|
+
const r = e[K];
|
|
1379
|
+
return (r ? ye(r) : e)[t];
|
|
1380
|
+
}
|
|
1381
|
+
function lo(e, t, r) {
|
|
1382
|
+
var o;
|
|
1383
|
+
const n = Xr(t, r);
|
|
1384
|
+
return n ? We in n ? n[We] : (
|
|
1385
|
+
// This is a very special case, if the prop is a getter defined by the
|
|
1386
|
+
// prototype, we should invoke it with the draft as context!
|
|
1387
|
+
(o = n.get) == null ? void 0 : o.call(e.draft_)
|
|
1388
|
+
) : void 0;
|
|
1389
|
+
}
|
|
1390
|
+
function Xr(e, t) {
|
|
1391
|
+
if (!(t in e))
|
|
1392
|
+
return;
|
|
1393
|
+
let r = je(e);
|
|
1394
|
+
for (; r; ) {
|
|
1395
|
+
const n = Object.getOwnPropertyDescriptor(r, t);
|
|
1396
|
+
if (n)
|
|
1397
|
+
return n;
|
|
1398
|
+
r = je(r);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function Bt(e) {
|
|
1402
|
+
e.modified_ || (e.modified_ = !0, e.parent_ && Bt(e.parent_));
|
|
1403
|
+
}
|
|
1404
|
+
function ut(e) {
|
|
1405
|
+
e.copy_ || (e.assigned_ = /* @__PURE__ */ new Map(), e.copy_ = Lt(
|
|
1406
|
+
e.base_,
|
|
1407
|
+
e.scope_.immer_.useStrictShallowCopy_
|
|
1408
|
+
));
|
|
1409
|
+
}
|
|
1410
|
+
var uo = class {
|
|
1411
|
+
constructor(e) {
|
|
1412
|
+
this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (t, r, n) => {
|
|
1413
|
+
if (_e(t) && !_e(r)) {
|
|
1414
|
+
const s = r;
|
|
1415
|
+
r = t;
|
|
1416
|
+
const l = this;
|
|
1417
|
+
return function(y = s, ...h) {
|
|
1418
|
+
return l.produce(y, (w) => r.call(this, w, ...h));
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
_e(r) || te(6), n !== void 0 && !_e(n) && te(7);
|
|
1422
|
+
let o;
|
|
1423
|
+
if (ce(t)) {
|
|
1424
|
+
const s = br(this), l = $t(s, t, void 0);
|
|
1425
|
+
let a = !0;
|
|
1426
|
+
try {
|
|
1427
|
+
o = r(l), a = !1;
|
|
1428
|
+
} finally {
|
|
1429
|
+
a ? Ft(s) : Xt(s);
|
|
1430
|
+
}
|
|
1431
|
+
return xr(s, n), Er(o, s);
|
|
1432
|
+
} else if (!t || !Kt(t)) {
|
|
1433
|
+
if (o = r(t), o === void 0 && (o = t), o === Ir && (o = void 0), this.autoFreeze_ && Jt(o, !0), n) {
|
|
1434
|
+
const s = [], l = [];
|
|
1435
|
+
ke(Yt).generateReplacementPatches_(t, o, {
|
|
1436
|
+
patches_: s,
|
|
1437
|
+
inversePatches_: l
|
|
1438
|
+
}), n(s, l);
|
|
1439
|
+
}
|
|
1440
|
+
return o;
|
|
1441
|
+
} else
|
|
1442
|
+
te(1, t);
|
|
1443
|
+
}, this.produceWithPatches = (t, r) => {
|
|
1444
|
+
if (_e(t))
|
|
1445
|
+
return (l, ...a) => this.produceWithPatches(l, (y) => t(y, ...a));
|
|
1446
|
+
let n, o;
|
|
1447
|
+
return [this.produce(t, r, (l, a) => {
|
|
1448
|
+
n = l, o = a;
|
|
1449
|
+
}), n, o];
|
|
1450
|
+
}, It(e == null ? void 0 : e.autoFreeze) && this.setAutoFreeze(e.autoFreeze), It(e == null ? void 0 : e.useStrictShallowCopy) && this.setUseStrictShallowCopy(e.useStrictShallowCopy), It(e == null ? void 0 : e.useStrictIteration) && this.setUseStrictIteration(e.useStrictIteration);
|
|
1451
|
+
}
|
|
1452
|
+
createDraft(e) {
|
|
1453
|
+
ce(e) || te(8), ge(e) && (e = fo(e));
|
|
1454
|
+
const t = br(this), r = $t(t, e, void 0);
|
|
1455
|
+
return r[K].isManual_ = !0, Xt(t), r;
|
|
1456
|
+
}
|
|
1457
|
+
finishDraft(e, t) {
|
|
1458
|
+
const r = e && e[K];
|
|
1459
|
+
(!r || !r.isManual_) && te(9);
|
|
1460
|
+
const { scope_: n } = r;
|
|
1461
|
+
return xr(n, t), Er(void 0, n);
|
|
1462
|
+
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Pass true to automatically freeze all copies created by Immer.
|
|
1465
|
+
*
|
|
1466
|
+
* By default, auto-freezing is enabled.
|
|
1467
|
+
*/
|
|
1468
|
+
setAutoFreeze(e) {
|
|
1469
|
+
this.autoFreeze_ = e;
|
|
1470
|
+
}
|
|
1471
|
+
/**
|
|
1472
|
+
* Pass true to enable strict shallow copy.
|
|
1473
|
+
*
|
|
1474
|
+
* By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
|
|
1475
|
+
*/
|
|
1476
|
+
setUseStrictShallowCopy(e) {
|
|
1477
|
+
this.useStrictShallowCopy_ = e;
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Pass false to use faster iteration that skips non-enumerable properties
|
|
1481
|
+
* but still handles symbols for compatibility.
|
|
1482
|
+
*
|
|
1483
|
+
* By default, strict iteration is enabled (includes all own properties).
|
|
1484
|
+
*/
|
|
1485
|
+
setUseStrictIteration(e) {
|
|
1486
|
+
this.useStrictIteration_ = e;
|
|
1487
|
+
}
|
|
1488
|
+
shouldUseStrictIteration() {
|
|
1489
|
+
return this.useStrictIteration_;
|
|
1490
|
+
}
|
|
1491
|
+
applyPatches(e, t) {
|
|
1492
|
+
let r;
|
|
1493
|
+
for (r = t.length - 1; r >= 0; r--) {
|
|
1494
|
+
const o = t[r];
|
|
1495
|
+
if (o.path.length === 0 && o.op === "replace") {
|
|
1496
|
+
e = o.value;
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
r > -1 && (t = t.slice(r + 1));
|
|
1501
|
+
const n = ke(Yt).applyPatches_;
|
|
1502
|
+
return ge(e) ? n(e, t) : this.produce(
|
|
1503
|
+
e,
|
|
1504
|
+
(o) => n(o, t)
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
1508
|
+
function $t(e, t, r, n) {
|
|
1509
|
+
const [o, s] = Ct(t) ? ke(gt).proxyMap_(t, r) : kt(t) ? ke(gt).proxySet_(t, r) : co(t, r);
|
|
1510
|
+
return ((r == null ? void 0 : r.scope_) ?? Vr()).drafts_.push(o), s.callbacks_ = (r == null ? void 0 : r.callbacks_) ?? [], s.key_ = n, r && n !== void 0 ? so(r, s, n) : s.callbacks_.push(function(y) {
|
|
1511
|
+
var w;
|
|
1512
|
+
(w = y.mapSetPlugin_) == null || w.fixSetContents(s);
|
|
1513
|
+
const { patchPlugin_: h } = y;
|
|
1514
|
+
s.modified_ && h && h.generatePatches_(s, [], y);
|
|
1515
|
+
}), o;
|
|
1516
|
+
}
|
|
1517
|
+
function fo(e) {
|
|
1518
|
+
return ge(e) || te(10, e), Br(e);
|
|
1519
|
+
}
|
|
1520
|
+
function Br(e) {
|
|
1521
|
+
if (!ce(e) || St(e))
|
|
1522
|
+
return e;
|
|
1523
|
+
const t = e[K];
|
|
1524
|
+
let r, n = !0;
|
|
1525
|
+
if (t) {
|
|
1526
|
+
if (!t.modified_)
|
|
1527
|
+
return t.base_;
|
|
1528
|
+
t.finalized_ = !0, r = Lt(e, t.scope_.immer_.useStrictShallowCopy_), n = t.scope_.immer_.shouldUseStrictIteration();
|
|
1529
|
+
} else
|
|
1530
|
+
r = Lt(e, !0);
|
|
1531
|
+
return Et(
|
|
1532
|
+
r,
|
|
1533
|
+
(o, s) => {
|
|
1534
|
+
yt(r, o, Br(s));
|
|
1535
|
+
},
|
|
1536
|
+
n
|
|
1537
|
+
), t && (t.finalized_ = !1), r;
|
|
1538
|
+
}
|
|
1539
|
+
var ho = new uo(), $r = ho.produce;
|
|
1540
|
+
function Ur(e) {
|
|
1541
|
+
return ({ dispatch: r, getState: n }) => (o) => (s) => typeof s == "function" ? s(r, n, e) : o(s);
|
|
1542
|
+
}
|
|
1543
|
+
var po = Ur(), yo = Ur, go = typeof window < "u" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
1544
|
+
if (arguments.length !== 0)
|
|
1545
|
+
return typeof arguments[0] == "object" ? ft : ft.apply(null, arguments);
|
|
1546
|
+
}, mo = (e) => e && typeof e.match == "function";
|
|
1547
|
+
function Cr(e, t) {
|
|
1548
|
+
function r(...n) {
|
|
1549
|
+
if (t) {
|
|
1550
|
+
let o = t(...n);
|
|
1551
|
+
if (!o)
|
|
1552
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(0) : "prepareAction did not return an object");
|
|
1553
|
+
return {
|
|
1554
|
+
type: e,
|
|
1555
|
+
payload: o.payload,
|
|
1556
|
+
..."meta" in o && {
|
|
1557
|
+
meta: o.meta
|
|
1558
|
+
},
|
|
1559
|
+
..."error" in o && {
|
|
1560
|
+
error: o.error
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
}
|
|
1564
|
+
return {
|
|
1565
|
+
type: e,
|
|
1566
|
+
payload: n[0]
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
return r.toString = () => `${e}`, r.type = e, r.match = (n) => zr(n) && n.type === e, r;
|
|
1570
|
+
}
|
|
1571
|
+
function wo(e) {
|
|
1572
|
+
return typeof e == "function" && "type" in e && // hasMatchFunction only wants Matchers but I don't see the point in rewriting it
|
|
1573
|
+
mo(e);
|
|
1574
|
+
}
|
|
1575
|
+
function vo(e) {
|
|
1576
|
+
const t = e ? `${e}`.split("/") : [], r = t[t.length - 1] || "actionCreator";
|
|
1577
|
+
return `Detected an action creator with type "${e || "unknown"}" being dispatched.
|
|
1578
|
+
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${r}())\` instead of \`dispatch(${r})\`. This is necessary even if the action has no payload.`;
|
|
1579
|
+
}
|
|
1580
|
+
function xo(e = {}) {
|
|
1581
|
+
if (process.env.NODE_ENV === "production")
|
|
1582
|
+
return () => (r) => (n) => r(n);
|
|
1583
|
+
const {
|
|
1584
|
+
isActionCreator: t = wo
|
|
1585
|
+
} = e;
|
|
1586
|
+
return () => (r) => (n) => (t(n) && console.warn(vo(n.type)), r(n));
|
|
1587
|
+
}
|
|
1588
|
+
function Hr(e, t) {
|
|
1589
|
+
let r = 0;
|
|
1590
|
+
return {
|
|
1591
|
+
measureTime(n) {
|
|
1592
|
+
const o = Date.now();
|
|
1593
|
+
try {
|
|
1594
|
+
return n();
|
|
1595
|
+
} finally {
|
|
1596
|
+
const s = Date.now();
|
|
1597
|
+
r += s - o;
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
warnIfExceeded() {
|
|
1601
|
+
r > e && console.warn(`${t} took ${r}ms, which is more than the warning threshold of ${e}ms.
|
|
1602
|
+
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
|
|
1603
|
+
It is disabled in production builds, so you don't need to worry about that.`);
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
var Gr = class Ie extends Array {
|
|
1608
|
+
constructor(...t) {
|
|
1609
|
+
super(...t), Object.setPrototypeOf(this, Ie.prototype);
|
|
1610
|
+
}
|
|
1611
|
+
static get [Symbol.species]() {
|
|
1612
|
+
return Ie;
|
|
1613
|
+
}
|
|
1614
|
+
concat(...t) {
|
|
1615
|
+
return super.concat.apply(this, t);
|
|
1616
|
+
}
|
|
1617
|
+
prepend(...t) {
|
|
1618
|
+
return t.length === 1 && Array.isArray(t[0]) ? new Ie(...t[0].concat(this)) : new Ie(...t.concat(this));
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
function kr(e) {
|
|
1622
|
+
return ce(e) ? $r(e, () => {
|
|
1623
|
+
}) : e;
|
|
1624
|
+
}
|
|
1625
|
+
function st(e, t, r) {
|
|
1626
|
+
return e.has(t) ? e.get(t) : e.set(t, r(t)).get(t);
|
|
1627
|
+
}
|
|
1628
|
+
function bo(e) {
|
|
1629
|
+
return typeof e != "object" || e == null || Object.isFrozen(e);
|
|
1630
|
+
}
|
|
1631
|
+
function Eo(e, t, r) {
|
|
1632
|
+
const n = qr(e, t, r);
|
|
1633
|
+
return {
|
|
1634
|
+
detectMutations() {
|
|
1635
|
+
return Kr(e, t, n, r);
|
|
1636
|
+
}
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
function qr(e, t = [], r, n = "", o = /* @__PURE__ */ new Set()) {
|
|
1640
|
+
const s = {
|
|
1641
|
+
value: r
|
|
1642
|
+
};
|
|
1643
|
+
if (!e(r) && !o.has(r)) {
|
|
1644
|
+
o.add(r), s.children = {};
|
|
1645
|
+
const l = t.length > 0;
|
|
1646
|
+
for (const a in r) {
|
|
1647
|
+
const y = n ? n + "." + a : a;
|
|
1648
|
+
l && t.some((w) => w instanceof RegExp ? w.test(y) : y === w) || (s.children[a] = qr(e, t, r[a], y));
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
return s;
|
|
1652
|
+
}
|
|
1653
|
+
function Kr(e, t = [], r, n, o = !1, s = "") {
|
|
1654
|
+
const l = r ? r.value : void 0, a = l === n;
|
|
1655
|
+
if (o && !a && !Number.isNaN(n))
|
|
1656
|
+
return {
|
|
1657
|
+
wasMutated: !0,
|
|
1658
|
+
path: s
|
|
1659
|
+
};
|
|
1660
|
+
if (e(l) || e(n))
|
|
1661
|
+
return {
|
|
1662
|
+
wasMutated: !1
|
|
1663
|
+
};
|
|
1664
|
+
const y = {};
|
|
1665
|
+
for (let w in r.children)
|
|
1666
|
+
y[w] = !0;
|
|
1667
|
+
for (let w in n)
|
|
1668
|
+
y[w] = !0;
|
|
1669
|
+
const h = t.length > 0;
|
|
1670
|
+
for (let w in y) {
|
|
1671
|
+
const d = s ? s + "." + w : w;
|
|
1672
|
+
if (h && t.some((M) => M instanceof RegExp ? M.test(d) : d === M))
|
|
1673
|
+
continue;
|
|
1674
|
+
const g = Kr(e, t, r.children[w], n[w], a, d);
|
|
1675
|
+
if (g.wasMutated)
|
|
1676
|
+
return g;
|
|
1677
|
+
}
|
|
1678
|
+
return {
|
|
1679
|
+
wasMutated: !1
|
|
1680
|
+
};
|
|
1681
|
+
}
|
|
1682
|
+
function _o(e = {}) {
|
|
1683
|
+
if (process.env.NODE_ENV === "production")
|
|
1684
|
+
return () => (t) => (r) => t(r);
|
|
1685
|
+
{
|
|
1686
|
+
let t = function(a, y, h, w) {
|
|
1687
|
+
return JSON.stringify(a, r(y, w), h);
|
|
1688
|
+
}, r = function(a, y) {
|
|
1689
|
+
let h = [], w = [];
|
|
1690
|
+
return y || (y = function(d, g) {
|
|
1691
|
+
return h[0] === g ? "[Circular ~]" : "[Circular ~." + w.slice(0, h.indexOf(g)).join(".") + "]";
|
|
1692
|
+
}), function(d, g) {
|
|
1693
|
+
if (h.length > 0) {
|
|
1694
|
+
var k = h.indexOf(this);
|
|
1695
|
+
~k ? h.splice(k + 1) : h.push(this), ~k ? w.splice(k, 1 / 0, d) : w.push(d), ~h.indexOf(g) && (g = y.call(this, d, g));
|
|
1696
|
+
} else h.push(g);
|
|
1697
|
+
return a == null ? g : a.call(this, d, g);
|
|
1698
|
+
};
|
|
1699
|
+
}, {
|
|
1700
|
+
isImmutable: n = bo,
|
|
1701
|
+
ignoredPaths: o,
|
|
1702
|
+
warnAfter: s = 32
|
|
1703
|
+
} = e;
|
|
1704
|
+
const l = Eo.bind(null, n, o);
|
|
1705
|
+
return ({
|
|
1706
|
+
getState: a
|
|
1707
|
+
}) => {
|
|
1708
|
+
let y = a(), h = l(y), w;
|
|
1709
|
+
return (d) => (g) => {
|
|
1710
|
+
const k = Hr(s, "ImmutableStateInvariantMiddleware");
|
|
1711
|
+
k.measureTime(() => {
|
|
1712
|
+
if (y = a(), w = h.detectMutations(), h = l(y), w.wasMutated)
|
|
1713
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(19) : `A state mutation was detected between dispatches, in the path '${w.path || ""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1714
|
+
});
|
|
1715
|
+
const M = d(g);
|
|
1716
|
+
return k.measureTime(() => {
|
|
1717
|
+
if (y = a(), w = h.detectMutations(), h = l(y), w.wasMutated)
|
|
1718
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(20) : `A state mutation was detected inside a dispatch, in the path: ${w.path || ""}. Take a look at the reducer(s) handling the action ${t(g)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
1719
|
+
}), k.warnIfExceeded(), M;
|
|
1720
|
+
};
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
function Zr(e) {
|
|
1725
|
+
const t = typeof e;
|
|
1726
|
+
return e == null || t === "string" || t === "boolean" || t === "number" || Array.isArray(e) || Ye(e);
|
|
1727
|
+
}
|
|
1728
|
+
function Ut(e, t = "", r = Zr, n, o = [], s) {
|
|
1729
|
+
let l;
|
|
1730
|
+
if (!r(e))
|
|
1731
|
+
return {
|
|
1732
|
+
keyPath: t || "<root>",
|
|
1733
|
+
value: e
|
|
1734
|
+
};
|
|
1735
|
+
if (typeof e != "object" || e === null || s != null && s.has(e)) return !1;
|
|
1736
|
+
const a = n != null ? n(e) : Object.entries(e), y = o.length > 0;
|
|
1737
|
+
for (const [h, w] of a) {
|
|
1738
|
+
const d = t ? t + "." + h : h;
|
|
1739
|
+
if (!(y && o.some((k) => k instanceof RegExp ? k.test(d) : d === k))) {
|
|
1740
|
+
if (!r(w))
|
|
1741
|
+
return {
|
|
1742
|
+
keyPath: d,
|
|
1743
|
+
value: w
|
|
1744
|
+
};
|
|
1745
|
+
if (typeof w == "object" && (l = Ut(w, d, r, n, o, s), l))
|
|
1746
|
+
return l;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
return s && Jr(e) && s.add(e), !1;
|
|
1750
|
+
}
|
|
1751
|
+
function Jr(e) {
|
|
1752
|
+
if (!Object.isFrozen(e)) return !1;
|
|
1753
|
+
for (const t of Object.values(e))
|
|
1754
|
+
if (!(typeof t != "object" || t === null) && !Jr(t))
|
|
1755
|
+
return !1;
|
|
1756
|
+
return !0;
|
|
1757
|
+
}
|
|
1758
|
+
function Co(e = {}) {
|
|
1759
|
+
if (process.env.NODE_ENV === "production")
|
|
1760
|
+
return () => (t) => (r) => t(r);
|
|
1761
|
+
{
|
|
1762
|
+
const {
|
|
1763
|
+
isSerializable: t = Zr,
|
|
1764
|
+
getEntries: r,
|
|
1765
|
+
ignoredActions: n = [],
|
|
1766
|
+
ignoredActionPaths: o = ["meta.arg", "meta.baseQueryMeta"],
|
|
1767
|
+
ignoredPaths: s = [],
|
|
1768
|
+
warnAfter: l = 32,
|
|
1769
|
+
ignoreState: a = !1,
|
|
1770
|
+
ignoreActions: y = !1,
|
|
1771
|
+
disableCache: h = !1
|
|
1772
|
+
} = e, w = !h && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
|
|
1773
|
+
return (d) => (g) => (k) => {
|
|
1774
|
+
if (!zr(k))
|
|
1775
|
+
return g(k);
|
|
1776
|
+
const M = g(k), j = Hr(l, "SerializableStateInvariantMiddleware");
|
|
1777
|
+
return !y && !(n.length && n.indexOf(k.type) !== -1) && j.measureTime(() => {
|
|
1778
|
+
const N = Ut(k, "", t, r, o, w);
|
|
1779
|
+
if (N) {
|
|
1780
|
+
const {
|
|
1781
|
+
keyPath: P,
|
|
1782
|
+
value: x
|
|
1783
|
+
} = N;
|
|
1784
|
+
console.error(`A non-serializable value was detected in an action, in the path: \`${P}\`. Value:`, x, `
|
|
1785
|
+
Take a look at the logic that dispatched this action: `, k, `
|
|
1786
|
+
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`, `
|
|
1787
|
+
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`);
|
|
1788
|
+
}
|
|
1789
|
+
}), a || (j.measureTime(() => {
|
|
1790
|
+
const N = d.getState(), P = Ut(N, "", t, r, s, w);
|
|
1791
|
+
if (P) {
|
|
1792
|
+
const {
|
|
1793
|
+
keyPath: x,
|
|
1794
|
+
value: z
|
|
1795
|
+
} = P;
|
|
1796
|
+
console.error(`A non-serializable value was detected in the state, in the path: \`${x}\`. Value:`, z, `
|
|
1797
|
+
Take a look at the reducer(s) handling this action type: ${k.type}.
|
|
1798
|
+
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
|
|
1799
|
+
}
|
|
1800
|
+
}), j.warnIfExceeded()), M;
|
|
1801
|
+
};
|
|
1802
|
+
}
|
|
1803
|
+
}
|
|
1804
|
+
function at(e) {
|
|
1805
|
+
return typeof e == "boolean";
|
|
1806
|
+
}
|
|
1807
|
+
var ko = () => function(t) {
|
|
1808
|
+
const {
|
|
1809
|
+
thunk: r = !0,
|
|
1810
|
+
immutableCheck: n = !0,
|
|
1811
|
+
serializableCheck: o = !0,
|
|
1812
|
+
actionCreatorCheck: s = !0
|
|
1813
|
+
} = t ?? {};
|
|
1814
|
+
let l = new Gr();
|
|
1815
|
+
if (r && (at(r) ? l.push(po) : l.push(yo(r.extraArgument))), process.env.NODE_ENV !== "production") {
|
|
1816
|
+
if (n) {
|
|
1817
|
+
let a = {};
|
|
1818
|
+
at(n) || (a = n), l.unshift(_o(a));
|
|
1819
|
+
}
|
|
1820
|
+
if (o) {
|
|
1821
|
+
let a = {};
|
|
1822
|
+
at(o) || (a = o), l.push(Co(a));
|
|
1823
|
+
}
|
|
1824
|
+
if (s) {
|
|
1825
|
+
let a = {};
|
|
1826
|
+
at(s) || (a = s), l.unshift(xo(a));
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
return l;
|
|
1830
|
+
}, So = "RTK_autoBatch", Sr = (e) => (t) => {
|
|
1831
|
+
setTimeout(t, e);
|
|
1832
|
+
}, No = (e = {
|
|
1833
|
+
type: "raf"
|
|
1834
|
+
}) => (t) => (...r) => {
|
|
1835
|
+
const n = t(...r);
|
|
1836
|
+
let o = !0, s = !1, l = !1;
|
|
1837
|
+
const a = /* @__PURE__ */ new Set(), y = e.type === "tick" ? queueMicrotask : e.type === "raf" ? (
|
|
1838
|
+
// requestAnimationFrame won't exist in SSR environments. Fall back to a vague approximation just to keep from erroring.
|
|
1839
|
+
typeof window < "u" && window.requestAnimationFrame ? window.requestAnimationFrame : Sr(10)
|
|
1840
|
+
) : e.type === "callback" ? e.queueNotification : Sr(e.timeout), h = () => {
|
|
1841
|
+
l = !1, s && (s = !1, a.forEach((w) => w()));
|
|
1842
|
+
};
|
|
1843
|
+
return Object.assign({}, n, {
|
|
1844
|
+
// Override the base `store.subscribe` method to keep original listeners
|
|
1845
|
+
// from running if we're delaying notifications
|
|
1846
|
+
subscribe(w) {
|
|
1847
|
+
const d = () => o && w(), g = n.subscribe(d);
|
|
1848
|
+
return a.add(w), () => {
|
|
1849
|
+
g(), a.delete(w);
|
|
1850
|
+
};
|
|
1851
|
+
},
|
|
1852
|
+
// Override the base `store.dispatch` method so that we can check actions
|
|
1853
|
+
// for the `shouldAutoBatch` flag and determine if batching is active
|
|
1854
|
+
dispatch(w) {
|
|
1855
|
+
var d;
|
|
1856
|
+
try {
|
|
1857
|
+
return o = !((d = w == null ? void 0 : w.meta) != null && d[So]), s = !o, s && (l || (l = !0, y(h))), n.dispatch(w);
|
|
1858
|
+
} finally {
|
|
1859
|
+
o = !0;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
});
|
|
1863
|
+
}, Mo = (e) => function(r) {
|
|
1864
|
+
const {
|
|
1865
|
+
autoBatch: n = !0
|
|
1866
|
+
} = r ?? {};
|
|
1867
|
+
let o = new Gr(e);
|
|
1868
|
+
return n && o.push(No(typeof n == "object" ? n : void 0)), o;
|
|
1869
|
+
};
|
|
1870
|
+
function jo(e) {
|
|
1871
|
+
const t = ko(), {
|
|
1872
|
+
reducer: r = void 0,
|
|
1873
|
+
middleware: n,
|
|
1874
|
+
devTools: o = !0,
|
|
1875
|
+
duplicateMiddlewareCheck: s = !0,
|
|
1876
|
+
preloadedState: l = void 0,
|
|
1877
|
+
enhancers: a = void 0
|
|
1878
|
+
} = e || {};
|
|
1879
|
+
let y;
|
|
1880
|
+
if (typeof r == "function")
|
|
1881
|
+
y = r;
|
|
1882
|
+
else if (Ye(r))
|
|
1883
|
+
y = qn(r);
|
|
1884
|
+
else
|
|
1885
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
1886
|
+
if (process.env.NODE_ENV !== "production" && n && typeof n != "function")
|
|
1887
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(2) : "`middleware` field must be a callback");
|
|
1888
|
+
let h;
|
|
1889
|
+
if (typeof n == "function") {
|
|
1890
|
+
if (h = n(t), process.env.NODE_ENV !== "production" && !Array.isArray(h))
|
|
1891
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
1892
|
+
} else
|
|
1893
|
+
h = t();
|
|
1894
|
+
if (process.env.NODE_ENV !== "production" && h.some((j) => typeof j != "function"))
|
|
1895
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(4) : "each middleware provided to configureStore must be a function");
|
|
1896
|
+
if (process.env.NODE_ENV !== "production" && s) {
|
|
1897
|
+
let j = /* @__PURE__ */ new Set();
|
|
1898
|
+
h.forEach((N) => {
|
|
1899
|
+
if (j.has(N))
|
|
1900
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
|
|
1901
|
+
j.add(N);
|
|
1902
|
+
});
|
|
1903
|
+
}
|
|
1904
|
+
let w = ft;
|
|
1905
|
+
o && (w = go({
|
|
1906
|
+
// Enable capture of stack traces for dispatched Redux actions
|
|
1907
|
+
trace: process.env.NODE_ENV !== "production",
|
|
1908
|
+
...typeof o == "object" && o
|
|
1909
|
+
}));
|
|
1910
|
+
const d = Kn(...h), g = Mo(d);
|
|
1911
|
+
if (process.env.NODE_ENV !== "production" && a && typeof a != "function")
|
|
1912
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(5) : "`enhancers` field must be a callback");
|
|
1913
|
+
let k = typeof a == "function" ? a(g) : g();
|
|
1914
|
+
if (process.env.NODE_ENV !== "production" && !Array.isArray(k))
|
|
1915
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(6) : "`enhancers` callback must return an array");
|
|
1916
|
+
if (process.env.NODE_ENV !== "production" && k.some((j) => typeof j != "function"))
|
|
1917
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(7) : "each enhancer provided to configureStore must be a function");
|
|
1918
|
+
process.env.NODE_ENV !== "production" && h.length && !k.includes(d) && console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
1919
|
+
const M = w(...k);
|
|
1920
|
+
return Rr(y, l, M);
|
|
1921
|
+
}
|
|
1922
|
+
function Qr(e) {
|
|
1923
|
+
const t = {}, r = [];
|
|
1924
|
+
let n;
|
|
1925
|
+
const o = {
|
|
1926
|
+
addCase(s, l) {
|
|
1927
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1928
|
+
if (r.length > 0)
|
|
1929
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1930
|
+
if (n)
|
|
1931
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1932
|
+
}
|
|
1933
|
+
const a = typeof s == "string" ? s : s.type;
|
|
1934
|
+
if (!a)
|
|
1935
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1936
|
+
if (a in t)
|
|
1937
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${a}'`);
|
|
1938
|
+
return t[a] = l, o;
|
|
1939
|
+
},
|
|
1940
|
+
addAsyncThunk(s, l) {
|
|
1941
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
1942
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
1943
|
+
return l.pending && (t[s.pending.type] = l.pending), l.rejected && (t[s.rejected.type] = l.rejected), l.fulfilled && (t[s.fulfilled.type] = l.fulfilled), l.settled && r.push({
|
|
1944
|
+
matcher: s.settled,
|
|
1945
|
+
reducer: l.settled
|
|
1946
|
+
}), o;
|
|
1947
|
+
},
|
|
1948
|
+
addMatcher(s, l) {
|
|
1949
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
1950
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1951
|
+
return r.push({
|
|
1952
|
+
matcher: s,
|
|
1953
|
+
reducer: l
|
|
1954
|
+
}), o;
|
|
1955
|
+
},
|
|
1956
|
+
addDefaultCase(s) {
|
|
1957
|
+
if (process.env.NODE_ENV !== "production" && n)
|
|
1958
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(31) : "`builder.addDefaultCase` can only be called once");
|
|
1959
|
+
return n = s, o;
|
|
1960
|
+
}
|
|
1961
|
+
};
|
|
1962
|
+
return e(o), [t, r, n];
|
|
1963
|
+
}
|
|
1964
|
+
function Oo(e) {
|
|
1965
|
+
return typeof e == "function";
|
|
1966
|
+
}
|
|
1967
|
+
function To(e, t) {
|
|
1968
|
+
if (process.env.NODE_ENV !== "production" && typeof t == "object")
|
|
1969
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1970
|
+
let [r, n, o] = Qr(t), s;
|
|
1971
|
+
if (Oo(e))
|
|
1972
|
+
s = () => kr(e());
|
|
1973
|
+
else {
|
|
1974
|
+
const a = kr(e);
|
|
1975
|
+
s = () => a;
|
|
1976
|
+
}
|
|
1977
|
+
function l(a = s(), y) {
|
|
1978
|
+
let h = [r[y.type], ...n.filter(({
|
|
1979
|
+
matcher: w
|
|
1980
|
+
}) => w(y)).map(({
|
|
1981
|
+
reducer: w
|
|
1982
|
+
}) => w)];
|
|
1983
|
+
return h.filter((w) => !!w).length === 0 && (h = [o]), h.reduce((w, d) => {
|
|
1984
|
+
if (d)
|
|
1985
|
+
if (ge(w)) {
|
|
1986
|
+
const k = d(w, y);
|
|
1987
|
+
return k === void 0 ? w : k;
|
|
1988
|
+
} else {
|
|
1989
|
+
if (ce(w))
|
|
1990
|
+
return $r(w, (g) => d(g, y));
|
|
1991
|
+
{
|
|
1992
|
+
const g = d(w, y);
|
|
1993
|
+
if (g === void 0) {
|
|
1994
|
+
if (w === null)
|
|
1995
|
+
return w;
|
|
1996
|
+
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
1997
|
+
}
|
|
1998
|
+
return g;
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
return w;
|
|
2002
|
+
}, a);
|
|
2003
|
+
}
|
|
2004
|
+
return l.getInitialState = s, l;
|
|
2005
|
+
}
|
|
2006
|
+
var Po = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
2007
|
+
function Do(e, t) {
|
|
2008
|
+
return `${e}/${t}`;
|
|
2009
|
+
}
|
|
2010
|
+
function Ro({
|
|
2011
|
+
creators: e
|
|
2012
|
+
} = {}) {
|
|
2013
|
+
var r;
|
|
2014
|
+
const t = (r = e == null ? void 0 : e.asyncThunk) == null ? void 0 : r[Po];
|
|
2015
|
+
return function(o) {
|
|
2016
|
+
const {
|
|
2017
|
+
name: s,
|
|
2018
|
+
reducerPath: l = s
|
|
2019
|
+
} = o;
|
|
2020
|
+
if (!s)
|
|
2021
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(11) : "`name` is a required option for createSlice");
|
|
2022
|
+
typeof process < "u" && process.env.NODE_ENV === "development" && o.initialState === void 0 && console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
2023
|
+
const a = (typeof o.reducers == "function" ? o.reducers(Ao()) : o.reducers) || {}, y = Object.keys(a), h = {
|
|
2024
|
+
sliceCaseReducersByName: {},
|
|
2025
|
+
sliceCaseReducersByType: {},
|
|
2026
|
+
actionCreators: {},
|
|
2027
|
+
sliceMatchers: []
|
|
2028
|
+
}, w = {
|
|
2029
|
+
addCase(m, v) {
|
|
2030
|
+
const O = typeof m == "string" ? m : m.type;
|
|
2031
|
+
if (!O)
|
|
2032
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(12) : "`context.addCase` cannot be called with an empty action type");
|
|
2033
|
+
if (O in h.sliceCaseReducersByType)
|
|
2034
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + O);
|
|
2035
|
+
return h.sliceCaseReducersByType[O] = v, w;
|
|
2036
|
+
},
|
|
2037
|
+
addMatcher(m, v) {
|
|
2038
|
+
return h.sliceMatchers.push({
|
|
2039
|
+
matcher: m,
|
|
2040
|
+
reducer: v
|
|
2041
|
+
}), w;
|
|
2042
|
+
},
|
|
2043
|
+
exposeAction(m, v) {
|
|
2044
|
+
return h.actionCreators[m] = v, w;
|
|
2045
|
+
},
|
|
2046
|
+
exposeCaseReducer(m, v) {
|
|
2047
|
+
return h.sliceCaseReducersByName[m] = v, w;
|
|
2048
|
+
}
|
|
2049
|
+
};
|
|
2050
|
+
y.forEach((m) => {
|
|
2051
|
+
const v = a[m], O = {
|
|
2052
|
+
reducerName: m,
|
|
2053
|
+
type: Do(s, m),
|
|
2054
|
+
createNotation: typeof o.reducers == "function"
|
|
2055
|
+
};
|
|
2056
|
+
Vo(v) ? Yo(O, v, w, t) : Wo(O, v, w);
|
|
2057
|
+
});
|
|
2058
|
+
function d() {
|
|
2059
|
+
if (process.env.NODE_ENV !== "production" && typeof o.extraReducers == "object")
|
|
2060
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
2061
|
+
const [m = {}, v = [], O = void 0] = typeof o.extraReducers == "function" ? Qr(o.extraReducers) : [o.extraReducers], F = {
|
|
2062
|
+
...m,
|
|
2063
|
+
...h.sliceCaseReducersByType
|
|
2064
|
+
};
|
|
2065
|
+
return To(o.initialState, (U) => {
|
|
2066
|
+
for (let L in F)
|
|
2067
|
+
U.addCase(L, F[L]);
|
|
2068
|
+
for (let L of h.sliceMatchers)
|
|
2069
|
+
U.addMatcher(L.matcher, L.reducer);
|
|
2070
|
+
for (let L of v)
|
|
2071
|
+
U.addMatcher(L.matcher, L.reducer);
|
|
2072
|
+
O && U.addDefaultCase(O);
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
const g = (m) => m, k = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new WeakMap();
|
|
2076
|
+
let j;
|
|
2077
|
+
function N(m, v) {
|
|
2078
|
+
return j || (j = d()), j(m, v);
|
|
2079
|
+
}
|
|
2080
|
+
function P() {
|
|
2081
|
+
return j || (j = d()), j.getInitialState();
|
|
2082
|
+
}
|
|
2083
|
+
function x(m, v = !1) {
|
|
2084
|
+
function O(U) {
|
|
2085
|
+
let L = U[m];
|
|
2086
|
+
if (typeof L > "u") {
|
|
2087
|
+
if (v)
|
|
2088
|
+
L = st(M, O, P);
|
|
2089
|
+
else if (process.env.NODE_ENV !== "production")
|
|
2090
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
2091
|
+
}
|
|
2092
|
+
return L;
|
|
2093
|
+
}
|
|
2094
|
+
function F(U = g) {
|
|
2095
|
+
const L = st(k, v, () => /* @__PURE__ */ new WeakMap());
|
|
2096
|
+
return st(L, U, () => {
|
|
2097
|
+
const X = {};
|
|
2098
|
+
for (const [oe, de] of Object.entries(o.selectors ?? {}))
|
|
2099
|
+
X[oe] = zo(de, U, () => st(M, U, P), v);
|
|
2100
|
+
return X;
|
|
2101
|
+
});
|
|
2102
|
+
}
|
|
2103
|
+
return {
|
|
2104
|
+
reducerPath: m,
|
|
2105
|
+
getSelectors: F,
|
|
2106
|
+
get selectors() {
|
|
2107
|
+
return F(O);
|
|
2108
|
+
},
|
|
2109
|
+
selectSlice: O
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
const z = {
|
|
2113
|
+
name: s,
|
|
2114
|
+
reducer: N,
|
|
2115
|
+
actions: h.actionCreators,
|
|
2116
|
+
caseReducers: h.sliceCaseReducersByName,
|
|
2117
|
+
getInitialState: P,
|
|
2118
|
+
...x(l),
|
|
2119
|
+
injectInto(m, {
|
|
2120
|
+
reducerPath: v,
|
|
2121
|
+
...O
|
|
2122
|
+
} = {}) {
|
|
2123
|
+
const F = v ?? l;
|
|
2124
|
+
return m.inject({
|
|
2125
|
+
reducerPath: F,
|
|
2126
|
+
reducer: N
|
|
2127
|
+
}, O), {
|
|
2128
|
+
...z,
|
|
2129
|
+
...x(F, !0)
|
|
2130
|
+
};
|
|
2131
|
+
}
|
|
2132
|
+
};
|
|
2133
|
+
return z;
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
function zo(e, t, r, n) {
|
|
2137
|
+
function o(s, ...l) {
|
|
2138
|
+
let a = t(s);
|
|
2139
|
+
if (typeof a > "u") {
|
|
2140
|
+
if (n)
|
|
2141
|
+
a = r();
|
|
2142
|
+
else if (process.env.NODE_ENV !== "production")
|
|
2143
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
2144
|
+
}
|
|
2145
|
+
return e(a, ...l);
|
|
2146
|
+
}
|
|
2147
|
+
return o.unwrapped = e, o;
|
|
2148
|
+
}
|
|
2149
|
+
var Io = /* @__PURE__ */ Ro();
|
|
2150
|
+
function Ao() {
|
|
2151
|
+
function e(t, r) {
|
|
2152
|
+
return {
|
|
2153
|
+
_reducerDefinitionType: "asyncThunk",
|
|
2154
|
+
payloadCreator: t,
|
|
2155
|
+
...r
|
|
2156
|
+
};
|
|
2157
|
+
}
|
|
2158
|
+
return e.withTypes = () => e, {
|
|
2159
|
+
reducer(t) {
|
|
2160
|
+
return Object.assign({
|
|
2161
|
+
// hack so the wrapping function has the same name as the original
|
|
2162
|
+
// we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
|
|
2163
|
+
[t.name](...r) {
|
|
2164
|
+
return t(...r);
|
|
2165
|
+
}
|
|
2166
|
+
}[t.name], {
|
|
2167
|
+
_reducerDefinitionType: "reducer"
|
|
2168
|
+
/* reducer */
|
|
2169
|
+
});
|
|
2170
|
+
},
|
|
2171
|
+
preparedReducer(t, r) {
|
|
2172
|
+
return {
|
|
2173
|
+
_reducerDefinitionType: "reducerWithPrepare",
|
|
2174
|
+
prepare: t,
|
|
2175
|
+
reducer: r
|
|
2176
|
+
};
|
|
2177
|
+
},
|
|
2178
|
+
asyncThunk: e
|
|
2179
|
+
};
|
|
2180
|
+
}
|
|
2181
|
+
function Wo({
|
|
2182
|
+
type: e,
|
|
2183
|
+
reducerName: t,
|
|
2184
|
+
createNotation: r
|
|
2185
|
+
}, n, o) {
|
|
2186
|
+
let s, l;
|
|
2187
|
+
if ("reducer" in n) {
|
|
2188
|
+
if (r && !Lo(n))
|
|
2189
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
2190
|
+
s = n.reducer, l = n.prepare;
|
|
2191
|
+
} else
|
|
2192
|
+
s = n;
|
|
2193
|
+
o.addCase(e, s).exposeCaseReducer(t, s).exposeAction(t, l ? Cr(e, l) : Cr(e));
|
|
2194
|
+
}
|
|
2195
|
+
function Vo(e) {
|
|
2196
|
+
return e._reducerDefinitionType === "asyncThunk";
|
|
2197
|
+
}
|
|
2198
|
+
function Lo(e) {
|
|
2199
|
+
return e._reducerDefinitionType === "reducerWithPrepare";
|
|
2200
|
+
}
|
|
2201
|
+
function Yo({
|
|
2202
|
+
type: e,
|
|
2203
|
+
reducerName: t
|
|
2204
|
+
}, r, n, o) {
|
|
2205
|
+
if (!o)
|
|
2206
|
+
throw new Error(process.env.NODE_ENV === "production" ? W(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
2207
|
+
const {
|
|
2208
|
+
payloadCreator: s,
|
|
2209
|
+
fulfilled: l,
|
|
2210
|
+
pending: a,
|
|
2211
|
+
rejected: y,
|
|
2212
|
+
settled: h,
|
|
2213
|
+
options: w
|
|
2214
|
+
} = r, d = o(e, s, w);
|
|
2215
|
+
n.exposeAction(t, d), l && n.addCase(d.fulfilled, l), a && n.addCase(d.pending, a), y && n.addCase(d.rejected, y), h && n.addMatcher(d.settled, h), n.exposeCaseReducer(t, {
|
|
2216
|
+
fulfilled: l || ct,
|
|
2217
|
+
pending: a || ct,
|
|
2218
|
+
rejected: y || ct,
|
|
2219
|
+
settled: h || ct
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
function ct() {
|
|
2223
|
+
}
|
|
2224
|
+
function W(e) {
|
|
2225
|
+
return `Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `;
|
|
2226
|
+
}
|
|
2227
|
+
const Fo = {
|
|
2228
|
+
grid: {
|
|
2229
|
+
size: 20,
|
|
2230
|
+
color: "#ccc",
|
|
2231
|
+
enabled: !0
|
|
2232
|
+
},
|
|
2233
|
+
toolbar: {
|
|
2234
|
+
selectedTool: "pointer"
|
|
2235
|
+
// possible values: 'pointer', 'pencil', 'rectangle', 'circle', 'text'
|
|
2236
|
+
},
|
|
2237
|
+
toolProperties: {
|
|
2238
|
+
pencil: {
|
|
2239
|
+
strokeColor: "#000000",
|
|
2240
|
+
lineWidth: 4
|
|
2241
|
+
},
|
|
2242
|
+
rectangle: {
|
|
2243
|
+
strokeColor: "#000000",
|
|
2244
|
+
fillColor: "#ffffff",
|
|
2245
|
+
lineWidth: 2
|
|
2246
|
+
},
|
|
2247
|
+
circle: {
|
|
2248
|
+
strokeColor: "#000000",
|
|
2249
|
+
fillColor: "#ffffff",
|
|
2250
|
+
lineWidth: 2
|
|
2251
|
+
},
|
|
2252
|
+
triangle: {
|
|
2253
|
+
strokeColor: "#000000",
|
|
2254
|
+
fillColor: "#ffffff",
|
|
2255
|
+
lineWidth: 2
|
|
2256
|
+
},
|
|
2257
|
+
diamond: {
|
|
2258
|
+
strokeColor: "#000000",
|
|
2259
|
+
fillColor: "#ffffff",
|
|
2260
|
+
lineWidth: 2
|
|
2261
|
+
},
|
|
2262
|
+
star: {
|
|
2263
|
+
strokeColor: "#000000",
|
|
2264
|
+
fillColor: "#ffff00",
|
|
2265
|
+
lineWidth: 2
|
|
2266
|
+
},
|
|
2267
|
+
heart: {
|
|
2268
|
+
strokeColor: "#000000",
|
|
2269
|
+
fillColor: "#ff6b6b",
|
|
2270
|
+
lineWidth: 2
|
|
2271
|
+
},
|
|
2272
|
+
hexagon: {
|
|
2273
|
+
strokeColor: "#000000",
|
|
2274
|
+
fillColor: "#ffffff",
|
|
2275
|
+
lineWidth: 2
|
|
2276
|
+
},
|
|
2277
|
+
octagon: {
|
|
2278
|
+
strokeColor: "#000000",
|
|
2279
|
+
fillColor: "#ffffff",
|
|
2280
|
+
lineWidth: 2
|
|
2281
|
+
},
|
|
2282
|
+
arrow: {
|
|
2283
|
+
strokeColor: "#000000",
|
|
2284
|
+
fillColor: "#000000",
|
|
2285
|
+
lineWidth: 2
|
|
2286
|
+
},
|
|
2287
|
+
text: {
|
|
2288
|
+
fontSize: 16,
|
|
2289
|
+
fontColor: "#000000"
|
|
2290
|
+
}
|
|
2291
|
+
},
|
|
2292
|
+
elements: [],
|
|
2293
|
+
// to store drawn elements
|
|
2294
|
+
selectedElementId: null,
|
|
2295
|
+
// currently selected element
|
|
2296
|
+
viewport: {
|
|
2297
|
+
panX: 0,
|
|
2298
|
+
panY: 0,
|
|
2299
|
+
zoom: 1
|
|
2300
|
+
},
|
|
2301
|
+
watermark: {
|
|
2302
|
+
text: "Nines Studios",
|
|
2303
|
+
url: "https://github.com/huzeyfecoskun",
|
|
2304
|
+
visible: !0
|
|
2305
|
+
},
|
|
2306
|
+
lock: {
|
|
2307
|
+
isLocked: !0,
|
|
2308
|
+
text: "Whiteboard drawing is only for moderator"
|
|
2309
|
+
}
|
|
2310
|
+
}, en = Io({
|
|
2311
|
+
name: "whiteboard",
|
|
2312
|
+
initialState: Fo,
|
|
2313
|
+
reducers: {
|
|
2314
|
+
toggleGrid(e) {
|
|
2315
|
+
e.grid.enabled = !e.grid.enabled;
|
|
2316
|
+
},
|
|
2317
|
+
setGridSize(e, t) {
|
|
2318
|
+
e.grid.size = t.payload;
|
|
2319
|
+
},
|
|
2320
|
+
setGridColor(e, t) {
|
|
2321
|
+
e.grid.color = t.payload;
|
|
2322
|
+
},
|
|
2323
|
+
setSelectedTool(e, t) {
|
|
2324
|
+
e.toolbar.selectedTool = t.payload;
|
|
2325
|
+
},
|
|
2326
|
+
setToolProperty(e, t) {
|
|
2327
|
+
const { tool: r, property: n, value: o } = t.payload;
|
|
2328
|
+
e.toolProperties[r] && (e.toolProperties[r][n] = o);
|
|
2329
|
+
},
|
|
2330
|
+
addElement(e, t) {
|
|
2331
|
+
e.elements.push(t.payload);
|
|
2332
|
+
},
|
|
2333
|
+
updateElement(e, t) {
|
|
2334
|
+
const { id: r, updates: n } = t.payload, o = e.elements.findIndex((s) => s.id === r);
|
|
2335
|
+
o !== -1 && (e.elements[o] = { ...e.elements[o], ...n });
|
|
2336
|
+
},
|
|
2337
|
+
removeElement(e, t) {
|
|
2338
|
+
const r = t.payload;
|
|
2339
|
+
e.elements = e.elements.filter((n) => n.id !== r), e.selectedElementId === r && (e.selectedElementId = null);
|
|
2340
|
+
},
|
|
2341
|
+
setSelectedElement(e, t) {
|
|
2342
|
+
e.selectedElementId = t.payload;
|
|
2343
|
+
},
|
|
2344
|
+
clearElements(e) {
|
|
2345
|
+
e.elements = [];
|
|
2346
|
+
},
|
|
2347
|
+
setPan(e, t) {
|
|
2348
|
+
e.viewport.panX = t.payload.x, e.viewport.panY = t.payload.y;
|
|
2349
|
+
},
|
|
2350
|
+
setZoom(e, t) {
|
|
2351
|
+
e.viewport.zoom = Math.max(0.1, Math.min(5, t.payload));
|
|
2352
|
+
},
|
|
2353
|
+
resetViewport(e) {
|
|
2354
|
+
e.viewport.panX = 0, e.viewport.panY = 0, e.viewport.zoom = 1;
|
|
2355
|
+
},
|
|
2356
|
+
bringToFront(e, t) {
|
|
2357
|
+
const r = t.payload, n = e.elements.findIndex((o) => o.id === r);
|
|
2358
|
+
if (n !== -1 && n < e.elements.length - 1) {
|
|
2359
|
+
const [o] = e.elements.splice(n, 1);
|
|
2360
|
+
e.elements.push(o);
|
|
2361
|
+
}
|
|
2362
|
+
},
|
|
2363
|
+
sendToBack(e, t) {
|
|
2364
|
+
const r = t.payload, n = e.elements.findIndex((o) => o.id === r);
|
|
2365
|
+
if (n > 0) {
|
|
2366
|
+
const [o] = e.elements.splice(n, 1);
|
|
2367
|
+
e.elements.unshift(o);
|
|
2368
|
+
}
|
|
2369
|
+
},
|
|
2370
|
+
fitToView(e, t) {
|
|
2371
|
+
const { canvasWidth: r, canvasHeight: n, padding: o = 50 } = t.payload, s = e.elements;
|
|
2372
|
+
if (s.length === 0) {
|
|
2373
|
+
e.viewport.panX = 0, e.viewport.panY = 0, e.viewport.zoom = 1;
|
|
2374
|
+
return;
|
|
2375
|
+
}
|
|
2376
|
+
let l = 1 / 0, a = 1 / 0, y = -1 / 0, h = -1 / 0;
|
|
2377
|
+
s.forEach((v) => {
|
|
2378
|
+
v.type === "rectangle" ? (l = Math.min(l, v.x), a = Math.min(a, v.y), y = Math.max(y, v.x + v.width), h = Math.max(h, v.y + v.height)) : v.type === "circle" ? (l = Math.min(l, v.centerX - v.radius), a = Math.min(a, v.centerY - v.radius), y = Math.max(y, v.centerX + v.radius), h = Math.max(h, v.centerY + v.radius)) : v.type === "pencil" && v.points.length > 0 ? v.points.forEach((O) => {
|
|
2379
|
+
l = Math.min(l, O.x), a = Math.min(a, O.y), y = Math.max(y, O.x), h = Math.max(h, O.y);
|
|
2380
|
+
}) : v.type === "triangle" || v.type === "diamond" || v.type === "hexagon" || v.type === "octagon" ? (l = Math.min(l, v.x), a = Math.min(a, v.y), y = Math.max(y, v.x + v.width), h = Math.max(h, v.y + v.height)) : v.type === "star" || v.type === "heart" ? (l = Math.min(l, v.centerX - v.size), a = Math.min(a, v.centerY - v.size), y = Math.max(y, v.centerX + v.size), h = Math.max(h, v.centerY + v.size)) : v.type === "arrow" && (l = Math.min(l, v.startX, v.endX), a = Math.min(a, v.startY, v.endY), y = Math.max(y, v.startX, v.endX), h = Math.max(h, v.startY, v.endY));
|
|
2381
|
+
});
|
|
2382
|
+
const w = y - l, d = h - a;
|
|
2383
|
+
if (w <= 0 || d <= 0)
|
|
2384
|
+
return;
|
|
2385
|
+
const g = r - o * 2, k = n - o * 2, M = g / w, j = k / d, N = Math.min(M, j, 5), P = (l + y) / 2, x = (a + h) / 2, z = r / 2 - P * N, m = n / 2 - x * N;
|
|
2386
|
+
e.viewport.zoom = Math.max(0.1, N), e.viewport.panX = z, e.viewport.panY = m;
|
|
2387
|
+
},
|
|
2388
|
+
setLocked(e, t) {
|
|
2389
|
+
e.lock.isLocked = t.payload, t.payload && (e.toolbar.selectedTool = "pointer", e.selectedElementId = null);
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
}), {
|
|
2393
|
+
toggleGrid: Ri,
|
|
2394
|
+
setGridSize: zi,
|
|
2395
|
+
setGridColor: Ii,
|
|
2396
|
+
setSelectedTool: pe,
|
|
2397
|
+
setToolProperty: Xo,
|
|
2398
|
+
addElement: ie,
|
|
2399
|
+
updateElement: dt,
|
|
2400
|
+
removeElement: Bo,
|
|
2401
|
+
setSelectedElement: Ae,
|
|
2402
|
+
clearElements: Ai,
|
|
2403
|
+
setPan: $o,
|
|
2404
|
+
setZoom: Uo,
|
|
2405
|
+
resetViewport: Wi,
|
|
2406
|
+
fitToView: Ho,
|
|
2407
|
+
bringToFront: Go,
|
|
2408
|
+
sendToBack: qo,
|
|
2409
|
+
setLocked: tn
|
|
2410
|
+
} = en.actions, Ko = en.reducer;
|
|
2411
|
+
let Ht = null;
|
|
2412
|
+
const Zo = (e) => {
|
|
2413
|
+
Ht = e;
|
|
2414
|
+
}, Jo = (e) => (t) => (r) => {
|
|
2415
|
+
var o;
|
|
2416
|
+
const n = t(r);
|
|
2417
|
+
return !((o = r.meta) != null && o.fromRemote) && Ht && Ht(r), n;
|
|
2418
|
+
}, Qo = jo({
|
|
2419
|
+
reducer: {
|
|
2420
|
+
whiteboard: Ko
|
|
2421
|
+
},
|
|
2422
|
+
middleware: (e) => e().concat(Jo)
|
|
2423
|
+
}), ei = () => {
|
|
2424
|
+
const e = Q((t) => t.whiteboard.watermark);
|
|
2425
|
+
return /* @__PURE__ */ u.jsx("a", { href: e.url, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ u.jsx("div", { className: "watermark", children: e.text }) });
|
|
2426
|
+
};
|
|
2427
|
+
var rn = {
|
|
2428
|
+
color: void 0,
|
|
2429
|
+
size: void 0,
|
|
2430
|
+
className: void 0,
|
|
2431
|
+
style: void 0,
|
|
2432
|
+
attr: void 0
|
|
2433
|
+
}, Nr = ue.createContext && /* @__PURE__ */ ue.createContext(rn), ti = ["attr", "size", "title"];
|
|
2434
|
+
function ri(e, t) {
|
|
2435
|
+
if (e == null) return {};
|
|
2436
|
+
var r = ni(e, t), n, o;
|
|
2437
|
+
if (Object.getOwnPropertySymbols) {
|
|
2438
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
2439
|
+
for (o = 0; o < s.length; o++)
|
|
2440
|
+
n = s[o], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
|
|
2441
|
+
}
|
|
2442
|
+
return r;
|
|
2443
|
+
}
|
|
2444
|
+
function ni(e, t) {
|
|
2445
|
+
if (e == null) return {};
|
|
2446
|
+
var r = {};
|
|
2447
|
+
for (var n in e)
|
|
2448
|
+
if (Object.prototype.hasOwnProperty.call(e, n)) {
|
|
2449
|
+
if (t.indexOf(n) >= 0) continue;
|
|
2450
|
+
r[n] = e[n];
|
|
2451
|
+
}
|
|
2452
|
+
return r;
|
|
2453
|
+
}
|
|
2454
|
+
function vt() {
|
|
2455
|
+
return vt = Object.assign ? Object.assign.bind() : function(e) {
|
|
2456
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2457
|
+
var r = arguments[t];
|
|
2458
|
+
for (var n in r)
|
|
2459
|
+
Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
|
|
2460
|
+
}
|
|
2461
|
+
return e;
|
|
2462
|
+
}, vt.apply(this, arguments);
|
|
2463
|
+
}
|
|
2464
|
+
function Mr(e, t) {
|
|
2465
|
+
var r = Object.keys(e);
|
|
2466
|
+
if (Object.getOwnPropertySymbols) {
|
|
2467
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
2468
|
+
t && (n = n.filter(function(o) {
|
|
2469
|
+
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
2470
|
+
})), r.push.apply(r, n);
|
|
2471
|
+
}
|
|
2472
|
+
return r;
|
|
2473
|
+
}
|
|
2474
|
+
function xt(e) {
|
|
2475
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2476
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
2477
|
+
t % 2 ? Mr(Object(r), !0).forEach(function(n) {
|
|
2478
|
+
oi(e, n, r[n]);
|
|
2479
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Mr(Object(r)).forEach(function(n) {
|
|
2480
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
return e;
|
|
2484
|
+
}
|
|
2485
|
+
function oi(e, t, r) {
|
|
2486
|
+
return t = ii(t), t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
|
|
2487
|
+
}
|
|
2488
|
+
function ii(e) {
|
|
2489
|
+
var t = si(e, "string");
|
|
2490
|
+
return typeof t == "symbol" ? t : t + "";
|
|
2491
|
+
}
|
|
2492
|
+
function si(e, t) {
|
|
2493
|
+
if (typeof e != "object" || !e) return e;
|
|
2494
|
+
var r = e[Symbol.toPrimitive];
|
|
2495
|
+
if (r !== void 0) {
|
|
2496
|
+
var n = r.call(e, t);
|
|
2497
|
+
if (typeof n != "object") return n;
|
|
2498
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2499
|
+
}
|
|
2500
|
+
return (t === "string" ? String : Number)(e);
|
|
2501
|
+
}
|
|
2502
|
+
function nn(e) {
|
|
2503
|
+
return e && e.map((t, r) => /* @__PURE__ */ ue.createElement(t.tag, xt({
|
|
2504
|
+
key: r
|
|
2505
|
+
}, t.attr), nn(t.child)));
|
|
2506
|
+
}
|
|
2507
|
+
function $(e) {
|
|
2508
|
+
return (t) => /* @__PURE__ */ ue.createElement(ai, vt({
|
|
2509
|
+
attr: xt({}, e.attr)
|
|
2510
|
+
}, t), nn(e.child));
|
|
2511
|
+
}
|
|
2512
|
+
function ai(e) {
|
|
2513
|
+
var t = (r) => {
|
|
2514
|
+
var {
|
|
2515
|
+
attr: n,
|
|
2516
|
+
size: o,
|
|
2517
|
+
title: s
|
|
2518
|
+
} = e, l = ri(e, ti), a = o || r.size || "1em", y;
|
|
2519
|
+
return r.className && (y = r.className), e.className && (y = (y ? y + " " : "") + e.className), /* @__PURE__ */ ue.createElement("svg", vt({
|
|
2520
|
+
stroke: "currentColor",
|
|
2521
|
+
fill: "currentColor",
|
|
2522
|
+
strokeWidth: "0"
|
|
2523
|
+
}, r.attr, n, l, {
|
|
2524
|
+
className: y,
|
|
2525
|
+
style: xt(xt({
|
|
2526
|
+
color: e.color || r.color
|
|
2527
|
+
}, r.style), e.style),
|
|
2528
|
+
height: a,
|
|
2529
|
+
width: a,
|
|
2530
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2531
|
+
}), s && /* @__PURE__ */ ue.createElement("title", null, s), e.children);
|
|
2532
|
+
};
|
|
2533
|
+
return Nr !== void 0 ? /* @__PURE__ */ ue.createElement(Nr.Consumer, null, (r) => t(r)) : t(rn);
|
|
2534
|
+
}
|
|
2535
|
+
function ci(e) {
|
|
2536
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z" }, child: [] }] })(e);
|
|
2537
|
+
}
|
|
2538
|
+
function li(e) {
|
|
2539
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z" }, child: [] }] })(e);
|
|
2540
|
+
}
|
|
2541
|
+
function ui(e) {
|
|
2542
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M0 180V56c0-13.3 10.7-24 24-24h124c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12H64v84c0 6.6-5.4 12-12 12H12c-6.6 0-12-5.4-12-12zM288 44v40c0 6.6 5.4 12 12 12h84v84c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12V56c0-13.3-10.7-24-24-24H300c-6.6 0-12 5.4-12 12zm148 276h-40c-6.6 0-12 5.4-12 12v84h-84c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h124c13.3 0 24-10.7 24-24V332c0-6.6-5.4-12-12-12zM160 468v-40c0-6.6-5.4-12-12-12H64v-84c0-6.6-5.4-12-12-12H12c-6.6 0-12 5.4-12 12v124c0 13.3 10.7 24 24 24h124c6.6 0 12-5.4 12-12z" }, child: [] }] })(e);
|
|
2543
|
+
}
|
|
2544
|
+
function di(e) {
|
|
2545
|
+
return $({ attr: { viewBox: "0 0 496 512" }, child: [{ tag: "path", attr: { d: "M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152h177zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64zm324.7-96c-28.6-67.9-86.5-120.4-158-141.6 24.4 33.8 41.2 84.7 50 141.6h108zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6zM487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64zM120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64zm39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152h-177zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6zM19.3 352c28.6 67.9 86.5 120.4 158 141.6-24.4-33.8-41.2-84.7-50-141.6h-108z" }, child: [] }] })(e);
|
|
2546
|
+
}
|
|
2547
|
+
function fi(e) {
|
|
2548
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z" }, child: [] }] })(e);
|
|
2549
|
+
}
|
|
2550
|
+
function hi(e) {
|
|
2551
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M464 448H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h416c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48zM112 120c-30.928 0-56 25.072-56 56s25.072 56 56 56 56-25.072 56-56-25.072-56-56-56zM64 384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971 0L208 320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971 0L64 336v48z" }, child: [] }] })(e);
|
|
2552
|
+
}
|
|
2553
|
+
function pi(e) {
|
|
2554
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z" }, child: [] }] })(e);
|
|
2555
|
+
}
|
|
2556
|
+
function yi(e) {
|
|
2557
|
+
return $({ attr: { viewBox: "0 0 320 512" }, child: [{ tag: "path", attr: { d: "M302.189 329.126H196.105l55.831 135.993c3.889 9.428-.555 19.999-9.444 23.999l-49.165 21.427c-9.165 4-19.443-.571-23.332-9.714l-53.053-129.136-86.664 89.138C18.729 472.71 0 463.554 0 447.977V18.299C0 1.899 19.921-6.096 30.277 5.443l284.412 292.542c11.472 11.179 3.007 31.141-12.5 31.141z" }, child: [] }] })(e);
|
|
2558
|
+
}
|
|
2559
|
+
function gi(e) {
|
|
2560
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z" }, child: [] }] })(e);
|
|
2561
|
+
}
|
|
2562
|
+
function mi(e) {
|
|
2563
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z" }, child: [] }] })(e);
|
|
2564
|
+
}
|
|
2565
|
+
function wi(e) {
|
|
2566
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z" }, child: [] }] })(e);
|
|
2567
|
+
}
|
|
2568
|
+
function vi(e) {
|
|
2569
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z" }, child: [] }] })(e);
|
|
2570
|
+
}
|
|
2571
|
+
function xi(e) {
|
|
2572
|
+
return $({ attr: { viewBox: "0 0 576 512" }, child: [{ tag: "path", attr: { d: "M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" }, child: [] }] })(e);
|
|
2573
|
+
}
|
|
2574
|
+
const bi = ({ text: e }) => /* @__PURE__ */ u.jsxs(
|
|
2575
|
+
"div",
|
|
2576
|
+
{
|
|
2577
|
+
style: {
|
|
2578
|
+
position: "absolute",
|
|
2579
|
+
top: "10px",
|
|
2580
|
+
left: "10px",
|
|
2581
|
+
backgroundColor: "rgba(255, 68, 68, 0.9)",
|
|
2582
|
+
color: "white",
|
|
2583
|
+
padding: "8px 16px",
|
|
2584
|
+
borderRadius: "4px",
|
|
2585
|
+
display: "flex",
|
|
2586
|
+
alignItems: "center",
|
|
2587
|
+
gap: "8px",
|
|
2588
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.2)",
|
|
2589
|
+
zIndex: 1e3,
|
|
2590
|
+
pointerEvents: "none",
|
|
2591
|
+
userSelect: "none",
|
|
2592
|
+
fontFamily: "sans-serif",
|
|
2593
|
+
fontSize: "14px",
|
|
2594
|
+
fontWeight: "500"
|
|
2595
|
+
},
|
|
2596
|
+
children: [
|
|
2597
|
+
/* @__PURE__ */ u.jsx(pi, {}),
|
|
2598
|
+
/* @__PURE__ */ u.jsx("span", { children: e || "Locked" })
|
|
2599
|
+
]
|
|
2600
|
+
}
|
|
2601
|
+
);
|
|
2602
|
+
function Ei(e) {
|
|
2603
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z" }, child: [] }] })(e);
|
|
2604
|
+
}
|
|
2605
|
+
function _i(e) {
|
|
2606
|
+
return $({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M284.3 11.7c-15.6-15.6-40.9-15.6-56.6 0l-216 216c-15.6 15.6-15.6 40.9 0 56.6l216 216c15.6 15.6 40.9 15.6 56.6 0l216-216c15.6-15.6 15.6-40.9 0-56.6l-216-216z" }, child: [] }] })(e);
|
|
2607
|
+
}
|
|
2608
|
+
function Ci(e) {
|
|
2609
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" }, child: [] }] })(e);
|
|
2610
|
+
}
|
|
2611
|
+
function ki(e) {
|
|
2612
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M144 144l0 48 160 0 0-48c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192l0-48C80 64.5 144.5 0 224 0s144 64.5 144 144l0 48 16 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 256c0-35.3 28.7-64 64-64l16 0z" }, child: [] }] })(e);
|
|
2613
|
+
}
|
|
2614
|
+
function Si(e) {
|
|
2615
|
+
return $({ attr: { viewBox: "0 0 384 512" }, child: [{ tag: "path", attr: { d: "M32 32C14.3 32 0 46.3 0 64S14.3 96 32 96l128 0 0 352c0 17.7 14.3 32 32 32s32-14.3 32-32l0-352 128 0c17.7 0 32-14.3 32-32s-14.3-32-32-32L192 32 32 32z" }, child: [] }] })(e);
|
|
2616
|
+
}
|
|
2617
|
+
function Ni(e) {
|
|
2618
|
+
return $({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M144 144c0-44.2 35.8-80 80-80c31.9 0 59.4 18.6 72.3 45.7c7.6 16 26.7 22.8 42.6 15.2s22.8-26.7 15.2-42.6C331 33.7 281.5 0 224 0C144.5 0 80 64.5 80 144l0 48-16 0c-35.3 0-64 28.7-64 64L0 448c0 35.3 28.7 64 64 64l320 0c35.3 0 64-28.7 64-64l0-192c0-35.3-28.7-64-64-64l-240 0 0-48z" }, child: [] }] })(e);
|
|
2619
|
+
}
|
|
2620
|
+
function Mi(e) {
|
|
2621
|
+
return $({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M8.5.134a1 1 0 0 0-1 0l-6 3.577a1 1 0 0 0-.5.866v6.846a1 1 0 0 0 .5.866l6 3.577a1 1 0 0 0 1 0l6-3.577a1 1 0 0 0 .5-.866V4.577a1 1 0 0 0-.5-.866z" }, child: [] }] })(e);
|
|
2622
|
+
}
|
|
2623
|
+
function ji(e) {
|
|
2624
|
+
return $({ attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M11.107 0a.5.5 0 0 1 .353.146l4.394 4.394a.5.5 0 0 1 .146.353v6.214a.5.5 0 0 1-.146.353l-4.394 4.394a.5.5 0 0 1-.353.146H4.893a.5.5 0 0 1-.353-.146L.146 11.46A.5.5 0 0 1 0 11.107V4.893a.5.5 0 0 1 .146-.353L4.54.146A.5.5 0 0 1 4.893 0z" }, child: [] }] })(e);
|
|
2625
|
+
}
|
|
2626
|
+
const Oi = ({ onExport: e }) => {
|
|
2627
|
+
const t = qt(), { t: r, language: n, changeLanguage: o } = Dr(), s = Q(
|
|
2628
|
+
(m) => m.whiteboard.toolbar.selectedTool
|
|
2629
|
+
), l = Q((m) => m.whiteboard.lock.isLocked), [a, y] = G(!1), [h, w] = G(!1), d = xe(null), g = xe(null), k = xe(null), M = xe(null), j = xe(null), N = (m) => {
|
|
2630
|
+
const v = m.target.files[0];
|
|
2631
|
+
if (!v) return;
|
|
2632
|
+
const O = new FileReader();
|
|
2633
|
+
O.onload = (F) => {
|
|
2634
|
+
const U = new Image();
|
|
2635
|
+
U.onload = () => {
|
|
2636
|
+
const L = Date.now().toString();
|
|
2637
|
+
t(
|
|
2638
|
+
ie({
|
|
2639
|
+
id: L,
|
|
2640
|
+
type: "image",
|
|
2641
|
+
x: 100,
|
|
2642
|
+
y: 100,
|
|
2643
|
+
width: U.width,
|
|
2644
|
+
height: U.height,
|
|
2645
|
+
src: F.target.result
|
|
2646
|
+
})
|
|
2647
|
+
), t(pe("pointer")), t(Ae(L));
|
|
2648
|
+
}, U.src = F.target.result;
|
|
2649
|
+
}, O.readAsDataURL(v), m.target.value = "";
|
|
2650
|
+
};
|
|
2651
|
+
le(() => {
|
|
2652
|
+
const m = (v) => {
|
|
2653
|
+
d.current && !d.current.contains(v.target) && g.current && !g.current.contains(v.target) && y(!1), M.current && !M.current.contains(v.target) && k.current && !k.current.contains(v.target) && w(!1);
|
|
2654
|
+
};
|
|
2655
|
+
return document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
|
|
2656
|
+
}, []);
|
|
2657
|
+
const P = [
|
|
2658
|
+
{
|
|
2659
|
+
name: "triangle",
|
|
2660
|
+
icon: /* @__PURE__ */ u.jsx(mi, { style: { transform: "rotate(-30deg)" } })
|
|
2661
|
+
},
|
|
2662
|
+
{ name: "diamond", icon: /* @__PURE__ */ u.jsx(_i, {}) },
|
|
2663
|
+
{ name: "star", icon: /* @__PURE__ */ u.jsx(xi, {}) },
|
|
2664
|
+
{ name: "heart", icon: /* @__PURE__ */ u.jsx(fi, {}) },
|
|
2665
|
+
{ name: "hexagon", icon: /* @__PURE__ */ u.jsx(Mi, {}) },
|
|
2666
|
+
{ name: "octagon", icon: /* @__PURE__ */ u.jsx(ji, {}) },
|
|
2667
|
+
{ name: "arrow", icon: /* @__PURE__ */ u.jsx(Ei, {}) }
|
|
2668
|
+
], x = (m) => {
|
|
2669
|
+
t(pe(m)), y(!1);
|
|
2670
|
+
}, z = (m) => {
|
|
2671
|
+
o(m), w(!1);
|
|
2672
|
+
};
|
|
2673
|
+
return /* @__PURE__ */ u.jsxs("div", { className: "toolbar", children: [
|
|
2674
|
+
/* @__PURE__ */ u.jsx(
|
|
2675
|
+
"button",
|
|
2676
|
+
{
|
|
2677
|
+
className: s === "pointer" ? "active" : "",
|
|
2678
|
+
onClick: () => t(pe("pointer")),
|
|
2679
|
+
title: r("pointer"),
|
|
2680
|
+
disabled: l,
|
|
2681
|
+
children: /* @__PURE__ */ u.jsx(yi, {})
|
|
2682
|
+
}
|
|
2683
|
+
),
|
|
2684
|
+
/* @__PURE__ */ u.jsx(
|
|
2685
|
+
"button",
|
|
2686
|
+
{
|
|
2687
|
+
className: s === "text" ? "active" : "",
|
|
2688
|
+
onClick: () => t(pe("text")),
|
|
2689
|
+
title: r("text"),
|
|
2690
|
+
disabled: l,
|
|
2691
|
+
children: /* @__PURE__ */ u.jsx(Si, {})
|
|
2692
|
+
}
|
|
2693
|
+
),
|
|
2694
|
+
/* @__PURE__ */ u.jsx(
|
|
2695
|
+
"button",
|
|
2696
|
+
{
|
|
2697
|
+
onClick: () => {
|
|
2698
|
+
var m;
|
|
2699
|
+
return (m = j.current) == null ? void 0 : m.click();
|
|
2700
|
+
},
|
|
2701
|
+
title: r("image"),
|
|
2702
|
+
disabled: l,
|
|
2703
|
+
children: /* @__PURE__ */ u.jsx(hi, {})
|
|
2704
|
+
}
|
|
2705
|
+
),
|
|
2706
|
+
/* @__PURE__ */ u.jsx(
|
|
2707
|
+
"input",
|
|
2708
|
+
{
|
|
2709
|
+
type: "file",
|
|
2710
|
+
ref: j,
|
|
2711
|
+
style: { display: "none" },
|
|
2712
|
+
accept: "image/*",
|
|
2713
|
+
onChange: N
|
|
2714
|
+
}
|
|
2715
|
+
),
|
|
2716
|
+
/* @__PURE__ */ u.jsx(
|
|
2717
|
+
"button",
|
|
2718
|
+
{
|
|
2719
|
+
className: s === "pencil" ? "active" : "",
|
|
2720
|
+
onClick: () => t(pe("pencil")),
|
|
2721
|
+
title: r("pencil"),
|
|
2722
|
+
disabled: l,
|
|
2723
|
+
children: /* @__PURE__ */ u.jsx(gi, {})
|
|
2724
|
+
}
|
|
2725
|
+
),
|
|
2726
|
+
/* @__PURE__ */ u.jsx(
|
|
2727
|
+
"button",
|
|
2728
|
+
{
|
|
2729
|
+
className: s === "rectangle" ? "active" : "",
|
|
2730
|
+
onClick: () => t(pe("rectangle")),
|
|
2731
|
+
title: r("rectangle"),
|
|
2732
|
+
disabled: l,
|
|
2733
|
+
children: /* @__PURE__ */ u.jsx(vi, {})
|
|
2734
|
+
}
|
|
2735
|
+
),
|
|
2736
|
+
/* @__PURE__ */ u.jsx(
|
|
2737
|
+
"button",
|
|
2738
|
+
{
|
|
2739
|
+
className: s === "circle" ? "active" : "",
|
|
2740
|
+
onClick: () => t(pe("circle")),
|
|
2741
|
+
title: r("circle"),
|
|
2742
|
+
disabled: l,
|
|
2743
|
+
children: /* @__PURE__ */ u.jsx(ci, {})
|
|
2744
|
+
}
|
|
2745
|
+
),
|
|
2746
|
+
/* @__PURE__ */ u.jsxs("div", { className: "ellipsis-container", children: [
|
|
2747
|
+
/* @__PURE__ */ u.jsx(
|
|
2748
|
+
"button",
|
|
2749
|
+
{
|
|
2750
|
+
ref: g,
|
|
2751
|
+
className: P.some((m) => m.name === s) ? "active" : "",
|
|
2752
|
+
onClick: () => y(!a),
|
|
2753
|
+
title: r("moreShapes"),
|
|
2754
|
+
disabled: l,
|
|
2755
|
+
children: /* @__PURE__ */ u.jsx(Ci, {})
|
|
2756
|
+
}
|
|
2757
|
+
),
|
|
2758
|
+
a && /* @__PURE__ */ u.jsxs("div", { className: "shapes-popup", ref: d, children: [
|
|
2759
|
+
/* @__PURE__ */ u.jsx("div", { className: "shapes-popup-header", children: r("moreShapes") }),
|
|
2760
|
+
/* @__PURE__ */ u.jsx("div", { className: "shapes-popup-grid", children: P.map((m) => /* @__PURE__ */ u.jsx(
|
|
2761
|
+
"button",
|
|
2762
|
+
{
|
|
2763
|
+
className: s === m.name ? "active" : "",
|
|
2764
|
+
onClick: () => x(m.name),
|
|
2765
|
+
title: r(m.name),
|
|
2766
|
+
children: m.icon
|
|
2767
|
+
},
|
|
2768
|
+
m.name
|
|
2769
|
+
)) })
|
|
2770
|
+
] })
|
|
2771
|
+
] }),
|
|
2772
|
+
/* @__PURE__ */ u.jsx(
|
|
2773
|
+
"button",
|
|
2774
|
+
{
|
|
2775
|
+
className: s === "eraser" ? "active" : "",
|
|
2776
|
+
onClick: () => t(pe("eraser")),
|
|
2777
|
+
title: r("eraser"),
|
|
2778
|
+
disabled: l,
|
|
2779
|
+
children: /* @__PURE__ */ u.jsx(li, {})
|
|
2780
|
+
}
|
|
2781
|
+
),
|
|
2782
|
+
/* @__PURE__ */ u.jsx(
|
|
2783
|
+
"button",
|
|
2784
|
+
{
|
|
2785
|
+
onClick: () => t(
|
|
2786
|
+
Ho({
|
|
2787
|
+
canvasWidth: window.innerWidth,
|
|
2788
|
+
canvasHeight: window.innerHeight,
|
|
2789
|
+
padding: 50
|
|
2790
|
+
})
|
|
2791
|
+
),
|
|
2792
|
+
title: r("fitToView"),
|
|
2793
|
+
children: /* @__PURE__ */ u.jsx(ui, {})
|
|
2794
|
+
}
|
|
2795
|
+
),
|
|
2796
|
+
/* @__PURE__ */ u.jsx("button", { onClick: e, title: r("exportAsPng"), children: /* @__PURE__ */ u.jsx(wi, {}) }),
|
|
2797
|
+
/* @__PURE__ */ u.jsxs("div", { className: "language-container", children: [
|
|
2798
|
+
/* @__PURE__ */ u.jsx(
|
|
2799
|
+
"button",
|
|
2800
|
+
{
|
|
2801
|
+
ref: k,
|
|
2802
|
+
onClick: () => w(!h),
|
|
2803
|
+
title: r("language"),
|
|
2804
|
+
children: /* @__PURE__ */ u.jsx(di, {})
|
|
2805
|
+
}
|
|
2806
|
+
),
|
|
2807
|
+
h && /* @__PURE__ */ u.jsxs("div", { className: "language-popup", ref: M, children: [
|
|
2808
|
+
/* @__PURE__ */ u.jsx("div", { className: "language-popup-header", children: r("language") }),
|
|
2809
|
+
/* @__PURE__ */ u.jsxs("div", { className: "language-options", children: [
|
|
2810
|
+
/* @__PURE__ */ u.jsxs(
|
|
2811
|
+
"button",
|
|
2812
|
+
{
|
|
2813
|
+
className: n === "en" ? "active" : "",
|
|
2814
|
+
onClick: () => z("en"),
|
|
2815
|
+
children: [
|
|
2816
|
+
"🇺🇸 ",
|
|
2817
|
+
r("english")
|
|
2818
|
+
]
|
|
2819
|
+
}
|
|
2820
|
+
),
|
|
2821
|
+
/* @__PURE__ */ u.jsxs(
|
|
2822
|
+
"button",
|
|
2823
|
+
{
|
|
2824
|
+
className: n === "tr" ? "active" : "",
|
|
2825
|
+
onClick: () => z("tr"),
|
|
2826
|
+
children: [
|
|
2827
|
+
"🇹🇷 ",
|
|
2828
|
+
r("turkish")
|
|
2829
|
+
]
|
|
2830
|
+
}
|
|
2831
|
+
)
|
|
2832
|
+
] })
|
|
2833
|
+
] })
|
|
2834
|
+
] }),
|
|
2835
|
+
/* @__PURE__ */ u.jsx(
|
|
2836
|
+
"button",
|
|
2837
|
+
{
|
|
2838
|
+
onClick: () => t(tn(!l)),
|
|
2839
|
+
title: l ? "Unlock" : "Lock",
|
|
2840
|
+
style: { color: l ? "red" : "inherit" },
|
|
2841
|
+
children: l ? /* @__PURE__ */ u.jsx(ki, {}) : /* @__PURE__ */ u.jsx(Ni, {})
|
|
2842
|
+
}
|
|
2843
|
+
)
|
|
2844
|
+
] });
|
|
2845
|
+
}, Ti = () => {
|
|
2846
|
+
const e = qt(), { t } = Dr(), r = Q(
|
|
2847
|
+
(d) => d.whiteboard.toolbar.selectedTool
|
|
2848
|
+
), n = Q(
|
|
2849
|
+
(d) => d.whiteboard.toolProperties
|
|
2850
|
+
), o = Q(
|
|
2851
|
+
(d) => d.whiteboard.selectedElementId
|
|
2852
|
+
), s = Q((d) => d.whiteboard.elements), l = o ? s.find((d) => d.id === o) : null, a = (d, g, k) => {
|
|
2853
|
+
e(Xo({ tool: d, property: g, value: k }));
|
|
2854
|
+
}, y = (d, g) => {
|
|
2855
|
+
o && e(
|
|
2856
|
+
dt({ id: o, updates: { [d]: g } })
|
|
2857
|
+
);
|
|
2858
|
+
}, h = () => {
|
|
2859
|
+
o && e(Go(o));
|
|
2860
|
+
}, w = () => {
|
|
2861
|
+
o && e(qo(o));
|
|
2862
|
+
};
|
|
2863
|
+
if (r === "pointer" && l && l.type === "text")
|
|
2864
|
+
return /* @__PURE__ */ u.jsxs("div", { className: "prop-tools", children: [
|
|
2865
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2866
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fontSize") }),
|
|
2867
|
+
/* @__PURE__ */ u.jsxs(
|
|
2868
|
+
"select",
|
|
2869
|
+
{
|
|
2870
|
+
className: "font-size-selector",
|
|
2871
|
+
value: l.fontSize || 16,
|
|
2872
|
+
onChange: (d) => y("fontSize", parseInt(d.target.value)),
|
|
2873
|
+
children: [
|
|
2874
|
+
/* @__PURE__ */ u.jsx("option", { value: "12", children: "12 px" }),
|
|
2875
|
+
/* @__PURE__ */ u.jsx("option", { value: "14", children: "14 px" }),
|
|
2876
|
+
/* @__PURE__ */ u.jsx("option", { value: "16", children: "16 px" }),
|
|
2877
|
+
/* @__PURE__ */ u.jsx("option", { value: "18", children: "18 px" }),
|
|
2878
|
+
/* @__PURE__ */ u.jsx("option", { value: "24", children: "24 px" }),
|
|
2879
|
+
/* @__PURE__ */ u.jsx("option", { value: "32", children: "32 px" }),
|
|
2880
|
+
/* @__PURE__ */ u.jsx("option", { value: "48", children: "48 px" }),
|
|
2881
|
+
/* @__PURE__ */ u.jsx("option", { value: "64", children: "64 px" }),
|
|
2882
|
+
/* @__PURE__ */ u.jsx("option", { value: "72", children: "72 px" })
|
|
2883
|
+
]
|
|
2884
|
+
}
|
|
2885
|
+
)
|
|
2886
|
+
] }),
|
|
2887
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2888
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fontColor") }),
|
|
2889
|
+
/* @__PURE__ */ u.jsx(
|
|
2890
|
+
"input",
|
|
2891
|
+
{
|
|
2892
|
+
type: "color",
|
|
2893
|
+
value: l.fontColor || "#000000",
|
|
2894
|
+
onChange: (d) => y("fontColor", d.target.value)
|
|
2895
|
+
}
|
|
2896
|
+
)
|
|
2897
|
+
] }),
|
|
2898
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2899
|
+
/* @__PURE__ */ u.jsx("span", { children: t("layerOrder") }),
|
|
2900
|
+
/* @__PURE__ */ u.jsxs("div", { className: "layer-buttons", children: [
|
|
2901
|
+
/* @__PURE__ */ u.jsx("button", { onClick: h, title: t("bringToFront"), children: /* @__PURE__ */ u.jsxs(
|
|
2902
|
+
"svg",
|
|
2903
|
+
{
|
|
2904
|
+
width: "18",
|
|
2905
|
+
height: "18",
|
|
2906
|
+
viewBox: "0 0 24 24",
|
|
2907
|
+
fill: "none",
|
|
2908
|
+
stroke: "currentColor",
|
|
2909
|
+
strokeWidth: "2",
|
|
2910
|
+
children: [
|
|
2911
|
+
/* @__PURE__ */ u.jsx(
|
|
2912
|
+
"rect",
|
|
2913
|
+
{
|
|
2914
|
+
x: "8",
|
|
2915
|
+
y: "8",
|
|
2916
|
+
width: "12",
|
|
2917
|
+
height: "12",
|
|
2918
|
+
rx: "1",
|
|
2919
|
+
fill: "#0066cc",
|
|
2920
|
+
stroke: "#0066cc"
|
|
2921
|
+
}
|
|
2922
|
+
),
|
|
2923
|
+
/* @__PURE__ */ u.jsx("rect", { x: "4", y: "4", width: "12", height: "12", rx: "1", fill: "white" })
|
|
2924
|
+
]
|
|
2925
|
+
}
|
|
2926
|
+
) }),
|
|
2927
|
+
/* @__PURE__ */ u.jsx("button", { onClick: w, title: t("sendToBack"), children: /* @__PURE__ */ u.jsxs(
|
|
2928
|
+
"svg",
|
|
2929
|
+
{
|
|
2930
|
+
width: "18",
|
|
2931
|
+
height: "18",
|
|
2932
|
+
viewBox: "0 0 24 24",
|
|
2933
|
+
fill: "none",
|
|
2934
|
+
stroke: "currentColor",
|
|
2935
|
+
strokeWidth: "2",
|
|
2936
|
+
children: [
|
|
2937
|
+
/* @__PURE__ */ u.jsx(
|
|
2938
|
+
"rect",
|
|
2939
|
+
{
|
|
2940
|
+
x: "4",
|
|
2941
|
+
y: "4",
|
|
2942
|
+
width: "12",
|
|
2943
|
+
height: "12",
|
|
2944
|
+
rx: "1",
|
|
2945
|
+
fill: "#0066cc",
|
|
2946
|
+
stroke: "#0066cc"
|
|
2947
|
+
}
|
|
2948
|
+
),
|
|
2949
|
+
/* @__PURE__ */ u.jsx("rect", { x: "8", y: "8", width: "12", height: "12", rx: "1", fill: "white" })
|
|
2950
|
+
]
|
|
2951
|
+
}
|
|
2952
|
+
) })
|
|
2953
|
+
] })
|
|
2954
|
+
] })
|
|
2955
|
+
] });
|
|
2956
|
+
if (r === "pointer" && l) {
|
|
2957
|
+
const d = [
|
|
2958
|
+
"rectangle",
|
|
2959
|
+
"circle",
|
|
2960
|
+
"triangle",
|
|
2961
|
+
"diamond",
|
|
2962
|
+
"star",
|
|
2963
|
+
"heart",
|
|
2964
|
+
"hexagon",
|
|
2965
|
+
"octagon",
|
|
2966
|
+
"arrow"
|
|
2967
|
+
].includes(l.type), g = l.type === "pencil";
|
|
2968
|
+
return /* @__PURE__ */ u.jsxs("div", { className: "prop-tools", children: [
|
|
2969
|
+
d && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
2970
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2971
|
+
/* @__PURE__ */ u.jsx("span", { children: t("strokeColor") }),
|
|
2972
|
+
/* @__PURE__ */ u.jsx(
|
|
2973
|
+
"input",
|
|
2974
|
+
{
|
|
2975
|
+
type: "color",
|
|
2976
|
+
value: l.strokeColor,
|
|
2977
|
+
onChange: (k) => y("strokeColor", k.target.value)
|
|
2978
|
+
}
|
|
2979
|
+
)
|
|
2980
|
+
] }),
|
|
2981
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2982
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fillColor") }),
|
|
2983
|
+
/* @__PURE__ */ u.jsx(
|
|
2984
|
+
"input",
|
|
2985
|
+
{
|
|
2986
|
+
type: "color",
|
|
2987
|
+
value: l.fillColor,
|
|
2988
|
+
onChange: (k) => y("fillColor", k.target.value)
|
|
2989
|
+
}
|
|
2990
|
+
)
|
|
2991
|
+
] }),
|
|
2992
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
2993
|
+
/* @__PURE__ */ u.jsx("span", { children: t("strokeWidth") }),
|
|
2994
|
+
/* @__PURE__ */ u.jsxs(
|
|
2995
|
+
"select",
|
|
2996
|
+
{
|
|
2997
|
+
className: "stroke-width-selector",
|
|
2998
|
+
value: l.lineWidth,
|
|
2999
|
+
onChange: (k) => y(
|
|
3000
|
+
"lineWidth",
|
|
3001
|
+
parseInt(k.target.value)
|
|
3002
|
+
),
|
|
3003
|
+
children: [
|
|
3004
|
+
/* @__PURE__ */ u.jsx("option", { value: "1", children: "1 px" }),
|
|
3005
|
+
/* @__PURE__ */ u.jsx("option", { value: "2", children: "2 px" }),
|
|
3006
|
+
/* @__PURE__ */ u.jsx("option", { value: "4", children: "4 px" }),
|
|
3007
|
+
/* @__PURE__ */ u.jsx("option", { value: "8", children: "8 px" })
|
|
3008
|
+
]
|
|
3009
|
+
}
|
|
3010
|
+
)
|
|
3011
|
+
] })
|
|
3012
|
+
] }),
|
|
3013
|
+
g && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
3014
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3015
|
+
/* @__PURE__ */ u.jsx("span", { children: t("brushColor") }),
|
|
3016
|
+
/* @__PURE__ */ u.jsx(
|
|
3017
|
+
"input",
|
|
3018
|
+
{
|
|
3019
|
+
type: "color",
|
|
3020
|
+
value: l.strokeColor,
|
|
3021
|
+
onChange: (k) => y("strokeColor", k.target.value)
|
|
3022
|
+
}
|
|
3023
|
+
)
|
|
3024
|
+
] }),
|
|
3025
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3026
|
+
/* @__PURE__ */ u.jsx("span", { children: t("brushSize") }),
|
|
3027
|
+
/* @__PURE__ */ u.jsxs(
|
|
3028
|
+
"select",
|
|
3029
|
+
{
|
|
3030
|
+
className: "brush-size-selector",
|
|
3031
|
+
value: l.lineWidth,
|
|
3032
|
+
onChange: (k) => y(
|
|
3033
|
+
"lineWidth",
|
|
3034
|
+
parseInt(k.target.value)
|
|
3035
|
+
),
|
|
3036
|
+
children: [
|
|
3037
|
+
/* @__PURE__ */ u.jsx("option", { value: "1", children: "1 px" }),
|
|
3038
|
+
/* @__PURE__ */ u.jsx("option", { value: "2", children: "2 px" }),
|
|
3039
|
+
/* @__PURE__ */ u.jsx("option", { value: "4", children: "4 px" }),
|
|
3040
|
+
/* @__PURE__ */ u.jsx("option", { value: "8", children: "8 px" }),
|
|
3041
|
+
/* @__PURE__ */ u.jsx("option", { value: "16", children: "16 px" })
|
|
3042
|
+
]
|
|
3043
|
+
}
|
|
3044
|
+
)
|
|
3045
|
+
] })
|
|
3046
|
+
] }),
|
|
3047
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3048
|
+
/* @__PURE__ */ u.jsx("span", { children: t("layerOrder") }),
|
|
3049
|
+
/* @__PURE__ */ u.jsxs("div", { className: "layer-buttons", children: [
|
|
3050
|
+
/* @__PURE__ */ u.jsx("button", { onClick: h, title: t("bringToFront"), children: /* @__PURE__ */ u.jsxs(
|
|
3051
|
+
"svg",
|
|
3052
|
+
{
|
|
3053
|
+
width: "18",
|
|
3054
|
+
height: "18",
|
|
3055
|
+
viewBox: "0 0 24 24",
|
|
3056
|
+
fill: "none",
|
|
3057
|
+
stroke: "currentColor",
|
|
3058
|
+
strokeWidth: "2",
|
|
3059
|
+
children: [
|
|
3060
|
+
/* @__PURE__ */ u.jsx(
|
|
3061
|
+
"rect",
|
|
3062
|
+
{
|
|
3063
|
+
x: "8",
|
|
3064
|
+
y: "8",
|
|
3065
|
+
width: "12",
|
|
3066
|
+
height: "12",
|
|
3067
|
+
rx: "1",
|
|
3068
|
+
fill: "#0066cc",
|
|
3069
|
+
stroke: "#0066cc"
|
|
3070
|
+
}
|
|
3071
|
+
),
|
|
3072
|
+
/* @__PURE__ */ u.jsx("rect", { x: "4", y: "4", width: "12", height: "12", rx: "1", fill: "white" })
|
|
3073
|
+
]
|
|
3074
|
+
}
|
|
3075
|
+
) }),
|
|
3076
|
+
/* @__PURE__ */ u.jsx("button", { onClick: w, title: t("sendToBack"), children: /* @__PURE__ */ u.jsxs(
|
|
3077
|
+
"svg",
|
|
3078
|
+
{
|
|
3079
|
+
width: "18",
|
|
3080
|
+
height: "18",
|
|
3081
|
+
viewBox: "0 0 24 24",
|
|
3082
|
+
fill: "none",
|
|
3083
|
+
stroke: "currentColor",
|
|
3084
|
+
strokeWidth: "2",
|
|
3085
|
+
children: [
|
|
3086
|
+
/* @__PURE__ */ u.jsx(
|
|
3087
|
+
"rect",
|
|
3088
|
+
{
|
|
3089
|
+
x: "4",
|
|
3090
|
+
y: "4",
|
|
3091
|
+
width: "12",
|
|
3092
|
+
height: "12",
|
|
3093
|
+
rx: "1",
|
|
3094
|
+
fill: "#0066cc",
|
|
3095
|
+
stroke: "#0066cc"
|
|
3096
|
+
}
|
|
3097
|
+
),
|
|
3098
|
+
/* @__PURE__ */ u.jsx("rect", { x: "8", y: "8", width: "12", height: "12", rx: "1", fill: "white" })
|
|
3099
|
+
]
|
|
3100
|
+
}
|
|
3101
|
+
) })
|
|
3102
|
+
] })
|
|
3103
|
+
] })
|
|
3104
|
+
] });
|
|
3105
|
+
}
|
|
3106
|
+
return /* @__PURE__ */ u.jsxs("div", { className: "prop-tools", children: [
|
|
3107
|
+
r === "text" && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
3108
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3109
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fontSize") }),
|
|
3110
|
+
/* @__PURE__ */ u.jsxs(
|
|
3111
|
+
"select",
|
|
3112
|
+
{
|
|
3113
|
+
className: "font-size-selector",
|
|
3114
|
+
value: n.text.fontSize,
|
|
3115
|
+
onChange: (d) => a(
|
|
3116
|
+
"text",
|
|
3117
|
+
"fontSize",
|
|
3118
|
+
parseInt(d.target.value)
|
|
3119
|
+
),
|
|
3120
|
+
children: [
|
|
3121
|
+
/* @__PURE__ */ u.jsx("option", { value: "12", children: "12 px" }),
|
|
3122
|
+
/* @__PURE__ */ u.jsx("option", { value: "14", children: "14 px" }),
|
|
3123
|
+
/* @__PURE__ */ u.jsx("option", { value: "16", children: "16 px" }),
|
|
3124
|
+
/* @__PURE__ */ u.jsx("option", { value: "18", children: "18 px" }),
|
|
3125
|
+
/* @__PURE__ */ u.jsx("option", { value: "24", children: "24 px" }),
|
|
3126
|
+
/* @__PURE__ */ u.jsx("option", { value: "32", children: "32 px" }),
|
|
3127
|
+
/* @__PURE__ */ u.jsx("option", { value: "48", children: "48 px" }),
|
|
3128
|
+
/* @__PURE__ */ u.jsx("option", { value: "64", children: "64 px" }),
|
|
3129
|
+
/* @__PURE__ */ u.jsx("option", { value: "72", children: "72 px" })
|
|
3130
|
+
]
|
|
3131
|
+
}
|
|
3132
|
+
)
|
|
3133
|
+
] }),
|
|
3134
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3135
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fontColor") }),
|
|
3136
|
+
/* @__PURE__ */ u.jsx(
|
|
3137
|
+
"input",
|
|
3138
|
+
{
|
|
3139
|
+
type: "color",
|
|
3140
|
+
value: n.text.fontColor,
|
|
3141
|
+
onChange: (d) => a("text", "fontColor", d.target.value)
|
|
3142
|
+
}
|
|
3143
|
+
)
|
|
3144
|
+
] })
|
|
3145
|
+
] }),
|
|
3146
|
+
r === "pencil" && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
3147
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3148
|
+
/* @__PURE__ */ u.jsx("span", { children: t("brushColor") }),
|
|
3149
|
+
/* @__PURE__ */ u.jsx(
|
|
3150
|
+
"input",
|
|
3151
|
+
{
|
|
3152
|
+
type: "color",
|
|
3153
|
+
value: n.pencil.strokeColor,
|
|
3154
|
+
onChange: (d) => a("pencil", "strokeColor", d.target.value)
|
|
3155
|
+
}
|
|
3156
|
+
)
|
|
3157
|
+
] }),
|
|
3158
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3159
|
+
/* @__PURE__ */ u.jsx("span", { children: t("brushSize") }),
|
|
3160
|
+
/* @__PURE__ */ u.jsxs(
|
|
3161
|
+
"select",
|
|
3162
|
+
{
|
|
3163
|
+
className: "brush-size-selector",
|
|
3164
|
+
value: n.pencil.lineWidth,
|
|
3165
|
+
onChange: (d) => a(
|
|
3166
|
+
"pencil",
|
|
3167
|
+
"lineWidth",
|
|
3168
|
+
parseInt(d.target.value)
|
|
3169
|
+
),
|
|
3170
|
+
children: [
|
|
3171
|
+
/* @__PURE__ */ u.jsx("option", { value: "1", children: "1 px" }),
|
|
3172
|
+
/* @__PURE__ */ u.jsx("option", { value: "2", children: "2 px" }),
|
|
3173
|
+
/* @__PURE__ */ u.jsx("option", { value: "4", children: "4 px" }),
|
|
3174
|
+
/* @__PURE__ */ u.jsx("option", { value: "8", children: "8 px" }),
|
|
3175
|
+
/* @__PURE__ */ u.jsx("option", { value: "16", children: "16 px" })
|
|
3176
|
+
]
|
|
3177
|
+
}
|
|
3178
|
+
)
|
|
3179
|
+
] })
|
|
3180
|
+
] }),
|
|
3181
|
+
(r === "rectangle" || r === "circle" || r === "triangle" || r === "diamond" || r === "star" || r === "heart" || r === "hexagon" || r === "octagon" || r === "arrow") && /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
3182
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3183
|
+
/* @__PURE__ */ u.jsx("span", { children: t("strokeColor") }),
|
|
3184
|
+
/* @__PURE__ */ u.jsx(
|
|
3185
|
+
"input",
|
|
3186
|
+
{
|
|
3187
|
+
type: "color",
|
|
3188
|
+
value: n[r].strokeColor,
|
|
3189
|
+
onChange: (d) => a(
|
|
3190
|
+
r,
|
|
3191
|
+
"strokeColor",
|
|
3192
|
+
d.target.value
|
|
3193
|
+
)
|
|
3194
|
+
}
|
|
3195
|
+
)
|
|
3196
|
+
] }),
|
|
3197
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3198
|
+
/* @__PURE__ */ u.jsx("span", { children: t("fillColor") }),
|
|
3199
|
+
/* @__PURE__ */ u.jsx(
|
|
3200
|
+
"input",
|
|
3201
|
+
{
|
|
3202
|
+
type: "color",
|
|
3203
|
+
value: n[r].fillColor,
|
|
3204
|
+
onChange: (d) => a(r, "fillColor", d.target.value)
|
|
3205
|
+
}
|
|
3206
|
+
)
|
|
3207
|
+
] }),
|
|
3208
|
+
/* @__PURE__ */ u.jsxs("div", { className: "prop-tool-item", children: [
|
|
3209
|
+
/* @__PURE__ */ u.jsx("span", { children: t("strokeWidth") }),
|
|
3210
|
+
/* @__PURE__ */ u.jsxs(
|
|
3211
|
+
"select",
|
|
3212
|
+
{
|
|
3213
|
+
className: "stroke-width-selector",
|
|
3214
|
+
value: n[r].lineWidth,
|
|
3215
|
+
onChange: (d) => a(
|
|
3216
|
+
r,
|
|
3217
|
+
"lineWidth",
|
|
3218
|
+
parseInt(d.target.value)
|
|
3219
|
+
),
|
|
3220
|
+
children: [
|
|
3221
|
+
/* @__PURE__ */ u.jsx("option", { value: "1", children: "1 px" }),
|
|
3222
|
+
/* @__PURE__ */ u.jsx("option", { value: "2", children: "2 px" }),
|
|
3223
|
+
/* @__PURE__ */ u.jsx("option", { value: "4", children: "4 px" }),
|
|
3224
|
+
/* @__PURE__ */ u.jsx("option", { value: "8", children: "8 px" })
|
|
3225
|
+
]
|
|
3226
|
+
}
|
|
3227
|
+
)
|
|
3228
|
+
] })
|
|
3229
|
+
] })
|
|
3230
|
+
] });
|
|
3231
|
+
}, Pi = fn(({ onAction: e, watermark: t, isLocked: r, lockText: n, onLockChange: o }, s) => {
|
|
3232
|
+
var ir;
|
|
3233
|
+
const l = xe(null), a = qt(), y = Q((i) => i.whiteboard.grid), h = Q(
|
|
3234
|
+
(i) => i.whiteboard.toolbar.selectedTool
|
|
3235
|
+
), w = Q((i) => i.whiteboard.elements), d = Q((i) => i.whiteboard.viewport), g = Q(
|
|
3236
|
+
(i) => i.whiteboard.toolProperties
|
|
3237
|
+
), k = Q(
|
|
3238
|
+
(i) => i.whiteboard.selectedElementId
|
|
3239
|
+
), M = Q((i) => i.whiteboard.lock), j = M.isLocked, [N, P] = G(!1), [x, z] = G({ x: 0, y: 0 }), [m, v] = G({ x: 0, y: 0 }), [O, F] = G([]), [U, L] = G(!1), [X, oe] = G({ x: 0, y: 0 }), [de, Oe] = G(!1), [Te, Ee] = G(!1), [Se, Ne] = G(!1), [Pe, Xe] = G({ x: 0, y: 0 }), [De, b] = G({ y: 0, initialZoom: 1 }), [D, A] = G(!1), [B, Me] = G({ x: 0, y: 0 }), [fe, V] = G(""), [se, me] = G(null);
|
|
3240
|
+
le(() => {
|
|
3241
|
+
e && Zo(e);
|
|
3242
|
+
}, [e]), hn(s, () => ({
|
|
3243
|
+
canvas: l.current,
|
|
3244
|
+
applyAction: (i) => {
|
|
3245
|
+
a({
|
|
3246
|
+
...i,
|
|
3247
|
+
meta: {
|
|
3248
|
+
...i.meta,
|
|
3249
|
+
fromRemote: !0
|
|
3250
|
+
}
|
|
3251
|
+
});
|
|
3252
|
+
}
|
|
3253
|
+
})), le(() => {
|
|
3254
|
+
r !== void 0 && r !== j && a(tn(r));
|
|
3255
|
+
}, [r, j, a]), le(() => {
|
|
3256
|
+
o && o(j);
|
|
3257
|
+
}, [j, o]);
|
|
3258
|
+
const Be = H(
|
|
3259
|
+
(i, c, p) => {
|
|
3260
|
+
const f = i.canvas, C = f.width, _ = f.height, S = Math.floor(-d.panX / d.zoom / c) * c, E = Math.floor(-d.panY / d.zoom / c) * c, T = Math.ceil(
|
|
3261
|
+
(C / d.zoom - d.panX / d.zoom) / c
|
|
3262
|
+
) * c, I = Math.ceil(
|
|
3263
|
+
(_ / d.zoom - d.panY / d.zoom) / c
|
|
3264
|
+
) * c;
|
|
3265
|
+
i.strokeStyle = p, i.lineWidth = 0.5 / d.zoom;
|
|
3266
|
+
for (let R = S; R <= T; R += c)
|
|
3267
|
+
i.beginPath(), i.moveTo(R, E), i.lineTo(R, I), i.stroke();
|
|
3268
|
+
for (let R = E; R <= I; R += c)
|
|
3269
|
+
i.beginPath(), i.moveTo(S, R), i.lineTo(T, R), i.stroke();
|
|
3270
|
+
},
|
|
3271
|
+
[d]
|
|
3272
|
+
), Qt = H((i, c, p) => {
|
|
3273
|
+
const f = Math.min(c.x, p.x), C = Math.min(c.y, p.y), _ = Math.abs(p.x - c.x), S = Math.abs(p.y - c.y);
|
|
3274
|
+
i.strokeStyle = "#0066cc", i.lineWidth = 1, i.setLineDash([5, 5]), i.strokeRect(f, C, _, S), i.fillStyle = "rgba(0, 102, 204, 0.1)", i.fillRect(f, C, _, S), i.setLineDash([]);
|
|
3275
|
+
}, []), $e = H((i, c) => {
|
|
3276
|
+
const {
|
|
3277
|
+
x: p,
|
|
3278
|
+
y: f,
|
|
3279
|
+
width: C,
|
|
3280
|
+
height: _,
|
|
3281
|
+
fillColor: S = "#000",
|
|
3282
|
+
strokeColor: E = "#000",
|
|
3283
|
+
lineWidth: T = 2
|
|
3284
|
+
} = c;
|
|
3285
|
+
i.fillStyle = S, i.fillRect(p, f, C, _), i.strokeStyle = E, i.lineWidth = T, i.strokeRect(p, f, C, _);
|
|
3286
|
+
}, []), Ue = H((i, c) => {
|
|
3287
|
+
const {
|
|
3288
|
+
centerX: p,
|
|
3289
|
+
centerY: f,
|
|
3290
|
+
radius: C,
|
|
3291
|
+
fillColor: _ = "#000",
|
|
3292
|
+
strokeColor: S = "#000",
|
|
3293
|
+
lineWidth: E = 2
|
|
3294
|
+
} = c;
|
|
3295
|
+
i.beginPath(), i.arc(p, f, C, 0, Math.PI * 2), i.fillStyle = _, i.fill(), i.strokeStyle = S, i.lineWidth = E, i.stroke();
|
|
3296
|
+
}, []), He = H((i, c) => {
|
|
3297
|
+
const { points: p, strokeColor: f = "#000", lineWidth: C = 2 } = c;
|
|
3298
|
+
if (!(p.length < 2)) {
|
|
3299
|
+
i.strokeStyle = f, i.lineWidth = C, i.lineCap = "round", i.lineJoin = "round", i.beginPath(), i.moveTo(p[0].x, p[0].y);
|
|
3300
|
+
for (let _ = 1; _ < p.length; _++)
|
|
3301
|
+
i.lineTo(p[_].x, p[_].y);
|
|
3302
|
+
i.stroke();
|
|
3303
|
+
}
|
|
3304
|
+
}, []), er = H((i, c) => {
|
|
3305
|
+
const { x: p, y: f, text: C, fontSize: _ = 16, fontColor: S = "#000" } = c;
|
|
3306
|
+
i.font = `${_}px sans-serif`, i.fillStyle = S, i.textBaseline = "top", i.fillText(C, p, f);
|
|
3307
|
+
}, []), Ge = H((i, c) => {
|
|
3308
|
+
const {
|
|
3309
|
+
x: p,
|
|
3310
|
+
y: f,
|
|
3311
|
+
width: C,
|
|
3312
|
+
height: _,
|
|
3313
|
+
fillColor: S = "#fff",
|
|
3314
|
+
strokeColor: E = "#000",
|
|
3315
|
+
lineWidth: T = 2
|
|
3316
|
+
} = c;
|
|
3317
|
+
i.beginPath(), i.moveTo(p + C / 2, f), i.lineTo(p + C, f + _), i.lineTo(p, f + _), i.closePath(), i.fillStyle = S, i.fill(), i.strokeStyle = E, i.lineWidth = T, i.stroke();
|
|
3318
|
+
}, []), qe = H((i, c) => {
|
|
3319
|
+
const {
|
|
3320
|
+
x: p,
|
|
3321
|
+
y: f,
|
|
3322
|
+
width: C,
|
|
3323
|
+
height: _,
|
|
3324
|
+
fillColor: S = "#fff",
|
|
3325
|
+
strokeColor: E = "#000",
|
|
3326
|
+
lineWidth: T = 2
|
|
3327
|
+
} = c;
|
|
3328
|
+
i.beginPath(), i.moveTo(p + C / 2, f), i.lineTo(p + C, f + _ / 2), i.lineTo(p + C / 2, f + _), i.lineTo(p, f + _ / 2), i.closePath(), i.fillStyle = S, i.fill(), i.strokeStyle = E, i.lineWidth = T, i.stroke();
|
|
3329
|
+
}, []), Ke = H((i, c) => {
|
|
3330
|
+
const {
|
|
3331
|
+
centerX: p,
|
|
3332
|
+
centerY: f,
|
|
3333
|
+
size: C,
|
|
3334
|
+
fillColor: _ = "#ffff00",
|
|
3335
|
+
strokeColor: S = "#000",
|
|
3336
|
+
lineWidth: E = 2
|
|
3337
|
+
} = c, T = 5, I = C, R = C / 2;
|
|
3338
|
+
i.beginPath();
|
|
3339
|
+
for (let Z = 0; Z < T * 2; Z++) {
|
|
3340
|
+
const J = Z % 2 === 0 ? I : R, Y = Math.PI / T * Z - Math.PI / 2, ee = p + Math.cos(Y) * J, ae = f + Math.sin(Y) * J;
|
|
3341
|
+
Z === 0 ? i.moveTo(ee, ae) : i.lineTo(ee, ae);
|
|
3342
|
+
}
|
|
3343
|
+
i.closePath(), i.fillStyle = _, i.fill(), i.strokeStyle = S, i.lineWidth = E, i.stroke();
|
|
3344
|
+
}, []), Ze = H((i, c) => {
|
|
3345
|
+
const {
|
|
3346
|
+
centerX: p,
|
|
3347
|
+
centerY: f,
|
|
3348
|
+
size: C,
|
|
3349
|
+
fillColor: _ = "#ff6b6b",
|
|
3350
|
+
strokeColor: S = "#000",
|
|
3351
|
+
lineWidth: E = 2
|
|
3352
|
+
} = c;
|
|
3353
|
+
i.beginPath();
|
|
3354
|
+
const T = f - C / 2;
|
|
3355
|
+
i.moveTo(p, T + C / 4), i.bezierCurveTo(
|
|
3356
|
+
p - C / 2,
|
|
3357
|
+
T,
|
|
3358
|
+
p - C,
|
|
3359
|
+
T + C / 2,
|
|
3360
|
+
p,
|
|
3361
|
+
f + C / 2
|
|
3362
|
+
), i.bezierCurveTo(
|
|
3363
|
+
p + C,
|
|
3364
|
+
T + C / 2,
|
|
3365
|
+
p + C / 2,
|
|
3366
|
+
T,
|
|
3367
|
+
p,
|
|
3368
|
+
T + C / 4
|
|
3369
|
+
), i.fillStyle = _, i.fill(), i.strokeStyle = S, i.lineWidth = E, i.stroke();
|
|
3370
|
+
}, []), Je = H((i, c) => {
|
|
3371
|
+
const {
|
|
3372
|
+
x: p,
|
|
3373
|
+
y: f,
|
|
3374
|
+
width: C,
|
|
3375
|
+
height: _,
|
|
3376
|
+
fillColor: S = "#fff",
|
|
3377
|
+
strokeColor: E = "#000",
|
|
3378
|
+
lineWidth: T = 2
|
|
3379
|
+
} = c, I = p + C / 2, R = f + _ / 2, Z = C / 2, J = _ / 2;
|
|
3380
|
+
i.beginPath();
|
|
3381
|
+
for (let Y = 0; Y < 6; Y++) {
|
|
3382
|
+
const ee = Math.PI / 3 * Y - Math.PI / 2, ae = I + Math.cos(ee) * Z, we = R + Math.sin(ee) * J;
|
|
3383
|
+
Y === 0 ? i.moveTo(ae, we) : i.lineTo(ae, we);
|
|
3384
|
+
}
|
|
3385
|
+
i.closePath(), i.fillStyle = S, i.fill(), i.strokeStyle = E, i.lineWidth = T, i.stroke();
|
|
3386
|
+
}, []), Qe = H((i, c) => {
|
|
3387
|
+
const {
|
|
3388
|
+
x: p,
|
|
3389
|
+
y: f,
|
|
3390
|
+
width: C,
|
|
3391
|
+
height: _,
|
|
3392
|
+
fillColor: S = "#fff",
|
|
3393
|
+
strokeColor: E = "#000",
|
|
3394
|
+
lineWidth: T = 2
|
|
3395
|
+
} = c, I = p + C / 2, R = f + _ / 2, Z = C / 2, J = _ / 2;
|
|
3396
|
+
i.beginPath();
|
|
3397
|
+
for (let Y = 0; Y < 8; Y++) {
|
|
3398
|
+
const ee = Math.PI / 4 * Y - Math.PI / 2, ae = I + Math.cos(ee) * Z, we = R + Math.sin(ee) * J;
|
|
3399
|
+
Y === 0 ? i.moveTo(ae, we) : i.lineTo(ae, we);
|
|
3400
|
+
}
|
|
3401
|
+
i.closePath(), i.fillStyle = S, i.fill(), i.strokeStyle = E, i.lineWidth = T, i.stroke();
|
|
3402
|
+
}, []), et = H((i, c) => {
|
|
3403
|
+
const {
|
|
3404
|
+
startX: p,
|
|
3405
|
+
startY: f,
|
|
3406
|
+
endX: C,
|
|
3407
|
+
endY: _,
|
|
3408
|
+
fillColor: S = "#000",
|
|
3409
|
+
strokeColor: E = "#000",
|
|
3410
|
+
lineWidth: T = 2
|
|
3411
|
+
} = c, I = 15, R = Math.atan2(_ - f, C - p);
|
|
3412
|
+
i.beginPath(), i.moveTo(p, f), i.lineTo(C, _), i.strokeStyle = E, i.lineWidth = T, i.stroke(), i.beginPath(), i.moveTo(C, _), i.lineTo(
|
|
3413
|
+
C - I * Math.cos(R - Math.PI / 6),
|
|
3414
|
+
_ - I * Math.sin(R - Math.PI / 6)
|
|
3415
|
+
), i.lineTo(
|
|
3416
|
+
C - I * Math.cos(R + Math.PI / 6),
|
|
3417
|
+
_ - I * Math.sin(R + Math.PI / 6)
|
|
3418
|
+
), i.closePath(), i.fillStyle = S, i.fill();
|
|
3419
|
+
}, []), tt = xe({}), Mt = xe(null), tr = H((i, c) => {
|
|
3420
|
+
const { x: p, y: f, width: C, height: _, src: S } = c;
|
|
3421
|
+
if (tt.current[S]) {
|
|
3422
|
+
const E = tt.current[S];
|
|
3423
|
+
E.complete && i.drawImage(E, p, f, C, _);
|
|
3424
|
+
} else {
|
|
3425
|
+
const E = new Image();
|
|
3426
|
+
E.onload = () => {
|
|
3427
|
+
tt.current[S] = E, Mt.current && Mt.current();
|
|
3428
|
+
}, E.src = S, tt.current[S] = E;
|
|
3429
|
+
}
|
|
3430
|
+
}, []), rt = H(
|
|
3431
|
+
(i, c) => {
|
|
3432
|
+
switch (c.type) {
|
|
3433
|
+
case "rectangle":
|
|
3434
|
+
$e(i, c);
|
|
3435
|
+
break;
|
|
3436
|
+
case "circle":
|
|
3437
|
+
Ue(i, c);
|
|
3438
|
+
break;
|
|
3439
|
+
case "pencil":
|
|
3440
|
+
He(i, c);
|
|
3441
|
+
break;
|
|
3442
|
+
case "text":
|
|
3443
|
+
er(i, c);
|
|
3444
|
+
break;
|
|
3445
|
+
case "triangle":
|
|
3446
|
+
Ge(i, c);
|
|
3447
|
+
break;
|
|
3448
|
+
case "diamond":
|
|
3449
|
+
qe(i, c);
|
|
3450
|
+
break;
|
|
3451
|
+
case "star":
|
|
3452
|
+
Ke(i, c);
|
|
3453
|
+
break;
|
|
3454
|
+
case "heart":
|
|
3455
|
+
Ze(i, c);
|
|
3456
|
+
break;
|
|
3457
|
+
case "hexagon":
|
|
3458
|
+
Je(i, c);
|
|
3459
|
+
break;
|
|
3460
|
+
case "octagon":
|
|
3461
|
+
Qe(i, c);
|
|
3462
|
+
break;
|
|
3463
|
+
case "arrow":
|
|
3464
|
+
et(i, c);
|
|
3465
|
+
break;
|
|
3466
|
+
case "image":
|
|
3467
|
+
tr(i, c);
|
|
3468
|
+
break;
|
|
3469
|
+
}
|
|
3470
|
+
},
|
|
3471
|
+
[
|
|
3472
|
+
$e,
|
|
3473
|
+
Ue,
|
|
3474
|
+
He,
|
|
3475
|
+
er,
|
|
3476
|
+
Ge,
|
|
3477
|
+
qe,
|
|
3478
|
+
Ke,
|
|
3479
|
+
Ze,
|
|
3480
|
+
Je,
|
|
3481
|
+
Qe,
|
|
3482
|
+
et,
|
|
3483
|
+
tr
|
|
3484
|
+
]
|
|
3485
|
+
), on = H(() => {
|
|
3486
|
+
const i = l.current;
|
|
3487
|
+
if (!i) return;
|
|
3488
|
+
const c = document.createElement("canvas");
|
|
3489
|
+
c.width = i.width, c.height = i.height;
|
|
3490
|
+
const p = c.getContext("2d");
|
|
3491
|
+
p.fillStyle = "#ffffff", p.fillRect(0, 0, c.width, c.height), p.save(), p.translate(d.panX, d.panY), p.scale(d.zoom, d.zoom), w.forEach((_) => {
|
|
3492
|
+
rt(p, _);
|
|
3493
|
+
}), p.restore();
|
|
3494
|
+
const f = c.toDataURL("image/png"), C = document.createElement("a");
|
|
3495
|
+
C.download = `whiteboard-${Date.now()}.png`, C.href = f, C.click();
|
|
3496
|
+
}, [d, w, rt]), jt = H(
|
|
3497
|
+
(i, c) => {
|
|
3498
|
+
for (let p = w.length - 1; p >= 0; p--) {
|
|
3499
|
+
const f = w[p];
|
|
3500
|
+
if (f.type === "rectangle") {
|
|
3501
|
+
if (i >= f.x && i <= f.x + f.width && c >= f.y && c <= f.y + f.height)
|
|
3502
|
+
return f;
|
|
3503
|
+
} else if (f.type === "circle") {
|
|
3504
|
+
if (Math.sqrt(
|
|
3505
|
+
Math.pow(i - f.centerX, 2) + Math.pow(c - f.centerY, 2)
|
|
3506
|
+
) <= f.radius)
|
|
3507
|
+
return f;
|
|
3508
|
+
} else if (f.type === "pencil")
|
|
3509
|
+
for (let _ = 1; _ < f.points.length; _++) {
|
|
3510
|
+
const S = f.points[_ - 1], E = f.points[_];
|
|
3511
|
+
if (rr(
|
|
3512
|
+
i,
|
|
3513
|
+
c,
|
|
3514
|
+
S.x,
|
|
3515
|
+
S.y,
|
|
3516
|
+
E.x,
|
|
3517
|
+
E.y
|
|
3518
|
+
) <= 5)
|
|
3519
|
+
return f;
|
|
3520
|
+
}
|
|
3521
|
+
else if (f.type === "text") {
|
|
3522
|
+
const C = f.fontSize || 16, _ = f.text.length * C * 0.6, S = C;
|
|
3523
|
+
if (i >= f.x && i <= f.x + _ && c >= f.y && c <= f.y + S)
|
|
3524
|
+
return f;
|
|
3525
|
+
} else if (f.type === "triangle" || f.type === "diamond" || f.type === "hexagon" || f.type === "octagon") {
|
|
3526
|
+
if (i >= f.x && i <= f.x + f.width && c >= f.y && c <= f.y + f.height)
|
|
3527
|
+
return f;
|
|
3528
|
+
} else if (f.type === "star" || f.type === "heart") {
|
|
3529
|
+
if (Math.sqrt(
|
|
3530
|
+
Math.pow(i - f.centerX, 2) + Math.pow(c - f.centerY, 2)
|
|
3531
|
+
) <= f.size)
|
|
3532
|
+
return f;
|
|
3533
|
+
} else if (f.type === "arrow") {
|
|
3534
|
+
if (rr(
|
|
3535
|
+
i,
|
|
3536
|
+
c,
|
|
3537
|
+
f.startX,
|
|
3538
|
+
f.startY,
|
|
3539
|
+
f.endX,
|
|
3540
|
+
f.endY
|
|
3541
|
+
) <= 10)
|
|
3542
|
+
return f;
|
|
3543
|
+
} else if (f.type === "image" && i >= f.x && i <= f.x + f.width && c >= f.y && c <= f.y + f.height)
|
|
3544
|
+
return f;
|
|
3545
|
+
}
|
|
3546
|
+
return null;
|
|
3547
|
+
},
|
|
3548
|
+
[w]
|
|
3549
|
+
), rr = (i, c, p, f, C, _) => {
|
|
3550
|
+
const S = i - p, E = c - f, T = C - p, I = _ - f, R = S * T + E * I, Z = T * T + I * I;
|
|
3551
|
+
let J = -1;
|
|
3552
|
+
Z !== 0 && (J = R / Z);
|
|
3553
|
+
let Y, ee;
|
|
3554
|
+
J < 0 ? (Y = p, ee = f) : J > 1 ? (Y = C, ee = _) : (Y = p + J * T, ee = f + J * I);
|
|
3555
|
+
const ae = i - Y, we = c - ee;
|
|
3556
|
+
return Math.sqrt(ae * ae + we * we);
|
|
3557
|
+
}, nr = H((i, c) => {
|
|
3558
|
+
if (i.strokeStyle = "#0066cc", i.lineWidth = 2, i.setLineDash([5, 5]), c.type === "rectangle")
|
|
3559
|
+
i.strokeRect(
|
|
3560
|
+
c.x - 4,
|
|
3561
|
+
c.y - 4,
|
|
3562
|
+
c.width + 8,
|
|
3563
|
+
c.height + 8
|
|
3564
|
+
);
|
|
3565
|
+
else if (c.type === "circle")
|
|
3566
|
+
i.beginPath(), i.arc(
|
|
3567
|
+
c.centerX,
|
|
3568
|
+
c.centerY,
|
|
3569
|
+
c.radius + 4,
|
|
3570
|
+
0,
|
|
3571
|
+
Math.PI * 2
|
|
3572
|
+
), i.stroke();
|
|
3573
|
+
else if (c.type === "pencil" && c.points.length > 0) {
|
|
3574
|
+
const p = Math.min(...c.points.map((S) => S.x)), f = Math.max(...c.points.map((S) => S.x)), C = Math.min(...c.points.map((S) => S.y)), _ = Math.max(...c.points.map((S) => S.y));
|
|
3575
|
+
i.strokeRect(p - 4, C - 4, f - p + 8, _ - C + 8);
|
|
3576
|
+
} else if (c.type === "text") {
|
|
3577
|
+
const p = c.fontSize || 16, f = c.text.length * p * 0.6, C = p;
|
|
3578
|
+
i.strokeRect(
|
|
3579
|
+
c.x - 4,
|
|
3580
|
+
c.y - 4,
|
|
3581
|
+
f + 8,
|
|
3582
|
+
C + 8
|
|
3583
|
+
);
|
|
3584
|
+
} else if (c.type === "triangle" || c.type === "diamond" || c.type === "hexagon" || c.type === "octagon")
|
|
3585
|
+
i.strokeRect(
|
|
3586
|
+
c.x - 4,
|
|
3587
|
+
c.y - 4,
|
|
3588
|
+
c.width + 8,
|
|
3589
|
+
c.height + 8
|
|
3590
|
+
);
|
|
3591
|
+
else if (c.type === "star" || c.type === "heart")
|
|
3592
|
+
i.beginPath(), i.arc(
|
|
3593
|
+
c.centerX,
|
|
3594
|
+
c.centerY,
|
|
3595
|
+
c.size + 4,
|
|
3596
|
+
0,
|
|
3597
|
+
Math.PI * 2
|
|
3598
|
+
), i.stroke();
|
|
3599
|
+
else if (c.type === "arrow") {
|
|
3600
|
+
const p = Math.min(c.startX, c.endX), f = Math.max(c.startX, c.endX), C = Math.min(c.startY, c.endY), _ = Math.max(c.startY, c.endY);
|
|
3601
|
+
i.strokeRect(p - 4, C - 4, f - p + 8, _ - C + 8);
|
|
3602
|
+
} else c.type === "image" && i.strokeRect(
|
|
3603
|
+
c.x - 4,
|
|
3604
|
+
c.y - 4,
|
|
3605
|
+
c.width + 8,
|
|
3606
|
+
c.height + 8
|
|
3607
|
+
);
|
|
3608
|
+
i.setLineDash([]);
|
|
3609
|
+
}, []), he = H(() => {
|
|
3610
|
+
const i = l.current;
|
|
3611
|
+
if (!i) return;
|
|
3612
|
+
const c = i.getContext("2d");
|
|
3613
|
+
c.clearRect(0, 0, i.width, i.height), c.save(), c.translate(d.panX, d.panY), c.scale(d.zoom, d.zoom), y.enabled && Be(c, y.size, y.color), w.forEach((p) => {
|
|
3614
|
+
rt(c, p), p.id === k && nr(c, p);
|
|
3615
|
+
}), c.restore();
|
|
3616
|
+
}, [
|
|
3617
|
+
y,
|
|
3618
|
+
Be,
|
|
3619
|
+
w,
|
|
3620
|
+
rt,
|
|
3621
|
+
k,
|
|
3622
|
+
nr,
|
|
3623
|
+
d
|
|
3624
|
+
]);
|
|
3625
|
+
le(() => {
|
|
3626
|
+
Mt.current = he;
|
|
3627
|
+
}, [he]), le(() => {
|
|
3628
|
+
const i = l.current;
|
|
3629
|
+
if (!i) return;
|
|
3630
|
+
const c = () => {
|
|
3631
|
+
i.width = window.innerWidth, i.height = window.innerHeight, he();
|
|
3632
|
+
};
|
|
3633
|
+
return c(), window.addEventListener("resize", c), () => {
|
|
3634
|
+
window.removeEventListener("resize", c);
|
|
3635
|
+
};
|
|
3636
|
+
}, [he]), le(() => {
|
|
3637
|
+
he();
|
|
3638
|
+
}, [he]), le(() => {
|
|
3639
|
+
const i = (p) => {
|
|
3640
|
+
p.target.tagName === "INPUT" || p.target.tagName === "TEXTAREA" || p.code === "Space" && !p.repeat && (p.preventDefault(), Oe(!0));
|
|
3641
|
+
}, c = (p) => {
|
|
3642
|
+
p.target.tagName === "INPUT" || p.target.tagName === "TEXTAREA" || p.code === "Space" && (p.preventDefault(), Oe(!1), Ee(!1), Ne(!1));
|
|
3643
|
+
};
|
|
3644
|
+
return window.addEventListener("keydown", i), window.addEventListener("keyup", c), () => {
|
|
3645
|
+
window.removeEventListener("keydown", i), window.removeEventListener("keyup", c);
|
|
3646
|
+
};
|
|
3647
|
+
}, []);
|
|
3648
|
+
const Ot = H(
|
|
3649
|
+
(i, c) => ({
|
|
3650
|
+
x: (i - d.panX) / d.zoom,
|
|
3651
|
+
y: (c - d.panY) / d.zoom
|
|
3652
|
+
}),
|
|
3653
|
+
[d]
|
|
3654
|
+
);
|
|
3655
|
+
le(() => {
|
|
3656
|
+
const i = l.current;
|
|
3657
|
+
if (!i || !N) return;
|
|
3658
|
+
const c = i.getContext("2d");
|
|
3659
|
+
if (he(), c.save(), c.translate(d.panX, d.panY), c.scale(d.zoom, d.zoom), h === "pointer")
|
|
3660
|
+
Qt(c, x, m);
|
|
3661
|
+
else if (h === "rectangle") {
|
|
3662
|
+
const p = Math.min(x.x, m.x), f = Math.min(x.y, m.y), C = Math.abs(m.x - x.x), _ = Math.abs(m.y - x.y);
|
|
3663
|
+
$e(c, {
|
|
3664
|
+
x: p,
|
|
3665
|
+
y: f,
|
|
3666
|
+
width: C,
|
|
3667
|
+
height: _,
|
|
3668
|
+
strokeColor: g.rectangle.strokeColor,
|
|
3669
|
+
fillColor: g.rectangle.fillColor,
|
|
3670
|
+
lineWidth: g.rectangle.lineWidth
|
|
3671
|
+
});
|
|
3672
|
+
} else if (h === "circle") {
|
|
3673
|
+
const p = x.x, f = x.y, C = Math.sqrt(
|
|
3674
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
3675
|
+
);
|
|
3676
|
+
Ue(c, {
|
|
3677
|
+
centerX: p,
|
|
3678
|
+
centerY: f,
|
|
3679
|
+
radius: C,
|
|
3680
|
+
strokeColor: g.circle.strokeColor,
|
|
3681
|
+
fillColor: g.circle.fillColor,
|
|
3682
|
+
lineWidth: g.circle.lineWidth
|
|
3683
|
+
});
|
|
3684
|
+
} else if (h === "pencil")
|
|
3685
|
+
He(c, {
|
|
3686
|
+
points: O,
|
|
3687
|
+
strokeColor: g.pencil.strokeColor,
|
|
3688
|
+
lineWidth: g.pencil.lineWidth
|
|
3689
|
+
});
|
|
3690
|
+
else if (h === "triangle") {
|
|
3691
|
+
const p = Math.min(x.x, m.x), f = Math.min(x.y, m.y), C = Math.abs(m.x - x.x), _ = Math.abs(m.y - x.y);
|
|
3692
|
+
Ge(c, {
|
|
3693
|
+
x: p,
|
|
3694
|
+
y: f,
|
|
3695
|
+
width: C,
|
|
3696
|
+
height: _,
|
|
3697
|
+
strokeColor: g.triangle.strokeColor,
|
|
3698
|
+
fillColor: g.triangle.fillColor,
|
|
3699
|
+
lineWidth: g.triangle.lineWidth
|
|
3700
|
+
});
|
|
3701
|
+
} else if (h === "diamond") {
|
|
3702
|
+
const p = Math.min(x.x, m.x), f = Math.min(x.y, m.y), C = Math.abs(m.x - x.x), _ = Math.abs(m.y - x.y);
|
|
3703
|
+
qe(c, {
|
|
3704
|
+
x: p,
|
|
3705
|
+
y: f,
|
|
3706
|
+
width: C,
|
|
3707
|
+
height: _,
|
|
3708
|
+
strokeColor: g.diamond.strokeColor,
|
|
3709
|
+
fillColor: g.diamond.fillColor,
|
|
3710
|
+
lineWidth: g.diamond.lineWidth
|
|
3711
|
+
});
|
|
3712
|
+
} else if (h === "star") {
|
|
3713
|
+
const p = x.x, f = x.y, C = Math.sqrt(
|
|
3714
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
3715
|
+
);
|
|
3716
|
+
Ke(c, {
|
|
3717
|
+
centerX: p,
|
|
3718
|
+
centerY: f,
|
|
3719
|
+
size: C,
|
|
3720
|
+
strokeColor: g.star.strokeColor,
|
|
3721
|
+
fillColor: g.star.fillColor,
|
|
3722
|
+
lineWidth: g.star.lineWidth
|
|
3723
|
+
});
|
|
3724
|
+
} else if (h === "heart") {
|
|
3725
|
+
const p = x.x, f = x.y, C = Math.sqrt(
|
|
3726
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
3727
|
+
);
|
|
3728
|
+
Ze(c, {
|
|
3729
|
+
centerX: p,
|
|
3730
|
+
centerY: f,
|
|
3731
|
+
size: C,
|
|
3732
|
+
strokeColor: g.heart.strokeColor,
|
|
3733
|
+
fillColor: g.heart.fillColor,
|
|
3734
|
+
lineWidth: g.heart.lineWidth
|
|
3735
|
+
});
|
|
3736
|
+
} else if (h === "hexagon") {
|
|
3737
|
+
const p = Math.min(x.x, m.x), f = Math.min(x.y, m.y), C = Math.abs(m.x - x.x), _ = Math.abs(m.y - x.y);
|
|
3738
|
+
Je(c, {
|
|
3739
|
+
x: p,
|
|
3740
|
+
y: f,
|
|
3741
|
+
width: C,
|
|
3742
|
+
height: _,
|
|
3743
|
+
strokeColor: g.hexagon.strokeColor,
|
|
3744
|
+
fillColor: g.hexagon.fillColor,
|
|
3745
|
+
lineWidth: g.hexagon.lineWidth
|
|
3746
|
+
});
|
|
3747
|
+
} else if (h === "octagon") {
|
|
3748
|
+
const p = Math.min(x.x, m.x), f = Math.min(x.y, m.y), C = Math.abs(m.x - x.x), _ = Math.abs(m.y - x.y);
|
|
3749
|
+
Qe(c, {
|
|
3750
|
+
x: p,
|
|
3751
|
+
y: f,
|
|
3752
|
+
width: C,
|
|
3753
|
+
height: _,
|
|
3754
|
+
strokeColor: g.octagon.strokeColor,
|
|
3755
|
+
fillColor: g.octagon.fillColor,
|
|
3756
|
+
lineWidth: g.octagon.lineWidth
|
|
3757
|
+
});
|
|
3758
|
+
} else h === "arrow" && et(c, {
|
|
3759
|
+
startX: x.x,
|
|
3760
|
+
startY: x.y,
|
|
3761
|
+
endX: m.x,
|
|
3762
|
+
endY: m.y,
|
|
3763
|
+
strokeColor: g.arrow.strokeColor,
|
|
3764
|
+
fillColor: g.arrow.fillColor,
|
|
3765
|
+
lineWidth: g.arrow.lineWidth
|
|
3766
|
+
});
|
|
3767
|
+
c.restore();
|
|
3768
|
+
}, [
|
|
3769
|
+
N,
|
|
3770
|
+
h,
|
|
3771
|
+
x,
|
|
3772
|
+
m,
|
|
3773
|
+
O,
|
|
3774
|
+
he,
|
|
3775
|
+
Qt,
|
|
3776
|
+
$e,
|
|
3777
|
+
Ue,
|
|
3778
|
+
He,
|
|
3779
|
+
Ge,
|
|
3780
|
+
qe,
|
|
3781
|
+
Ke,
|
|
3782
|
+
Ze,
|
|
3783
|
+
Je,
|
|
3784
|
+
Qe,
|
|
3785
|
+
et,
|
|
3786
|
+
d,
|
|
3787
|
+
g
|
|
3788
|
+
]);
|
|
3789
|
+
const sn = (i) => {
|
|
3790
|
+
const p = l.current.getBoundingClientRect(), f = i.clientX - p.left, C = i.clientY - p.top;
|
|
3791
|
+
if (j || D)
|
|
3792
|
+
return;
|
|
3793
|
+
if (de) {
|
|
3794
|
+
i.preventDefault(), i.button === 0 ? (Ee(!0), Xe({ x: f - d.panX, y: C - d.panY })) : i.button === 2 && (Ne(!0), b({ y: C, initialZoom: d.zoom }));
|
|
3795
|
+
return;
|
|
3796
|
+
}
|
|
3797
|
+
const { x: _, y: S } = Ot(f, C);
|
|
3798
|
+
if (h === "pointer") {
|
|
3799
|
+
const E = jt(_, S);
|
|
3800
|
+
if (E)
|
|
3801
|
+
if (a(Ae(E.id)), L(!0), E.type === "rectangle")
|
|
3802
|
+
oe({ x: _ - E.x, y: S - E.y });
|
|
3803
|
+
else if (E.type === "circle")
|
|
3804
|
+
oe({
|
|
3805
|
+
x: _ - E.centerX,
|
|
3806
|
+
y: S - E.centerY
|
|
3807
|
+
});
|
|
3808
|
+
else if (E.type === "pencil") {
|
|
3809
|
+
const T = Math.min(...E.points.map((R) => R.x)), I = Math.min(...E.points.map((R) => R.y));
|
|
3810
|
+
oe({ x: _ - T, y: S - I });
|
|
3811
|
+
} else E.type === "text" ? oe({ x: _ - E.x, y: S - E.y }) : E.type === "triangle" || E.type === "diamond" || E.type === "hexagon" || E.type === "octagon" ? oe({ x: _ - E.x, y: S - E.y }) : E.type === "star" || E.type === "heart" ? oe({
|
|
3812
|
+
x: _ - E.centerX,
|
|
3813
|
+
y: S - E.centerY
|
|
3814
|
+
}) : E.type === "arrow" ? oe({
|
|
3815
|
+
x: _ - E.startX,
|
|
3816
|
+
y: S - E.startY
|
|
3817
|
+
}) : E.type === "image" && oe({ x: _ - E.x, y: S - E.y });
|
|
3818
|
+
else
|
|
3819
|
+
a(Ae(null)), P(!0), z({ x: _, y: S }), v({ x: _, y: S });
|
|
3820
|
+
} else if (h === "text") {
|
|
3821
|
+
const E = Date.now().toString();
|
|
3822
|
+
a(
|
|
3823
|
+
ie({
|
|
3824
|
+
id: E,
|
|
3825
|
+
type: "text",
|
|
3826
|
+
x: _,
|
|
3827
|
+
y: S,
|
|
3828
|
+
text: "Text",
|
|
3829
|
+
fontSize: g.text.fontSize,
|
|
3830
|
+
fontColor: g.text.fontColor
|
|
3831
|
+
})
|
|
3832
|
+
), a(pe("pointer")), a(Ae(E));
|
|
3833
|
+
} else if (h === "eraser") {
|
|
3834
|
+
const E = jt(_, S);
|
|
3835
|
+
E && a(Bo(E.id));
|
|
3836
|
+
} else
|
|
3837
|
+
a(Ae(null)), P(!0), z({ x: _, y: S }), v({ x: _, y: S }), h === "pencil" && F([{ x: _, y: S }]);
|
|
3838
|
+
}, an = (i) => {
|
|
3839
|
+
const p = l.current.getBoundingClientRect(), f = i.clientX - p.left, C = i.clientY - p.top;
|
|
3840
|
+
if (Te) {
|
|
3841
|
+
a(
|
|
3842
|
+
$o({
|
|
3843
|
+
x: f - Pe.x,
|
|
3844
|
+
y: C - Pe.y
|
|
3845
|
+
})
|
|
3846
|
+
);
|
|
3847
|
+
return;
|
|
3848
|
+
}
|
|
3849
|
+
if (Se) {
|
|
3850
|
+
const E = De.y - C, I = De.initialZoom * (1 + E * 5e-3);
|
|
3851
|
+
a(Uo(I));
|
|
3852
|
+
return;
|
|
3853
|
+
}
|
|
3854
|
+
const { x: _, y: S } = Ot(f, C);
|
|
3855
|
+
if (U && k) {
|
|
3856
|
+
const E = w.find(
|
|
3857
|
+
(I) => I.id === k
|
|
3858
|
+
);
|
|
3859
|
+
if (!E) return;
|
|
3860
|
+
let T = {};
|
|
3861
|
+
if (E.type === "rectangle")
|
|
3862
|
+
T = {
|
|
3863
|
+
x: _ - X.x,
|
|
3864
|
+
y: S - X.y
|
|
3865
|
+
};
|
|
3866
|
+
else if (E.type === "circle")
|
|
3867
|
+
T = {
|
|
3868
|
+
centerX: _ - X.x,
|
|
3869
|
+
centerY: S - X.y
|
|
3870
|
+
};
|
|
3871
|
+
else if (E.type === "pencil") {
|
|
3872
|
+
const I = Math.min(...E.points.map((Y) => Y.x)), R = Math.min(...E.points.map((Y) => Y.y)), Z = _ - X.x - I, J = S - X.y - R;
|
|
3873
|
+
T = {
|
|
3874
|
+
points: E.points.map((Y) => ({
|
|
3875
|
+
x: Y.x + Z,
|
|
3876
|
+
y: Y.y + J
|
|
3877
|
+
}))
|
|
3878
|
+
};
|
|
3879
|
+
} else if (E.type === "text")
|
|
3880
|
+
T = {
|
|
3881
|
+
x: _ - X.x,
|
|
3882
|
+
y: S - X.y
|
|
3883
|
+
};
|
|
3884
|
+
else if (E.type === "triangle" || E.type === "diamond" || E.type === "hexagon" || E.type === "octagon")
|
|
3885
|
+
T = {
|
|
3886
|
+
x: _ - X.x,
|
|
3887
|
+
y: S - X.y
|
|
3888
|
+
};
|
|
3889
|
+
else if (E.type === "star" || E.type === "heart")
|
|
3890
|
+
T = {
|
|
3891
|
+
centerX: _ - X.x,
|
|
3892
|
+
centerY: S - X.y
|
|
3893
|
+
};
|
|
3894
|
+
else if (E.type === "arrow") {
|
|
3895
|
+
const I = E.endX - E.startX, R = E.endY - E.startY;
|
|
3896
|
+
T = {
|
|
3897
|
+
startX: _ - X.x,
|
|
3898
|
+
startY: S - X.y,
|
|
3899
|
+
endX: _ - X.x + I,
|
|
3900
|
+
endY: S - X.y + R
|
|
3901
|
+
};
|
|
3902
|
+
} else E.type === "image" && (T = {
|
|
3903
|
+
x: _ - X.x,
|
|
3904
|
+
y: S - X.y
|
|
3905
|
+
});
|
|
3906
|
+
a(dt({ id: k, updates: T }));
|
|
3907
|
+
return;
|
|
3908
|
+
}
|
|
3909
|
+
N && (v({ x: _, y: S }), h === "pencil" && F((E) => [...E, { x: _, y: S }]));
|
|
3910
|
+
}, or = () => {
|
|
3911
|
+
if (Te || Se) {
|
|
3912
|
+
Ee(!1), Ne(!1);
|
|
3913
|
+
return;
|
|
3914
|
+
}
|
|
3915
|
+
if (U) {
|
|
3916
|
+
L(!1);
|
|
3917
|
+
return;
|
|
3918
|
+
}
|
|
3919
|
+
if (N) {
|
|
3920
|
+
if (h === "pointer")
|
|
3921
|
+
he();
|
|
3922
|
+
else if (h === "rectangle") {
|
|
3923
|
+
const i = Math.min(x.x, m.x), c = Math.min(x.y, m.y), p = Math.abs(m.x - x.x), f = Math.abs(m.y - x.y);
|
|
3924
|
+
p > 0 && f > 0 && a(
|
|
3925
|
+
ie({
|
|
3926
|
+
id: Date.now().toString(),
|
|
3927
|
+
type: "rectangle",
|
|
3928
|
+
x: i,
|
|
3929
|
+
y: c,
|
|
3930
|
+
width: p,
|
|
3931
|
+
height: f,
|
|
3932
|
+
strokeColor: g.rectangle.strokeColor,
|
|
3933
|
+
fillColor: g.rectangle.fillColor,
|
|
3934
|
+
lineWidth: g.rectangle.lineWidth
|
|
3935
|
+
})
|
|
3936
|
+
);
|
|
3937
|
+
} else if (h === "circle") {
|
|
3938
|
+
const i = x.x, c = x.y, p = Math.sqrt(
|
|
3939
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
3940
|
+
);
|
|
3941
|
+
p > 0 && a(
|
|
3942
|
+
ie({
|
|
3943
|
+
id: Date.now().toString(),
|
|
3944
|
+
type: "circle",
|
|
3945
|
+
centerX: i,
|
|
3946
|
+
centerY: c,
|
|
3947
|
+
radius: p,
|
|
3948
|
+
strokeColor: g.circle.strokeColor,
|
|
3949
|
+
fillColor: g.circle.fillColor,
|
|
3950
|
+
lineWidth: g.circle.lineWidth
|
|
3951
|
+
})
|
|
3952
|
+
);
|
|
3953
|
+
} else if (h === "pencil")
|
|
3954
|
+
O.length > 1 && a(
|
|
3955
|
+
ie({
|
|
3956
|
+
id: Date.now().toString(),
|
|
3957
|
+
type: "pencil",
|
|
3958
|
+
points: [...O],
|
|
3959
|
+
strokeColor: g.pencil.strokeColor,
|
|
3960
|
+
lineWidth: g.pencil.lineWidth
|
|
3961
|
+
})
|
|
3962
|
+
), F([]);
|
|
3963
|
+
else if (h === "triangle") {
|
|
3964
|
+
const i = Math.min(x.x, m.x), c = Math.min(x.y, m.y), p = Math.abs(m.x - x.x), f = Math.abs(m.y - x.y);
|
|
3965
|
+
p > 0 && f > 0 && a(
|
|
3966
|
+
ie({
|
|
3967
|
+
id: Date.now().toString(),
|
|
3968
|
+
type: "triangle",
|
|
3969
|
+
x: i,
|
|
3970
|
+
y: c,
|
|
3971
|
+
width: p,
|
|
3972
|
+
height: f,
|
|
3973
|
+
strokeColor: g.triangle.strokeColor,
|
|
3974
|
+
fillColor: g.triangle.fillColor,
|
|
3975
|
+
lineWidth: g.triangle.lineWidth
|
|
3976
|
+
})
|
|
3977
|
+
);
|
|
3978
|
+
} else if (h === "diamond") {
|
|
3979
|
+
const i = Math.min(x.x, m.x), c = Math.min(x.y, m.y), p = Math.abs(m.x - x.x), f = Math.abs(m.y - x.y);
|
|
3980
|
+
p > 0 && f > 0 && a(
|
|
3981
|
+
ie({
|
|
3982
|
+
id: Date.now().toString(),
|
|
3983
|
+
type: "diamond",
|
|
3984
|
+
x: i,
|
|
3985
|
+
y: c,
|
|
3986
|
+
width: p,
|
|
3987
|
+
height: f,
|
|
3988
|
+
strokeColor: g.diamond.strokeColor,
|
|
3989
|
+
fillColor: g.diamond.fillColor,
|
|
3990
|
+
lineWidth: g.diamond.lineWidth
|
|
3991
|
+
})
|
|
3992
|
+
);
|
|
3993
|
+
} else if (h === "star") {
|
|
3994
|
+
const i = x.x, c = x.y, p = Math.sqrt(
|
|
3995
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
3996
|
+
);
|
|
3997
|
+
p > 0 && a(
|
|
3998
|
+
ie({
|
|
3999
|
+
id: Date.now().toString(),
|
|
4000
|
+
type: "star",
|
|
4001
|
+
centerX: i,
|
|
4002
|
+
centerY: c,
|
|
4003
|
+
size: p,
|
|
4004
|
+
strokeColor: g.star.strokeColor,
|
|
4005
|
+
fillColor: g.star.fillColor,
|
|
4006
|
+
lineWidth: g.star.lineWidth
|
|
4007
|
+
})
|
|
4008
|
+
);
|
|
4009
|
+
} else if (h === "heart") {
|
|
4010
|
+
const i = x.x, c = x.y, p = Math.sqrt(
|
|
4011
|
+
Math.pow(m.x - x.x, 2) + Math.pow(m.y - x.y, 2)
|
|
4012
|
+
);
|
|
4013
|
+
p > 0 && a(
|
|
4014
|
+
ie({
|
|
4015
|
+
id: Date.now().toString(),
|
|
4016
|
+
type: "heart",
|
|
4017
|
+
centerX: i,
|
|
4018
|
+
centerY: c,
|
|
4019
|
+
size: p,
|
|
4020
|
+
strokeColor: g.heart.strokeColor,
|
|
4021
|
+
fillColor: g.heart.fillColor,
|
|
4022
|
+
lineWidth: g.heart.lineWidth
|
|
4023
|
+
})
|
|
4024
|
+
);
|
|
4025
|
+
} else if (h === "hexagon") {
|
|
4026
|
+
const i = Math.min(x.x, m.x), c = Math.min(x.y, m.y), p = Math.abs(m.x - x.x), f = Math.abs(m.y - x.y);
|
|
4027
|
+
p > 0 && f > 0 && a(
|
|
4028
|
+
ie({
|
|
4029
|
+
id: Date.now().toString(),
|
|
4030
|
+
type: "hexagon",
|
|
4031
|
+
x: i,
|
|
4032
|
+
y: c,
|
|
4033
|
+
width: p,
|
|
4034
|
+
height: f,
|
|
4035
|
+
strokeColor: g.hexagon.strokeColor,
|
|
4036
|
+
fillColor: g.hexagon.fillColor,
|
|
4037
|
+
lineWidth: g.hexagon.lineWidth
|
|
4038
|
+
})
|
|
4039
|
+
);
|
|
4040
|
+
} else if (h === "octagon") {
|
|
4041
|
+
const i = Math.min(x.x, m.x), c = Math.min(x.y, m.y), p = Math.abs(m.x - x.x), f = Math.abs(m.y - x.y);
|
|
4042
|
+
p > 0 && f > 0 && a(
|
|
4043
|
+
ie({
|
|
4044
|
+
id: Date.now().toString(),
|
|
4045
|
+
type: "octagon",
|
|
4046
|
+
x: i,
|
|
4047
|
+
y: c,
|
|
4048
|
+
width: p,
|
|
4049
|
+
height: f,
|
|
4050
|
+
strokeColor: g.octagon.strokeColor,
|
|
4051
|
+
fillColor: g.octagon.fillColor,
|
|
4052
|
+
lineWidth: g.octagon.lineWidth
|
|
4053
|
+
})
|
|
4054
|
+
);
|
|
4055
|
+
} else if (h === "arrow") {
|
|
4056
|
+
const i = m.x - x.x, c = m.y - x.y;
|
|
4057
|
+
Math.sqrt(i * i + c * c) > 5 && a(
|
|
4058
|
+
ie({
|
|
4059
|
+
id: Date.now().toString(),
|
|
4060
|
+
type: "arrow",
|
|
4061
|
+
startX: x.x,
|
|
4062
|
+
startY: x.y,
|
|
4063
|
+
endX: m.x,
|
|
4064
|
+
endY: m.y,
|
|
4065
|
+
strokeColor: g.arrow.strokeColor,
|
|
4066
|
+
fillColor: g.arrow.fillColor,
|
|
4067
|
+
lineWidth: g.arrow.lineWidth
|
|
4068
|
+
})
|
|
4069
|
+
);
|
|
4070
|
+
}
|
|
4071
|
+
P(!1);
|
|
4072
|
+
}
|
|
4073
|
+
}, cn = (i) => {
|
|
4074
|
+
de && i.preventDefault();
|
|
4075
|
+
}, ln = () => de ? Te ? "grabbing" : Se ? "ns-resize" : "grab" : "default";
|
|
4076
|
+
return /* @__PURE__ */ u.jsxs("div", { style: { position: "relative", width: "100%", height: "100%" }, children: [
|
|
4077
|
+
/* @__PURE__ */ u.jsx(
|
|
4078
|
+
"canvas",
|
|
4079
|
+
{
|
|
4080
|
+
ref: l,
|
|
4081
|
+
onMouseDown: sn,
|
|
4082
|
+
onMouseMove: an,
|
|
4083
|
+
onMouseUp: or,
|
|
4084
|
+
onMouseLeave: or,
|
|
4085
|
+
onDoubleClick: (i) => {
|
|
4086
|
+
const p = l.current.getBoundingClientRect(), f = i.clientX - p.left, C = i.clientY - p.top, { x: _, y: S } = Ot(f, C), E = jt(_, S);
|
|
4087
|
+
E && E.type === "text" && (me(E.id), Me({ x: E.x, y: E.y }), V(E.text), A(!0));
|
|
4088
|
+
},
|
|
4089
|
+
onContextMenu: cn,
|
|
4090
|
+
style: { cursor: ln() }
|
|
4091
|
+
}
|
|
4092
|
+
),
|
|
4093
|
+
j && /* @__PURE__ */ u.jsx(bi, { text: n || ((ir = t == null ? void 0 : t.lock) == null ? void 0 : ir.text) || M.text }),
|
|
4094
|
+
D && /* @__PURE__ */ u.jsx(
|
|
4095
|
+
"input",
|
|
4096
|
+
{
|
|
4097
|
+
type: "text",
|
|
4098
|
+
value: fe,
|
|
4099
|
+
onChange: (i) => V(i.target.value),
|
|
4100
|
+
onKeyDown: (i) => {
|
|
4101
|
+
i.key === "Enter" && fe.trim() ? (se && a(
|
|
4102
|
+
dt({
|
|
4103
|
+
id: se,
|
|
4104
|
+
updates: { text: fe }
|
|
4105
|
+
})
|
|
4106
|
+
), A(!1), V(""), me(null)) : i.key === "Escape" && (A(!1), V(""), me(null));
|
|
4107
|
+
},
|
|
4108
|
+
onBlur: () => {
|
|
4109
|
+
fe.trim() && se && a(
|
|
4110
|
+
dt({
|
|
4111
|
+
id: se,
|
|
4112
|
+
updates: { text: fe }
|
|
4113
|
+
})
|
|
4114
|
+
), A(!1), V(""), me(null);
|
|
4115
|
+
},
|
|
4116
|
+
onMouseDown: (i) => i.stopPropagation(),
|
|
4117
|
+
autoFocus: !0,
|
|
4118
|
+
style: {
|
|
4119
|
+
position: "absolute",
|
|
4120
|
+
left: B.x * d.zoom + d.panX,
|
|
4121
|
+
top: B.y * d.zoom + d.panY,
|
|
4122
|
+
fontSize: g.text.fontSize * d.zoom,
|
|
4123
|
+
color: g.text.fontColor,
|
|
4124
|
+
background: "white",
|
|
4125
|
+
border: "2px solid #0066cc",
|
|
4126
|
+
outline: "none",
|
|
4127
|
+
fontFamily: "sans-serif",
|
|
4128
|
+
minWidth: "150px",
|
|
4129
|
+
padding: "4px 8px",
|
|
4130
|
+
zIndex: 1e3,
|
|
4131
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.2)"
|
|
4132
|
+
}
|
|
4133
|
+
}
|
|
4134
|
+
),
|
|
4135
|
+
/* @__PURE__ */ u.jsx(Oi, { onExport: on }),
|
|
4136
|
+
/* @__PURE__ */ u.jsx(Ti, {}),
|
|
4137
|
+
/* @__PURE__ */ u.jsx(ei, {})
|
|
4138
|
+
] });
|
|
4139
|
+
}), Vi = (e) => /* @__PURE__ */ u.jsx(Pn, { store: Qo, children: /* @__PURE__ */ u.jsx(Ln, { children: /* @__PURE__ */ u.jsx(Pi, { ...e }) }) });
|
|
4140
|
+
export {
|
|
4141
|
+
Pi as WhiteboardComponent,
|
|
4142
|
+
Vi as default,
|
|
4143
|
+
Qo as store,
|
|
4144
|
+
Ko as whiteboardReducer
|
|
4145
|
+
};
|