@fullkekw/popup 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,783 @@
1
+ import Le, { createContext as Er, useState as k, useEffect as L, useContext as Ye } from "react";
2
+ import { createPortal as _r } from "react-dom";
3
+ function Rr(y) {
4
+ return y && y.__esModule && Object.prototype.hasOwnProperty.call(y, "default") ? y.default : y;
5
+ }
6
+ var K = { exports: {} }, V = {};
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.min.js
10
+ *
11
+ * Copyright (c) Facebook, Inc. and its affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ var Fe;
17
+ function xr() {
18
+ if (Fe) return V;
19
+ Fe = 1;
20
+ var y = Le, O = Symbol.for("react.element"), R = Symbol.for("react.fragment"), v = Object.prototype.hasOwnProperty, p = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: !0, ref: !0, __self: !0, __source: !0 };
21
+ function c(d, b, C) {
22
+ var i, g = {}, u = null, _ = null;
23
+ C !== void 0 && (u = "" + C), b.key !== void 0 && (u = "" + b.key), b.ref !== void 0 && (_ = b.ref);
24
+ for (i in b) v.call(b, i) && !o.hasOwnProperty(i) && (g[i] = b[i]);
25
+ if (d && d.defaultProps) for (i in b = d.defaultProps, b) g[i] === void 0 && (g[i] = b[i]);
26
+ return { $$typeof: O, type: d, key: u, ref: _, props: g, _owner: p.current };
27
+ }
28
+ return V.Fragment = R, V.jsx = c, V.jsxs = c, V;
29
+ }
30
+ var U = {};
31
+ /**
32
+ * @license React
33
+ * react-jsx-runtime.development.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+ var Ne;
41
+ function Or() {
42
+ return Ne || (Ne = 1, process.env.NODE_ENV !== "production" && function() {
43
+ var y = Le, O = Symbol.for("react.element"), R = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), p = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), c = Symbol.for("react.provider"), d = Symbol.for("react.context"), b = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), i = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), u = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), m = Symbol.iterator, P = "@@iterator";
44
+ function X(e) {
45
+ if (e === null || typeof e != "object")
46
+ return null;
47
+ var r = m && e[m] || e[P];
48
+ return typeof r == "function" ? r : null;
49
+ }
50
+ var S = y.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function x(e) {
52
+ {
53
+ for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
54
+ t[n - 1] = arguments[n];
55
+ H("error", e, t);
56
+ }
57
+ }
58
+ function H(e, r, t) {
59
+ {
60
+ var n = S.ReactDebugCurrentFrame, f = n.getStackAddendum();
61
+ f !== "" && (r += "%s", t = t.concat([f]));
62
+ var l = t.map(function(s) {
63
+ return String(s);
64
+ });
65
+ l.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, l);
66
+ }
67
+ }
68
+ var Z = !1, I = !1, Q = !1, Ue = !1, ze = !1, ce;
69
+ ce = Symbol.for("react.module.reference");
70
+ function qe(e) {
71
+ return !!(typeof e == "string" || typeof e == "function" || e === v || e === o || ze || e === p || e === C || e === i || Ue || e === _ || Z || I || Q || typeof e == "object" && e !== null && (e.$$typeof === u || e.$$typeof === g || e.$$typeof === c || e.$$typeof === d || e.$$typeof === b || // This needs to include all possible module reference object
72
+ // types supported by any Flight configuration anywhere since
73
+ // we don't know which Flight build this will end up being used
74
+ // with.
75
+ e.$$typeof === ce || e.getModuleId !== void 0));
76
+ }
77
+ function Je(e, r, t) {
78
+ var n = e.displayName;
79
+ if (n)
80
+ return n;
81
+ var f = r.displayName || r.name || "";
82
+ return f !== "" ? t + "(" + f + ")" : t;
83
+ }
84
+ function le(e) {
85
+ return e.displayName || "Context";
86
+ }
87
+ function D(e) {
88
+ if (e == null)
89
+ return null;
90
+ if (typeof e.tag == "number" && x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
+ return e.displayName || e.name || null;
92
+ if (typeof e == "string")
93
+ return e;
94
+ switch (e) {
95
+ case v:
96
+ return "Fragment";
97
+ case R:
98
+ return "Portal";
99
+ case o:
100
+ return "Profiler";
101
+ case p:
102
+ return "StrictMode";
103
+ case C:
104
+ return "Suspense";
105
+ case i:
106
+ return "SuspenseList";
107
+ }
108
+ if (typeof e == "object")
109
+ switch (e.$$typeof) {
110
+ case d:
111
+ var r = e;
112
+ return le(r) + ".Consumer";
113
+ case c:
114
+ var t = e;
115
+ return le(t._context) + ".Provider";
116
+ case b:
117
+ return Je(e, e.render, "ForwardRef");
118
+ case g:
119
+ var n = e.displayName || null;
120
+ return n !== null ? n : D(e.type) || "Memo";
121
+ case u: {
122
+ var f = e, l = f._payload, s = f._init;
123
+ try {
124
+ return D(s(l));
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ var A = Object.assign, Y = 0, de, pe, ve, ge, me, ye, be;
133
+ function he() {
134
+ }
135
+ he.__reactDisabledLog = !0;
136
+ function Be() {
137
+ {
138
+ if (Y === 0) {
139
+ de = console.log, pe = console.info, ve = console.warn, ge = console.error, me = console.group, ye = console.groupCollapsed, be = console.groupEnd;
140
+ var e = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ value: he,
144
+ writable: !0
145
+ };
146
+ Object.defineProperties(console, {
147
+ info: e,
148
+ log: e,
149
+ warn: e,
150
+ error: e,
151
+ group: e,
152
+ groupCollapsed: e,
153
+ groupEnd: e
154
+ });
155
+ }
156
+ Y++;
157
+ }
158
+ }
159
+ function Ke() {
160
+ {
161
+ if (Y--, Y === 0) {
162
+ var e = {
163
+ configurable: !0,
164
+ enumerable: !0,
165
+ writable: !0
166
+ };
167
+ Object.defineProperties(console, {
168
+ log: A({}, e, {
169
+ value: de
170
+ }),
171
+ info: A({}, e, {
172
+ value: pe
173
+ }),
174
+ warn: A({}, e, {
175
+ value: ve
176
+ }),
177
+ error: A({}, e, {
178
+ value: ge
179
+ }),
180
+ group: A({}, e, {
181
+ value: me
182
+ }),
183
+ groupCollapsed: A({}, e, {
184
+ value: ye
185
+ }),
186
+ groupEnd: A({}, e, {
187
+ value: be
188
+ })
189
+ });
190
+ }
191
+ Y < 0 && x("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ }
193
+ }
194
+ var ee = S.ReactCurrentDispatcher, re;
195
+ function z(e, r, t) {
196
+ {
197
+ if (re === void 0)
198
+ try {
199
+ throw Error();
200
+ } catch (f) {
201
+ var n = f.stack.trim().match(/\n( *(at )?)/);
202
+ re = n && n[1] || "";
203
+ }
204
+ return `
205
+ ` + re + e;
206
+ }
207
+ }
208
+ var te = !1, q;
209
+ {
210
+ var Ge = typeof WeakMap == "function" ? WeakMap : Map;
211
+ q = new Ge();
212
+ }
213
+ function Ee(e, r) {
214
+ if (!e || te)
215
+ return "";
216
+ {
217
+ var t = q.get(e);
218
+ if (t !== void 0)
219
+ return t;
220
+ }
221
+ var n;
222
+ te = !0;
223
+ var f = Error.prepareStackTrace;
224
+ Error.prepareStackTrace = void 0;
225
+ var l;
226
+ l = ee.current, ee.current = null, Be();
227
+ try {
228
+ if (r) {
229
+ var s = function() {
230
+ throw Error();
231
+ };
232
+ if (Object.defineProperty(s.prototype, "props", {
233
+ set: function() {
234
+ throw Error();
235
+ }
236
+ }), typeof Reflect == "object" && Reflect.construct) {
237
+ try {
238
+ Reflect.construct(s, []);
239
+ } catch (T) {
240
+ n = T;
241
+ }
242
+ Reflect.construct(e, [], s);
243
+ } else {
244
+ try {
245
+ s.call();
246
+ } catch (T) {
247
+ n = T;
248
+ }
249
+ e.call(s.prototype);
250
+ }
251
+ } else {
252
+ try {
253
+ throw Error();
254
+ } catch (T) {
255
+ n = T;
256
+ }
257
+ e();
258
+ }
259
+ } catch (T) {
260
+ if (T && n && typeof T.stack == "string") {
261
+ for (var a = T.stack.split(`
262
+ `), w = n.stack.split(`
263
+ `), h = a.length - 1, E = w.length - 1; h >= 1 && E >= 0 && a[h] !== w[E]; )
264
+ E--;
265
+ for (; h >= 1 && E >= 0; h--, E--)
266
+ if (a[h] !== w[E]) {
267
+ if (h !== 1 || E !== 1)
268
+ do
269
+ if (h--, E--, E < 0 || a[h] !== w[E]) {
270
+ var j = `
271
+ ` + a[h].replace(" at new ", " at ");
272
+ return e.displayName && j.includes("<anonymous>") && (j = j.replace("<anonymous>", e.displayName)), typeof e == "function" && q.set(e, j), j;
273
+ }
274
+ while (h >= 1 && E >= 0);
275
+ break;
276
+ }
277
+ }
278
+ } finally {
279
+ te = !1, ee.current = l, Ke(), Error.prepareStackTrace = f;
280
+ }
281
+ var W = e ? e.displayName || e.name : "", F = W ? z(W) : "";
282
+ return typeof e == "function" && q.set(e, F), F;
283
+ }
284
+ function Xe(e, r, t) {
285
+ return Ee(e, !1);
286
+ }
287
+ function He(e) {
288
+ var r = e.prototype;
289
+ return !!(r && r.isReactComponent);
290
+ }
291
+ function J(e, r, t) {
292
+ if (e == null)
293
+ return "";
294
+ if (typeof e == "function")
295
+ return Ee(e, He(e));
296
+ if (typeof e == "string")
297
+ return z(e);
298
+ switch (e) {
299
+ case C:
300
+ return z("Suspense");
301
+ case i:
302
+ return z("SuspenseList");
303
+ }
304
+ if (typeof e == "object")
305
+ switch (e.$$typeof) {
306
+ case b:
307
+ return Xe(e.render);
308
+ case g:
309
+ return J(e.type, r, t);
310
+ case u: {
311
+ var n = e, f = n._payload, l = n._init;
312
+ try {
313
+ return J(l(f), r, t);
314
+ } catch {
315
+ }
316
+ }
317
+ }
318
+ return "";
319
+ }
320
+ var M = Object.prototype.hasOwnProperty, _e = {}, Re = S.ReactDebugCurrentFrame;
321
+ function B(e) {
322
+ if (e) {
323
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
324
+ Re.setExtraStackFrame(t);
325
+ } else
326
+ Re.setExtraStackFrame(null);
327
+ }
328
+ function Ze(e, r, t, n, f) {
329
+ {
330
+ var l = Function.call.bind(M);
331
+ for (var s in e)
332
+ if (l(e, s)) {
333
+ var a = void 0;
334
+ try {
335
+ if (typeof e[s] != "function") {
336
+ var w = Error((n || "React class") + ": " + t + " type `" + s + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[s] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw w.name = "Invariant Violation", w;
338
+ }
339
+ a = e[s](r, s, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (h) {
341
+ a = h;
342
+ }
343
+ a && !(a instanceof Error) && (B(f), x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, s, typeof a), B(null)), a instanceof Error && !(a.message in _e) && (_e[a.message] = !0, B(f), x("Failed %s type: %s", t, a.message), B(null));
344
+ }
345
+ }
346
+ }
347
+ var Qe = Array.isArray;
348
+ function ne(e) {
349
+ return Qe(e);
350
+ }
351
+ function er(e) {
352
+ {
353
+ var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
+ return t;
355
+ }
356
+ }
357
+ function rr(e) {
358
+ try {
359
+ return xe(e), !1;
360
+ } catch {
361
+ return !0;
362
+ }
363
+ }
364
+ function xe(e) {
365
+ return "" + e;
366
+ }
367
+ function Oe(e) {
368
+ if (rr(e))
369
+ return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", er(e)), xe(e);
370
+ }
371
+ var we = S.ReactCurrentOwner, tr = {
372
+ key: !0,
373
+ ref: !0,
374
+ __self: !0,
375
+ __source: !0
376
+ }, Se, Te;
377
+ function nr(e) {
378
+ if (M.call(e, "ref")) {
379
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
380
+ if (r && r.isReactWarning)
381
+ return !1;
382
+ }
383
+ return e.ref !== void 0;
384
+ }
385
+ function ar(e) {
386
+ if (M.call(e, "key")) {
387
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
388
+ if (r && r.isReactWarning)
389
+ return !1;
390
+ }
391
+ return e.key !== void 0;
392
+ }
393
+ function or(e, r) {
394
+ typeof e.ref == "string" && we.current;
395
+ }
396
+ function ir(e, r) {
397
+ {
398
+ var t = function() {
399
+ Se || (Se = !0, x("%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://reactjs.org/link/special-props)", r));
400
+ };
401
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
402
+ get: t,
403
+ configurable: !0
404
+ });
405
+ }
406
+ }
407
+ function ur(e, r) {
408
+ {
409
+ var t = function() {
410
+ Te || (Te = !0, x("%s: `ref` 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://reactjs.org/link/special-props)", r));
411
+ };
412
+ t.isReactWarning = !0, Object.defineProperty(e, "ref", {
413
+ get: t,
414
+ configurable: !0
415
+ });
416
+ }
417
+ }
418
+ var sr = function(e, r, t, n, f, l, s) {
419
+ var a = {
420
+ // This tag allows us to uniquely identify this as a React Element
421
+ $$typeof: O,
422
+ // Built-in properties that belong on the element
423
+ type: e,
424
+ key: r,
425
+ ref: t,
426
+ props: s,
427
+ // Record the component responsible for creating this element.
428
+ _owner: l
429
+ };
430
+ return a._store = {}, Object.defineProperty(a._store, "validated", {
431
+ configurable: !1,
432
+ enumerable: !1,
433
+ writable: !0,
434
+ value: !1
435
+ }), Object.defineProperty(a, "_self", {
436
+ configurable: !1,
437
+ enumerable: !1,
438
+ writable: !1,
439
+ value: n
440
+ }), Object.defineProperty(a, "_source", {
441
+ configurable: !1,
442
+ enumerable: !1,
443
+ writable: !1,
444
+ value: f
445
+ }), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
446
+ };
447
+ function fr(e, r, t, n, f) {
448
+ {
449
+ var l, s = {}, a = null, w = null;
450
+ t !== void 0 && (Oe(t), a = "" + t), ar(r) && (Oe(r.key), a = "" + r.key), nr(r) && (w = r.ref, or(r, f));
451
+ for (l in r)
452
+ M.call(r, l) && !tr.hasOwnProperty(l) && (s[l] = r[l]);
453
+ if (e && e.defaultProps) {
454
+ var h = e.defaultProps;
455
+ for (l in h)
456
+ s[l] === void 0 && (s[l] = h[l]);
457
+ }
458
+ if (a || w) {
459
+ var E = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
460
+ a && ir(s, E), w && ur(s, E);
461
+ }
462
+ return sr(e, a, w, f, n, we.current, s);
463
+ }
464
+ }
465
+ var ae = S.ReactCurrentOwner, Pe = S.ReactDebugCurrentFrame;
466
+ function $(e) {
467
+ if (e) {
468
+ var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
469
+ Pe.setExtraStackFrame(t);
470
+ } else
471
+ Pe.setExtraStackFrame(null);
472
+ }
473
+ var oe;
474
+ oe = !1;
475
+ function ie(e) {
476
+ return typeof e == "object" && e !== null && e.$$typeof === O;
477
+ }
478
+ function Ce() {
479
+ {
480
+ if (ae.current) {
481
+ var e = D(ae.current.type);
482
+ if (e)
483
+ return `
484
+
485
+ Check the render method of \`` + e + "`.";
486
+ }
487
+ return "";
488
+ }
489
+ }
490
+ function cr(e) {
491
+ return "";
492
+ }
493
+ var je = {};
494
+ function lr(e) {
495
+ {
496
+ var r = Ce();
497
+ if (!r) {
498
+ var t = typeof e == "string" ? e : e.displayName || e.name;
499
+ t && (r = `
500
+
501
+ Check the top-level render call using <` + t + ">.");
502
+ }
503
+ return r;
504
+ }
505
+ }
506
+ function ke(e, r) {
507
+ {
508
+ if (!e._store || e._store.validated || e.key != null)
509
+ return;
510
+ e._store.validated = !0;
511
+ var t = lr(r);
512
+ if (je[t])
513
+ return;
514
+ je[t] = !0;
515
+ var n = "";
516
+ e && e._owner && e._owner !== ae.current && (n = " It was passed a child from " + D(e._owner.type) + "."), $(e), x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), $(null);
517
+ }
518
+ }
519
+ function De(e, r) {
520
+ {
521
+ if (typeof e != "object")
522
+ return;
523
+ if (ne(e))
524
+ for (var t = 0; t < e.length; t++) {
525
+ var n = e[t];
526
+ ie(n) && ke(n, r);
527
+ }
528
+ else if (ie(e))
529
+ e._store && (e._store.validated = !0);
530
+ else if (e) {
531
+ var f = X(e);
532
+ if (typeof f == "function" && f !== e.entries)
533
+ for (var l = f.call(e), s; !(s = l.next()).done; )
534
+ ie(s.value) && ke(s.value, r);
535
+ }
536
+ }
537
+ }
538
+ function dr(e) {
539
+ {
540
+ var r = e.type;
541
+ if (r == null || typeof r == "string")
542
+ return;
543
+ var t;
544
+ if (typeof r == "function")
545
+ t = r.propTypes;
546
+ else if (typeof r == "object" && (r.$$typeof === b || // Note: Memo only checks outer props here.
547
+ // Inner props are checked in the reconciler.
548
+ r.$$typeof === g))
549
+ t = r.propTypes;
550
+ else
551
+ return;
552
+ if (t) {
553
+ var n = D(r);
554
+ Ze(t, e.props, "prop", n, e);
555
+ } else if (r.PropTypes !== void 0 && !oe) {
556
+ oe = !0;
557
+ var f = D(r);
558
+ x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", f || "Unknown");
559
+ }
560
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
561
+ }
562
+ }
563
+ function pr(e) {
564
+ {
565
+ for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
566
+ var n = r[t];
567
+ if (n !== "children" && n !== "key") {
568
+ $(e), x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), $(null);
569
+ break;
570
+ }
571
+ }
572
+ e.ref !== null && ($(e), x("Invalid attribute `ref` supplied to `React.Fragment`."), $(null));
573
+ }
574
+ }
575
+ var Ie = {};
576
+ function Ae(e, r, t, n, f, l) {
577
+ {
578
+ var s = qe(e);
579
+ if (!s) {
580
+ var a = "";
581
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
582
+ var w = cr();
583
+ w ? a += w : a += Ce();
584
+ var h;
585
+ e === null ? h = "null" : ne(e) ? h = "array" : e !== void 0 && e.$$typeof === O ? (h = "<" + (D(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : h = typeof e, x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", h, a);
586
+ }
587
+ var E = fr(e, r, t, f, l);
588
+ if (E == null)
589
+ return E;
590
+ if (s) {
591
+ var j = r.children;
592
+ if (j !== void 0)
593
+ if (n)
594
+ if (ne(j)) {
595
+ for (var W = 0; W < j.length; W++)
596
+ De(j[W], e);
597
+ Object.freeze && Object.freeze(j);
598
+ } else
599
+ x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
600
+ else
601
+ De(j, e);
602
+ }
603
+ if (M.call(r, "key")) {
604
+ var F = D(e), T = Object.keys(r).filter(function(hr) {
605
+ return hr !== "key";
606
+ }), ue = T.length > 0 ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}";
607
+ if (!Ie[F + ue]) {
608
+ var br = T.length > 0 ? "{" + T.join(": ..., ") + ": ...}" : "{}";
609
+ x(`A props object containing a "key" prop is being spread into JSX:
610
+ let props = %s;
611
+ <%s {...props} />
612
+ React keys must be passed directly to JSX without using spread:
613
+ let props = %s;
614
+ <%s key={someKey} {...props} />`, ue, F, br, F), Ie[F + ue] = !0;
615
+ }
616
+ }
617
+ return e === v ? pr(E) : dr(E), E;
618
+ }
619
+ }
620
+ function vr(e, r, t) {
621
+ return Ae(e, r, t, !0);
622
+ }
623
+ function gr(e, r, t) {
624
+ return Ae(e, r, t, !1);
625
+ }
626
+ var mr = gr, yr = vr;
627
+ U.Fragment = v, U.jsx = mr, U.jsxs = yr;
628
+ }()), U;
629
+ }
630
+ var $e;
631
+ function wr() {
632
+ return $e || ($e = 1, process.env.NODE_ENV === "production" ? K.exports = xr() : K.exports = Or()), K.exports;
633
+ }
634
+ var N = wr(), se = { exports: {} };
635
+ /*!
636
+ Copyright (c) 2018 Jed Watson.
637
+ Licensed under the MIT License (MIT), see
638
+ http://jedwatson.github.io/classnames
639
+ */
640
+ var We;
641
+ function Sr() {
642
+ return We || (We = 1, function(y) {
643
+ (function() {
644
+ var O = {}.hasOwnProperty;
645
+ function R() {
646
+ for (var o = "", c = 0; c < arguments.length; c++) {
647
+ var d = arguments[c];
648
+ d && (o = p(o, v(d)));
649
+ }
650
+ return o;
651
+ }
652
+ function v(o) {
653
+ if (typeof o == "string" || typeof o == "number")
654
+ return o;
655
+ if (typeof o != "object")
656
+ return "";
657
+ if (Array.isArray(o))
658
+ return R.apply(null, o);
659
+ if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
660
+ return o.toString();
661
+ var c = "";
662
+ for (var d in o)
663
+ O.call(o, d) && o[d] && (c = p(c, d));
664
+ return c;
665
+ }
666
+ function p(o, c) {
667
+ return c ? o ? o + " " + c : o + c : o;
668
+ }
669
+ y.exports ? (R.default = R, y.exports = R) : window.classNames = R;
670
+ })();
671
+ }(se)), se.exports;
672
+ }
673
+ var Tr = Sr();
674
+ const G = /* @__PURE__ */ Rr(Tr), Me = {
675
+ disableScroll: !0,
676
+ exitOnDocument: !0,
677
+ exitOnEscape: !0,
678
+ preventStateChange: !1
679
+ }, fe = Er({}), Pr = ({ className: y, settings: O, children: R }) => {
680
+ const [v] = k(Ve(O ?? {}, Me)), [p, o] = k([]), c = {
681
+ nodes: p,
682
+ toggleNode: d,
683
+ registerNode: b,
684
+ toggleDocument: C
685
+ };
686
+ L(() => {
687
+ if (typeof window > "u") return;
688
+ window.addEventListener("keydown", i);
689
+ function i(g) {
690
+ if (g.key === "Escape") {
691
+ const _ = Math.max(...p.filter((P) => P.open).map((P) => P.zIndex)), m = p.find((P) => P.open && P.zIndex === _);
692
+ if (!m || !m.settings.exitOnEscape || !(v != null && v.exitOnEscape)) return;
693
+ d(m.id);
694
+ }
695
+ }
696
+ return () => {
697
+ window.removeEventListener("keydown", i);
698
+ };
699
+ }, [p]);
700
+ function d(i, g) {
701
+ let u;
702
+ if (typeof i == "string" ? u = { ...p.find((m) => m.id === i) } : u = { ...i }, !u.id) return;
703
+ if ((v.preventStateChange || u.settings.preventStateChange) && g === void 0) return console.warn("Popup action prevented");
704
+ const _ = g ?? !(u != null && u.open);
705
+ u.open = _, u.zIndex = _ ? Math.max(...p.map((m) => m.zIndex), 0) + 1 : 0, o((m) => [...m.filter((P) => P.id !== u.id), u]), v.disableScroll && u.settings.disableScroll && _ && document.body.classList.add("fkw-popup--noScroll"), !_ && !p.filter((m) => m.id !== u.id).some((m) => m.open) && document.body.classList.remove("fkw-popup--noScroll");
706
+ }
707
+ function b(i) {
708
+ o((g) => [...g, i]), i.open && d(i, !0);
709
+ }
710
+ function C(i, g) {
711
+ const u = { ...p.find((m) => m.id === i) };
712
+ !u.id || !u.settings.exitOnDocument || g.target.closest(".fkw-popup") || !u.settings.exitOnDocument || !v.exitOnDocument || d(u.id);
713
+ }
714
+ return /* @__PURE__ */ N.jsxs(fe.Provider, { value: c, children: [
715
+ R,
716
+ /* @__PURE__ */ N.jsx("section", { className: G("fkw-popup-container", y), id: "fkw-popup-container" })
717
+ ] });
718
+ }, Cr = ({ children: y, className: O, layerClassName: R, style: v, id: p, settings: o, isOpen: c, setIsOpen: d, animation: b, ...C }) => {
719
+ const i = Ye(fe), [g] = k(b ?? "scale"), [u] = k(Ve(o ?? {}, Me)), [_, m] = k(!1), [P, X] = k(null), [S, x] = k(!1), [H, Z] = k(0);
720
+ return L(() => {
721
+ X(document.querySelector("#fkw-popup-container")), m(!0), i.registerNode({
722
+ id: p,
723
+ open: !1,
724
+ zIndex: 0,
725
+ settings: u
726
+ });
727
+ }, []), L(() => {
728
+ const I = i.nodes.find((Q) => Q.id === p);
729
+ I && (x(I.open), Z(I.zIndex));
730
+ }, [i]), L(() => {
731
+ d === void 0 || c === S || d(S);
732
+ }, [S]), L(() => {
733
+ c === void 0 || c === S || i.toggleNode(p, c);
734
+ }, [c]), !_ || !P ? null : _r(/* @__PURE__ */ N.jsx(N.Fragment, { children: /* @__PURE__ */ N.jsx(
735
+ "section",
736
+ {
737
+ id: p,
738
+ className: G("fkw-popup-layer", S && "fkw-popup-layer--open", R),
739
+ style: { zIndex: 1e4 + H, cursor: u.exitOnDocument && !u.preventStateChange ? "pointer" : "auto", ...v },
740
+ onClick: u.exitOnDocument && !u.preventStateChange ? (I) => i.toggleDocument(p, I) : void 0,
741
+ children: /* @__PURE__ */ N.jsx(
742
+ "article",
743
+ {
744
+ className: G("fkw-popup", S && "fkw-popup--open", g && `fkw-popup-animation--${g}`, O),
745
+ role: "dialog",
746
+ "aria-modal": !0,
747
+ "aria-hidden": !S,
748
+ ...C,
749
+ children: y
750
+ }
751
+ )
752
+ }
753
+ ) }), P);
754
+ }, jr = ({ children: y, as: O, className: R, onClick: v, disabled: p, popupId: o, ...c }) => {
755
+ const d = Ye(fe), { toggleNode: b } = d, C = O ?? "button", [i, g] = k(!1);
756
+ L(() => {
757
+ const _ = d.nodes.find((m) => m.id === o);
758
+ _ && g(_.open);
759
+ }, [d]);
760
+ function u(_) {
761
+ b(o), v && v(_);
762
+ }
763
+ return /* @__PURE__ */ N.jsx(C, { className: G("fkw-popup-button", i && "fkw-popup-button--active", R), role: "button", onClick: u, "aria-haspopup": "dialog", tabIndex: 0, disabled: p, "aria-disabled": p, "data-fkw-popup-operator": o, "aria-label": i ? "Close Popup" : "Open Popup", ...c, children: y });
764
+ };
765
+ function Ve(y, O) {
766
+ const R = { ...O };
767
+ for (const v in y)
768
+ R[v] = y[v];
769
+ return R;
770
+ }
771
+ const Ir = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
772
+ __proto__: null,
773
+ PopupButton: jr,
774
+ PopupLayer: Pr,
775
+ PopupWindow: Cr
776
+ }, Symbol.toStringTag, { value: "Module" }));
777
+ export {
778
+ jr as PopupButton,
779
+ Pr as PopupLayer,
780
+ Cr as PopupWindow,
781
+ Ir as default
782
+ };
783
+ //# sourceMappingURL=index.es.js.map