@jeevandev/flow-canvas 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.
@@ -0,0 +1,3034 @@
1
+ import re, { createContext as qt, useContext as ht, useRef as ve, useEffect as ie, useState as Le, useCallback as ge, useMemo as tt } from "react";
2
+ var Ae = { exports: {} }, Ee = {};
3
+ var Et;
4
+ function bn() {
5
+ if (Et) return Ee;
6
+ Et = 1;
7
+ var t = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
8
+ function n(s, r, i) {
9
+ var o = null;
10
+ if (i !== void 0 && (o = "" + i), r.key !== void 0 && (o = "" + r.key), "key" in r) {
11
+ i = {};
12
+ for (var a in r)
13
+ a !== "key" && (i[a] = r[a]);
14
+ } else i = r;
15
+ return r = i.ref, {
16
+ $$typeof: t,
17
+ type: s,
18
+ key: o,
19
+ ref: r !== void 0 ? r : null,
20
+ props: i
21
+ };
22
+ }
23
+ return Ee.Fragment = e, Ee.jsx = n, Ee.jsxs = n, Ee;
24
+ }
25
+ var Se = {};
26
+ var St;
27
+ function wn() {
28
+ return St || (St = 1, process.env.NODE_ENV !== "production" && (function() {
29
+ function t(u) {
30
+ if (u == null) return null;
31
+ if (typeof u == "function")
32
+ return u.$$typeof === M ? null : u.displayName || u.name || null;
33
+ if (typeof u == "string") return u;
34
+ switch (u) {
35
+ case c:
36
+ return "Fragment";
37
+ case p:
38
+ return "Profiler";
39
+ case g:
40
+ return "StrictMode";
41
+ case h:
42
+ return "Suspense";
43
+ case D:
44
+ return "SuspenseList";
45
+ case S:
46
+ return "Activity";
47
+ }
48
+ if (typeof u == "object")
49
+ switch (typeof u.tag == "number" && console.error(
50
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
51
+ ), u.$$typeof) {
52
+ case R:
53
+ return "Portal";
54
+ case _:
55
+ return u.displayName || "Context";
56
+ case b:
57
+ return (u._context.displayName || "Context") + ".Consumer";
58
+ case k:
59
+ var N = u.render;
60
+ return u = u.displayName, u || (u = N.displayName || N.name || "", u = u !== "" ? "ForwardRef(" + u + ")" : "ForwardRef"), u;
61
+ case T:
62
+ return N = u.displayName || null, N !== null ? N : t(u.type) || "Memo";
63
+ case I:
64
+ N = u._payload, u = u._init;
65
+ try {
66
+ return t(u(N));
67
+ } catch {
68
+ }
69
+ }
70
+ return null;
71
+ }
72
+ function e(u) {
73
+ return "" + u;
74
+ }
75
+ function n(u) {
76
+ try {
77
+ e(u);
78
+ var N = !1;
79
+ } catch {
80
+ N = !0;
81
+ }
82
+ if (N) {
83
+ N = console;
84
+ var H = N.error, B = typeof Symbol == "function" && Symbol.toStringTag && u[Symbol.toStringTag] || u.constructor.name || "Object";
85
+ return H.call(
86
+ N,
87
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
88
+ B
89
+ ), e(u);
90
+ }
91
+ }
92
+ function s(u) {
93
+ if (u === c) return "<>";
94
+ if (typeof u == "object" && u !== null && u.$$typeof === I)
95
+ return "<...>";
96
+ try {
97
+ var N = t(u);
98
+ return N ? "<" + N + ">" : "<...>";
99
+ } catch {
100
+ return "<...>";
101
+ }
102
+ }
103
+ function r() {
104
+ var u = j.A;
105
+ return u === null ? null : u.getOwner();
106
+ }
107
+ function i() {
108
+ return Error("react-stack-top-frame");
109
+ }
110
+ function o(u) {
111
+ if (x.call(u, "key")) {
112
+ var N = Object.getOwnPropertyDescriptor(u, "key").get;
113
+ if (N && N.isReactWarning) return !1;
114
+ }
115
+ return u.key !== void 0;
116
+ }
117
+ function a(u, N) {
118
+ function H() {
119
+ K || (K = !0, console.error(
120
+ "%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)",
121
+ N
122
+ ));
123
+ }
124
+ H.isReactWarning = !0, Object.defineProperty(u, "key", {
125
+ get: H,
126
+ configurable: !0
127
+ });
128
+ }
129
+ function l() {
130
+ var u = t(this.type);
131
+ return L[u] || (L[u] = !0, console.error(
132
+ "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."
133
+ )), u = this.props.ref, u !== void 0 ? u : null;
134
+ }
135
+ function d(u, N, H, B, me, E) {
136
+ var A = H.ref;
137
+ return u = {
138
+ $$typeof: O,
139
+ type: u,
140
+ key: N,
141
+ props: H,
142
+ _owner: B
143
+ }, (A !== void 0 ? A : null) !== null ? Object.defineProperty(u, "ref", {
144
+ enumerable: !1,
145
+ get: l
146
+ }) : Object.defineProperty(u, "ref", { enumerable: !1, value: null }), u._store = {}, Object.defineProperty(u._store, "validated", {
147
+ configurable: !1,
148
+ enumerable: !1,
149
+ writable: !0,
150
+ value: 0
151
+ }), Object.defineProperty(u, "_debugInfo", {
152
+ configurable: !1,
153
+ enumerable: !1,
154
+ writable: !0,
155
+ value: null
156
+ }), Object.defineProperty(u, "_debugStack", {
157
+ configurable: !1,
158
+ enumerable: !1,
159
+ writable: !0,
160
+ value: me
161
+ }), Object.defineProperty(u, "_debugTask", {
162
+ configurable: !1,
163
+ enumerable: !1,
164
+ writable: !0,
165
+ value: E
166
+ }), Object.freeze && (Object.freeze(u.props), Object.freeze(u)), u;
167
+ }
168
+ function f(u, N, H, B, me, E) {
169
+ var A = N.children;
170
+ if (A !== void 0)
171
+ if (B)
172
+ if (U(A)) {
173
+ for (B = 0; B < A.length; B++)
174
+ v(A[B]);
175
+ Object.freeze && Object.freeze(A);
176
+ } else
177
+ console.error(
178
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
179
+ );
180
+ else v(A);
181
+ if (x.call(N, "key")) {
182
+ A = t(u);
183
+ var W = Object.keys(N).filter(function(Z) {
184
+ return Z !== "key";
185
+ });
186
+ B = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", te[A + B] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
187
+ `A props object containing a "key" prop is being spread into JSX:
188
+ let props = %s;
189
+ <%s {...props} />
190
+ React keys must be passed directly to JSX without using spread:
191
+ let props = %s;
192
+ <%s key={someKey} {...props} />`,
193
+ B,
194
+ A,
195
+ W,
196
+ A
197
+ ), te[A + B] = !0);
198
+ }
199
+ if (A = null, H !== void 0 && (n(H), A = "" + H), o(N) && (n(N.key), A = "" + N.key), "key" in N) {
200
+ H = {};
201
+ for (var z in N)
202
+ z !== "key" && (H[z] = N[z]);
203
+ } else H = N;
204
+ return A && a(
205
+ H,
206
+ typeof u == "function" ? u.displayName || u.name || "Unknown" : u
207
+ ), d(
208
+ u,
209
+ A,
210
+ H,
211
+ r(),
212
+ me,
213
+ E
214
+ );
215
+ }
216
+ function v(u) {
217
+ m(u) ? u._store && (u._store.validated = 1) : typeof u == "object" && u !== null && u.$$typeof === I && (u._payload.status === "fulfilled" ? m(u._payload.value) && u._payload.value._store && (u._payload.value._store.validated = 1) : u._store && (u._store.validated = 1));
218
+ }
219
+ function m(u) {
220
+ return typeof u == "object" && u !== null && u.$$typeof === O;
221
+ }
222
+ var w = re, O = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), g = Symbol.for("react.strict_mode"), p = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), _ = Symbol.for("react.context"), k = Symbol.for("react.forward_ref"), h = Symbol.for("react.suspense"), D = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), I = Symbol.for("react.lazy"), S = Symbol.for("react.activity"), M = Symbol.for("react.client.reference"), j = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, x = Object.prototype.hasOwnProperty, U = Array.isArray, G = console.createTask ? console.createTask : function() {
223
+ return null;
224
+ };
225
+ w = {
226
+ react_stack_bottom_frame: function(u) {
227
+ return u();
228
+ }
229
+ };
230
+ var K, L = {}, F = w.react_stack_bottom_frame.bind(
231
+ w,
232
+ i
233
+ )(), ue = G(s(i)), te = {};
234
+ Se.Fragment = c, Se.jsx = function(u, N, H) {
235
+ var B = 1e4 > j.recentlyCreatedOwnerStacks++;
236
+ return f(
237
+ u,
238
+ N,
239
+ H,
240
+ !1,
241
+ B ? Error("react-stack-top-frame") : F,
242
+ B ? G(s(u)) : ue
243
+ );
244
+ }, Se.jsxs = function(u, N, H) {
245
+ var B = 1e4 > j.recentlyCreatedOwnerStacks++;
246
+ return f(
247
+ u,
248
+ N,
249
+ H,
250
+ !0,
251
+ B ? Error("react-stack-top-frame") : F,
252
+ B ? G(s(u)) : ue
253
+ );
254
+ };
255
+ })()), Se;
256
+ }
257
+ var Tt;
258
+ function xn() {
259
+ return Tt || (Tt = 1, process.env.NODE_ENV === "production" ? Ae.exports = bn() : Ae.exports = wn()), Ae.exports;
260
+ }
261
+ var y = xn();
262
+ const It = (t) => {
263
+ let e;
264
+ const n = /* @__PURE__ */ new Set(), s = (d, f) => {
265
+ const v = typeof d == "function" ? d(e) : d;
266
+ if (!Object.is(v, e)) {
267
+ const m = e;
268
+ e = f ?? (typeof v != "object" || v === null) ? v : Object.assign({}, e, v), n.forEach((w) => w(e, m));
269
+ }
270
+ }, r = () => e, a = { setState: s, getState: r, getInitialState: () => l, subscribe: (d) => (n.add(d), () => n.delete(d)) }, l = e = t(s, r, a);
271
+ return a;
272
+ }, En = ((t) => t ? It(t) : It), Sn = (t) => t;
273
+ function Tn(t, e = Sn) {
274
+ const n = re.useSyncExternalStore(
275
+ t.subscribe,
276
+ re.useCallback(() => e(t.getState()), [t, e]),
277
+ re.useCallback(() => e(t.getInitialState()), [t, e])
278
+ );
279
+ return re.useDebugValue(n), n;
280
+ }
281
+ var Jt = Symbol.for("immer-nothing"), Pt = Symbol.for("immer-draftable"), q = Symbol.for("immer-state"), In = process.env.NODE_ENV !== "production" ? [
282
+ // All error codes, starting by 0:
283
+ function(t) {
284
+ return `The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`;
285
+ },
286
+ function(t) {
287
+ 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 '${t}'`;
288
+ },
289
+ "This object has been frozen and should not be mutated",
290
+ function(t) {
291
+ return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + t;
292
+ },
293
+ "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
294
+ "Immer forbids circular references",
295
+ "The first or second argument to `produce` must be a function",
296
+ "The third argument to `produce` must be a function or undefined",
297
+ "First argument to `createDraft` must be a plain object, an array, or an immerable object",
298
+ "First argument to `finishDraft` must be a draft returned by `createDraft`",
299
+ function(t) {
300
+ return `'current' expects a draft, got: ${t}`;
301
+ },
302
+ "Object.defineProperty() cannot be used on an Immer draft",
303
+ "Object.setPrototypeOf() cannot be used on an Immer draft",
304
+ "Immer only supports deleting array indices",
305
+ "Immer only supports setting array indices and the 'length' property",
306
+ function(t) {
307
+ return `'original' expects a draft, got: ${t}`;
308
+ }
309
+ // Note: if more errors are added, the errorOffset in Patches.ts should be increased
310
+ // See Patches.ts for additional errors
311
+ ] : [];
312
+ function Q(t, ...e) {
313
+ if (process.env.NODE_ENV !== "production") {
314
+ const n = In[t], s = he(n) ? n.apply(null, e) : n;
315
+ throw new Error(`[Immer] ${s}`);
316
+ }
317
+ throw new Error(
318
+ `[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`
319
+ );
320
+ }
321
+ var ee = Object, be = ee.getPrototypeOf, $e = "constructor", Be = "prototype", nt = "configurable", He = "enumerable", Me = "writable", Te = "value", fe = (t) => !!t && !!t[q];
322
+ function le(t) {
323
+ return t ? Zt(t) || Xe(t) || !!t[Pt] || !!t[$e]?.[Pt] || We(t) || Ke(t) : !1;
324
+ }
325
+ var Pn = ee[Be][$e].toString(), kt = /* @__PURE__ */ new WeakMap();
326
+ function Zt(t) {
327
+ if (!t || !pt(t))
328
+ return !1;
329
+ const e = be(t);
330
+ if (e === null || e === ee[Be])
331
+ return !0;
332
+ const n = ee.hasOwnProperty.call(e, $e) && e[$e];
333
+ if (n === Object)
334
+ return !0;
335
+ if (!he(n))
336
+ return !1;
337
+ let s = kt.get(n);
338
+ return s === void 0 && (s = Function.toString.call(n), kt.set(n, s)), s === Pn;
339
+ }
340
+ function ke(t, e, n = !0) {
341
+ De(t) === 0 ? (n ? Reflect.ownKeys(t) : ee.keys(t)).forEach((r) => {
342
+ e(r, t[r], t);
343
+ }) : t.forEach((s, r) => e(r, s, t));
344
+ }
345
+ function De(t) {
346
+ const e = t[q];
347
+ return e ? e.type_ : Xe(t) ? 1 : We(t) ? 2 : Ke(t) ? 3 : 0;
348
+ }
349
+ var Dt = (t, e, n = De(t)) => n === 2 ? t.has(e) : ee[Be].hasOwnProperty.call(t, e), st = (t, e, n = De(t)) => (
350
+ // @ts-ignore
351
+ n === 2 ? t.get(e) : t[e]
352
+ ), Ve = (t, e, n, s = De(t)) => {
353
+ s === 2 ? t.set(e, n) : s === 3 ? t.add(n) : t[e] = n;
354
+ };
355
+ function kn(t, e) {
356
+ return t === e ? t !== 0 || 1 / t === 1 / e : t !== t && e !== e;
357
+ }
358
+ var Xe = Array.isArray, We = (t) => t instanceof Map, Ke = (t) => t instanceof Set, pt = (t) => typeof t == "object", he = (t) => typeof t == "function", Ze = (t) => typeof t == "boolean", ce = (t) => t.copy_ || t.base_, mt = (t) => t.modified_ ? t.copy_ : t.base_;
359
+ function rt(t, e) {
360
+ if (We(t))
361
+ return new Map(t);
362
+ if (Ke(t))
363
+ return new Set(t);
364
+ if (Xe(t))
365
+ return Array[Be].slice.call(t);
366
+ const n = Zt(t);
367
+ if (e === !0 || e === "class_only" && !n) {
368
+ const s = ee.getOwnPropertyDescriptors(t);
369
+ delete s[q];
370
+ let r = Reflect.ownKeys(s);
371
+ for (let i = 0; i < r.length; i++) {
372
+ const o = r[i], a = s[o];
373
+ a[Me] === !1 && (a[Me] = !0, a[nt] = !0), (a.get || a.set) && (s[o] = {
374
+ [nt]: !0,
375
+ [Me]: !0,
376
+ // could live with !!desc.set as well here...
377
+ [He]: a[He],
378
+ [Te]: t[o]
379
+ });
380
+ }
381
+ return ee.create(be(t), s);
382
+ } else {
383
+ const s = be(t);
384
+ if (s !== null && n)
385
+ return { ...t };
386
+ const r = ee.create(s);
387
+ return ee.assign(r, t);
388
+ }
389
+ }
390
+ function gt(t, e = !1) {
391
+ return Ge(t) || fe(t) || !le(t) || (De(t) > 1 && ee.defineProperties(t, {
392
+ set: Ce,
393
+ add: Ce,
394
+ clear: Ce,
395
+ delete: Ce
396
+ }), ee.freeze(t), e && ke(
397
+ t,
398
+ (n, s) => {
399
+ gt(s, !0);
400
+ },
401
+ !1
402
+ )), t;
403
+ }
404
+ function Dn() {
405
+ Q(2);
406
+ }
407
+ var Ce = {
408
+ [Te]: Dn
409
+ };
410
+ function Ge(t) {
411
+ return t === null || !pt(t) ? !0 : ee.isFrozen(t);
412
+ }
413
+ var Ye = "MapSet", it = "Patches", Qt = {};
414
+ function we(t) {
415
+ const e = Qt[t];
416
+ return e || Q(0, t), e;
417
+ }
418
+ var On = (t) => !!Qt[t], Ie, en = () => Ie, Rn = (t, e) => ({
419
+ drafts_: [],
420
+ parent_: t,
421
+ immer_: e,
422
+ // Whenever the modified draft contains a draft from another scope, we
423
+ // need to prevent auto-freezing so the unowned draft can be finalized.
424
+ canAutoFreeze_: !0,
425
+ unfinalizedDrafts_: 0,
426
+ handledSet_: /* @__PURE__ */ new Set(),
427
+ processedForPatches_: /* @__PURE__ */ new Set(),
428
+ mapSetPlugin_: On(Ye) ? we(Ye) : void 0
429
+ });
430
+ function Ot(t, e) {
431
+ e && (t.patchPlugin_ = we(it), t.patches_ = [], t.inversePatches_ = [], t.patchListener_ = e);
432
+ }
433
+ function ot(t) {
434
+ at(t), t.drafts_.forEach(Nn), t.drafts_ = null;
435
+ }
436
+ function at(t) {
437
+ t === Ie && (Ie = t.parent_);
438
+ }
439
+ var Rt = (t) => Ie = Rn(Ie, t);
440
+ function Nn(t) {
441
+ const e = t[q];
442
+ e.type_ === 0 || e.type_ === 1 ? e.revoke_() : e.revoked_ = !0;
443
+ }
444
+ function Nt(t, e) {
445
+ e.unfinalizedDrafts_ = e.drafts_.length;
446
+ const n = e.drafts_[0];
447
+ if (t !== void 0 && t !== n) {
448
+ n[q].modified_ && (ot(e), Q(4)), le(t) && (t = At(e, t));
449
+ const { patchPlugin_: r } = e;
450
+ r && r.generateReplacementPatches_(
451
+ n[q].base_,
452
+ t,
453
+ e
454
+ );
455
+ } else
456
+ t = At(e, n);
457
+ return An(e, t, !0), ot(e), e.patches_ && e.patchListener_(e.patches_, e.inversePatches_), t !== Jt ? t : void 0;
458
+ }
459
+ function At(t, e) {
460
+ if (Ge(e))
461
+ return e;
462
+ const n = e[q];
463
+ if (!n)
464
+ return yt(e, t.handledSet_, t);
465
+ if (!qe(n, t))
466
+ return e;
467
+ if (!n.modified_)
468
+ return n.base_;
469
+ if (!n.finalized_) {
470
+ const { callbacks_: s } = n;
471
+ if (s)
472
+ for (; s.length > 0; )
473
+ s.pop()(t);
474
+ sn(n, t);
475
+ }
476
+ return n.copy_;
477
+ }
478
+ function An(t, e, n = !1) {
479
+ !t.parent_ && t.immer_.autoFreeze_ && t.canAutoFreeze_ && gt(e, n);
480
+ }
481
+ function tn(t) {
482
+ t.finalized_ = !0, t.scope_.unfinalizedDrafts_--;
483
+ }
484
+ var qe = (t, e) => t.scope_ === e, Cn = [];
485
+ function nn(t, e, n, s) {
486
+ const r = ce(t), i = t.type_;
487
+ if (s !== void 0 && st(r, s, i) === e) {
488
+ Ve(r, s, n, i);
489
+ return;
490
+ }
491
+ if (!t.draftLocations_) {
492
+ const a = t.draftLocations_ = /* @__PURE__ */ new Map();
493
+ ke(r, (l, d) => {
494
+ if (fe(d)) {
495
+ const f = a.get(d) || [];
496
+ f.push(l), a.set(d, f);
497
+ }
498
+ });
499
+ }
500
+ const o = t.draftLocations_.get(e) ?? Cn;
501
+ for (const a of o)
502
+ Ve(r, a, n, i);
503
+ }
504
+ function Mn(t, e, n) {
505
+ t.callbacks_.push(function(r) {
506
+ const i = e;
507
+ if (!i || !qe(i, r))
508
+ return;
509
+ r.mapSetPlugin_?.fixSetContents(i);
510
+ const o = mt(i);
511
+ nn(t, i.draft_ ?? i, o, n), sn(i, r);
512
+ });
513
+ }
514
+ function sn(t, e) {
515
+ if (t.modified_ && !t.finalized_ && (t.type_ === 3 || (t.assigned_?.size ?? 0) > 0)) {
516
+ const { patchPlugin_: s } = e;
517
+ if (s) {
518
+ const r = s.getPath(t);
519
+ r && s.generatePatches_(t, r, e);
520
+ }
521
+ tn(t);
522
+ }
523
+ }
524
+ function jn(t, e, n) {
525
+ const { scope_: s } = t;
526
+ if (fe(n)) {
527
+ const r = n[q];
528
+ qe(r, s) && r.callbacks_.push(function() {
529
+ je(t);
530
+ const o = mt(r);
531
+ nn(t, n, o, e);
532
+ });
533
+ } else le(n) && t.callbacks_.push(function() {
534
+ const i = ce(t);
535
+ st(i, e, t.type_) === n && s.drafts_.length > 1 && (t.assigned_.get(e) ?? !1) === !0 && t.copy_ && yt(
536
+ st(t.copy_, e, t.type_),
537
+ s.handledSet_,
538
+ s
539
+ );
540
+ });
541
+ }
542
+ function yt(t, e, n) {
543
+ return !n.immer_.autoFreeze_ && n.unfinalizedDrafts_ < 1 || fe(t) || e.has(t) || !le(t) || Ge(t) || (e.add(t), ke(t, (s, r) => {
544
+ if (fe(r)) {
545
+ const i = r[q];
546
+ if (qe(i, n)) {
547
+ const o = mt(i);
548
+ Ve(t, s, o, t.type_), tn(i);
549
+ }
550
+ } else le(r) && yt(r, e, n);
551
+ })), t;
552
+ }
553
+ function zn(t, e) {
554
+ const n = Xe(t), s = {
555
+ type_: n ? 1 : 0,
556
+ // Track which produce call this is associated with.
557
+ scope_: e ? e.scope_ : en(),
558
+ // True for both shallow and deep changes.
559
+ modified_: !1,
560
+ // Used during finalization.
561
+ finalized_: !1,
562
+ // Track which properties have been assigned (true) or deleted (false).
563
+ // actually instantiated in `prepareCopy()`
564
+ assigned_: void 0,
565
+ // The parent draft state.
566
+ parent_: e,
567
+ // The base state.
568
+ base_: t,
569
+ // The base proxy.
570
+ draft_: null,
571
+ // set below
572
+ // The base copy with any updated values.
573
+ copy_: null,
574
+ // Called by the `produce` function.
575
+ revoke_: null,
576
+ isManual_: !1,
577
+ // `callbacks` actually gets assigned in `createProxy`
578
+ callbacks_: void 0
579
+ };
580
+ let r = s, i = _t;
581
+ n && (r = [s], i = Pe);
582
+ const { revoke: o, proxy: a } = Proxy.revocable(r, i);
583
+ return s.draft_ = a, s.revoke_ = o, [a, s];
584
+ }
585
+ var _t = {
586
+ get(t, e) {
587
+ if (e === q)
588
+ return t;
589
+ const n = ce(t);
590
+ if (!Dt(n, e, t.type_))
591
+ return Ln(t, n, e);
592
+ const s = n[e];
593
+ if (t.finalized_ || !le(s))
594
+ return s;
595
+ if (s === Qe(t.base_, e)) {
596
+ je(t);
597
+ const r = t.type_ === 1 ? +e : e, i = lt(t.scope_, s, t, r);
598
+ return t.copy_[r] = i;
599
+ }
600
+ return s;
601
+ },
602
+ has(t, e) {
603
+ return e in ce(t);
604
+ },
605
+ ownKeys(t) {
606
+ return Reflect.ownKeys(ce(t));
607
+ },
608
+ set(t, e, n) {
609
+ const s = rn(ce(t), e);
610
+ if (s?.set)
611
+ return s.set.call(t.draft_, n), !0;
612
+ if (!t.modified_) {
613
+ const r = Qe(ce(t), e), i = r?.[q];
614
+ if (i && i.base_ === n)
615
+ return t.copy_[e] = n, t.assigned_.set(e, !1), !0;
616
+ if (kn(n, r) && (n !== void 0 || Dt(t.base_, e, t.type_)))
617
+ return !0;
618
+ je(t), ct(t);
619
+ }
620
+ return t.copy_[e] === n && // special case: handle new props with value 'undefined'
621
+ (n !== void 0 || e in t.copy_) || // special case: NaN
622
+ Number.isNaN(n) && Number.isNaN(t.copy_[e]) || (t.copy_[e] = n, t.assigned_.set(e, !0), jn(t, e, n)), !0;
623
+ },
624
+ deleteProperty(t, e) {
625
+ return je(t), Qe(t.base_, e) !== void 0 || e in t.base_ ? (t.assigned_.set(e, !1), ct(t)) : t.assigned_.delete(e), t.copy_ && delete t.copy_[e], !0;
626
+ },
627
+ // Note: We never coerce `desc.value` into an Immer draft, because we can't make
628
+ // the same guarantee in ES5 mode.
629
+ getOwnPropertyDescriptor(t, e) {
630
+ const n = ce(t), s = Reflect.getOwnPropertyDescriptor(n, e);
631
+ return s && {
632
+ [Me]: !0,
633
+ [nt]: t.type_ !== 1 || e !== "length",
634
+ [He]: s[He],
635
+ [Te]: n[e]
636
+ };
637
+ },
638
+ defineProperty() {
639
+ Q(11);
640
+ },
641
+ getPrototypeOf(t) {
642
+ return be(t.base_);
643
+ },
644
+ setPrototypeOf() {
645
+ Q(12);
646
+ }
647
+ }, Pe = {};
648
+ ke(_t, (t, e) => {
649
+ Pe[t] = function() {
650
+ const n = arguments;
651
+ return n[0] = n[0][0], e.apply(this, n);
652
+ };
653
+ });
654
+ Pe.deleteProperty = function(t, e) {
655
+ return process.env.NODE_ENV !== "production" && isNaN(parseInt(e)) && Q(13), Pe.set.call(this, t, e, void 0);
656
+ };
657
+ Pe.set = function(t, e, n) {
658
+ return process.env.NODE_ENV !== "production" && e !== "length" && isNaN(parseInt(e)) && Q(14), _t.set.call(this, t[0], e, n, t[0]);
659
+ };
660
+ function Qe(t, e) {
661
+ const n = t[q];
662
+ return (n ? ce(n) : t)[e];
663
+ }
664
+ function Ln(t, e, n) {
665
+ const s = rn(e, n);
666
+ return s ? Te in s ? s[Te] : (
667
+ // This is a very special case, if the prop is a getter defined by the
668
+ // prototype, we should invoke it with the draft as context!
669
+ s.get?.call(t.draft_)
670
+ ) : void 0;
671
+ }
672
+ function rn(t, e) {
673
+ if (!(e in t))
674
+ return;
675
+ let n = be(t);
676
+ for (; n; ) {
677
+ const s = Object.getOwnPropertyDescriptor(n, e);
678
+ if (s)
679
+ return s;
680
+ n = be(n);
681
+ }
682
+ }
683
+ function ct(t) {
684
+ t.modified_ || (t.modified_ = !0, t.parent_ && ct(t.parent_));
685
+ }
686
+ function je(t) {
687
+ t.copy_ || (t.assigned_ = /* @__PURE__ */ new Map(), t.copy_ = rt(
688
+ t.base_,
689
+ t.scope_.immer_.useStrictShallowCopy_
690
+ ));
691
+ }
692
+ var $n = class {
693
+ constructor(t) {
694
+ this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.useStrictIteration_ = !1, this.produce = (e, n, s) => {
695
+ if (he(e) && !he(n)) {
696
+ const i = n;
697
+ n = e;
698
+ const o = this;
699
+ return function(l = i, ...d) {
700
+ return o.produce(l, (f) => n.call(this, f, ...d));
701
+ };
702
+ }
703
+ he(n) || Q(6), s !== void 0 && !he(s) && Q(7);
704
+ let r;
705
+ if (le(e)) {
706
+ const i = Rt(this), o = lt(i, e, void 0);
707
+ let a = !0;
708
+ try {
709
+ r = n(o), a = !1;
710
+ } finally {
711
+ a ? ot(i) : at(i);
712
+ }
713
+ return Ot(i, s), Nt(r, i);
714
+ } else if (!e || !pt(e)) {
715
+ if (r = n(e), r === void 0 && (r = e), r === Jt && (r = void 0), this.autoFreeze_ && gt(r, !0), s) {
716
+ const i = [], o = [];
717
+ we(it).generateReplacementPatches_(e, r, {
718
+ patches_: i,
719
+ inversePatches_: o
720
+ }), s(i, o);
721
+ }
722
+ return r;
723
+ } else
724
+ Q(1, e);
725
+ }, this.produceWithPatches = (e, n) => {
726
+ if (he(e))
727
+ return (o, ...a) => this.produceWithPatches(o, (l) => e(l, ...a));
728
+ let s, r;
729
+ return [this.produce(e, n, (o, a) => {
730
+ s = o, r = a;
731
+ }), s, r];
732
+ }, Ze(t?.autoFreeze) && this.setAutoFreeze(t.autoFreeze), Ze(t?.useStrictShallowCopy) && this.setUseStrictShallowCopy(t.useStrictShallowCopy), Ze(t?.useStrictIteration) && this.setUseStrictIteration(t.useStrictIteration);
733
+ }
734
+ createDraft(t) {
735
+ le(t) || Q(8), fe(t) && (t = Hn(t));
736
+ const e = Rt(this), n = lt(e, t, void 0);
737
+ return n[q].isManual_ = !0, at(e), n;
738
+ }
739
+ finishDraft(t, e) {
740
+ const n = t && t[q];
741
+ (!n || !n.isManual_) && Q(9);
742
+ const { scope_: s } = n;
743
+ return Ot(s, e), Nt(void 0, s);
744
+ }
745
+ /**
746
+ * Pass true to automatically freeze all copies created by Immer.
747
+ *
748
+ * By default, auto-freezing is enabled.
749
+ */
750
+ setAutoFreeze(t) {
751
+ this.autoFreeze_ = t;
752
+ }
753
+ /**
754
+ * Pass true to enable strict shallow copy.
755
+ *
756
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
757
+ */
758
+ setUseStrictShallowCopy(t) {
759
+ this.useStrictShallowCopy_ = t;
760
+ }
761
+ /**
762
+ * Pass false to use faster iteration that skips non-enumerable properties
763
+ * but still handles symbols for compatibility.
764
+ *
765
+ * By default, strict iteration is enabled (includes all own properties).
766
+ */
767
+ setUseStrictIteration(t) {
768
+ this.useStrictIteration_ = t;
769
+ }
770
+ shouldUseStrictIteration() {
771
+ return this.useStrictIteration_;
772
+ }
773
+ applyPatches(t, e) {
774
+ let n;
775
+ for (n = e.length - 1; n >= 0; n--) {
776
+ const r = e[n];
777
+ if (r.path.length === 0 && r.op === "replace") {
778
+ t = r.value;
779
+ break;
780
+ }
781
+ }
782
+ n > -1 && (e = e.slice(n + 1));
783
+ const s = we(it).applyPatches_;
784
+ return fe(t) ? s(t, e) : this.produce(
785
+ t,
786
+ (r) => s(r, e)
787
+ );
788
+ }
789
+ };
790
+ function lt(t, e, n, s) {
791
+ const [r, i] = We(e) ? we(Ye).proxyMap_(e, n) : Ke(e) ? we(Ye).proxySet_(e, n) : zn(e, n);
792
+ return (n?.scope_ ?? en()).drafts_.push(r), i.callbacks_ = n?.callbacks_ ?? [], i.key_ = s, n && s !== void 0 ? Mn(n, i, s) : i.callbacks_.push(function(l) {
793
+ l.mapSetPlugin_?.fixSetContents(i);
794
+ const { patchPlugin_: d } = l;
795
+ i.modified_ && d && d.generatePatches_(i, [], l);
796
+ }), r;
797
+ }
798
+ function Hn(t) {
799
+ return fe(t) || Q(10, t), on(t);
800
+ }
801
+ function on(t) {
802
+ if (!le(t) || Ge(t))
803
+ return t;
804
+ const e = t[q];
805
+ let n, s = !0;
806
+ if (e) {
807
+ if (!e.modified_)
808
+ return e.base_;
809
+ e.finalized_ = !0, n = rt(t, e.scope_.immer_.useStrictShallowCopy_), s = e.scope_.immer_.shouldUseStrictIteration();
810
+ } else
811
+ n = rt(t, !0);
812
+ return ke(
813
+ n,
814
+ (r, i) => {
815
+ Ve(n, r, on(i));
816
+ },
817
+ s
818
+ ), e && (e.finalized_ = !1), n;
819
+ }
820
+ var Vn = new $n(), Yn = Vn.produce;
821
+ const Fn = (t) => (e, n, s) => (s.setState = (r, i, ...o) => {
822
+ const a = typeof r == "function" ? Yn(r) : r;
823
+ return e(a, i, ...o);
824
+ }, t(s.setState, n, s)), Un = Fn, Bn = {
825
+ snapping: !0,
826
+ snapGuide: !0,
827
+ rotation: !0,
828
+ rotationSpeed: 2,
829
+ rotationSnap: 5,
830
+ // Default 15 degree snap
831
+ zoom: !0,
832
+ pan: !0,
833
+ viewOnly: !1,
834
+ minZoom: 0.1,
835
+ maxZoom: 5,
836
+ showGrid: !0,
837
+ gridSize: 20,
838
+ gridColor: "#ddd"
839
+ }, Xn = (t = [], e = [], n = {}) => En(
840
+ Un((s) => ({
841
+ nodes: t.reduce((r, i) => ({ ...r, [i.id]: i }), {}),
842
+ edges: e.reduce((r, i) => ({ ...r, [i.id]: i }), {}),
843
+ selectedIds: [],
844
+ camera: { x: 0, y: 0, zoom: 1 },
845
+ dimensions: { width: 0, height: 0 },
846
+ // Init default
847
+ config: { ...Bn, ...n },
848
+ // --- Connection State ---
849
+ connectionState: { nodeId: null, handleId: null, handleType: null, position: null, isValid: !1 },
850
+ startConnection: (r, i, o, a) => s((l) => {
851
+ l.connectionState = { nodeId: r, handleId: i, handleType: o, position: a, isValid: !0 };
852
+ }),
853
+ updateConnection: (r) => s((i) => {
854
+ i.connectionState.nodeId && (i.connectionState.position = r);
855
+ }),
856
+ endConnection: () => s((r) => {
857
+ r.connectionState = { nodeId: null, handleId: null, handleType: null, position: null, isValid: !1 };
858
+ }),
859
+ setCamera: (r) => s((i) => {
860
+ Object.assign(i.camera, r);
861
+ }),
862
+ panCamera: (r, i) => s((o) => {
863
+ o.camera.x += r, o.camera.y += i;
864
+ }),
865
+ zoomCamera: (r, i, o) => s((a) => {
866
+ const { minZoom: l = 0.1, maxZoom: d = 5 } = a.config, f = Math.min(Math.max(a.camera.zoom * r, l), d), v = (i - a.camera.x) / a.camera.zoom, m = (o - a.camera.y) / a.camera.zoom;
867
+ a.camera.x = i - v * f, a.camera.y = o - m * f, a.camera.zoom = f;
868
+ }),
869
+ setDimensions: (r, i) => s((o) => {
870
+ o.dimensions = { width: r, height: i };
871
+ }),
872
+ // --- Nodes ---
873
+ setNodes: (r) => s((i) => {
874
+ i.nodes = r.reduce((o, a) => ({ ...o, [a.id]: a }), {});
875
+ }),
876
+ addNode: (r) => s((i) => {
877
+ i.nodes[r.id] = r;
878
+ }),
879
+ updateNode: (r, i) => s((o) => {
880
+ o.nodes[r] && Object.assign(o.nodes[r], i);
881
+ }),
882
+ registerHandle: (r, i, o) => s((a) => {
883
+ const l = a.nodes[r];
884
+ l && (l.handles || (l.handles = {}), l.handles[i] = { id: i, ...o });
885
+ }),
886
+ removeNode: (r) => s((i) => {
887
+ delete i.nodes[r], Object.keys(i.edges).forEach((o) => {
888
+ const a = i.edges[o];
889
+ (a.source === r || a.target === r) && delete i.edges[o];
890
+ }), i.selectedIds = i.selectedIds.filter((o) => o !== r);
891
+ }),
892
+ // --- Edges ---
893
+ setEdges: (r) => s((i) => {
894
+ i.edges = r.reduce((o, a) => ({ ...o, [a.id]: a }), {});
895
+ }),
896
+ addEdge: (r) => s((i) => {
897
+ Object.values(i.edges).some(
898
+ (a) => a.source === r.source && a.target === r.target && a.sourceHandle === r.sourceHandle && a.targetHandle === r.targetHandle
899
+ ) || (i.edges[r.id] = r);
900
+ }),
901
+ removeEdge: (r) => s((i) => {
902
+ delete i.edges[r];
903
+ }),
904
+ selectNode: (r) => s((i) => {
905
+ i.selectedIds = r ? [r] : [];
906
+ }),
907
+ resizeNode: (r, i, o, a, l) => s((d) => {
908
+ d.nodes[r] && (d.nodes[r].x = i, d.nodes[r].y = o, d.nodes[r].width = a, d.nodes[r].height = l);
909
+ }),
910
+ rotateNode: (r, i) => s((o) => {
911
+ o.nodes[r] && (o.nodes[r].rotation = i);
912
+ }),
913
+ deleteSelected: () => s((r) => {
914
+ r.selectedIds.forEach((i) => {
915
+ r.nodes[i] ? (delete r.nodes[i], Object.keys(r.edges).forEach((o) => {
916
+ const a = r.edges[o];
917
+ (a.source === i || a.target === i) && delete r.edges[o];
918
+ })) : r.edges[i] && delete r.edges[i];
919
+ }), r.selectedIds = [];
920
+ }),
921
+ selectAll: () => s((r) => {
922
+ r.selectedIds = Object.keys(r.nodes);
923
+ }),
924
+ deselectAll: () => s((r) => {
925
+ r.selectedIds = [];
926
+ }),
927
+ duplicateSelected: () => s((r) => {
928
+ const i = [];
929
+ r.selectedIds.forEach((o) => {
930
+ const a = r.nodes[o];
931
+ if (a) {
932
+ const l = `node-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, d = {
933
+ ...a,
934
+ id: l,
935
+ x: a.x + 20,
936
+ y: a.y + 20
937
+ };
938
+ r.nodes[l] = d, i.push(d);
939
+ }
940
+ }), r.selectedIds = i.map((o) => o.id);
941
+ }),
942
+ nudgeSelected: (r, i) => s((o) => {
943
+ o.selectedIds.forEach((a) => {
944
+ const l = o.nodes[a];
945
+ l && (l.x += r, l.y += i);
946
+ });
947
+ }),
948
+ setConfig: (r) => s((i) => {
949
+ i.config = { ...i.config, ...r };
950
+ })
951
+ }))
952
+ ), vt = qt(null), gr = ({ children: t, initialNodes: e = [], initialEdges: n = [], nodes: s, config: r = {}, className: i = "", style: o, onChange: a }) => {
953
+ const l = ve(null);
954
+ return l.current || (l.current = Xn(e, n, r)), ie(() => {
955
+ s && l.current && l.current.getState().setNodes(s);
956
+ }, [s]), ie(() => {
957
+ if (!a || !l.current) return;
958
+ const d = l.current.subscribe((f) => {
959
+ a(f);
960
+ });
961
+ return () => d();
962
+ }, [a]), ie(() => {
963
+ l.current && l.current.getState().setConfig(r);
964
+ }, [r]), /* @__PURE__ */ y.jsx(vt.Provider, { value: l.current, children: /* @__PURE__ */ y.jsx("div", { className: `ce-editor ${i}`, style: o, children: t }) });
965
+ }, C = (t) => {
966
+ const e = ht(vt);
967
+ if (!e) throw new Error("useEditor must be used within Editor");
968
+ return Tn(e, t);
969
+ }, bt = () => {
970
+ const t = ht(vt);
971
+ if (!t) throw new Error("useEditor must be used within Editor");
972
+ return t;
973
+ }, an = qt(null), Wn = ({ id: t, children: e }) => /* @__PURE__ */ y.jsx(an.Provider, { value: t, children: e }), Kn = () => {
974
+ const t = ht(an);
975
+ return t || null;
976
+ }, Fe = ({ type: t, id: e = "default", position: n = "top", className: s = "", style: r, ...i }) => {
977
+ const o = Kn(), a = C((w) => w.startConnection), l = C((w) => w.camera), d = C((w) => w.registerHandle), f = bt(), v = re.useRef(null);
978
+ ie(() => {
979
+ if (!o || !v.current) return;
980
+ const w = () => {
981
+ const c = document.getElementById(o);
982
+ if (!c || !v.current) return;
983
+ const g = c.getBoundingClientRect(), p = v.current.getBoundingClientRect(), b = f.getState().camera.zoom, _ = (p.left + p.width / 2 - g.left) / b, k = (p.top + p.height / 2 - g.top) / b;
984
+ d(o, e, {
985
+ type: t,
986
+ position: n,
987
+ x: _,
988
+ y: k,
989
+ width: p.width / b,
990
+ height: p.height / b
991
+ });
992
+ };
993
+ w();
994
+ const O = document.getElementById(o);
995
+ if (!O) return;
996
+ const R = new ResizeObserver(() => {
997
+ requestAnimationFrame(w);
998
+ });
999
+ return R.observe(O), () => R.disconnect();
1000
+ }, [o, e, t, n, d]);
1001
+ const m = (w) => {
1002
+ if (!o) return;
1003
+ w.stopPropagation();
1004
+ const O = document.querySelector(".ce-editor__viewport")?.getBoundingClientRect();
1005
+ if (!O) return;
1006
+ const R = (w.clientX - O.left - l.x) / l.zoom, c = (w.clientY - O.top - l.y) / l.zoom;
1007
+ a(o, e, t, { x: R, y: c });
1008
+ };
1009
+ return /* @__PURE__ */ y.jsx(
1010
+ "div",
1011
+ {
1012
+ ref: v,
1013
+ "data-handle-type": t,
1014
+ "data-handle-id": e,
1015
+ onPointerDown: m,
1016
+ className: `ce-handle ce-handle--${n} ${s}`,
1017
+ style: r,
1018
+ ...i
1019
+ }
1020
+ );
1021
+ }, ut = ({ data: t, ...e }) => /* @__PURE__ */ y.jsxs("div", { className: "ce-node-default", ...e, style: e.style, children: [
1022
+ /* @__PURE__ */ y.jsx(Fe, { type: "target", position: "left", id: "input" }),
1023
+ /* @__PURE__ */ y.jsx("div", { className: "ce-node-content", children: t.label || "Default Node" }),
1024
+ /* @__PURE__ */ y.jsx(Fe, { type: "source", position: "right", id: "output" })
1025
+ ] }), Gn = ({ data: t, ...e }) => /* @__PURE__ */ y.jsxs("div", { className: "ce-node-input", ...e, style: e.style, children: [
1026
+ /* @__PURE__ */ y.jsx("div", { className: "ce-node-content", children: t.label || "Input Node" }),
1027
+ /* @__PURE__ */ y.jsx(Fe, { type: "source", position: "right", id: "output" })
1028
+ ] }), qn = ({ data: t, ...e }) => /* @__PURE__ */ y.jsxs("div", { className: "ce-node-output", ...e, style: e.style, children: [
1029
+ /* @__PURE__ */ y.jsx(Fe, { type: "target", position: "left", id: "input" }),
1030
+ /* @__PURE__ */ y.jsx("div", { className: "ce-node-content", children: t.label || "Output Node" })
1031
+ ] });
1032
+ function Jn(t, e, n) {
1033
+ return Math.max(e, Math.min(t, n));
1034
+ }
1035
+ const $ = {
1036
+ toVector(t, e) {
1037
+ return t === void 0 && (t = e), Array.isArray(t) ? t : [t, t];
1038
+ },
1039
+ add(t, e) {
1040
+ return [t[0] + e[0], t[1] + e[1]];
1041
+ },
1042
+ sub(t, e) {
1043
+ return [t[0] - e[0], t[1] - e[1]];
1044
+ },
1045
+ addTo(t, e) {
1046
+ t[0] += e[0], t[1] += e[1];
1047
+ },
1048
+ subTo(t, e) {
1049
+ t[0] -= e[0], t[1] -= e[1];
1050
+ }
1051
+ };
1052
+ function Ct(t, e, n) {
1053
+ return e === 0 || Math.abs(e) === 1 / 0 ? Math.pow(t, n * 5) : t * e * n / (e + n * t);
1054
+ }
1055
+ function Mt(t, e, n, s = 0.15) {
1056
+ return s === 0 ? Jn(t, e, n) : t < e ? -Ct(e - t, n - e, s) + e : t > n ? +Ct(t - n, n - e, s) + n : t;
1057
+ }
1058
+ function Zn(t, [e, n], [s, r]) {
1059
+ const [[i, o], [a, l]] = t;
1060
+ return [Mt(e, i, o, s), Mt(n, a, l, r)];
1061
+ }
1062
+ function Qn(t, e) {
1063
+ if (typeof t != "object" || t === null) return t;
1064
+ var n = t[Symbol.toPrimitive];
1065
+ if (n !== void 0) {
1066
+ var s = n.call(t, e);
1067
+ if (typeof s != "object") return s;
1068
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1069
+ }
1070
+ return (e === "string" ? String : Number)(t);
1071
+ }
1072
+ function es(t) {
1073
+ var e = Qn(t, "string");
1074
+ return typeof e == "symbol" ? e : String(e);
1075
+ }
1076
+ function X(t, e, n) {
1077
+ return e = es(e), e in t ? Object.defineProperty(t, e, {
1078
+ value: n,
1079
+ enumerable: !0,
1080
+ configurable: !0,
1081
+ writable: !0
1082
+ }) : t[e] = n, t;
1083
+ }
1084
+ function jt(t, e) {
1085
+ var n = Object.keys(t);
1086
+ if (Object.getOwnPropertySymbols) {
1087
+ var s = Object.getOwnPropertySymbols(t);
1088
+ e && (s = s.filter(function(r) {
1089
+ return Object.getOwnPropertyDescriptor(t, r).enumerable;
1090
+ })), n.push.apply(n, s);
1091
+ }
1092
+ return n;
1093
+ }
1094
+ function Y(t) {
1095
+ for (var e = 1; e < arguments.length; e++) {
1096
+ var n = arguments[e] != null ? arguments[e] : {};
1097
+ e % 2 ? jt(Object(n), !0).forEach(function(s) {
1098
+ X(t, s, n[s]);
1099
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : jt(Object(n)).forEach(function(s) {
1100
+ Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(n, s));
1101
+ });
1102
+ }
1103
+ return t;
1104
+ }
1105
+ const cn = {
1106
+ pointer: {
1107
+ start: "down",
1108
+ change: "move",
1109
+ end: "up"
1110
+ },
1111
+ mouse: {
1112
+ start: "down",
1113
+ change: "move",
1114
+ end: "up"
1115
+ },
1116
+ touch: {
1117
+ start: "start",
1118
+ change: "move",
1119
+ end: "end"
1120
+ },
1121
+ gesture: {
1122
+ start: "start",
1123
+ change: "change",
1124
+ end: "end"
1125
+ }
1126
+ };
1127
+ function zt(t) {
1128
+ return t ? t[0].toUpperCase() + t.slice(1) : "";
1129
+ }
1130
+ const ts = ["enter", "leave"];
1131
+ function ns(t = !1, e) {
1132
+ return t && !ts.includes(e);
1133
+ }
1134
+ function ss(t, e = "", n = !1) {
1135
+ const s = cn[t], r = s && s[e] || e;
1136
+ return "on" + zt(t) + zt(r) + (ns(n, r) ? "Capture" : "");
1137
+ }
1138
+ const rs = ["gotpointercapture", "lostpointercapture"];
1139
+ function is(t) {
1140
+ let e = t.substring(2).toLowerCase();
1141
+ const n = !!~e.indexOf("passive");
1142
+ n && (e = e.replace("passive", ""));
1143
+ const s = rs.includes(e) ? "capturecapture" : "capture", r = !!~e.indexOf(s);
1144
+ return r && (e = e.replace("capture", "")), {
1145
+ device: e,
1146
+ capture: r,
1147
+ passive: n
1148
+ };
1149
+ }
1150
+ function os(t, e = "") {
1151
+ const n = cn[t], s = n && n[e] || e;
1152
+ return t + s;
1153
+ }
1154
+ function Je(t) {
1155
+ return "touches" in t;
1156
+ }
1157
+ function ln(t) {
1158
+ return Je(t) ? "touch" : "pointerType" in t ? t.pointerType : "mouse";
1159
+ }
1160
+ function as(t) {
1161
+ return Array.from(t.touches).filter((e) => {
1162
+ var n, s;
1163
+ return e.target === t.currentTarget || ((n = t.currentTarget) === null || n === void 0 || (s = n.contains) === null || s === void 0 ? void 0 : s.call(n, e.target));
1164
+ });
1165
+ }
1166
+ function cs(t) {
1167
+ return t.type === "touchend" || t.type === "touchcancel" ? t.changedTouches : t.targetTouches;
1168
+ }
1169
+ function un(t) {
1170
+ return Je(t) ? cs(t)[0] : t;
1171
+ }
1172
+ function dt(t, e) {
1173
+ try {
1174
+ const n = e.clientX - t.clientX, s = e.clientY - t.clientY, r = (e.clientX + t.clientX) / 2, i = (e.clientY + t.clientY) / 2, o = Math.hypot(n, s);
1175
+ return {
1176
+ angle: -(Math.atan2(n, s) * 180) / Math.PI,
1177
+ distance: o,
1178
+ origin: [r, i]
1179
+ };
1180
+ } catch {
1181
+ }
1182
+ return null;
1183
+ }
1184
+ function ls(t) {
1185
+ return as(t).map((e) => e.identifier);
1186
+ }
1187
+ function Lt(t, e) {
1188
+ const [n, s] = Array.from(t.touches).filter((r) => e.includes(r.identifier));
1189
+ return dt(n, s);
1190
+ }
1191
+ function et(t) {
1192
+ const e = un(t);
1193
+ return Je(t) ? e.identifier : e.pointerId;
1194
+ }
1195
+ function xe(t) {
1196
+ const e = un(t);
1197
+ return [e.clientX, e.clientY];
1198
+ }
1199
+ const $t = 40, Ht = 800;
1200
+ function dn(t) {
1201
+ let {
1202
+ deltaX: e,
1203
+ deltaY: n,
1204
+ deltaMode: s
1205
+ } = t;
1206
+ return s === 1 ? (e *= $t, n *= $t) : s === 2 && (e *= Ht, n *= Ht), [e, n];
1207
+ }
1208
+ function us(t) {
1209
+ var e, n;
1210
+ const {
1211
+ scrollX: s,
1212
+ scrollY: r,
1213
+ scrollLeft: i,
1214
+ scrollTop: o
1215
+ } = t.currentTarget;
1216
+ return [(e = s ?? i) !== null && e !== void 0 ? e : 0, (n = r ?? o) !== null && n !== void 0 ? n : 0];
1217
+ }
1218
+ function ds(t) {
1219
+ const e = {};
1220
+ if ("buttons" in t && (e.buttons = t.buttons), "shiftKey" in t) {
1221
+ const {
1222
+ shiftKey: n,
1223
+ altKey: s,
1224
+ metaKey: r,
1225
+ ctrlKey: i
1226
+ } = t;
1227
+ Object.assign(e, {
1228
+ shiftKey: n,
1229
+ altKey: s,
1230
+ metaKey: r,
1231
+ ctrlKey: i
1232
+ });
1233
+ }
1234
+ return e;
1235
+ }
1236
+ function Ue(t, ...e) {
1237
+ return typeof t == "function" ? t(...e) : t;
1238
+ }
1239
+ function fs() {
1240
+ }
1241
+ function hs(...t) {
1242
+ return t.length === 0 ? fs : t.length === 1 ? t[0] : function() {
1243
+ let e;
1244
+ for (const n of t)
1245
+ e = n.apply(this, arguments) || e;
1246
+ return e;
1247
+ };
1248
+ }
1249
+ function Vt(t, e) {
1250
+ return Object.assign({}, e, t || {});
1251
+ }
1252
+ const ps = 32;
1253
+ class fn {
1254
+ constructor(e, n, s) {
1255
+ this.ctrl = e, this.args = n, this.key = s, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
1256
+ }
1257
+ get state() {
1258
+ return this.ctrl.state[this.key];
1259
+ }
1260
+ set state(e) {
1261
+ this.ctrl.state[this.key] = e;
1262
+ }
1263
+ get shared() {
1264
+ return this.ctrl.state.shared;
1265
+ }
1266
+ get eventStore() {
1267
+ return this.ctrl.gestureEventStores[this.key];
1268
+ }
1269
+ get timeoutStore() {
1270
+ return this.ctrl.gestureTimeoutStores[this.key];
1271
+ }
1272
+ get config() {
1273
+ return this.ctrl.config[this.key];
1274
+ }
1275
+ get sharedConfig() {
1276
+ return this.ctrl.config.shared;
1277
+ }
1278
+ get handler() {
1279
+ return this.ctrl.handlers[this.key];
1280
+ }
1281
+ reset() {
1282
+ const {
1283
+ state: e,
1284
+ shared: n,
1285
+ ingKey: s,
1286
+ args: r
1287
+ } = this;
1288
+ n[s] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [[-1 / 0, 1 / 0], [-1 / 0, 1 / 0]], e.args = r, e.axis = void 0, e.memo = void 0, e.elapsedTime = e.timeDelta = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0;
1289
+ }
1290
+ start(e) {
1291
+ const n = this.state, s = this.config;
1292
+ n._active || (this.reset(), this.computeInitial(), n._active = !0, n.target = e.target, n.currentTarget = e.currentTarget, n.lastOffset = s.from ? Ue(s.from, n) : n.offset, n.offset = n.lastOffset, n.startTime = n.timeStamp = e.timeStamp);
1293
+ }
1294
+ computeValues(e) {
1295
+ const n = this.state;
1296
+ n._values = e, n.values = this.config.transform(e);
1297
+ }
1298
+ computeInitial() {
1299
+ const e = this.state;
1300
+ e._initial = e._values, e.initial = e.values;
1301
+ }
1302
+ compute(e) {
1303
+ const {
1304
+ state: n,
1305
+ config: s,
1306
+ shared: r
1307
+ } = this;
1308
+ n.args = this.args;
1309
+ let i = 0;
1310
+ if (e && (n.event = e, s.preventDefault && e.cancelable && n.event.preventDefault(), n.type = e.type, r.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, r.locked = !!document.pointerLockElement, Object.assign(r, ds(e)), r.down = r.pressed = r.buttons % 2 === 1 || r.touches > 0, i = e.timeStamp - n.timeStamp, n.timeStamp = e.timeStamp, n.elapsedTime = n.timeStamp - n.startTime), n._active) {
1311
+ const h = n._delta.map(Math.abs);
1312
+ $.addTo(n._distance, h);
1313
+ }
1314
+ this.axisIntent && this.axisIntent(e);
1315
+ const [o, a] = n._movement, [l, d] = s.threshold, {
1316
+ _step: f,
1317
+ values: v
1318
+ } = n;
1319
+ if (s.hasCustomTransform ? (f[0] === !1 && (f[0] = Math.abs(o) >= l && v[0]), f[1] === !1 && (f[1] = Math.abs(a) >= d && v[1])) : (f[0] === !1 && (f[0] = Math.abs(o) >= l && Math.sign(o) * l), f[1] === !1 && (f[1] = Math.abs(a) >= d && Math.sign(a) * d)), n.intentional = f[0] !== !1 || f[1] !== !1, !n.intentional) return;
1320
+ const m = [0, 0];
1321
+ if (s.hasCustomTransform) {
1322
+ const [h, D] = v;
1323
+ m[0] = f[0] !== !1 ? h - f[0] : 0, m[1] = f[1] !== !1 ? D - f[1] : 0;
1324
+ } else
1325
+ m[0] = f[0] !== !1 ? o - f[0] : 0, m[1] = f[1] !== !1 ? a - f[1] : 0;
1326
+ this.restrictToAxis && !n._blocked && this.restrictToAxis(m);
1327
+ const w = n.offset, O = n._active && !n._blocked || n.active;
1328
+ O && (n.first = n._active && !n.active, n.last = !n._active && n.active, n.active = r[this.ingKey] = n._active, e && (n.first && ("bounds" in s && (n._bounds = Ue(s.bounds, n)), this.setup && this.setup()), n.movement = m, this.computeOffset()));
1329
+ const [R, c] = n.offset, [[g, p], [b, _]] = n._bounds;
1330
+ n.overflow = [R < g ? -1 : R > p ? 1 : 0, c < b ? -1 : c > _ ? 1 : 0], n._movementBound[0] = n.overflow[0] ? n._movementBound[0] === !1 ? n._movement[0] : n._movementBound[0] : !1, n._movementBound[1] = n.overflow[1] ? n._movementBound[1] === !1 ? n._movement[1] : n._movementBound[1] : !1;
1331
+ const k = n._active ? s.rubberband || [0, 0] : [0, 0];
1332
+ if (n.offset = Zn(n._bounds, n.offset, k), n.delta = $.sub(n.offset, w), this.computeMovement(), O && (!n.last || i > ps)) {
1333
+ n.delta = $.sub(n.offset, w);
1334
+ const h = n.delta.map(Math.abs);
1335
+ $.addTo(n.distance, h), n.direction = n.delta.map(Math.sign), n._direction = n._delta.map(Math.sign), !n.first && i > 0 && (n.velocity = [h[0] / i, h[1] / i], n.timeDelta = i);
1336
+ }
1337
+ }
1338
+ emit() {
1339
+ const e = this.state, n = this.shared, s = this.config;
1340
+ if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !s.triggerAllEvents) return;
1341
+ const r = this.handler(Y(Y(Y({}, n), e), {}, {
1342
+ [this.aliasKey]: e.values
1343
+ }));
1344
+ r !== void 0 && (e.memo = r);
1345
+ }
1346
+ clean() {
1347
+ this.eventStore.clean(), this.timeoutStore.clean();
1348
+ }
1349
+ }
1350
+ function ms([t, e], n) {
1351
+ const s = Math.abs(t), r = Math.abs(e);
1352
+ if (s > r && s > n)
1353
+ return "x";
1354
+ if (r > s && r > n)
1355
+ return "y";
1356
+ }
1357
+ class Oe extends fn {
1358
+ constructor(...e) {
1359
+ super(...e), X(this, "aliasKey", "xy");
1360
+ }
1361
+ reset() {
1362
+ super.reset(), this.state.axis = void 0;
1363
+ }
1364
+ init() {
1365
+ this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
1366
+ }
1367
+ computeOffset() {
1368
+ this.state.offset = $.add(this.state.lastOffset, this.state.movement);
1369
+ }
1370
+ computeMovement() {
1371
+ this.state.movement = $.sub(this.state.offset, this.state.lastOffset);
1372
+ }
1373
+ axisIntent(e) {
1374
+ const n = this.state, s = this.config;
1375
+ if (!n.axis && e) {
1376
+ const r = typeof s.axisThreshold == "object" ? s.axisThreshold[ln(e)] : s.axisThreshold;
1377
+ n.axis = ms(n._movement, r);
1378
+ }
1379
+ n._blocked = (s.lockDirection || !!s.axis) && !n.axis || !!s.axis && s.axis !== n.axis;
1380
+ }
1381
+ restrictToAxis(e) {
1382
+ if (this.config.axis || this.config.lockDirection)
1383
+ switch (this.state.axis) {
1384
+ case "x":
1385
+ e[1] = 0;
1386
+ break;
1387
+ case "y":
1388
+ e[0] = 0;
1389
+ break;
1390
+ }
1391
+ }
1392
+ }
1393
+ const Yt = (t) => t, Ft = 0.15, wt = {
1394
+ enabled(t = !0) {
1395
+ return t;
1396
+ },
1397
+ eventOptions(t, e, n) {
1398
+ return Y(Y({}, n.shared.eventOptions), t);
1399
+ },
1400
+ preventDefault(t = !1) {
1401
+ return t;
1402
+ },
1403
+ triggerAllEvents(t = !1) {
1404
+ return t;
1405
+ },
1406
+ rubberband(t = 0) {
1407
+ switch (t) {
1408
+ case !0:
1409
+ return [Ft, Ft];
1410
+ case !1:
1411
+ return [0, 0];
1412
+ default:
1413
+ return $.toVector(t);
1414
+ }
1415
+ },
1416
+ from(t) {
1417
+ if (typeof t == "function") return t;
1418
+ if (t != null) return $.toVector(t);
1419
+ },
1420
+ transform(t, e, n) {
1421
+ const s = t || n.shared.transform;
1422
+ if (this.hasCustomTransform = !!s, process.env.NODE_ENV === "development") {
1423
+ const r = s || Yt;
1424
+ return (i) => {
1425
+ const o = r(i);
1426
+ return (!isFinite(o[0]) || !isFinite(o[1])) && console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${o[0]},${[1]}]`), o;
1427
+ };
1428
+ }
1429
+ return s || Yt;
1430
+ },
1431
+ threshold(t) {
1432
+ return $.toVector(t, 0);
1433
+ }
1434
+ };
1435
+ process.env.NODE_ENV === "development" && Object.assign(wt, {
1436
+ domTarget(t) {
1437
+ if (t !== void 0)
1438
+ throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
1439
+ return NaN;
1440
+ },
1441
+ lockDirection(t) {
1442
+ if (t !== void 0)
1443
+ throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
1444
+ return NaN;
1445
+ },
1446
+ initial(t) {
1447
+ if (t !== void 0)
1448
+ throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
1449
+ return NaN;
1450
+ }
1451
+ });
1452
+ const gs = 0, pe = Y(Y({}, wt), {}, {
1453
+ axis(t, e, {
1454
+ axis: n
1455
+ }) {
1456
+ if (this.lockDirection = n === "lock", !this.lockDirection) return n;
1457
+ },
1458
+ axisThreshold(t = gs) {
1459
+ return t;
1460
+ },
1461
+ bounds(t = {}) {
1462
+ if (typeof t == "function")
1463
+ return (i) => pe.bounds(t(i));
1464
+ if ("current" in t)
1465
+ return () => t.current;
1466
+ if (typeof HTMLElement == "function" && t instanceof HTMLElement)
1467
+ return t;
1468
+ const {
1469
+ left: e = -1 / 0,
1470
+ right: n = 1 / 0,
1471
+ top: s = -1 / 0,
1472
+ bottom: r = 1 / 0
1473
+ } = t;
1474
+ return [[e, n], [s, r]];
1475
+ }
1476
+ }), Ut = {
1477
+ ArrowRight: (t, e = 1) => [t * e, 0],
1478
+ ArrowLeft: (t, e = 1) => [-1 * t * e, 0],
1479
+ ArrowUp: (t, e = 1) => [0, -1 * t * e],
1480
+ ArrowDown: (t, e = 1) => [0, t * e]
1481
+ };
1482
+ class ys extends Oe {
1483
+ constructor(...e) {
1484
+ super(...e), X(this, "ingKey", "dragging");
1485
+ }
1486
+ reset() {
1487
+ super.reset();
1488
+ const e = this.state;
1489
+ e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this);
1490
+ }
1491
+ setup() {
1492
+ const e = this.state;
1493
+ if (e._bounds instanceof HTMLElement) {
1494
+ const n = e._bounds.getBoundingClientRect(), s = e.currentTarget.getBoundingClientRect(), r = {
1495
+ left: n.left - s.left + e.offset[0],
1496
+ right: n.right - s.right + e.offset[0],
1497
+ top: n.top - s.top + e.offset[1],
1498
+ bottom: n.bottom - s.bottom + e.offset[1]
1499
+ };
1500
+ e._bounds = pe.bounds(r);
1501
+ }
1502
+ }
1503
+ cancel() {
1504
+ const e = this.state;
1505
+ e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
1506
+ this.compute(), this.emit();
1507
+ }, 0));
1508
+ }
1509
+ setActive() {
1510
+ this.state._active = this.state._pointerActive || this.state._keyboardActive;
1511
+ }
1512
+ clean() {
1513
+ this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
1514
+ }
1515
+ pointerDown(e) {
1516
+ const n = this.config, s = this.state;
1517
+ if (e.buttons != null && (Array.isArray(n.pointerButtons) ? !n.pointerButtons.includes(e.buttons) : n.pointerButtons !== -1 && n.pointerButtons !== e.buttons)) return;
1518
+ const r = this.ctrl.setEventIds(e);
1519
+ n.pointerCapture && e.target.setPointerCapture(e.pointerId), !(r && r.size > 1 && s._pointerActive) && (this.start(e), this.setupPointer(e), s._pointerId = et(e), s._pointerActive = !0, this.computeValues(xe(e)), this.computeInitial(), n.preventScrollAxis && ln(e) !== "mouse" ? (s._active = !1, this.setupScrollPrevention(e)) : n.delay > 0 ? (this.setupDelayTrigger(e), n.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
1520
+ }
1521
+ startPointerDrag(e) {
1522
+ const n = this.state;
1523
+ n._active = !0, n._preventScroll = !0, n._delayed = !1, this.compute(e), this.emit();
1524
+ }
1525
+ pointerMove(e) {
1526
+ const n = this.state, s = this.config;
1527
+ if (!n._pointerActive) return;
1528
+ const r = et(e);
1529
+ if (n._pointerId !== void 0 && r !== n._pointerId) return;
1530
+ const i = xe(e);
1531
+ if (document.pointerLockElement === e.target ? n._delta = [e.movementX, e.movementY] : (n._delta = $.sub(i, n._values), this.computeValues(i)), $.addTo(n._movement, n._delta), this.compute(e), n._delayed && n.intentional) {
1532
+ this.timeoutStore.remove("dragDelay"), n.active = !1, this.startPointerDrag(e);
1533
+ return;
1534
+ }
1535
+ if (s.preventScrollAxis && !n._preventScroll)
1536
+ if (n.axis)
1537
+ if (n.axis === s.preventScrollAxis || s.preventScrollAxis === "xy") {
1538
+ n._active = !1, this.clean();
1539
+ return;
1540
+ } else {
1541
+ this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
1542
+ return;
1543
+ }
1544
+ else
1545
+ return;
1546
+ this.emit();
1547
+ }
1548
+ pointerUp(e) {
1549
+ this.ctrl.setEventIds(e);
1550
+ try {
1551
+ this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId);
1552
+ } catch {
1553
+ process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
1554
+ }
1555
+ const n = this.state, s = this.config;
1556
+ if (!n._active || !n._pointerActive) return;
1557
+ const r = et(e);
1558
+ if (n._pointerId !== void 0 && r !== n._pointerId) return;
1559
+ this.state._pointerActive = !1, this.setActive(), this.compute(e);
1560
+ const [i, o] = n._distance;
1561
+ if (n.tap = i <= s.tapsThreshold && o <= s.tapsThreshold, n.tap && s.filterTaps)
1562
+ n._force = !0;
1563
+ else {
1564
+ const [a, l] = n._delta, [d, f] = n._movement, [v, m] = s.swipe.velocity, [w, O] = s.swipe.distance, R = s.swipe.duration;
1565
+ if (n.elapsedTime < R) {
1566
+ const c = Math.abs(a / n.timeDelta), g = Math.abs(l / n.timeDelta);
1567
+ c > v && Math.abs(d) > w && (n.swipe[0] = Math.sign(a)), g > m && Math.abs(f) > O && (n.swipe[1] = Math.sign(l));
1568
+ }
1569
+ }
1570
+ this.emit();
1571
+ }
1572
+ pointerClick(e) {
1573
+ !this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation());
1574
+ }
1575
+ setupPointer(e) {
1576
+ const n = this.config, s = n.device;
1577
+ if (process.env.NODE_ENV === "development")
1578
+ try {
1579
+ if (s === "pointer" && n.preventScrollDelay === void 0) {
1580
+ const r = "uv" in e ? e.sourceEvent.currentTarget : e.currentTarget;
1581
+ window.getComputedStyle(r).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", r);
1582
+ }
1583
+ } catch {
1584
+ }
1585
+ n.pointerLock && e.currentTarget.requestPointerLock(), n.pointerCapture || (this.eventStore.add(this.sharedConfig.window, s, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, s, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, s, "cancel", this.pointerUp.bind(this)));
1586
+ }
1587
+ pointerClean() {
1588
+ this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
1589
+ }
1590
+ preventScroll(e) {
1591
+ this.state._preventScroll && e.cancelable && e.preventDefault();
1592
+ }
1593
+ setupScrollPrevention(e) {
1594
+ this.state._preventScroll = !1, _s(e);
1595
+ const n = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), {
1596
+ passive: !1
1597
+ });
1598
+ this.eventStore.add(this.sharedConfig.window, "touch", "end", n), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", n), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e);
1599
+ }
1600
+ setupDelayTrigger(e) {
1601
+ this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
1602
+ this.state._step = [0, 0], this.startPointerDrag(e);
1603
+ }, this.config.delay);
1604
+ }
1605
+ keyDown(e) {
1606
+ const n = Ut[e.key];
1607
+ if (n) {
1608
+ const s = this.state, r = e.shiftKey ? 10 : e.altKey ? 0.1 : 1;
1609
+ this.start(e), s._delta = n(this.config.keyboardDisplacement, r), s._keyboardActive = !0, $.addTo(s._movement, s._delta), this.compute(e), this.emit();
1610
+ }
1611
+ }
1612
+ keyUp(e) {
1613
+ e.key in Ut && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit());
1614
+ }
1615
+ bind(e) {
1616
+ const n = this.config.device;
1617
+ e(n, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(n, "change", this.pointerMove.bind(this)), e(n, "end", this.pointerUp.bind(this)), e(n, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
1618
+ capture: !0,
1619
+ passive: !1
1620
+ });
1621
+ }
1622
+ }
1623
+ function _s(t) {
1624
+ "persist" in t && typeof t.persist == "function" && t.persist();
1625
+ }
1626
+ const Re = typeof window < "u" && window.document && window.document.createElement;
1627
+ function hn() {
1628
+ return Re && "ontouchstart" in window;
1629
+ }
1630
+ function vs() {
1631
+ return hn() || Re && window.navigator.maxTouchPoints > 1;
1632
+ }
1633
+ function bs() {
1634
+ return Re && "onpointerdown" in window;
1635
+ }
1636
+ function ws() {
1637
+ return Re && "exitPointerLock" in window.document;
1638
+ }
1639
+ function xs() {
1640
+ try {
1641
+ return "constructor" in GestureEvent;
1642
+ } catch {
1643
+ return !1;
1644
+ }
1645
+ }
1646
+ const ne = {
1647
+ isBrowser: Re,
1648
+ gesture: xs(),
1649
+ touch: hn(),
1650
+ touchscreen: vs(),
1651
+ pointer: bs(),
1652
+ pointerLock: ws()
1653
+ }, Es = 250, Ss = 180, Ts = 0.5, Is = 50, Ps = 250, ks = 10, Bt = {
1654
+ mouse: 0,
1655
+ touch: 0,
1656
+ pen: 8
1657
+ }, pn = Y(Y({}, pe), {}, {
1658
+ device(t, e, {
1659
+ pointer: {
1660
+ touch: n = !1,
1661
+ lock: s = !1,
1662
+ mouse: r = !1
1663
+ } = {}
1664
+ }) {
1665
+ return this.pointerLock = s && ne.pointerLock, ne.touch && n ? "touch" : this.pointerLock ? "mouse" : ne.pointer && !r ? "pointer" : ne.touch ? "touch" : "mouse";
1666
+ },
1667
+ preventScrollAxis(t, e, {
1668
+ preventScroll: n
1669
+ }) {
1670
+ if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && t ? Es : void 0, !(!ne.touchscreen || n === !1))
1671
+ return t || (n !== void 0 ? "y" : void 0);
1672
+ },
1673
+ pointerCapture(t, e, {
1674
+ pointer: {
1675
+ capture: n = !0,
1676
+ buttons: s = 1,
1677
+ keys: r = !0
1678
+ } = {}
1679
+ }) {
1680
+ return this.pointerButtons = s, this.keys = r, !this.pointerLock && this.device === "pointer" && n;
1681
+ },
1682
+ threshold(t, e, {
1683
+ filterTaps: n = !1,
1684
+ tapsThreshold: s = 3,
1685
+ axis: r = void 0
1686
+ }) {
1687
+ const i = $.toVector(t, n ? s : r ? 1 : 0);
1688
+ return this.filterTaps = n, this.tapsThreshold = s, i;
1689
+ },
1690
+ swipe({
1691
+ velocity: t = Ts,
1692
+ distance: e = Is,
1693
+ duration: n = Ps
1694
+ } = {}) {
1695
+ return {
1696
+ velocity: this.transform($.toVector(t)),
1697
+ distance: this.transform($.toVector(e)),
1698
+ duration: n
1699
+ };
1700
+ },
1701
+ delay(t = 0) {
1702
+ switch (t) {
1703
+ case !0:
1704
+ return Ss;
1705
+ case !1:
1706
+ return 0;
1707
+ default:
1708
+ return t;
1709
+ }
1710
+ },
1711
+ axisThreshold(t) {
1712
+ return t ? Y(Y({}, Bt), t) : Bt;
1713
+ },
1714
+ keyboardDisplacement(t = ks) {
1715
+ return t;
1716
+ }
1717
+ });
1718
+ process.env.NODE_ENV === "development" && Object.assign(pn, {
1719
+ useTouch(t) {
1720
+ if (t !== void 0)
1721
+ throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
1722
+ return NaN;
1723
+ },
1724
+ experimental_preventWindowScrollY(t) {
1725
+ if (t !== void 0)
1726
+ throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
1727
+ return NaN;
1728
+ },
1729
+ swipeVelocity(t) {
1730
+ if (t !== void 0)
1731
+ throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
1732
+ return NaN;
1733
+ },
1734
+ swipeDistance(t) {
1735
+ if (t !== void 0)
1736
+ throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
1737
+ return NaN;
1738
+ },
1739
+ swipeDuration(t) {
1740
+ if (t !== void 0)
1741
+ throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
1742
+ return NaN;
1743
+ }
1744
+ });
1745
+ function mn(t) {
1746
+ const [e, n] = t.overflow, [s, r] = t._delta, [i, o] = t._direction;
1747
+ (e < 0 && s > 0 && i < 0 || e > 0 && s < 0 && i > 0) && (t._movement[0] = t._movementBound[0]), (n < 0 && r > 0 && o < 0 || n > 0 && r < 0 && o > 0) && (t._movement[1] = t._movementBound[1]);
1748
+ }
1749
+ const Ds = 30, Os = 100;
1750
+ class Rs extends fn {
1751
+ constructor(...e) {
1752
+ super(...e), X(this, "ingKey", "pinching"), X(this, "aliasKey", "da");
1753
+ }
1754
+ init() {
1755
+ this.state.offset = [1, 0], this.state.lastOffset = [1, 0], this.state._pointerEvents = /* @__PURE__ */ new Map();
1756
+ }
1757
+ reset() {
1758
+ super.reset();
1759
+ const e = this.state;
1760
+ e._touchIds = [], e.canceled = !1, e.cancel = this.cancel.bind(this), e.turns = 0;
1761
+ }
1762
+ computeOffset() {
1763
+ const {
1764
+ type: e,
1765
+ movement: n,
1766
+ lastOffset: s
1767
+ } = this.state;
1768
+ e === "wheel" ? this.state.offset = $.add(n, s) : this.state.offset = [(1 + n[0]) * s[0], n[1] + s[1]];
1769
+ }
1770
+ computeMovement() {
1771
+ const {
1772
+ offset: e,
1773
+ lastOffset: n
1774
+ } = this.state;
1775
+ this.state.movement = [e[0] / n[0], e[1] - n[1]];
1776
+ }
1777
+ axisIntent() {
1778
+ const e = this.state, [n, s] = e._movement;
1779
+ if (!e.axis) {
1780
+ const r = Math.abs(n) * Ds - Math.abs(s);
1781
+ r < 0 ? e.axis = "angle" : r > 0 && (e.axis = "scale");
1782
+ }
1783
+ }
1784
+ restrictToAxis(e) {
1785
+ this.config.lockDirection && (this.state.axis === "scale" ? e[1] = 0 : this.state.axis === "angle" && (e[0] = 0));
1786
+ }
1787
+ cancel() {
1788
+ const e = this.state;
1789
+ e.canceled || setTimeout(() => {
1790
+ e.canceled = !0, e._active = !1, this.compute(), this.emit();
1791
+ }, 0);
1792
+ }
1793
+ touchStart(e) {
1794
+ this.ctrl.setEventIds(e);
1795
+ const n = this.state, s = this.ctrl.touchIds;
1796
+ if (n._active && n._touchIds.every((i) => s.has(i)) || s.size < 2) return;
1797
+ this.start(e), n._touchIds = Array.from(s).slice(0, 2);
1798
+ const r = Lt(e, n._touchIds);
1799
+ r && this.pinchStart(e, r);
1800
+ }
1801
+ pointerStart(e) {
1802
+ if (e.buttons != null && e.buttons % 2 !== 1) return;
1803
+ this.ctrl.setEventIds(e), e.target.setPointerCapture(e.pointerId);
1804
+ const n = this.state, s = n._pointerEvents, r = this.ctrl.pointerIds;
1805
+ if (n._active && Array.from(s.keys()).every((o) => r.has(o)) || (s.size < 2 && s.set(e.pointerId, e), n._pointerEvents.size < 2)) return;
1806
+ this.start(e);
1807
+ const i = dt(...Array.from(s.values()));
1808
+ i && this.pinchStart(e, i);
1809
+ }
1810
+ pinchStart(e, n) {
1811
+ const s = this.state;
1812
+ s.origin = n.origin, this.computeValues([n.distance, n.angle]), this.computeInitial(), this.compute(e), this.emit();
1813
+ }
1814
+ touchMove(e) {
1815
+ if (!this.state._active) return;
1816
+ const n = Lt(e, this.state._touchIds);
1817
+ n && this.pinchMove(e, n);
1818
+ }
1819
+ pointerMove(e) {
1820
+ const n = this.state._pointerEvents;
1821
+ if (n.has(e.pointerId) && n.set(e.pointerId, e), !this.state._active) return;
1822
+ const s = dt(...Array.from(n.values()));
1823
+ s && this.pinchMove(e, s);
1824
+ }
1825
+ pinchMove(e, n) {
1826
+ const s = this.state, r = s._values[1], i = n.angle - r;
1827
+ let o = 0;
1828
+ Math.abs(i) > 270 && (o += Math.sign(i)), this.computeValues([n.distance, n.angle - 360 * o]), s.origin = n.origin, s.turns = o, s._movement = [s._values[0] / s._initial[0] - 1, s._values[1] - s._initial[1]], this.compute(e), this.emit();
1829
+ }
1830
+ touchEnd(e) {
1831
+ this.ctrl.setEventIds(e), this.state._active && this.state._touchIds.some((n) => !this.ctrl.touchIds.has(n)) && (this.state._active = !1, this.compute(e), this.emit());
1832
+ }
1833
+ pointerEnd(e) {
1834
+ const n = this.state;
1835
+ this.ctrl.setEventIds(e);
1836
+ try {
1837
+ e.target.releasePointerCapture(e.pointerId);
1838
+ } catch {
1839
+ }
1840
+ n._pointerEvents.has(e.pointerId) && n._pointerEvents.delete(e.pointerId), n._active && n._pointerEvents.size < 2 && (n._active = !1, this.compute(e), this.emit());
1841
+ }
1842
+ gestureStart(e) {
1843
+ e.cancelable && e.preventDefault();
1844
+ const n = this.state;
1845
+ n._active || (this.start(e), this.computeValues([e.scale, e.rotation]), n.origin = [e.clientX, e.clientY], this.compute(e), this.emit());
1846
+ }
1847
+ gestureMove(e) {
1848
+ if (e.cancelable && e.preventDefault(), !this.state._active) return;
1849
+ const n = this.state;
1850
+ this.computeValues([e.scale, e.rotation]), n.origin = [e.clientX, e.clientY];
1851
+ const s = n._movement;
1852
+ n._movement = [e.scale - 1, e.rotation], n._delta = $.sub(n._movement, s), this.compute(e), this.emit();
1853
+ }
1854
+ gestureEnd(e) {
1855
+ this.state._active && (this.state._active = !1, this.compute(e), this.emit());
1856
+ }
1857
+ wheel(e) {
1858
+ const n = this.config.modifierKey;
1859
+ n && (Array.isArray(n) ? !n.find((s) => e[s]) : !e[n]) || (this.state._active ? this.wheelChange(e) : this.wheelStart(e), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this)));
1860
+ }
1861
+ wheelStart(e) {
1862
+ this.start(e), this.wheelChange(e);
1863
+ }
1864
+ wheelChange(e) {
1865
+ "uv" in e || (e.cancelable && e.preventDefault(), process.env.NODE_ENV === "development" && !e.defaultPrevented && console.warn("[@use-gesture]: To properly support zoom on trackpads, try using the `target` option.\n\nThis message will only appear in development mode."));
1866
+ const s = this.state;
1867
+ s._delta = [-dn(e)[1] / Os * s.offset[0], 0], $.addTo(s._movement, s._delta), mn(s), this.state.origin = [e.clientX, e.clientY], this.compute(e), this.emit();
1868
+ }
1869
+ wheelEnd() {
1870
+ this.state._active && (this.state._active = !1, this.compute(), this.emit());
1871
+ }
1872
+ bind(e) {
1873
+ const n = this.config.device;
1874
+ n && (e(n, "start", this[n + "Start"].bind(this)), e(n, "change", this[n + "Move"].bind(this)), e(n, "end", this[n + "End"].bind(this)), e(n, "cancel", this[n + "End"].bind(this)), e("lostPointerCapture", "", this[n + "End"].bind(this))), this.config.pinchOnWheel && e("wheel", "", this.wheel.bind(this), {
1875
+ passive: !1
1876
+ });
1877
+ }
1878
+ }
1879
+ const Ns = Y(Y({}, wt), {}, {
1880
+ device(t, e, {
1881
+ shared: n,
1882
+ pointer: {
1883
+ touch: s = !1
1884
+ } = {}
1885
+ }) {
1886
+ if (n.target && !ne.touch && ne.gesture) return "gesture";
1887
+ if (ne.touch && s) return "touch";
1888
+ if (ne.touchscreen) {
1889
+ if (ne.pointer) return "pointer";
1890
+ if (ne.touch) return "touch";
1891
+ }
1892
+ },
1893
+ bounds(t, e, {
1894
+ scaleBounds: n = {},
1895
+ angleBounds: s = {}
1896
+ }) {
1897
+ const r = (o) => {
1898
+ const a = Vt(Ue(n, o), {
1899
+ min: -1 / 0,
1900
+ max: 1 / 0
1901
+ });
1902
+ return [a.min, a.max];
1903
+ }, i = (o) => {
1904
+ const a = Vt(Ue(s, o), {
1905
+ min: -1 / 0,
1906
+ max: 1 / 0
1907
+ });
1908
+ return [a.min, a.max];
1909
+ };
1910
+ return typeof n != "function" && typeof s != "function" ? [r(), i()] : (o) => [r(o), i(o)];
1911
+ },
1912
+ threshold(t, e, n) {
1913
+ return this.lockDirection = n.axis === "lock", $.toVector(t, this.lockDirection ? [0.1, 3] : 0);
1914
+ },
1915
+ modifierKey(t) {
1916
+ return t === void 0 ? "ctrlKey" : t;
1917
+ },
1918
+ pinchOnWheel(t = !0) {
1919
+ return t;
1920
+ }
1921
+ });
1922
+ class As extends Oe {
1923
+ constructor(...e) {
1924
+ super(...e), X(this, "ingKey", "moving");
1925
+ }
1926
+ move(e) {
1927
+ this.config.mouseOnly && e.pointerType !== "mouse" || (this.state._active ? this.moveChange(e) : this.moveStart(e), this.timeoutStore.add("moveEnd", this.moveEnd.bind(this)));
1928
+ }
1929
+ moveStart(e) {
1930
+ this.start(e), this.computeValues(xe(e)), this.compute(e), this.computeInitial(), this.emit();
1931
+ }
1932
+ moveChange(e) {
1933
+ if (!this.state._active) return;
1934
+ const n = xe(e), s = this.state;
1935
+ s._delta = $.sub(n, s._values), $.addTo(s._movement, s._delta), this.computeValues(n), this.compute(e), this.emit();
1936
+ }
1937
+ moveEnd(e) {
1938
+ this.state._active && (this.state._active = !1, this.compute(e), this.emit());
1939
+ }
1940
+ bind(e) {
1941
+ e("pointer", "change", this.move.bind(this)), e("pointer", "leave", this.moveEnd.bind(this));
1942
+ }
1943
+ }
1944
+ const Cs = Y(Y({}, pe), {}, {
1945
+ mouseOnly: (t = !0) => t
1946
+ });
1947
+ class Ms extends Oe {
1948
+ constructor(...e) {
1949
+ super(...e), X(this, "ingKey", "scrolling");
1950
+ }
1951
+ scroll(e) {
1952
+ this.state._active || this.start(e), this.scrollChange(e), this.timeoutStore.add("scrollEnd", this.scrollEnd.bind(this));
1953
+ }
1954
+ scrollChange(e) {
1955
+ e.cancelable && e.preventDefault();
1956
+ const n = this.state, s = us(e);
1957
+ n._delta = $.sub(s, n._values), $.addTo(n._movement, n._delta), this.computeValues(s), this.compute(e), this.emit();
1958
+ }
1959
+ scrollEnd() {
1960
+ this.state._active && (this.state._active = !1, this.compute(), this.emit());
1961
+ }
1962
+ bind(e) {
1963
+ e("scroll", "", this.scroll.bind(this));
1964
+ }
1965
+ }
1966
+ const js = pe;
1967
+ class zs extends Oe {
1968
+ constructor(...e) {
1969
+ super(...e), X(this, "ingKey", "wheeling");
1970
+ }
1971
+ wheel(e) {
1972
+ this.state._active || this.start(e), this.wheelChange(e), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this));
1973
+ }
1974
+ wheelChange(e) {
1975
+ const n = this.state;
1976
+ n._delta = dn(e), $.addTo(n._movement, n._delta), mn(n), this.compute(e), this.emit();
1977
+ }
1978
+ wheelEnd() {
1979
+ this.state._active && (this.state._active = !1, this.compute(), this.emit());
1980
+ }
1981
+ bind(e) {
1982
+ e("wheel", "", this.wheel.bind(this));
1983
+ }
1984
+ }
1985
+ const Ls = pe;
1986
+ class $s extends Oe {
1987
+ constructor(...e) {
1988
+ super(...e), X(this, "ingKey", "hovering");
1989
+ }
1990
+ enter(e) {
1991
+ this.config.mouseOnly && e.pointerType !== "mouse" || (this.start(e), this.computeValues(xe(e)), this.compute(e), this.emit());
1992
+ }
1993
+ leave(e) {
1994
+ if (this.config.mouseOnly && e.pointerType !== "mouse") return;
1995
+ const n = this.state;
1996
+ if (!n._active) return;
1997
+ n._active = !1;
1998
+ const s = xe(e);
1999
+ n._movement = n._delta = $.sub(s, n._values), this.computeValues(s), this.compute(e), n.delta = n.movement, this.emit();
2000
+ }
2001
+ bind(e) {
2002
+ e("pointer", "enter", this.enter.bind(this)), e("pointer", "leave", this.leave.bind(this));
2003
+ }
2004
+ }
2005
+ const Hs = Y(Y({}, pe), {}, {
2006
+ mouseOnly: (t = !0) => t
2007
+ }), xt = /* @__PURE__ */ new Map(), ft = /* @__PURE__ */ new Map();
2008
+ function Vs(t) {
2009
+ xt.set(t.key, t.engine), ft.set(t.key, t.resolver);
2010
+ }
2011
+ const Ys = {
2012
+ key: "drag",
2013
+ engine: ys,
2014
+ resolver: pn
2015
+ }, Fs = {
2016
+ key: "hover",
2017
+ engine: $s,
2018
+ resolver: Hs
2019
+ }, Us = {
2020
+ key: "move",
2021
+ engine: As,
2022
+ resolver: Cs
2023
+ }, Bs = {
2024
+ key: "pinch",
2025
+ engine: Rs,
2026
+ resolver: Ns
2027
+ }, Xs = {
2028
+ key: "scroll",
2029
+ engine: Ms,
2030
+ resolver: js
2031
+ }, Ws = {
2032
+ key: "wheel",
2033
+ engine: zs,
2034
+ resolver: Ls
2035
+ };
2036
+ function Ks(t, e) {
2037
+ if (t == null) return {};
2038
+ var n = {}, s = Object.keys(t), r, i;
2039
+ for (i = 0; i < s.length; i++)
2040
+ r = s[i], !(e.indexOf(r) >= 0) && (n[r] = t[r]);
2041
+ return n;
2042
+ }
2043
+ function Gs(t, e) {
2044
+ if (t == null) return {};
2045
+ var n = Ks(t, e), s, r;
2046
+ if (Object.getOwnPropertySymbols) {
2047
+ var i = Object.getOwnPropertySymbols(t);
2048
+ for (r = 0; r < i.length; r++)
2049
+ s = i[r], !(e.indexOf(s) >= 0) && Object.prototype.propertyIsEnumerable.call(t, s) && (n[s] = t[s]);
2050
+ }
2051
+ return n;
2052
+ }
2053
+ const qs = {
2054
+ target(t) {
2055
+ if (t)
2056
+ return () => "current" in t ? t.current : t;
2057
+ },
2058
+ enabled(t = !0) {
2059
+ return t;
2060
+ },
2061
+ window(t = ne.isBrowser ? window : void 0) {
2062
+ return t;
2063
+ },
2064
+ eventOptions({
2065
+ passive: t = !0,
2066
+ capture: e = !1
2067
+ } = {}) {
2068
+ return {
2069
+ passive: t,
2070
+ capture: e
2071
+ };
2072
+ },
2073
+ transform(t) {
2074
+ return t;
2075
+ }
2076
+ }, Js = ["target", "eventOptions", "window", "enabled", "transform"];
2077
+ function ze(t = {}, e) {
2078
+ const n = {};
2079
+ for (const [s, r] of Object.entries(e))
2080
+ switch (typeof r) {
2081
+ case "function":
2082
+ if (process.env.NODE_ENV === "development") {
2083
+ const i = r.call(n, t[s], s, t);
2084
+ Number.isNaN(i) || (n[s] = i);
2085
+ } else
2086
+ n[s] = r.call(n, t[s], s, t);
2087
+ break;
2088
+ case "object":
2089
+ n[s] = ze(t[s], r);
2090
+ break;
2091
+ case "boolean":
2092
+ r && (n[s] = t[s]);
2093
+ break;
2094
+ }
2095
+ return n;
2096
+ }
2097
+ function Zs(t, e, n = {}) {
2098
+ const s = t, {
2099
+ target: r,
2100
+ eventOptions: i,
2101
+ window: o,
2102
+ enabled: a,
2103
+ transform: l
2104
+ } = s, d = Gs(s, Js);
2105
+ if (n.shared = ze({
2106
+ target: r,
2107
+ eventOptions: i,
2108
+ window: o,
2109
+ enabled: a,
2110
+ transform: l
2111
+ }, qs), e) {
2112
+ const f = ft.get(e);
2113
+ n[e] = ze(Y({
2114
+ shared: n.shared
2115
+ }, d), f);
2116
+ } else
2117
+ for (const f in d) {
2118
+ const v = ft.get(f);
2119
+ if (v)
2120
+ n[f] = ze(Y({
2121
+ shared: n.shared
2122
+ }, d[f]), v);
2123
+ else if (process.env.NODE_ENV === "development" && !["drag", "pinch", "scroll", "wheel", "move", "hover"].includes(f)) {
2124
+ if (f === "domTarget")
2125
+ throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
2126
+ console.warn(`[@use-gesture]: Unknown config key \`${f}\` was used. Please read the documentation for further information.`);
2127
+ }
2128
+ }
2129
+ return n;
2130
+ }
2131
+ class gn {
2132
+ constructor(e, n) {
2133
+ X(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = e, this._gestureKey = n;
2134
+ }
2135
+ add(e, n, s, r, i) {
2136
+ const o = this._listeners, a = os(n, s), l = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}, d = Y(Y({}, l), i);
2137
+ e.addEventListener(a, r, d);
2138
+ const f = () => {
2139
+ e.removeEventListener(a, r, d), o.delete(f);
2140
+ };
2141
+ return o.add(f), f;
2142
+ }
2143
+ clean() {
2144
+ this._listeners.forEach((e) => e()), this._listeners.clear();
2145
+ }
2146
+ }
2147
+ class Qs {
2148
+ constructor() {
2149
+ X(this, "_timeouts", /* @__PURE__ */ new Map());
2150
+ }
2151
+ add(e, n, s = 140, ...r) {
2152
+ this.remove(e), this._timeouts.set(e, window.setTimeout(n, s, ...r));
2153
+ }
2154
+ remove(e) {
2155
+ const n = this._timeouts.get(e);
2156
+ n && window.clearTimeout(n);
2157
+ }
2158
+ clean() {
2159
+ this._timeouts.forEach((e) => void window.clearTimeout(e)), this._timeouts.clear();
2160
+ }
2161
+ }
2162
+ class er {
2163
+ constructor(e) {
2164
+ X(this, "gestures", /* @__PURE__ */ new Set()), X(this, "_targetEventStore", new gn(this)), X(this, "gestureEventStores", {}), X(this, "gestureTimeoutStores", {}), X(this, "handlers", {}), X(this, "config", {}), X(this, "pointerIds", /* @__PURE__ */ new Set()), X(this, "touchIds", /* @__PURE__ */ new Set()), X(this, "state", {
2165
+ shared: {
2166
+ shiftKey: !1,
2167
+ metaKey: !1,
2168
+ ctrlKey: !1,
2169
+ altKey: !1
2170
+ }
2171
+ }), tr(this, e);
2172
+ }
2173
+ setEventIds(e) {
2174
+ if (Je(e))
2175
+ return this.touchIds = new Set(ls(e)), this.touchIds;
2176
+ if ("pointerId" in e)
2177
+ return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds;
2178
+ }
2179
+ applyHandlers(e, n) {
2180
+ this.handlers = e, this.nativeHandlers = n;
2181
+ }
2182
+ applyConfig(e, n) {
2183
+ this.config = Zs(e, n, this.config);
2184
+ }
2185
+ clean() {
2186
+ this._targetEventStore.clean();
2187
+ for (const e of this.gestures)
2188
+ this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean();
2189
+ }
2190
+ effect() {
2191
+ return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
2192
+ }
2193
+ bind(...e) {
2194
+ const n = this.config.shared, s = {};
2195
+ let r;
2196
+ if (!(n.target && (r = n.target(), !r))) {
2197
+ if (n.enabled) {
2198
+ for (const o of this.gestures) {
2199
+ const a = this.config[o], l = Xt(s, a.eventOptions, !!r);
2200
+ if (a.enabled) {
2201
+ const d = xt.get(o);
2202
+ new d(this, e, o).bind(l);
2203
+ }
2204
+ }
2205
+ const i = Xt(s, n.eventOptions, !!r);
2206
+ for (const o in this.nativeHandlers)
2207
+ i(o, "", (a) => this.nativeHandlers[o](Y(Y({}, this.state.shared), {}, {
2208
+ event: a,
2209
+ args: e
2210
+ })), void 0, !0);
2211
+ }
2212
+ for (const i in s)
2213
+ s[i] = hs(...s[i]);
2214
+ if (!r) return s;
2215
+ for (const i in s) {
2216
+ const {
2217
+ device: o,
2218
+ capture: a,
2219
+ passive: l
2220
+ } = is(i);
2221
+ this._targetEventStore.add(r, o, "", s[i], {
2222
+ capture: a,
2223
+ passive: l
2224
+ });
2225
+ }
2226
+ }
2227
+ }
2228
+ }
2229
+ function ye(t, e) {
2230
+ t.gestures.add(e), t.gestureEventStores[e] = new gn(t, e), t.gestureTimeoutStores[e] = new Qs();
2231
+ }
2232
+ function tr(t, e) {
2233
+ e.drag && ye(t, "drag"), e.wheel && ye(t, "wheel"), e.scroll && ye(t, "scroll"), e.move && ye(t, "move"), e.pinch && ye(t, "pinch"), e.hover && ye(t, "hover");
2234
+ }
2235
+ const Xt = (t, e, n) => (s, r, i, o = {}, a = !1) => {
2236
+ var l, d;
2237
+ const f = (l = o.capture) !== null && l !== void 0 ? l : e.capture, v = (d = o.passive) !== null && d !== void 0 ? d : e.passive;
2238
+ let m = a ? s : ss(s, r, f);
2239
+ n && v && (m += "Passive"), t[m] = t[m] || [], t[m].push(i);
2240
+ }, nr = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
2241
+ function sr(t) {
2242
+ const e = {}, n = {}, s = /* @__PURE__ */ new Set();
2243
+ for (let r in t)
2244
+ nr.test(r) ? (s.add(RegExp.lastMatch), n[r] = t[r]) : e[r] = t[r];
2245
+ return [n, e, s];
2246
+ }
2247
+ function _e(t, e, n, s, r, i) {
2248
+ if (!t.has(n)) return;
2249
+ if (!xt.has(s)) {
2250
+ process.env.NODE_ENV === "development" && console.warn(`[@use-gesture]: You've created a custom handler that that uses the \`${s}\` gesture but isn't properly configured.
2251
+
2252
+ Please add \`${s}Action\` when creating your handler.`);
2253
+ return;
2254
+ }
2255
+ const o = n + "Start", a = n + "End", l = (d) => {
2256
+ let f;
2257
+ return d.first && o in e && e[o](d), n in e && (f = e[n](d)), d.last && a in e && e[a](d), f;
2258
+ };
2259
+ r[s] = l, i[s] = i[s] || {};
2260
+ }
2261
+ function rr(t, e) {
2262
+ const [n, s, r] = sr(t), i = {};
2263
+ return _e(r, n, "onDrag", "drag", i, e), _e(r, n, "onWheel", "wheel", i, e), _e(r, n, "onScroll", "scroll", i, e), _e(r, n, "onPinch", "pinch", i, e), _e(r, n, "onMove", "move", i, e), _e(r, n, "onHover", "hover", i, e), {
2264
+ handlers: i,
2265
+ config: e,
2266
+ nativeHandlers: s
2267
+ };
2268
+ }
2269
+ function ir(t, e = {}, n, s) {
2270
+ const r = re.useMemo(() => new er(t), []);
2271
+ if (r.applyHandlers(t, s), r.applyConfig(e, n), re.useEffect(r.effect.bind(r)), re.useEffect(() => r.clean.bind(r), []), e.target === void 0)
2272
+ return r.bind.bind(r);
2273
+ }
2274
+ function or(t) {
2275
+ return t.forEach(Vs), function(n, s) {
2276
+ const {
2277
+ handlers: r,
2278
+ nativeHandlers: i,
2279
+ config: o
2280
+ } = rr(n, s || {});
2281
+ return ir(r, o, void 0, i);
2282
+ };
2283
+ }
2284
+ function Ne(t, e) {
2285
+ return or([Ys, Bs, Xs, Ws, Us, Fs])(t, e || {});
2286
+ }
2287
+ const ar = ({ pos: t, onDragStart: e, onDragMove: n, onDragEnd: s, className: r = "", style: i }) => {
2288
+ const o = Ne(
2289
+ {
2290
+ onDrag: ({ first: a, movement: [l, d], memo: f, event: v }) => (v.stopPropagation(), a ? e() : (f && n(t, l, d, f), f)),
2291
+ onDragEnd: ({ movement: [a, l], memo: d, event: f }) => {
2292
+ f.stopPropagation(), d && s(t, a, l, d);
2293
+ }
2294
+ },
2295
+ { drag: { filterTaps: !0, threshold: 0 } }
2296
+ );
2297
+ return /* @__PURE__ */ y.jsx(
2298
+ "div",
2299
+ {
2300
+ className: `ce-resize-handle ce-resize-handle--${t} ${r}`,
2301
+ style: { touchAction: "none", ...i },
2302
+ ...o()
2303
+ }
2304
+ );
2305
+ }, cr = ({ onDragStart: t, onDragMove: e, onDragEnd: n, className: s = "", style: r }) => {
2306
+ const i = Ne(
2307
+ {
2308
+ onDrag: ({ first: o, movement: [a, l], memo: d, event: f }) => (f.stopPropagation(), o ? t(a, l) : (d && e(a, l, d), d)),
2309
+ onDragEnd: ({ movement: [o, a], memo: l, event: d }) => {
2310
+ d.stopPropagation(), l && n(o, a, l);
2311
+ }
2312
+ },
2313
+ { drag: { filterTaps: !0, threshold: 0 } }
2314
+ );
2315
+ return /* @__PURE__ */ y.jsx(
2316
+ "div",
2317
+ {
2318
+ className: `ce-rotate-handle ${s}`,
2319
+ style: { touchAction: "none", ...r },
2320
+ ...i(),
2321
+ children: /* @__PURE__ */ y.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ y.jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) })
2322
+ }
2323
+ );
2324
+ }, yn = ({ lines: t, className: e = "", style: n }) => t.length ? /* @__PURE__ */ y.jsx(y.Fragment, { children: t.map((s, r) => /* @__PURE__ */ y.jsx(
2325
+ "div",
2326
+ {
2327
+ className: `ce-snap-guide ce-snap-guide--${s.type} ${e}`,
2328
+ style: {
2329
+ left: s.type === "vertical" ? s.pos : 0,
2330
+ top: s.type === "horizontal" ? s.pos : 0,
2331
+ ...n
2332
+ }
2333
+ },
2334
+ r
2335
+ )) }) : null, Wt = 5, _n = (t, e, n, s, r, i) => {
2336
+ let o = e, a = n;
2337
+ const l = [], d = [e, e + s / 2, e + s], f = [n, n + r / 2, n + r];
2338
+ return Object.values(i).forEach((v) => {
2339
+ if (v.id === t) return;
2340
+ const m = [v.x, v.x + v.width / 2, v.x + v.width];
2341
+ d.forEach((O, R) => {
2342
+ m.forEach((c) => {
2343
+ Math.abs(O - c) < Wt && (R === 0 && (o = c), R === 1 && (o = c - s / 2), R === 2 && (o = c - s), l.push({ type: "vertical", pos: c }));
2344
+ });
2345
+ });
2346
+ const w = [v.y, v.y + v.height / 2, v.y + v.height];
2347
+ f.forEach((O, R) => {
2348
+ w.forEach((c) => {
2349
+ Math.abs(O - c) < Wt && (R === 0 && (a = c), R === 1 && (a = c - r / 2), R === 2 && (a = c - r), l.push({ type: "horizontal", pos: c }));
2350
+ });
2351
+ });
2352
+ }), { x: o, y: a, lines: l };
2353
+ }, Kt = (t, e, n, s, r, i, o) => {
2354
+ let l = s, d = r, f = e, v = n;
2355
+ const m = [], w = e, O = e + s, R = e + s / 2, c = n, g = n + r, p = n + r / 2, b = i.includes("w"), _ = i.includes("e"), k = i.includes("n"), h = i.includes("s"), D = i === "n" || i === "s", T = i === "e" || i === "w";
2356
+ Object.values(o).forEach((S) => {
2357
+ if (S.id === t) return;
2358
+ const M = S.x, j = S.x + S.width, x = S.x + S.width / 2, U = S.y, G = S.y + S.height, K = S.y + S.height / 2;
2359
+ if (_ && [M, j, x].forEach((L) => {
2360
+ Math.abs(O - L) < 5 && (l = L - e, m.push({ type: "vertical", pos: L }));
2361
+ }), b) {
2362
+ const L = e + s;
2363
+ [M, j, x].forEach((F) => {
2364
+ Math.abs(w - F) < 5 && (f = F, l = L - F, m.push({ type: "vertical", pos: F }));
2365
+ });
2366
+ }
2367
+ if (D && Math.abs(R - x) < 5 && (f = x - s / 2, m.push({ type: "vertical", pos: x })), h && [U, G, K].forEach((L) => {
2368
+ Math.abs(g - L) < 5 && (d = L - n, m.push({ type: "horizontal", pos: L }));
2369
+ }), k) {
2370
+ const L = n + r;
2371
+ [U, G, K].forEach((F) => {
2372
+ Math.abs(c - F) < 5 && (v = F, d = L - F, m.push({ type: "horizontal", pos: F }));
2373
+ });
2374
+ }
2375
+ T && Math.abs(p - K) < 5 && (v = K - r / 2, m.push({ type: "horizontal", pos: K }));
2376
+ });
2377
+ const I = 10;
2378
+ return l < I && (b && (f = e + s - I), l = I), d < I && (k && (v = n + r - I), d = I), {
2379
+ x: f,
2380
+ y: v,
2381
+ width: l,
2382
+ height: d,
2383
+ lines: m
2384
+ };
2385
+ }, Gt = (t, e, n, s, r, i, o, a) => {
2386
+ let l = 0.5, d = 0.5;
2387
+ i.includes("n") && (d = 1), i.includes("s") && (d = 0), i.includes("e") && (l = 0), i.includes("w") && (l = 1);
2388
+ const f = r * Math.PI / 180, v = Math.cos(f), m = Math.sin(f), w = t + n / 2, O = e + s / 2, R = n * l - n / 2, c = s * d - s / 2, g = w + (R * v - c * m), p = O + (R * m + c * v), b = Math.cos(-f), _ = Math.sin(-f), k = o * b - a * _, h = o * _ + a * b;
2389
+ let D = 0, T = 0;
2390
+ i.includes("e") && (D = k), i.includes("w") && (D = -k), i.includes("s") && (T = h), i.includes("n") && (T = -h);
2391
+ const I = Math.max(10, n + D), S = Math.max(10, s + T), M = I * l - I / 2, j = S * d - S / 2, x = M * v - j * m, U = M * m + j * v, G = g - x, K = p - U, L = G - I / 2, F = K - S / 2;
2392
+ return {
2393
+ x: L,
2394
+ y: F,
2395
+ width: I,
2396
+ height: S
2397
+ };
2398
+ }, lr = ({
2399
+ id: t,
2400
+ children: e,
2401
+ className: n = "",
2402
+ style: s,
2403
+ draggable: r,
2404
+ resizable: i,
2405
+ rotatable: o,
2406
+ selectable: a,
2407
+ rotationSnap: l,
2408
+ showDragHandle: d,
2409
+ doubleClickToEdit: f,
2410
+ ...v
2411
+ }) => {
2412
+ const m = C((E) => E.nodes[t]), w = C((E) => E.config), O = C((E) => E.config.viewOnly || a === !1 ? !1 : E.selectedIds?.includes(t)), R = C((E) => E.camera.zoom), c = bt(), g = C((E) => E.selectNode), p = C((E) => E.updateNode), b = ve(null), [_, k] = Le([]), [h, D] = Le(!1), T = ve(!1);
2413
+ ie(() => {
2414
+ O || (k([]), D(!1));
2415
+ }, [O]);
2416
+ const I = ve(m);
2417
+ ie(() => {
2418
+ I.current = m;
2419
+ }, [m]);
2420
+ const S = !w.viewOnly, M = (E, A) => E !== void 0 ? E : A !== void 0 ? A : !0, j = S && M(r, m?.draggable), x = S && M(i, m?.resizable), U = S && M(o, m?.rotatable), G = S && a !== !1, K = S && j && d !== !1, L = f !== void 0 ? f : m?.doubleClickToEdit ?? m?.data?.doubleClickToEdit ?? !1, F = () => typeof l == "number" ? l : l === !1 ? 0 : l === !0 ? w.rotationSnap || 15 : w.rotationSnap || 0, ue = Ne(
2421
+ {
2422
+ onDragStart: ({ event: E }) => {
2423
+ if (!S) return;
2424
+ const A = E.target;
2425
+ A.closest(".ce-resize-handle") || A.closest(".ce-rotate-handle") || h && !A.closest(".ce-drag-handle-minimal") || G && !O && g(t);
2426
+ },
2427
+ onDrag: ({ movement: [E, A], first: W, memo: z, event: Z }) => {
2428
+ if (!S || !j) return;
2429
+ const V = Z.target;
2430
+ if (V.closest(".ce-resize-handle") || V.closest(".ce-rotate-handle") || h && !V.closest(".ce-drag-handle-minimal") || T.current || (Z && Z.stopPropagation(), !m)) return;
2431
+ if (W) return { x: m.x, y: m.y };
2432
+ const P = c.getState().nodes, J = z?.x ?? m.x, oe = z?.y ?? m.y;
2433
+ let de = J + E / R, se = oe + A / R;
2434
+ if (w.snapping) {
2435
+ const ae = _n(t, de, se, m.width, m.height, P);
2436
+ de = ae.x, se = ae.y, w.snapGuide && k(ae.lines);
2437
+ }
2438
+ if (w.isLimited) {
2439
+ const ae = (w.width || 1920) - m.width, vn = (w.height || 1080) - m.height;
2440
+ de = Math.max(0, Math.min(de, ae)), se = Math.max(0, Math.min(se, vn));
2441
+ }
2442
+ return b.current && (b.current.style.transform = `translate(${de}px, ${se}px) rotate(${m.rotation}deg)`), { x: J, y: oe, finalX: de, finalY: se };
2443
+ },
2444
+ onDragEnd: ({ memo: E, event: A }) => {
2445
+ A && A.stopPropagation(), k([]), E && typeof E.finalX == "number" && p(t, { x: E.finalX, y: E.finalY });
2446
+ }
2447
+ },
2448
+ { drag: { filterTaps: !0, threshold: 3, enabled: S } }
2449
+ ), te = ge(() => {
2450
+ T.current = !0;
2451
+ const E = I.current;
2452
+ return E ? {
2453
+ x: E.x,
2454
+ y: E.y,
2455
+ w: E.width,
2456
+ h: E.height,
2457
+ r: E.rotation || 0
2458
+ } : { x: 0, y: 0, w: 0, h: 0, r: 0 };
2459
+ }, []), u = ge((E, A, W, z) => {
2460
+ if (!b.current) return;
2461
+ const Z = c.getState().nodes, V = Gt(
2462
+ z.x,
2463
+ z.y,
2464
+ z.w,
2465
+ z.h,
2466
+ z.r,
2467
+ E,
2468
+ A / R,
2469
+ W / R
2470
+ );
2471
+ let P = { x: V.x, y: V.y, width: V.width, height: V.height, lines: [] };
2472
+ if (w.snapping ? P = Kt(
2473
+ t,
2474
+ V.x,
2475
+ V.y,
2476
+ V.width,
2477
+ V.height,
2478
+ E,
2479
+ Z
2480
+ ) : P = { ...V, lines: [] }, w.isLimited) {
2481
+ const J = w.width || 1920, oe = w.height || 1080;
2482
+ P.x < 0 && (P.width += P.x, P.x = 0), P.y < 0 && (P.height += P.y, P.y = 0), P.x + P.width > J && (P.width = J - P.x), P.y + P.height > oe && (P.height = oe - P.y);
2483
+ }
2484
+ w.snapGuide && k(P.lines), b.current.style.width = `${P.width}px`, b.current.style.height = `${P.height}px`, b.current.style.transform = `translate(${P.x}px, ${P.y}px) rotate(${z.r}deg)`;
2485
+ }, [t, R, w, c]), N = ge((E, A, W, z) => {
2486
+ const Z = c.getState().nodes, V = Gt(z.x, z.y, z.w, z.h, z.r, E, A / R, W / R);
2487
+ let P = { ...V };
2488
+ if (w.snapping && (P = Kt(t, V.x, V.y, V.width, V.height, E, Z)), w.isLimited) {
2489
+ const J = w.width || 1920, oe = w.height || 1080;
2490
+ P.x < 0 && (P.width += P.x, P.x = 0), P.y < 0 && (P.height += P.y, P.y = 0), P.x + P.width > J && (P.width = J - P.x), P.y + P.height > oe && (P.height = oe - P.y);
2491
+ }
2492
+ p(t, {
2493
+ x: P.x,
2494
+ y: P.y,
2495
+ width: P.width,
2496
+ height: P.height
2497
+ }), k([]), setTimeout(() => {
2498
+ T.current = !1;
2499
+ }, 100);
2500
+ }, [t, R, p, w, c]), H = ge((E, A) => {
2501
+ T.current = !0;
2502
+ const W = I.current;
2503
+ if (!W || !b.current) return { startRotation: 0, startAngle: 0 };
2504
+ const z = b.current.getBoundingClientRect(), Z = z.left + z.width / 2, V = z.top + z.height / 2;
2505
+ let J = Math.atan2(A - V, E - Z) * (180 / Math.PI);
2506
+ return J += 90, { startRotation: W.rotation, startAngle: J };
2507
+ }, []), B = ge((E, A, W) => {
2508
+ if (!b.current || !I.current) return;
2509
+ const z = b.current.getBoundingClientRect(), Z = z.left + z.width / 2, V = z.top + z.height / 2;
2510
+ let J = Math.atan2(A - V, E - Z) * (180 / Math.PI);
2511
+ J += 90;
2512
+ const oe = J - W.startAngle, de = w.rotationSpeed || 1;
2513
+ let se = W.startRotation + oe * de;
2514
+ const ae = F();
2515
+ ae > 0 && (se = Math.round(se / ae) * ae), b.current.style.transform = `translate(${I.current.x}px, ${I.current.y}px) rotate(${se}deg)`, b.current.__tempRotation = se;
2516
+ }, [w.rotationSpeed, F]), me = ge(() => {
2517
+ const E = b.current.__tempRotation;
2518
+ typeof E == "number" && (p(t, { rotation: E }), delete b.current.__tempRotation), setTimeout(() => {
2519
+ T.current = !1;
2520
+ }, 100);
2521
+ }, [t, p]);
2522
+ return m ? /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
2523
+ /* @__PURE__ */ y.jsx(yn, { lines: _ }),
2524
+ /* @__PURE__ */ y.jsxs(
2525
+ "div",
2526
+ {
2527
+ ref: b,
2528
+ "data-node-id": t,
2529
+ className: `ce-element ${O ? "ce-element--selected" : ""} ${n}`,
2530
+ style: {
2531
+ transform: `translate(${m.x}px, ${m.y}px) rotate(${m.rotation}deg)`,
2532
+ width: m.width,
2533
+ height: m.height,
2534
+ zIndex: O ? 100 : 1,
2535
+ "--ce-inverse-zoom": 1 / R,
2536
+ // Inject inverse zoom for CSS scaling
2537
+ ...s
2538
+ },
2539
+ ...ue(),
2540
+ ...v,
2541
+ onClick: (E) => {
2542
+ E.stopPropagation(), S && G && g(t);
2543
+ },
2544
+ onDoubleClick: (E) => {
2545
+ S && L && (E.stopPropagation(), D(!0));
2546
+ },
2547
+ children: [
2548
+ /* @__PURE__ */ y.jsx("div", { style: {
2549
+ width: "100%",
2550
+ height: "100%",
2551
+ pointerEvents: L && !h ? "none" : "auto"
2552
+ }, children: e }),
2553
+ O && S && /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
2554
+ K && /* @__PURE__ */ y.jsx("div", { className: "ce-drag-handle-minimal", children: /* @__PURE__ */ y.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
2555
+ /* @__PURE__ */ y.jsx("polyline", { points: "5 9 2 12 5 15" }),
2556
+ /* @__PURE__ */ y.jsx("polyline", { points: "9 5 12 2 15 5" }),
2557
+ /* @__PURE__ */ y.jsx("polyline", { points: "19 9 22 12 19 15" }),
2558
+ /* @__PURE__ */ y.jsx("polyline", { points: "9 19 12 22 15 19" }),
2559
+ /* @__PURE__ */ y.jsx("path", { d: "M2 12h20" }),
2560
+ /* @__PURE__ */ y.jsx("path", { d: "M12 2v20" })
2561
+ ] }) }),
2562
+ x && ["nw", "ne", "sw", "se", "n", "s", "e", "w"].map((E) => /* @__PURE__ */ y.jsx(
2563
+ ar,
2564
+ {
2565
+ pos: E,
2566
+ onDragStart: te,
2567
+ onDragMove: u,
2568
+ onDragEnd: N
2569
+ },
2570
+ E
2571
+ )),
2572
+ w.rotation && U && /* @__PURE__ */ y.jsx(
2573
+ cr,
2574
+ {
2575
+ onDragStart: H,
2576
+ onDragMove: B,
2577
+ onDragEnd: me
2578
+ }
2579
+ )
2580
+ ] })
2581
+ ]
2582
+ }
2583
+ )
2584
+ ] }) : null;
2585
+ }, ur = re.memo(lr), dr = ({
2586
+ id: t,
2587
+ children: e,
2588
+ className: n = "",
2589
+ style: s,
2590
+ draggable: r = !0,
2591
+ selectable: i = !0
2592
+ }) => {
2593
+ const o = C((_) => _.nodes[t]), a = C((_) => _.config), l = bt(), d = C((_) => _.removeNode), f = C((_) => _.config.viewOnly || !i ? !1 : _.selectedIds?.includes(t)), v = C((_) => _.camera.zoom), m = C((_) => _.selectNode), w = C((_) => _.updateNode), O = ve(null), [R, c] = Le([]);
2594
+ if (ie(() => {
2595
+ f || c([]);
2596
+ }, [f]), ie(() => {
2597
+ if (!O.current) return;
2598
+ const _ = new ResizeObserver((k) => {
2599
+ for (const h of k) {
2600
+ const { width: D, height: T } = h.contentRect;
2601
+ o && (Math.abs(o.width - D) > 1 || Math.abs(o.height - T) > 1) && w(t, { width: D, height: T });
2602
+ }
2603
+ });
2604
+ return _.observe(O.current), () => _.disconnect();
2605
+ }, [t, o?.width, o?.height, w]), !o) return null;
2606
+ const g = !a.viewOnly, p = g && r && o.draggable !== !1, b = Ne(
2607
+ {
2608
+ onDragStart: ({ event: _ }) => {
2609
+ if (!g) return;
2610
+ const k = _.target;
2611
+ k.tagName === "INPUT" || k.tagName === "TEXTAREA" || i && !f && m(t);
2612
+ },
2613
+ onDrag: ({ movement: [_, k], first: h, memo: D, event: T }) => {
2614
+ if (!p) return;
2615
+ if (T && T.stopPropagation(), h) return { x: o.x, y: o.y };
2616
+ const I = l.getState().nodes, S = D?.x ?? o.x, M = D?.y ?? o.y;
2617
+ let j = S + _ / v, x = M + k / v;
2618
+ if (a.snapping) {
2619
+ const U = _n(t, j, x, o.width, o.height, I);
2620
+ j = U.x, x = U.y, a.snapGuide && c(U.lines);
2621
+ }
2622
+ return w(t, { x: j, y: x }), O.current && (O.current.style.transform = `translate(${j}px, ${x}px)`), { x: S, y: M, finalX: j, finalY: x };
2623
+ },
2624
+ onDragEnd: ({ event: _ }) => {
2625
+ _ && _.stopPropagation(), c([]);
2626
+ }
2627
+ },
2628
+ { drag: { filterTaps: !0, threshold: 3, enabled: p } }
2629
+ );
2630
+ return /* @__PURE__ */ y.jsxs(y.Fragment, { children: [
2631
+ a.snapGuide && /* @__PURE__ */ y.jsx(yn, { lines: R }),
2632
+ /* @__PURE__ */ y.jsxs(
2633
+ "div",
2634
+ {
2635
+ ref: O,
2636
+ "data-node-id": t,
2637
+ className: `ce-element ce-workflow-node ${f ? "ce-element--selected" : ""} ${n}`,
2638
+ style: {
2639
+ position: "absolute",
2640
+ left: 0,
2641
+ top: 0,
2642
+ width: "max-content",
2643
+ transform: `translate(${o.x}px, ${o.y}px)`,
2644
+ zIndex: f ? 10 : 1,
2645
+ cursor: p ? "grab" : "default",
2646
+ touchAction: "none",
2647
+ ...s
2648
+ },
2649
+ ...b(),
2650
+ onClick: (_) => {
2651
+ _.stopPropagation(), g && i && m(t);
2652
+ },
2653
+ children: [
2654
+ o.customCss && /* @__PURE__ */ y.jsx("style", { children: `
2655
+ [data-node-id="${t}"] {
2656
+ ${o.customCss}
2657
+ }
2658
+ ` }),
2659
+ /* @__PURE__ */ y.jsx(Wn, { id: t, children: e }),
2660
+ g && !a.viewOnly && /* @__PURE__ */ y.jsx(
2661
+ "button",
2662
+ {
2663
+ className: "ce-delete-node-btn",
2664
+ onPointerDown: (_) => _.stopPropagation(),
2665
+ onClick: (_) => {
2666
+ _.stopPropagation(), d(t);
2667
+ },
2668
+ title: "Remove Node",
2669
+ children: "×"
2670
+ }
2671
+ )
2672
+ ]
2673
+ }
2674
+ )
2675
+ ] });
2676
+ }, fr = re.memo(dr), hr = () => {
2677
+ const t = C((c) => c.edges), e = C((c) => c.nodes), n = C((c) => c.connectionState), s = C((c) => c.selectNode), r = C((c) => c.selectedIds), i = C((c) => c.removeEdge), o = (c, g, p, b, _) => {
2678
+ const k = 1 - c;
2679
+ return Math.pow(k, 3) * g + 3 * Math.pow(k, 2) * c * p + 3 * k * Math.pow(c, 2) * b + Math.pow(c, 3) * _;
2680
+ }, a = (c, g, p, b) => {
2681
+ const _ = Math.abs(p - c) / 2, k = c + _, h = g, D = p - _;
2682
+ return `M ${c} ${g} C ${k} ${h}, ${D} ${b}, ${p} ${b}`;
2683
+ }, l = (c, g, p, b) => `M ${c} ${g} L ${p} ${b}`, d = (c, g, p, b) => {
2684
+ const _ = (c + p) / 2;
2685
+ return `M ${c} ${g} L ${_} ${g} L ${_} ${b} L ${p} ${b}`;
2686
+ }, f = (c, g, p, b, _) => {
2687
+ switch (c) {
2688
+ case "straight":
2689
+ return l(g, p, b, _);
2690
+ case "step":
2691
+ return d(g, p, b, _);
2692
+ default:
2693
+ return a(g, p, b, _);
2694
+ }
2695
+ }, v = C((c) => c.camera), m = C((c) => c.dimensions), O = tt(() => m.width === 0 || m.height === 0 ? Object.values(t) : Object.values(t).filter((c) => {
2696
+ const g = e[c.source], p = e[c.target];
2697
+ if (!g || !p) return !1;
2698
+ const b = Math.min(g.x, p.x), _ = Math.max(g.x + g.width, p.x + p.width), k = Math.min(g.y, p.y), h = Math.max(g.y + g.height, p.y + p.height), D = v.zoom, T = b * D + v.x, I = _ * D + v.x, S = k * D + v.y, M = h * D + v.y, j = 100;
2699
+ return !(I < -j || T > m.width + j || M < -j || S > m.height + j);
2700
+ }), [t, e, v, m]).map((c) => {
2701
+ const g = e[c.source], p = e[c.target];
2702
+ if (!g || !p) return null;
2703
+ let b = g.x + g.width / 2, _ = g.y + g.height / 2, k = p.x + p.width / 2, h = p.y + p.height / 2;
2704
+ if (g.handles && c.sourceHandle && g.handles[c.sourceHandle]) {
2705
+ const x = g.handles[c.sourceHandle];
2706
+ typeof x.x == "number" && typeof x.y == "number" && x.x !== 0 ? (b = g.x + x.x, _ = g.y + x.y) : x.position === "top" ? (b = g.x + g.width / 2, _ = g.y) : x.position === "bottom" ? (b = g.x + g.width / 2, _ = g.y + g.height) : x.position === "left" ? (b = g.x, _ = g.y + g.height / 2) : x.position === "right" && (b = g.x + g.width, _ = g.y + g.height / 2);
2707
+ }
2708
+ if (p.handles && c.targetHandle && p.handles[c.targetHandle]) {
2709
+ const x = p.handles[c.targetHandle];
2710
+ typeof x.x == "number" && typeof x.y == "number" && x.x !== 0 ? (k = p.x + x.x, h = p.y + x.y) : x.position === "top" ? (k = p.x + p.width / 2, h = p.y) : x.position === "bottom" ? (k = p.x + p.width / 2, h = p.y + p.height) : x.position === "left" ? (k = p.x, h = p.y + p.height / 2) : x.position === "right" && (k = p.x + p.width, h = p.y + p.height / 2);
2711
+ }
2712
+ const D = f(c.type, b, _, k, h), T = r.includes(c.id), I = (b + k) / 2, S = (_ + h) / 2;
2713
+ let M = I, j = S;
2714
+ if (!c.type || c.type === "default") {
2715
+ const x = Math.abs(k - b) / 2;
2716
+ M = o(0.5, b, b + x, k - x, k), j = o(0.5, _, _, h, h);
2717
+ }
2718
+ return /* @__PURE__ */ y.jsxs("g", { className: "ce-edge-group", style: { pointerEvents: "all" }, children: [
2719
+ /* @__PURE__ */ y.jsx(
2720
+ "path",
2721
+ {
2722
+ d: D,
2723
+ stroke: "transparent",
2724
+ strokeWidth: "20",
2725
+ fill: "none",
2726
+ style: { cursor: "pointer" },
2727
+ onClick: (x) => {
2728
+ x.stopPropagation(), s(c.id);
2729
+ }
2730
+ }
2731
+ ),
2732
+ /* @__PURE__ */ y.jsx(
2733
+ "path",
2734
+ {
2735
+ d: D,
2736
+ stroke: T ? "#3b82f6" : "#b1b1b7",
2737
+ strokeWidth: T ? "3" : "2",
2738
+ fill: "none",
2739
+ markerEnd: "url(#arrow-closed)",
2740
+ style: { pointerEvents: "none" }
2741
+ }
2742
+ ),
2743
+ /* @__PURE__ */ y.jsx(
2744
+ "foreignObject",
2745
+ {
2746
+ x: M - 10,
2747
+ y: j - 10,
2748
+ width: 20,
2749
+ height: 20,
2750
+ className: "ce-edge-delete-fo",
2751
+ style: { overflow: "visible" },
2752
+ children: /* @__PURE__ */ y.jsx(
2753
+ "button",
2754
+ {
2755
+ className: "ce-edge-delete-btn",
2756
+ onClick: (x) => {
2757
+ x.stopPropagation(), i(c.id);
2758
+ },
2759
+ title: "Disconnect",
2760
+ style: {
2761
+ width: "20px",
2762
+ height: "20px",
2763
+ borderRadius: "50%",
2764
+ background: "#ff4d4f",
2765
+ color: "white",
2766
+ border: "1px solid white",
2767
+ padding: 0,
2768
+ display: "flex",
2769
+ alignItems: "center",
2770
+ justifyContent: "center",
2771
+ fontSize: "14px",
2772
+ lineHeight: 1,
2773
+ cursor: "pointer",
2774
+ boxShadow: "0 2px 4px rgba(0,0,0,0.2)"
2775
+ },
2776
+ children: "×"
2777
+ }
2778
+ )
2779
+ }
2780
+ )
2781
+ ] }, c.id);
2782
+ });
2783
+ let R = null;
2784
+ if (n.isValid && n.nodeId && n.position && e[n.nodeId]) {
2785
+ const c = e[n.nodeId];
2786
+ let g = c.x + c.width / 2, p = c.y + c.height / 2;
2787
+ if (n.handleId && c.handles && c.handles[n.handleId]) {
2788
+ const h = c.handles[n.handleId];
2789
+ typeof h.x == "number" && typeof h.y == "number" && h.x !== 0 ? (g = c.x + h.x, p = c.y + h.y) : h.position === "top" ? (g = c.x + c.width / 2, p = c.y) : h.position === "bottom" ? (g = c.x + c.width / 2, p = c.y + c.height) : h.position === "left" ? (g = c.x, p = c.y + c.height / 2) : h.position === "right" && (g = c.x + c.width, p = c.y + c.height / 2);
2790
+ }
2791
+ const b = n.position.x, _ = n.position.y, k = a(g, p, b, _);
2792
+ R = /* @__PURE__ */ y.jsx(
2793
+ "path",
2794
+ {
2795
+ d: k,
2796
+ stroke: "#3b82f6",
2797
+ strokeWidth: "2",
2798
+ strokeDasharray: "5,5",
2799
+ fill: "none",
2800
+ markerEnd: "url(#arrow-closed)",
2801
+ className: "ce-connection-line"
2802
+ }
2803
+ );
2804
+ }
2805
+ return /* @__PURE__ */ y.jsxs(
2806
+ "svg",
2807
+ {
2808
+ className: "ce-edge-layer",
2809
+ style: {
2810
+ position: "absolute",
2811
+ top: 0,
2812
+ left: 0,
2813
+ width: "100%",
2814
+ height: "100%",
2815
+ overflow: "visible",
2816
+ pointerEvents: "visible",
2817
+ // Handled by children
2818
+ zIndex: 0
2819
+ },
2820
+ children: [
2821
+ /* @__PURE__ */ y.jsx("defs", { children: /* @__PURE__ */ y.jsx(
2822
+ "marker",
2823
+ {
2824
+ id: "arrow-closed",
2825
+ viewBox: "0 0 10 10",
2826
+ refX: "9",
2827
+ refY: "5",
2828
+ markerWidth: "6",
2829
+ markerHeight: "6",
2830
+ orient: "auto-start-reverse",
2831
+ children: /* @__PURE__ */ y.jsx("path", { d: "M 0 0 L 10 5 L 0 10 z", fill: "#b1b1b7" })
2832
+ }
2833
+ ) }),
2834
+ O,
2835
+ O,
2836
+ R
2837
+ ]
2838
+ }
2839
+ );
2840
+ }, yr = ({ children: t, grid: e, background: n, className: s = "", style: r, canvasStyle: i }) => {
2841
+ const o = ve(null), a = C((h) => h.camera), l = C((h) => h.config), d = C((h) => h.panCamera), f = C((h) => h.zoomCamera), v = C((h) => h.deselectAll), m = C((h) => h.deleteSelected), w = C((h) => h.setDimensions);
2842
+ ie(() => {
2843
+ const h = (I) => {
2844
+ I.ctrlKey && I.preventDefault();
2845
+ }, D = o.current;
2846
+ D && D.addEventListener("wheel", h, { passive: !1 });
2847
+ let T = null;
2848
+ return D && (T = new ResizeObserver((I) => {
2849
+ for (const S of I) {
2850
+ const { width: M, height: j } = S.contentRect;
2851
+ w(M, j);
2852
+ }
2853
+ }), T.observe(D)), () => {
2854
+ D && D.removeEventListener("wheel", h), T && T.disconnect();
2855
+ };
2856
+ }, [w]);
2857
+ const [O, R] = Le(!1);
2858
+ ie(() => {
2859
+ const h = (T) => {
2860
+ if (T.code === "Space" && !T.repeat && R(!0), (T.code === "Delete" || T.code === "Backspace") && !l.viewOnly) {
2861
+ const I = T.target;
2862
+ I.tagName !== "INPUT" && I.tagName !== "TEXTAREA" && m();
2863
+ }
2864
+ }, D = (T) => {
2865
+ T.code === "Space" && R(!1);
2866
+ };
2867
+ return window.addEventListener("keydown", h), window.addEventListener("keyup", D), () => {
2868
+ window.removeEventListener("keydown", h), window.removeEventListener("keyup", D);
2869
+ };
2870
+ }, [m, l.viewOnly]), Ne(
2871
+ {
2872
+ onDrag: ({ delta: [h, D], event: T }) => {
2873
+ const I = T.target, S = I.closest(".ce-element") || I.closest(".ce-resize-handle");
2874
+ (O || l.pan && !S) && d(h, D);
2875
+ },
2876
+ onWheel: ({ event: h, delta: [, D], ctrlKey: T }) => {
2877
+ if (T || h.metaKey) {
2878
+ if (l.zoom) {
2879
+ const I = o.current?.getBoundingClientRect();
2880
+ if (I) {
2881
+ let S, M;
2882
+ !l.pan && !O ? (S = (I.width || window.innerWidth) / 2, M = (I.height || window.innerHeight) / 2) : (S = h.clientX - I.left, M = h.clientY - I.top), f(1 - D / 500, S, M);
2883
+ }
2884
+ }
2885
+ } else
2886
+ d(-h.deltaX, -h.deltaY);
2887
+ }
2888
+ },
2889
+ {
2890
+ target: o,
2891
+ drag: { filterTaps: !0 }
2892
+ }
2893
+ );
2894
+ const c = C((h) => h.connectionState), g = C((h) => h.updateConnection), p = C((h) => h.endConnection), b = C((h) => h.addEdge);
2895
+ ie(() => {
2896
+ if (!c.isValid) return;
2897
+ const h = (T) => {
2898
+ if (!o.current) return;
2899
+ const I = o.current.getBoundingClientRect();
2900
+ let S = (T.clientX - I.left - a.x) / a.zoom, M = (T.clientY - I.top - a.y) / a.zoom;
2901
+ const x = document.elementFromPoint(T.clientX, T.clientY)?.closest(".ce-handle");
2902
+ if (document.querySelectorAll(".ce-handle--valid").forEach((U) => U.classList.remove("ce-handle--valid")), x && c.nodeId) {
2903
+ const U = x.closest("[data-node-id]")?.getAttribute("data-node-id"), G = x.dataset.handleId, K = x.dataset.handleType, L = c.handleType, F = U === c.nodeId;
2904
+ if (U && G && !F && (L === "source" && K === "target" || L === "target" && K === "source")) {
2905
+ x.classList.add("ce-handle--valid");
2906
+ const te = x.getBoundingClientRect();
2907
+ S = (te.left + te.width / 2 - I.left - a.x) / a.zoom, M = (te.top + te.height / 2 - I.top - a.y) / a.zoom;
2908
+ }
2909
+ }
2910
+ g({ x: S, y: M });
2911
+ }, D = (T) => {
2912
+ const S = document.elementFromPoint(T.clientX, T.clientY)?.closest(".ce-handle");
2913
+ if (S && c.nodeId) {
2914
+ const M = S.closest("[data-node-id]")?.getAttribute("data-node-id"), j = S.dataset.handleId, x = S.dataset.handleType, U = c.handleType, G = M === c.nodeId;
2915
+ if (M && j && !G && (U === "source" && x === "target" || U === "target" && x === "source")) {
2916
+ let L = c.nodeId, F = c.handleId || void 0, ue = M, te = j;
2917
+ U === "target" && x === "source" && (L = M, F = j, ue = c.nodeId, te = c.handleId || void 0), b({
2918
+ id: `e-${Date.now()}`,
2919
+ source: L,
2920
+ sourceHandle: F || void 0,
2921
+ target: ue,
2922
+ targetHandle: te
2923
+ });
2924
+ }
2925
+ }
2926
+ document.querySelectorAll(".ce-handle--valid").forEach((M) => M.classList.remove("ce-handle--valid")), p();
2927
+ };
2928
+ return window.addEventListener("pointermove", h), window.addEventListener("pointerup", D), () => {
2929
+ window.removeEventListener("pointermove", h), window.removeEventListener("pointerup", D), document.querySelectorAll(".ce-handle--valid").forEach((T) => T.classList.remove("ce-handle--valid"));
2930
+ };
2931
+ }, [c.isValid, a, g, p, b, c.nodeId, c.handleType, c.handleId]);
2932
+ const _ = () => {
2933
+ l.viewOnly || v();
2934
+ }, k = l.isLimited ? { touchAction: "none", cursor: O ? "grab" : "default" } : { ...r, touchAction: "none", cursor: O ? "grab" : "default" };
2935
+ return /* @__PURE__ */ y.jsxs(
2936
+ "div",
2937
+ {
2938
+ ref: o,
2939
+ className: `ce-editor__viewport ${O ? "ce-editor__viewport--panning" : ""} ${s} ${l.viewOnly ? "ce-editor--view-only" : ""} ${c.isValid ? "ce-editor--connecting" : ""}`,
2940
+ style: k,
2941
+ onClick: _,
2942
+ children: [
2943
+ n,
2944
+ /* @__PURE__ */ y.jsxs(
2945
+ "div",
2946
+ {
2947
+ className: "ce-editor__canvas",
2948
+ style: {
2949
+ transform: `translate(${a.x}px, ${a.y}px) scale(${a.zoom})`,
2950
+ ...i
2951
+ },
2952
+ children: [
2953
+ l.showGrid && /* @__PURE__ */ y.jsx("div", { className: "ce-editor__grid-layer", children: e || /* @__PURE__ */ y.jsxs("svg", { width: "100%", height: "100%", children: [
2954
+ /* @__PURE__ */ y.jsx("defs", { children: /* @__PURE__ */ y.jsx("pattern", { id: "default-grid", width: l.gridSize, height: l.gridSize, patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ y.jsx("circle", { cx: "1", cy: "1", r: "1", fill: l.gridColor || "#ccc" }) }) }),
2955
+ /* @__PURE__ */ y.jsx("rect", { width: "100%", height: "100%", fill: "url(#default-grid)" })
2956
+ ] }) }),
2957
+ /* @__PURE__ */ y.jsx(hr, {}),
2958
+ l.isLimited ? /* @__PURE__ */ y.jsx(
2959
+ "div",
2960
+ {
2961
+ className: "ce-editor__content-area",
2962
+ style: {
2963
+ width: l.width || 1920,
2964
+ height: l.height || 1080,
2965
+ ...r
2966
+ },
2967
+ children: t
2968
+ }
2969
+ ) : (
2970
+ // Infinite mode container
2971
+ /* @__PURE__ */ y.jsx("div", { className: "ce-editor__infinite-area", children: t })
2972
+ )
2973
+ ]
2974
+ }
2975
+ )
2976
+ ]
2977
+ }
2978
+ );
2979
+ }, pr = {
2980
+ default: ut,
2981
+ input: Gn,
2982
+ output: qn,
2983
+ workflow: ut
2984
+ // Fallback
2985
+ }, _r = ({ nodeTypes: t = {} }) => {
2986
+ const e = C((o) => o.nodes), n = C((o) => o.camera), s = C((o) => o.dimensions), r = tt(() => ({ ...pr, ...t }), [t]), i = tt(() => {
2987
+ if (s.width <= 0 || s.height <= 0) return Object.values(e);
2988
+ const o = 100;
2989
+ return Object.values(e).filter((a) => {
2990
+ const l = n.zoom, d = a.x * l + n.x, f = a.y * l + n.y, v = a.width * l, m = a.height * l;
2991
+ return !(d + v < -o || // Left
2992
+ d > s.width + o || // Right
2993
+ f + m < -o || // Top
2994
+ f > s.height + o);
2995
+ });
2996
+ }, [e, n, s]);
2997
+ return /* @__PURE__ */ y.jsx(y.Fragment, { children: i.map((o) => {
2998
+ const a = r[o.type || "default"] || ut;
2999
+ return o.type === "custom" || o.type === "design" || o.resizable || o.rotatable ? /* @__PURE__ */ y.jsx(
3000
+ ur,
3001
+ {
3002
+ id: o.id,
3003
+ draggable: o.draggable,
3004
+ resizable: o.resizable,
3005
+ rotatable: o.rotatable,
3006
+ children: /* @__PURE__ */ y.jsx(a, { style: o.style, className: o.className, data: o.data, id: o.id })
3007
+ },
3008
+ o.id
3009
+ ) : /* @__PURE__ */ y.jsx(
3010
+ fr,
3011
+ {
3012
+ id: o.id,
3013
+ draggable: o.draggable,
3014
+ className: o.className,
3015
+ style: o.style,
3016
+ children: /* @__PURE__ */ y.jsx(a, { data: o.data, id: o.id })
3017
+ },
3018
+ o.id
3019
+ );
3020
+ }) });
3021
+ };
3022
+ export {
3023
+ yr as Canvas,
3024
+ ut as DefaultNode,
3025
+ gr as Editor,
3026
+ ur as ElementWrapper,
3027
+ Fe as Handle,
3028
+ Gn as InputNode,
3029
+ _r as NodeLayer,
3030
+ qn as OutputNode,
3031
+ fr as WorkflowNodeWrapper,
3032
+ C as useEditor,
3033
+ bt as useEditorStoreApi
3034
+ };