@egjs/react-flicking 4.15.0 → 4.16.0-beta.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.
Files changed (84) hide show
  1. package/dev/archive/App.css +32 -0
  2. package/dev/archive/App.tsx +52 -0
  3. package/dev/archive/DebugPage.css +21 -0
  4. package/dev/archive/DebugPage.tsx +93 -0
  5. package/dev/archive/Header.tsx +52 -0
  6. package/dev/archive/StatePage.css +21 -0
  7. package/dev/archive/StatePage.tsx +107 -0
  8. package/dev/archive/css/align.css +79 -0
  9. package/dev/archive/css/bound.css +88 -0
  10. package/dev/archive/css/common.css +76 -0
  11. package/dev/archive/css/cross.css +21 -0
  12. package/dev/archive/css/features.css +49 -0
  13. package/dev/archive/css/gap.css +13 -0
  14. package/dev/archive/css/highlight.css +96 -0
  15. package/dev/archive/css/infinite.css +35 -0
  16. package/dev/archive/css/parallax.css +3 -0
  17. package/dev/archive/css/plugins.css +46 -0
  18. package/dev/archive/css/progress.css +16 -0
  19. package/dev/archive/css/variable-size.css +15 -0
  20. package/dev/archive/features/Align.tsx +149 -0
  21. package/dev/archive/features/Bound.tsx +83 -0
  22. package/dev/archive/features/CrossFlicking.tsx +74 -0
  23. package/dev/archive/features/FreeScroll.tsx +66 -0
  24. package/dev/archive/features/InfiniteFlicking.tsx +192 -0
  25. package/dev/archive/features/PlaceHolderItem.tsx +36 -0
  26. package/dev/archive/features/Progress.tsx +241 -0
  27. package/dev/archive/features/PropChange.tsx +171 -0
  28. package/dev/archive/features/Snap.tsx +95 -0
  29. package/dev/archive/features/VariableSize.tsx +42 -0
  30. package/dev/archive/features/Virtual.tsx +45 -0
  31. package/dev/archive/plugins/Arrow.tsx +25 -0
  32. package/dev/archive/plugins/AutoPlay.tsx +70 -0
  33. package/dev/archive/plugins/Fade.tsx +69 -0
  34. package/dev/archive/plugins/Parallax.tsx +70 -0
  35. package/dev/archive/utils.ts +3 -0
  36. package/dev/basic-sample/App.tsx +36 -0
  37. package/dev/basic-sample/index.html +12 -0
  38. package/dev/basic-sample/main.tsx +10 -0
  39. package/dev/index.html +18 -0
  40. package/dev/plugin-check/App.tsx +341 -0
  41. package/dev/plugin-check/index.html +15 -0
  42. package/dev/plugin-check/main.tsx +6 -0
  43. package/dev/scratch/App.tsx +34 -0
  44. package/dev/scratch/index.html +15 -0
  45. package/dev/scratch/main.tsx +13 -0
  46. package/dev/tsconfig.json +12 -0
  47. package/dev/vite-env.d.ts +3 -0
  48. package/{declaration → dist}/CrossFlicking.d.ts +3 -5
  49. package/{declaration → dist}/CrossGroup.d.ts +1 -1
  50. package/{declaration → dist}/Flicking.d.ts +8 -8
  51. package/{declaration → dist}/NonStrictPanel.d.ts +1 -1
  52. package/{declaration → dist}/ReactRenderer.d.ts +1 -1
  53. package/{declaration → dist}/StrictPanel.d.ts +1 -1
  54. package/{declaration → dist}/ViewportSlot.d.ts +1 -1
  55. package/dist/flicking.cjs.js +1514 -579
  56. package/dist/flicking.cjs.js.map +1 -1
  57. package/dist/flicking.esm.js +1573 -651
  58. package/dist/flicking.esm.js.map +1 -1
  59. package/dist/flicking.js +1634 -0
  60. package/dist/flicking.js.map +1 -0
  61. package/{declaration → dist}/index.d.ts +3 -3
  62. package/{declaration → dist}/types.d.ts +1 -2
  63. package/package.json +18 -33
  64. package/src/react-flicking/CrossFlicking.tsx +28 -37
  65. package/src/react-flicking/CrossGroup.tsx +6 -8
  66. package/src/react-flicking/Flicking.tsx +81 -69
  67. package/src/react-flicking/NonStrictPanel.tsx +15 -7
  68. package/src/react-flicking/ReactElementProvider.ts +6 -4
  69. package/src/react-flicking/ReactRenderer.ts +1 -2
  70. package/src/react-flicking/StrictPanel.tsx +10 -6
  71. package/src/react-flicking/consts.ts +14 -14
  72. package/src/react-flicking/index.ts +4 -7
  73. package/src/react-flicking/index.umd.ts +1 -1
  74. package/src/react-flicking/reactive.ts +3 -3
  75. package/src/react-flicking/types.ts +17 -17
  76. package/tsconfig.json +2 -9
  77. package/vite.config.ts +38 -0
  78. package/vite.dev.config.ts +58 -0
  79. package/dist/flicking.umd.js +0 -699
  80. package/dist/flicking.umd.js.map +0 -1
  81. /package/{declaration → dist}/ReactElementProvider.d.ts +0 -0
  82. /package/{declaration → dist}/consts.d.ts +0 -0
  83. /package/{declaration → dist}/index.umd.d.ts +0 -0
  84. /package/{declaration → dist}/reactive.d.ts +0 -0
@@ -1,204 +1,936 @@
1
- /*
2
- Copyright (c) 2015-present NAVER Corp.
3
- name: @egjs/react-flicking
4
- license: MIT
5
- author: NAVER Corp.
6
- repository: https://github.com/naver/egjs-flicking/tree/master/packages/react-flicking
7
- version: 4.15.0
8
- */
9
- 'use strict';
10
-
11
- var React = require('react');
12
- var Component = require('@egjs/component');
13
- var ListDiffer = require('@egjs/list-differ');
14
- var VanillaFlicking = require('@egjs/flicking');
15
- var react = require('@cfcs/react');
16
-
17
- /******************************************************************************
18
- Copyright (c) Microsoft Corporation.
19
-
20
- Permission to use, copy, modify, and/or distribute this software for any
21
- purpose with or without fee is hereby granted.
22
-
23
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
24
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
25
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
26
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
27
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
28
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
29
- PERFORMANCE OF THIS SOFTWARE.
30
- ***************************************************************************** */
31
- /* global Reflect, Promise */
32
-
33
- var extendStatics = function (d, b) {
34
- extendStatics = Object.setPrototypeOf || {
35
- __proto__: []
36
- } instanceof Array && function (d, b) {
37
- d.__proto__ = b;
38
- } || function (d, b) {
39
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
40
- };
41
- return extendStatics(d, b);
42
- };
43
- function __extends(d, b) {
44
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
45
- extendStatics(d, b);
46
- function __() {
47
- this.constructor = d;
48
- }
49
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
50
- }
51
- var __assign = function () {
52
- __assign = Object.assign || function __assign(t) {
53
- for (var s, i = 1, n = arguments.length; i < n; i++) {
54
- s = arguments[i];
55
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1
+ "use strict";
2
+ const React = require("react");
3
+ const Component = require("@egjs/component");
4
+ const VanillaFlicking = require("@egjs/flicking");
5
+ const ListDiffer = require("@egjs/list-differ");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
56
17
  }
57
- return t;
58
- };
59
- return __assign.apply(this, arguments);
60
- };
61
- function __rest(s, e) {
62
- var t = {};
63
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
64
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
65
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
66
18
  }
67
- return t;
68
- }
69
- function __decorate(decorators, target, key, desc) {
70
- var c = arguments.length,
71
- r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
72
- d;
73
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
74
- return c > 3 && r && Object.defineProperty(target, key, r), r;
19
+ n.default = e;
20
+ return Object.freeze(n);
75
21
  }
76
- function __awaiter(thisArg, _arguments, P, generator) {
77
- function adopt(value) {
78
- return value instanceof P ? value : new P(function (resolve) {
79
- resolve(value);
80
- });
22
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
23
+ var jsxRuntime = { exports: {} };
24
+ var reactJsxRuntime_production_min = {};
25
+ var hasRequiredReactJsxRuntime_production_min;
26
+ function requireReactJsxRuntime_production_min() {
27
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
28
+ hasRequiredReactJsxRuntime_production_min = 1;
29
+ var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
30
+ function q(c, a, g) {
31
+ var b, d = {}, e = null, h = null;
32
+ void 0 !== g && (e = "" + g);
33
+ void 0 !== a.key && (e = "" + a.key);
34
+ void 0 !== a.ref && (h = a.ref);
35
+ for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
36
+ if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
37
+ return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
81
38
  }
82
- return new (P || (P = Promise))(function (resolve, reject) {
83
- function fulfilled(value) {
84
- try {
85
- step(generator.next(value));
86
- } catch (e) {
87
- reject(e);
39
+ reactJsxRuntime_production_min.Fragment = l;
40
+ reactJsxRuntime_production_min.jsx = q;
41
+ reactJsxRuntime_production_min.jsxs = q;
42
+ return reactJsxRuntime_production_min;
43
+ }
44
+ var reactJsxRuntime_development = {};
45
+ var hasRequiredReactJsxRuntime_development;
46
+ function requireReactJsxRuntime_development() {
47
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
48
+ hasRequiredReactJsxRuntime_development = 1;
49
+ if (process.env.NODE_ENV !== "production") {
50
+ (function() {
51
+ var React$1 = React;
52
+ var REACT_ELEMENT_TYPE = Symbol.for("react.element");
53
+ var REACT_PORTAL_TYPE = Symbol.for("react.portal");
54
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
55
+ var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
56
+ var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
57
+ var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
58
+ var REACT_CONTEXT_TYPE = Symbol.for("react.context");
59
+ var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
60
+ var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
61
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
62
+ var REACT_MEMO_TYPE = Symbol.for("react.memo");
63
+ var REACT_LAZY_TYPE = Symbol.for("react.lazy");
64
+ var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
65
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
66
+ var FAUX_ITERATOR_SYMBOL = "@@iterator";
67
+ function getIteratorFn(maybeIterable) {
68
+ if (maybeIterable === null || typeof maybeIterable !== "object") {
69
+ return null;
70
+ }
71
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
72
+ if (typeof maybeIterator === "function") {
73
+ return maybeIterator;
74
+ }
75
+ return null;
88
76
  }
89
- }
90
- function rejected(value) {
91
- try {
92
- step(generator["throw"](value));
93
- } catch (e) {
94
- reject(e);
77
+ var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
78
+ function error(format) {
79
+ {
80
+ {
81
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
82
+ args[_key2 - 1] = arguments[_key2];
83
+ }
84
+ printWarning("error", format, args);
85
+ }
86
+ }
95
87
  }
96
- }
97
- function step(result) {
98
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
99
- }
100
- step((generator = generator.apply(thisArg, _arguments || [])).next());
101
- });
102
- }
103
- function __generator(thisArg, body) {
104
- var _ = {
105
- label: 0,
106
- sent: function () {
107
- if (t[0] & 1) throw t[1];
108
- return t[1];
109
- },
110
- trys: [],
111
- ops: []
112
- },
113
- f,
114
- y,
115
- t,
116
- g;
117
- return g = {
118
- next: verb(0),
119
- "throw": verb(1),
120
- "return": verb(2)
121
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
122
- return this;
123
- }), g;
124
- function verb(n) {
125
- return function (v) {
126
- return step([n, v]);
127
- };
128
- }
129
- function step(op) {
130
- if (f) throw new TypeError("Generator is already executing.");
131
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
132
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
133
- if (y = 0, t) op = [op[0] & 2, t.value];
134
- switch (op[0]) {
135
- case 0:
136
- case 1:
137
- t = op;
138
- break;
139
- case 4:
140
- _.label++;
141
- return {
142
- value: op[1],
143
- done: false
88
+ function printWarning(level, format, args) {
89
+ {
90
+ var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
91
+ var stack = ReactDebugCurrentFrame2.getStackAddendum();
92
+ if (stack !== "") {
93
+ format += "%s";
94
+ args = args.concat([stack]);
95
+ }
96
+ var argsWithFormat = args.map(function(item) {
97
+ return String(item);
98
+ });
99
+ argsWithFormat.unshift("Warning: " + format);
100
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
101
+ }
102
+ }
103
+ var enableScopeAPI = false;
104
+ var enableCacheElement = false;
105
+ var enableTransitionTracing = false;
106
+ var enableLegacyHidden = false;
107
+ var enableDebugTracing = false;
108
+ var REACT_MODULE_REFERENCE;
109
+ {
110
+ REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
111
+ }
112
+ function isValidElementType(type) {
113
+ if (typeof type === "string" || typeof type === "function") {
114
+ return true;
115
+ }
116
+ if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
117
+ return true;
118
+ }
119
+ if (typeof type === "object" && type !== null) {
120
+ if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
121
+ // types supported by any Flight configuration anywhere since
122
+ // we don't know which Flight build this will end up being used
123
+ // with.
124
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
125
+ return true;
126
+ }
127
+ }
128
+ return false;
129
+ }
130
+ function getWrappedName(outerType, innerType, wrapperName) {
131
+ var displayName = outerType.displayName;
132
+ if (displayName) {
133
+ return displayName;
134
+ }
135
+ var functionName = innerType.displayName || innerType.name || "";
136
+ return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
137
+ }
138
+ function getContextName(type) {
139
+ return type.displayName || "Context";
140
+ }
141
+ function getComponentNameFromType(type) {
142
+ if (type == null) {
143
+ return null;
144
+ }
145
+ {
146
+ if (typeof type.tag === "number") {
147
+ error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
148
+ }
149
+ }
150
+ if (typeof type === "function") {
151
+ return type.displayName || type.name || null;
152
+ }
153
+ if (typeof type === "string") {
154
+ return type;
155
+ }
156
+ switch (type) {
157
+ case REACT_FRAGMENT_TYPE:
158
+ return "Fragment";
159
+ case REACT_PORTAL_TYPE:
160
+ return "Portal";
161
+ case REACT_PROFILER_TYPE:
162
+ return "Profiler";
163
+ case REACT_STRICT_MODE_TYPE:
164
+ return "StrictMode";
165
+ case REACT_SUSPENSE_TYPE:
166
+ return "Suspense";
167
+ case REACT_SUSPENSE_LIST_TYPE:
168
+ return "SuspenseList";
169
+ }
170
+ if (typeof type === "object") {
171
+ switch (type.$$typeof) {
172
+ case REACT_CONTEXT_TYPE:
173
+ var context = type;
174
+ return getContextName(context) + ".Consumer";
175
+ case REACT_PROVIDER_TYPE:
176
+ var provider = type;
177
+ return getContextName(provider._context) + ".Provider";
178
+ case REACT_FORWARD_REF_TYPE:
179
+ return getWrappedName(type, type.render, "ForwardRef");
180
+ case REACT_MEMO_TYPE:
181
+ var outerName = type.displayName || null;
182
+ if (outerName !== null) {
183
+ return outerName;
184
+ }
185
+ return getComponentNameFromType(type.type) || "Memo";
186
+ case REACT_LAZY_TYPE: {
187
+ var lazyComponent = type;
188
+ var payload = lazyComponent._payload;
189
+ var init = lazyComponent._init;
190
+ try {
191
+ return getComponentNameFromType(init(payload));
192
+ } catch (x) {
193
+ return null;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ return null;
199
+ }
200
+ var assign = Object.assign;
201
+ var disabledDepth = 0;
202
+ var prevLog;
203
+ var prevInfo;
204
+ var prevWarn;
205
+ var prevError;
206
+ var prevGroup;
207
+ var prevGroupCollapsed;
208
+ var prevGroupEnd;
209
+ function disabledLog() {
210
+ }
211
+ disabledLog.__reactDisabledLog = true;
212
+ function disableLogs() {
213
+ {
214
+ if (disabledDepth === 0) {
215
+ prevLog = console.log;
216
+ prevInfo = console.info;
217
+ prevWarn = console.warn;
218
+ prevError = console.error;
219
+ prevGroup = console.group;
220
+ prevGroupCollapsed = console.groupCollapsed;
221
+ prevGroupEnd = console.groupEnd;
222
+ var props = {
223
+ configurable: true,
224
+ enumerable: true,
225
+ value: disabledLog,
226
+ writable: true
227
+ };
228
+ Object.defineProperties(console, {
229
+ info: props,
230
+ log: props,
231
+ warn: props,
232
+ error: props,
233
+ group: props,
234
+ groupCollapsed: props,
235
+ groupEnd: props
236
+ });
237
+ }
238
+ disabledDepth++;
239
+ }
240
+ }
241
+ function reenableLogs() {
242
+ {
243
+ disabledDepth--;
244
+ if (disabledDepth === 0) {
245
+ var props = {
246
+ configurable: true,
247
+ enumerable: true,
248
+ writable: true
249
+ };
250
+ Object.defineProperties(console, {
251
+ log: assign({}, props, {
252
+ value: prevLog
253
+ }),
254
+ info: assign({}, props, {
255
+ value: prevInfo
256
+ }),
257
+ warn: assign({}, props, {
258
+ value: prevWarn
259
+ }),
260
+ error: assign({}, props, {
261
+ value: prevError
262
+ }),
263
+ group: assign({}, props, {
264
+ value: prevGroup
265
+ }),
266
+ groupCollapsed: assign({}, props, {
267
+ value: prevGroupCollapsed
268
+ }),
269
+ groupEnd: assign({}, props, {
270
+ value: prevGroupEnd
271
+ })
272
+ });
273
+ }
274
+ if (disabledDepth < 0) {
275
+ error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
276
+ }
277
+ }
278
+ }
279
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
280
+ var prefix;
281
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
282
+ {
283
+ if (prefix === void 0) {
284
+ try {
285
+ throw Error();
286
+ } catch (x) {
287
+ var match = x.stack.trim().match(/\n( *(at )?)/);
288
+ prefix = match && match[1] || "";
289
+ }
290
+ }
291
+ return "\n" + prefix + name;
292
+ }
293
+ }
294
+ var reentry = false;
295
+ var componentFrameCache;
296
+ {
297
+ var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
298
+ componentFrameCache = new PossiblyWeakMap();
299
+ }
300
+ function describeNativeComponentFrame(fn, construct) {
301
+ if (!fn || reentry) {
302
+ return "";
303
+ }
304
+ {
305
+ var frame = componentFrameCache.get(fn);
306
+ if (frame !== void 0) {
307
+ return frame;
308
+ }
309
+ }
310
+ var control;
311
+ reentry = true;
312
+ var previousPrepareStackTrace = Error.prepareStackTrace;
313
+ Error.prepareStackTrace = void 0;
314
+ var previousDispatcher;
315
+ {
316
+ previousDispatcher = ReactCurrentDispatcher.current;
317
+ ReactCurrentDispatcher.current = null;
318
+ disableLogs();
319
+ }
320
+ try {
321
+ if (construct) {
322
+ var Fake = function() {
323
+ throw Error();
324
+ };
325
+ Object.defineProperty(Fake.prototype, "props", {
326
+ set: function() {
327
+ throw Error();
328
+ }
329
+ });
330
+ if (typeof Reflect === "object" && Reflect.construct) {
331
+ try {
332
+ Reflect.construct(Fake, []);
333
+ } catch (x) {
334
+ control = x;
335
+ }
336
+ Reflect.construct(fn, [], Fake);
337
+ } else {
338
+ try {
339
+ Fake.call();
340
+ } catch (x) {
341
+ control = x;
342
+ }
343
+ fn.call(Fake.prototype);
344
+ }
345
+ } else {
346
+ try {
347
+ throw Error();
348
+ } catch (x) {
349
+ control = x;
350
+ }
351
+ fn();
352
+ }
353
+ } catch (sample) {
354
+ if (sample && control && typeof sample.stack === "string") {
355
+ var sampleLines = sample.stack.split("\n");
356
+ var controlLines = control.stack.split("\n");
357
+ var s = sampleLines.length - 1;
358
+ var c = controlLines.length - 1;
359
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
360
+ c--;
361
+ }
362
+ for (; s >= 1 && c >= 0; s--, c--) {
363
+ if (sampleLines[s] !== controlLines[c]) {
364
+ if (s !== 1 || c !== 1) {
365
+ do {
366
+ s--;
367
+ c--;
368
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
369
+ var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
370
+ if (fn.displayName && _frame.includes("<anonymous>")) {
371
+ _frame = _frame.replace("<anonymous>", fn.displayName);
372
+ }
373
+ {
374
+ if (typeof fn === "function") {
375
+ componentFrameCache.set(fn, _frame);
376
+ }
377
+ }
378
+ return _frame;
379
+ }
380
+ } while (s >= 1 && c >= 0);
381
+ }
382
+ break;
383
+ }
384
+ }
385
+ }
386
+ } finally {
387
+ reentry = false;
388
+ {
389
+ ReactCurrentDispatcher.current = previousDispatcher;
390
+ reenableLogs();
391
+ }
392
+ Error.prepareStackTrace = previousPrepareStackTrace;
393
+ }
394
+ var name = fn ? fn.displayName || fn.name : "";
395
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
396
+ {
397
+ if (typeof fn === "function") {
398
+ componentFrameCache.set(fn, syntheticFrame);
399
+ }
400
+ }
401
+ return syntheticFrame;
402
+ }
403
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
404
+ {
405
+ return describeNativeComponentFrame(fn, false);
406
+ }
407
+ }
408
+ function shouldConstruct(Component2) {
409
+ var prototype = Component2.prototype;
410
+ return !!(prototype && prototype.isReactComponent);
411
+ }
412
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
413
+ if (type == null) {
414
+ return "";
415
+ }
416
+ if (typeof type === "function") {
417
+ {
418
+ return describeNativeComponentFrame(type, shouldConstruct(type));
419
+ }
420
+ }
421
+ if (typeof type === "string") {
422
+ return describeBuiltInComponentFrame(type);
423
+ }
424
+ switch (type) {
425
+ case REACT_SUSPENSE_TYPE:
426
+ return describeBuiltInComponentFrame("Suspense");
427
+ case REACT_SUSPENSE_LIST_TYPE:
428
+ return describeBuiltInComponentFrame("SuspenseList");
429
+ }
430
+ if (typeof type === "object") {
431
+ switch (type.$$typeof) {
432
+ case REACT_FORWARD_REF_TYPE:
433
+ return describeFunctionComponentFrame(type.render);
434
+ case REACT_MEMO_TYPE:
435
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
436
+ case REACT_LAZY_TYPE: {
437
+ var lazyComponent = type;
438
+ var payload = lazyComponent._payload;
439
+ var init = lazyComponent._init;
440
+ try {
441
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
442
+ } catch (x) {
443
+ }
444
+ }
445
+ }
446
+ }
447
+ return "";
448
+ }
449
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
450
+ var loggedTypeFailures = {};
451
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
452
+ function setCurrentlyValidatingElement(element) {
453
+ {
454
+ if (element) {
455
+ var owner = element._owner;
456
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
457
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
458
+ } else {
459
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
460
+ }
461
+ }
462
+ }
463
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
464
+ {
465
+ var has = Function.call.bind(hasOwnProperty);
466
+ for (var typeSpecName in typeSpecs) {
467
+ if (has(typeSpecs, typeSpecName)) {
468
+ var error$1 = void 0;
469
+ try {
470
+ if (typeof typeSpecs[typeSpecName] !== "function") {
471
+ var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
472
+ err.name = "Invariant Violation";
473
+ throw err;
474
+ }
475
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
476
+ } catch (ex) {
477
+ error$1 = ex;
478
+ }
479
+ if (error$1 && !(error$1 instanceof Error)) {
480
+ setCurrentlyValidatingElement(element);
481
+ error("%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).", componentName || "React class", location, typeSpecName, typeof error$1);
482
+ setCurrentlyValidatingElement(null);
483
+ }
484
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
485
+ loggedTypeFailures[error$1.message] = true;
486
+ setCurrentlyValidatingElement(element);
487
+ error("Failed %s type: %s", location, error$1.message);
488
+ setCurrentlyValidatingElement(null);
489
+ }
490
+ }
491
+ }
492
+ }
493
+ }
494
+ var isArrayImpl = Array.isArray;
495
+ function isArray(a) {
496
+ return isArrayImpl(a);
497
+ }
498
+ function typeName(value) {
499
+ {
500
+ var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
501
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
502
+ return type;
503
+ }
504
+ }
505
+ function willCoercionThrow(value) {
506
+ {
507
+ try {
508
+ testStringCoercion(value);
509
+ return false;
510
+ } catch (e) {
511
+ return true;
512
+ }
513
+ }
514
+ }
515
+ function testStringCoercion(value) {
516
+ return "" + value;
517
+ }
518
+ function checkKeyStringCoercion(value) {
519
+ {
520
+ if (willCoercionThrow(value)) {
521
+ error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
522
+ return testStringCoercion(value);
523
+ }
524
+ }
525
+ }
526
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
527
+ var RESERVED_PROPS = {
528
+ key: true,
529
+ ref: true,
530
+ __self: true,
531
+ __source: true
532
+ };
533
+ var specialPropKeyWarningShown;
534
+ var specialPropRefWarningShown;
535
+ function hasValidRef(config) {
536
+ {
537
+ if (hasOwnProperty.call(config, "ref")) {
538
+ var getter = Object.getOwnPropertyDescriptor(config, "ref").get;
539
+ if (getter && getter.isReactWarning) {
540
+ return false;
541
+ }
542
+ }
543
+ }
544
+ return config.ref !== void 0;
545
+ }
546
+ function hasValidKey(config) {
547
+ {
548
+ if (hasOwnProperty.call(config, "key")) {
549
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
550
+ if (getter && getter.isReactWarning) {
551
+ return false;
552
+ }
553
+ }
554
+ }
555
+ return config.key !== void 0;
556
+ }
557
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
558
+ {
559
+ if (typeof config.ref === "string" && ReactCurrentOwner.current && self) ;
560
+ }
561
+ }
562
+ function defineKeyPropWarningGetter(props, displayName) {
563
+ {
564
+ var warnAboutAccessingKey = function() {
565
+ if (!specialPropKeyWarningShown) {
566
+ specialPropKeyWarningShown = true;
567
+ error("%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)", displayName);
568
+ }
144
569
  };
145
- case 5:
146
- _.label++;
147
- y = op[1];
148
- op = [0];
149
- continue;
150
- case 7:
151
- op = _.ops.pop();
152
- _.trys.pop();
153
- continue;
154
- default:
155
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
156
- _ = 0;
157
- continue;
158
- }
159
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
160
- _.label = op[1];
161
- break;
162
- }
163
- if (op[0] === 6 && _.label < t[1]) {
164
- _.label = t[1];
165
- t = op;
166
- break;
167
- }
168
- if (t && _.label < t[2]) {
169
- _.label = t[2];
170
- _.ops.push(op);
171
- break;
172
- }
173
- if (t[2]) _.ops.pop();
174
- _.trys.pop();
175
- continue;
176
- }
177
- op = body.call(thisArg, _);
178
- } catch (e) {
179
- op = [6, e];
180
- y = 0;
181
- } finally {
182
- f = t = 0;
183
- }
184
- if (op[0] & 5) throw op[1];
185
- return {
186
- value: op[0] ? op[1] : void 0,
187
- done: true
188
- };
570
+ warnAboutAccessingKey.isReactWarning = true;
571
+ Object.defineProperty(props, "key", {
572
+ get: warnAboutAccessingKey,
573
+ configurable: true
574
+ });
575
+ }
576
+ }
577
+ function defineRefPropWarningGetter(props, displayName) {
578
+ {
579
+ var warnAboutAccessingRef = function() {
580
+ if (!specialPropRefWarningShown) {
581
+ specialPropRefWarningShown = true;
582
+ error("%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)", displayName);
583
+ }
584
+ };
585
+ warnAboutAccessingRef.isReactWarning = true;
586
+ Object.defineProperty(props, "ref", {
587
+ get: warnAboutAccessingRef,
588
+ configurable: true
589
+ });
590
+ }
591
+ }
592
+ var ReactElement = function(type, key, ref, self, source, owner, props) {
593
+ var element = {
594
+ // This tag allows us to uniquely identify this as a React Element
595
+ $$typeof: REACT_ELEMENT_TYPE,
596
+ // Built-in properties that belong on the element
597
+ type,
598
+ key,
599
+ ref,
600
+ props,
601
+ // Record the component responsible for creating this element.
602
+ _owner: owner
603
+ };
604
+ {
605
+ element._store = {};
606
+ Object.defineProperty(element._store, "validated", {
607
+ configurable: false,
608
+ enumerable: false,
609
+ writable: true,
610
+ value: false
611
+ });
612
+ Object.defineProperty(element, "_self", {
613
+ configurable: false,
614
+ enumerable: false,
615
+ writable: false,
616
+ value: self
617
+ });
618
+ Object.defineProperty(element, "_source", {
619
+ configurable: false,
620
+ enumerable: false,
621
+ writable: false,
622
+ value: source
623
+ });
624
+ if (Object.freeze) {
625
+ Object.freeze(element.props);
626
+ Object.freeze(element);
627
+ }
628
+ }
629
+ return element;
630
+ };
631
+ function jsxDEV(type, config, maybeKey, source, self) {
632
+ {
633
+ var propName;
634
+ var props = {};
635
+ var key = null;
636
+ var ref = null;
637
+ if (maybeKey !== void 0) {
638
+ {
639
+ checkKeyStringCoercion(maybeKey);
640
+ }
641
+ key = "" + maybeKey;
642
+ }
643
+ if (hasValidKey(config)) {
644
+ {
645
+ checkKeyStringCoercion(config.key);
646
+ }
647
+ key = "" + config.key;
648
+ }
649
+ if (hasValidRef(config)) {
650
+ ref = config.ref;
651
+ warnIfStringRefCannotBeAutoConverted(config, self);
652
+ }
653
+ for (propName in config) {
654
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
655
+ props[propName] = config[propName];
656
+ }
657
+ }
658
+ if (type && type.defaultProps) {
659
+ var defaultProps = type.defaultProps;
660
+ for (propName in defaultProps) {
661
+ if (props[propName] === void 0) {
662
+ props[propName] = defaultProps[propName];
663
+ }
664
+ }
665
+ }
666
+ if (key || ref) {
667
+ var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
668
+ if (key) {
669
+ defineKeyPropWarningGetter(props, displayName);
670
+ }
671
+ if (ref) {
672
+ defineRefPropWarningGetter(props, displayName);
673
+ }
674
+ }
675
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
676
+ }
677
+ }
678
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
679
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
680
+ function setCurrentlyValidatingElement$1(element) {
681
+ {
682
+ if (element) {
683
+ var owner = element._owner;
684
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
685
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
686
+ } else {
687
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
688
+ }
689
+ }
690
+ }
691
+ var propTypesMisspellWarningShown;
692
+ {
693
+ propTypesMisspellWarningShown = false;
694
+ }
695
+ function isValidElement(object) {
696
+ {
697
+ return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
698
+ }
699
+ }
700
+ function getDeclarationErrorAddendum() {
701
+ {
702
+ if (ReactCurrentOwner$1.current) {
703
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
704
+ if (name) {
705
+ return "\n\nCheck the render method of `" + name + "`.";
706
+ }
707
+ }
708
+ return "";
709
+ }
710
+ }
711
+ function getSourceInfoErrorAddendum(source) {
712
+ {
713
+ return "";
714
+ }
715
+ }
716
+ var ownerHasKeyUseWarning = {};
717
+ function getCurrentComponentErrorInfo(parentType) {
718
+ {
719
+ var info = getDeclarationErrorAddendum();
720
+ if (!info) {
721
+ var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
722
+ if (parentName) {
723
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
724
+ }
725
+ }
726
+ return info;
727
+ }
728
+ }
729
+ function validateExplicitKey(element, parentType) {
730
+ {
731
+ if (!element._store || element._store.validated || element.key != null) {
732
+ return;
733
+ }
734
+ element._store.validated = true;
735
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
736
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
737
+ return;
738
+ }
739
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
740
+ var childOwner = "";
741
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
742
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
743
+ }
744
+ setCurrentlyValidatingElement$1(element);
745
+ error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
746
+ setCurrentlyValidatingElement$1(null);
747
+ }
748
+ }
749
+ function validateChildKeys(node, parentType) {
750
+ {
751
+ if (typeof node !== "object") {
752
+ return;
753
+ }
754
+ if (isArray(node)) {
755
+ for (var i = 0; i < node.length; i++) {
756
+ var child = node[i];
757
+ if (isValidElement(child)) {
758
+ validateExplicitKey(child, parentType);
759
+ }
760
+ }
761
+ } else if (isValidElement(node)) {
762
+ if (node._store) {
763
+ node._store.validated = true;
764
+ }
765
+ } else if (node) {
766
+ var iteratorFn = getIteratorFn(node);
767
+ if (typeof iteratorFn === "function") {
768
+ if (iteratorFn !== node.entries) {
769
+ var iterator = iteratorFn.call(node);
770
+ var step;
771
+ while (!(step = iterator.next()).done) {
772
+ if (isValidElement(step.value)) {
773
+ validateExplicitKey(step.value, parentType);
774
+ }
775
+ }
776
+ }
777
+ }
778
+ }
779
+ }
780
+ }
781
+ function validatePropTypes(element) {
782
+ {
783
+ var type = element.type;
784
+ if (type === null || type === void 0 || typeof type === "string") {
785
+ return;
786
+ }
787
+ var propTypes;
788
+ if (typeof type === "function") {
789
+ propTypes = type.propTypes;
790
+ } else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
791
+ // Inner props are checked in the reconciler.
792
+ type.$$typeof === REACT_MEMO_TYPE)) {
793
+ propTypes = type.propTypes;
794
+ } else {
795
+ return;
796
+ }
797
+ if (propTypes) {
798
+ var name = getComponentNameFromType(type);
799
+ checkPropTypes(propTypes, element.props, "prop", name, element);
800
+ } else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
801
+ propTypesMisspellWarningShown = true;
802
+ var _name = getComponentNameFromType(type);
803
+ error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
804
+ }
805
+ if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
806
+ error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
807
+ }
808
+ }
809
+ }
810
+ function validateFragmentProps(fragment) {
811
+ {
812
+ var keys2 = Object.keys(fragment.props);
813
+ for (var i = 0; i < keys2.length; i++) {
814
+ var key = keys2[i];
815
+ if (key !== "children" && key !== "key") {
816
+ setCurrentlyValidatingElement$1(fragment);
817
+ error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
818
+ setCurrentlyValidatingElement$1(null);
819
+ break;
820
+ }
821
+ }
822
+ if (fragment.ref !== null) {
823
+ setCurrentlyValidatingElement$1(fragment);
824
+ error("Invalid attribute `ref` supplied to `React.Fragment`.");
825
+ setCurrentlyValidatingElement$1(null);
826
+ }
827
+ }
828
+ }
829
+ var didWarnAboutKeySpread = {};
830
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
831
+ {
832
+ var validType = isValidElementType(type);
833
+ if (!validType) {
834
+ var info = "";
835
+ if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
836
+ info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
837
+ }
838
+ var sourceInfo = getSourceInfoErrorAddendum();
839
+ if (sourceInfo) {
840
+ info += sourceInfo;
841
+ } else {
842
+ info += getDeclarationErrorAddendum();
843
+ }
844
+ var typeString;
845
+ if (type === null) {
846
+ typeString = "null";
847
+ } else if (isArray(type)) {
848
+ typeString = "array";
849
+ } else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE) {
850
+ typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
851
+ info = " Did you accidentally export a JSX literal instead of a component?";
852
+ } else {
853
+ typeString = typeof type;
854
+ }
855
+ error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
856
+ }
857
+ var element = jsxDEV(type, props, key, source, self);
858
+ if (element == null) {
859
+ return element;
860
+ }
861
+ if (validType) {
862
+ var children = props.children;
863
+ if (children !== void 0) {
864
+ if (isStaticChildren) {
865
+ if (isArray(children)) {
866
+ for (var i = 0; i < children.length; i++) {
867
+ validateChildKeys(children[i], type);
868
+ }
869
+ if (Object.freeze) {
870
+ Object.freeze(children);
871
+ }
872
+ } else {
873
+ error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
874
+ }
875
+ } else {
876
+ validateChildKeys(children, type);
877
+ }
878
+ }
879
+ }
880
+ {
881
+ if (hasOwnProperty.call(props, "key")) {
882
+ var componentName = getComponentNameFromType(type);
883
+ var keys2 = Object.keys(props).filter(function(k) {
884
+ return k !== "key";
885
+ });
886
+ var beforeExample = keys2.length > 0 ? "{key: someKey, " + keys2.join(": ..., ") + ": ...}" : "{key: someKey}";
887
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
888
+ var afterExample = keys2.length > 0 ? "{" + keys2.join(": ..., ") + ": ...}" : "{}";
889
+ error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
890
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
891
+ }
892
+ }
893
+ }
894
+ if (type === REACT_FRAGMENT_TYPE) {
895
+ validateFragmentProps(element);
896
+ } else {
897
+ validatePropTypes(element);
898
+ }
899
+ return element;
900
+ }
901
+ }
902
+ function jsxWithValidationStatic(type, props, key) {
903
+ {
904
+ return jsxWithValidation(type, props, key, true);
905
+ }
906
+ }
907
+ function jsxWithValidationDynamic(type, props, key) {
908
+ {
909
+ return jsxWithValidation(type, props, key, false);
910
+ }
911
+ }
912
+ var jsx = jsxWithValidationDynamic;
913
+ var jsxs = jsxWithValidationStatic;
914
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
915
+ reactJsxRuntime_development.jsx = jsx;
916
+ reactJsxRuntime_development.jsxs = jsxs;
917
+ })();
189
918
  }
919
+ return reactJsxRuntime_development;
190
920
  }
191
- function __spreadArray(to, from, pack) {
192
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
193
- if (ar || !(i in from)) {
194
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
195
- ar[i] = from[i];
196
- }
921
+ var hasRequiredJsxRuntime;
922
+ function requireJsxRuntime() {
923
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
924
+ hasRequiredJsxRuntime = 1;
925
+ if (process.env.NODE_ENV === "production") {
926
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
927
+ } else {
928
+ jsxRuntime.exports = requireReactJsxRuntime_development();
197
929
  }
198
- return to.concat(ar || Array.prototype.slice.call(from));
930
+ return jsxRuntime.exports;
199
931
  }
200
-
201
- var DEFAULT_PROPS = {
932
+ var jsxRuntimeExports = requireJsxRuntime();
933
+ const DEFAULT_PROPS = {
202
934
  viewportTag: "div",
203
935
  cameraTag: "div",
204
936
  cameraClass: "",
@@ -207,235 +939,182 @@ var DEFAULT_PROPS = {
207
939
  plugins: [],
208
940
  useFindDOMNode: false,
209
941
  hideBeforeInit: false,
210
- onReady: function (e) {},
211
- onBeforeResize: function (e) {},
212
- onAfterResize: function (e) {},
213
- onHoldStart: function (e) {},
214
- onHoldEnd: function (e) {},
215
- onMoveStart: function (e) {},
216
- onMove: function (e) {},
217
- onMoveEnd: function (e) {},
218
- onWillChange: function (e) {},
219
- onChanged: function (e) {},
220
- onWillRestore: function (e) {},
221
- onRestored: function (e) {},
222
- onSelect: function (e) {},
223
- onNeedPanel: function (e) {},
224
- onVisibleChange: function (e) {},
225
- onReachEdge: function (e) {},
226
- onPanelChange: function (e) {}
942
+ onReady: (e) => {
943
+ },
944
+ onBeforeResize: (e) => {
945
+ },
946
+ onAfterResize: (e) => {
947
+ },
948
+ onHoldStart: (e) => {
949
+ },
950
+ onHoldEnd: (e) => {
951
+ },
952
+ onMoveStart: (e) => {
953
+ },
954
+ onMove: (e) => {
955
+ },
956
+ onMoveEnd: (e) => {
957
+ },
958
+ onWillChange: (e) => {
959
+ },
960
+ onChanged: (e) => {
961
+ },
962
+ onWillRestore: (e) => {
963
+ },
964
+ onRestored: (e) => {
965
+ },
966
+ onSelect: (e) => {
967
+ },
968
+ onNeedPanel: (e) => {
969
+ },
970
+ onVisibleChange: (e) => {
971
+ },
972
+ onReachEdge: (e) => {
973
+ },
974
+ onPanelChange: (e) => {
975
+ }
227
976
  };
228
-
229
- var ReactRenderer = /*#__PURE__*/function (_super) {
230
- __extends(ReactRenderer, _super);
231
- function ReactRenderer(options) {
232
- var _this = _super.call(this, options) || this;
233
- _this._reactFlicking = options.reactFlicking;
234
- return _this;
977
+ class ReactElementProvider {
978
+ get element() {
979
+ return this._el?.nativeElement;
980
+ }
981
+ get rendered() {
982
+ return this._el?.rendered;
983
+ }
984
+ constructor(el) {
985
+ this._el = el;
986
+ }
987
+ show() {
988
+ this._el?.show();
989
+ }
990
+ hide() {
991
+ this._el?.hide();
992
+ }
993
+ }
994
+ class ReactRenderer extends VanillaFlicking.ExternalRenderer {
995
+ constructor(options) {
996
+ super(options);
997
+ this._reactFlicking = options.reactFlicking;
235
998
  }
236
999
  // eslint-disable-next-line @typescript-eslint/require-await
237
- var __proto = ReactRenderer.prototype;
238
- __proto.render = function () {
239
- return __awaiter(this, void 0, void 0, function () {
240
- var flicking, reactFlicking, strategy;
241
- var _this = this;
242
- return __generator(this, function (_a) {
243
- flicking = VanillaFlicking.getFlickingAttached(this._flicking);
244
- reactFlicking = this._reactFlicking;
245
- strategy = this._strategy;
246
- if (flicking.virtualEnabled) {
247
- // virtual 값은 VirtualManager Object 이므로 virtualEnabled 로 검사하는 것이 맞습니다.
248
- // applyTransform does not work when renderer.rendering is true. #916
249
- // updateRenderingPanels should be called before rendering becomes true, or transform will be applied later.
250
- strategy.updateRenderingPanels(flicking);
251
- this._rendering = true;
252
- } else {
253
- this._rendering = true;
254
- strategy.updateRenderingPanels(flicking);
255
- }
256
- strategy.renderPanels(flicking);
257
- return [2 /*return*/, new Promise(function (resolve) {
258
- reactFlicking.renderEmitter.once("render", function () {
259
- _this._rendering = false;
260
- _this._afterRender();
261
- resolve();
262
- });
263
- reactFlicking.forceUpdate();
264
- })];
1000
+ async render() {
1001
+ const flicking = VanillaFlicking.getFlickingAttached(this._flicking);
1002
+ const reactFlicking = this._reactFlicking;
1003
+ const strategy = this._strategy;
1004
+ if (flicking.virtualEnabled) {
1005
+ strategy.updateRenderingPanels(flicking);
1006
+ this._rendering = true;
1007
+ } else {
1008
+ this._rendering = true;
1009
+ strategy.updateRenderingPanels(flicking);
1010
+ }
1011
+ strategy.renderPanels(flicking);
1012
+ return new Promise((resolve) => {
1013
+ reactFlicking.renderEmitter.once("render", () => {
1014
+ this._rendering = false;
1015
+ this._afterRender();
1016
+ resolve();
265
1017
  });
1018
+ reactFlicking.forceUpdate();
266
1019
  });
267
- };
268
- __proto.forceRenderAllPanels = function () {
269
- return __awaiter(this, void 0, void 0, function () {
270
- var reactFlicking;
271
- var _this = this;
272
- return __generator(this, function (_a) {
273
- switch (_a.label) {
274
- case 0:
275
- reactFlicking = this._reactFlicking;
276
- this._rendering = true;
277
- return [4 /*yield*/, _super.prototype.forceRenderAllPanels.call(this)];
278
- case 1:
279
- _a.sent();
280
- return [2 /*return*/, new Promise(function (resolve) {
281
- reactFlicking.renderEmitter.once("render", function () {
282
- _this._rendering = false;
283
- resolve();
284
- });
285
- reactFlicking.forceUpdate();
286
- })];
287
- }
1020
+ }
1021
+ async forceRenderAllPanels() {
1022
+ const reactFlicking = this._reactFlicking;
1023
+ this._rendering = true;
1024
+ await super.forceRenderAllPanels();
1025
+ return new Promise((resolve) => {
1026
+ reactFlicking.renderEmitter.once("render", () => {
1027
+ this._rendering = false;
1028
+ resolve();
288
1029
  });
1030
+ reactFlicking.forceUpdate();
289
1031
  });
290
- };
291
- __proto.destroy = function () {
292
- _super.prototype.destroy.call(this);
1032
+ }
1033
+ destroy() {
1034
+ super.destroy();
293
1035
  this._reactFlicking.renderEmitter.off("render");
294
- };
295
- __proto._collectPanels = function () {
296
- var flicking = VanillaFlicking.getFlickingAttached(this._flicking);
297
- var reactFlicking = this._reactFlicking;
298
- var reactPanels = reactFlicking.reactPanels;
1036
+ }
1037
+ _collectPanels() {
1038
+ const flicking = VanillaFlicking.getFlickingAttached(this._flicking);
1039
+ const reactFlicking = this._reactFlicking;
1040
+ const reactPanels = reactFlicking.reactPanels;
299
1041
  this._panels = this._strategy.collectPanels(flicking, reactPanels);
300
- };
301
- __proto._createPanel = function (externalComponent, options) {
1042
+ }
1043
+ _createPanel(externalComponent, options) {
302
1044
  return this._strategy.createPanel(externalComponent, options);
303
- };
304
- return ReactRenderer;
305
- }(VanillaFlicking.ExternalRenderer);
306
-
307
- var StrictPanel = /*#__PURE__*/function (_super) {
308
- __extends(StrictPanel, _super);
309
- function StrictPanel() {
310
- var _this = _super !== null && _super.apply(this, arguments) || this;
311
- _this._hide = false;
312
- _this._elRef = React.createRef();
313
- return _this;
314
- }
315
- var __proto = StrictPanel.prototype;
316
- Object.defineProperty(__proto, "nativeElement", {
317
- get: function () {
318
- return this._elRef.current;
319
- },
320
- enumerable: false,
321
- configurable: true
322
- });
323
- Object.defineProperty(__proto, "rendered", {
324
- get: function () {
325
- return !this._hide;
326
- },
327
- enumerable: false,
328
- configurable: true
329
- });
330
- Object.defineProperty(__proto, "elRef", {
331
- get: function () {
332
- return this._elRef;
333
- },
334
- enumerable: false,
335
- configurable: true
336
- });
337
- __proto.render = function () {
338
- return this._hide ? React.createElement(React.Fragment, null) : this._getElement();
339
- };
340
- __proto.show = function () {
1045
+ }
1046
+ }
1047
+ class StrictPanel extends React__namespace.Component {
1048
+ constructor() {
1049
+ super(...arguments);
341
1050
  this._hide = false;
342
- };
343
- __proto.hide = function () {
1051
+ this._elRef = React__namespace.createRef();
1052
+ }
1053
+ get nativeElement() {
1054
+ return this._elRef.current;
1055
+ }
1056
+ get rendered() {
1057
+ return !this._hide;
1058
+ }
1059
+ get elRef() {
1060
+ return this._elRef;
1061
+ }
1062
+ render() {
1063
+ return this._hide ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {}) : this._getElement();
1064
+ }
1065
+ show() {
1066
+ this._hide = false;
1067
+ }
1068
+ hide() {
344
1069
  this._hide = true;
345
- };
346
- __proto._getElement = function () {
347
- return React.cloneElement(React.Children.only(this.props.children), {
1070
+ }
1071
+ _getElement() {
1072
+ return React__namespace.cloneElement(React__namespace.Children.only(this.props.children), {
348
1073
  ref: this._elRef
349
1074
  });
350
- };
351
- return StrictPanel;
352
- }(React.Component);
353
-
354
- /*
355
- * Copyright (c) 2015 NAVER Corp.
356
- * egjs projects are licensed under the MIT license
357
- */
358
- var ViewportSlot = React.memo(function (props) {
359
- return React.createElement(React.Fragment, null, props.children);
360
- });
361
-
362
- var ReactElementProvider = /*#__PURE__*/function () {
363
- function ReactElementProvider(el) {
364
- this._el = el;
365
1075
  }
366
- var __proto = ReactElementProvider.prototype;
367
- Object.defineProperty(__proto, "element", {
368
- get: function () {
369
- var _a;
370
- return (_a = this._el) === null || _a === void 0 ? void 0 : _a.nativeElement;
371
- },
372
- enumerable: false,
373
- configurable: true
374
- });
375
- Object.defineProperty(__proto, "rendered", {
376
- get: function () {
377
- var _a;
378
- return (_a = this._el) === null || _a === void 0 ? void 0 : _a.rendered;
379
- },
380
- enumerable: false,
381
- configurable: true
382
- });
383
- __proto.show = function () {
384
- var _a;
385
- (_a = this._el) === null || _a === void 0 ? void 0 : _a.show();
386
- };
387
- __proto.hide = function () {
388
- var _a;
389
- (_a = this._el) === null || _a === void 0 ? void 0 : _a.hide();
390
- };
391
- return ReactElementProvider;
392
- }();
393
-
394
- var Flicking = /*#__PURE__*/function (_super) {
395
- __extends(Flicking, _super);
396
- function Flicking(props) {
397
- var _this = _super.call(this, props) || this;
398
- _this._panels = [];
399
- _this._renderEmitter = new Component();
400
- var children = _this._getChildren();
401
- _this._panels = _this._createPanelRefs(props, children);
402
- _this._prevChildren = children;
403
- return _this;
404
- }
405
- var __proto = Flicking.prototype;
406
- Object.defineProperty(__proto, "reactPanels", {
407
- get: function () {
408
- return this._panels.map(function (panel) {
409
- return panel.current;
410
- });
411
- },
412
- enumerable: false,
413
- configurable: true
414
- });
415
- Object.defineProperty(__proto, "renderEmitter", {
416
- get: function () {
417
- return this._renderEmitter;
418
- },
419
- enumerable: false,
420
- configurable: true
421
- });
422
- __proto.componentDidMount = function () {
423
- var props = this.props;
424
- var rendererOptions = {
1076
+ }
1077
+ const ViewportSlot = React.memo((props) => /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children }));
1078
+ var __defProp = Object.defineProperty;
1079
+ var __decorateClass = (decorators, target, key, kind) => {
1080
+ var result = void 0;
1081
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
1082
+ if (decorator = decorators[i])
1083
+ result = decorator(target, key, result) || result;
1084
+ if (result) __defProp(target, key, result);
1085
+ return result;
1086
+ };
1087
+ const _Flicking = class _Flicking extends React__namespace.Component {
1088
+ constructor(props) {
1089
+ super(props);
1090
+ this._panels = [];
1091
+ this._renderEmitter = new Component();
1092
+ const children = this._getChildren();
1093
+ this._panels = this._createPanelRefs(props, children);
1094
+ this._prevChildren = children;
1095
+ }
1096
+ get reactPanels() {
1097
+ return this._panels.map((panel) => panel.current);
1098
+ }
1099
+ get renderEmitter() {
1100
+ return this._renderEmitter;
1101
+ }
1102
+ componentDidMount() {
1103
+ const props = this.props;
1104
+ const rendererOptions = {
425
1105
  reactFlicking: this,
426
1106
  align: props.align,
427
1107
  strategy: props.virtual && props.panelsPerView > 0 ? new VanillaFlicking.VirtualRenderingStrategy() : new VanillaFlicking.NormalRenderingStrategy({
428
1108
  providerCtor: ReactElementProvider
429
1109
  })
430
1110
  };
431
- var flicking = new VanillaFlicking(this._viewportElement, __assign(__assign({}, props), {
1111
+ const flicking = new VanillaFlicking(this._viewportElement, {
1112
+ ...props,
432
1113
  externalRenderer: new ReactRenderer(rendererOptions)
433
- }));
434
- this._vanillaFlicking = flicking;
435
- var children = this._getChildren();
436
- this._jsxDiffer = new ListDiffer(children, function (panel) {
437
- return panel.key;
438
1114
  });
1115
+ this._vanillaFlicking = flicking;
1116
+ const children = this._getChildren();
1117
+ this._jsxDiffer = new ListDiffer(children, (panel) => panel.key);
439
1118
  this._pluginsDiffer = new ListDiffer();
440
1119
  this._prevChildren = children;
441
1120
  this._bindEvents();
@@ -443,54 +1122,46 @@ var Flicking = /*#__PURE__*/function (_super) {
443
1122
  if (props.status) {
444
1123
  flicking.setStatus(props.status);
445
1124
  }
446
- };
447
- __proto.componentWillUnmount = function () {
448
- var _a;
449
- (_a = this._vanillaFlicking) === null || _a === void 0 ? void 0 : _a.destroy();
450
- };
451
- __proto.shouldComponentUpdate = function (nextProps) {
452
- var vanillaFlicking = this._vanillaFlicking;
453
- var prevProps = this.props;
1125
+ }
1126
+ componentWillUnmount() {
1127
+ this._vanillaFlicking?.destroy();
1128
+ }
1129
+ shouldComponentUpdate(nextProps) {
1130
+ const vanillaFlicking = this._vanillaFlicking;
1131
+ const prevProps = this.props;
454
1132
  if (!vanillaFlicking || !vanillaFlicking.initialized) return false;
455
- var children = nextProps.children,
456
- restProps = __rest(nextProps, ["children"]);
457
- for (var key in restProps) {
1133
+ const { children, ...restProps } = nextProps;
1134
+ for (const key in restProps) {
458
1135
  if (prevProps[key] !== nextProps[key]) {
459
1136
  return true;
460
1137
  }
461
1138
  }
462
- var prevChildren = this._prevChildren;
463
- var nextChildren = this._getChildren(children);
1139
+ const prevChildren = this._prevChildren;
1140
+ const nextChildren = this._getChildren(children);
464
1141
  if (nextProps.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) return true;
465
1142
  return false;
466
- };
467
- __proto.beforeRender = function () {
468
- var vanillaFlicking = this._vanillaFlicking;
469
- var props = this.props;
470
- var prevChildren = this._prevChildren;
471
- // Ignore updates before init, they will be updated after "ready" event's force update
472
- // Also, prevent updates when another update is already queued.
473
- // This usually happens when render() called twice without calling componentDidMount, like in the case of React.StrictMode.
1143
+ }
1144
+ beforeRender() {
1145
+ const vanillaFlicking = this._vanillaFlicking;
1146
+ const props = this.props;
1147
+ const prevChildren = this._prevChildren;
474
1148
  if (!vanillaFlicking || !vanillaFlicking.initialized || this._diffResult) return;
475
- var nextChildren = this._getChildren(props.children);
1149
+ const nextChildren = this._getChildren(props.children);
476
1150
  if (props.renderOnSameKey || !this._hasSameChildren(prevChildren, nextChildren)) {
477
1151
  this._panels = this._createPanelRefs(props, nextChildren);
478
1152
  this._diffResult = this._jsxDiffer.update(nextChildren);
479
1153
  this._prevChildren = nextChildren;
480
1154
  }
481
- };
482
- __proto.componentDidUpdate = function () {
483
- var flicking = this._vanillaFlicking;
484
- var renderEmitter = this._renderEmitter;
485
- var diffResult = this._diffResult;
1155
+ }
1156
+ componentDidUpdate() {
1157
+ const flicking = this._vanillaFlicking;
1158
+ const renderEmitter = this._renderEmitter;
1159
+ const diffResult = this._diffResult;
486
1160
  this._checkPlugins();
487
1161
  renderEmitter.trigger("render");
488
1162
  flicking.camera.updateOffset();
489
- // Omit 'virtual', as it can't have any setter
490
- var _a = this.props;
491
- _a.virtual;
492
- var props = __rest(_a, ["virtual"]);
493
- for (var key in props) {
1163
+ const { virtual, ...props } = this.props;
1164
+ for (const key in props) {
494
1165
  if (key in flicking && flicking[key] !== props[key]) {
495
1166
  flicking[key] = props[key];
496
1167
  }
@@ -498,84 +1169,69 @@ var Flicking = /*#__PURE__*/function (_super) {
498
1169
  if (!diffResult || !flicking.initialized) return;
499
1170
  VanillaFlicking.sync(flicking, diffResult, this.reactPanels);
500
1171
  this._diffResult = null;
501
- };
502
- __proto.render = function () {
503
- var _this = this;
504
- var _a;
505
- var props = this.props;
506
- var Viewport = props.viewportTag;
507
- var Camera = props.cameraTag;
508
- var attributes = {};
1172
+ }
1173
+ render() {
1174
+ const props = this.props;
1175
+ const Viewport = props.viewportTag;
1176
+ const Camera = props.cameraTag;
1177
+ const attributes = {};
509
1178
  this.beforeRender();
510
- for (var name in props) {
1179
+ for (const name in props) {
511
1180
  if (!(name in DEFAULT_PROPS) && !(name in VanillaFlicking.prototype)) {
512
1181
  attributes[name] = props[name];
513
1182
  }
514
1183
  }
515
- var _b = this._getClasses(attributes, props),
516
- viewportClasses = _b.viewportClasses,
517
- cameraClasses = _b.cameraClasses,
518
- cameraProps = _b.cameraProps;
519
- var panels = !!props.virtual && ((_a = props.panelsPerView) !== null && _a !== void 0 ? _a : -1) > 0 ? this._getVirtualPanels() : this._getPanels();
520
- return React.createElement(Viewport, __assign({}, attributes, {
521
- className: viewportClasses.join(" "),
522
- ref: function (e) {
523
- e && (_this._viewportElement = e);
524
- }
525
- }), React.createElement(Camera, __assign({
526
- className: cameraClasses.join(" ")
527
- }, cameraProps), panels), this._getViewportSlot());
528
- };
529
- __proto._createPanelRefs = function (props, children) {
530
- var _a;
531
- var panelsPerView = (_a = props.panelsPerView) !== null && _a !== void 0 ? _a : -1;
532
- return panelsPerView > 0 && !!props.virtual ? VanillaFlicking.range(panelsPerView + 1).map(function () {
533
- return React.createRef();
534
- }) : children.map(function () {
535
- return React.createRef();
536
- });
537
- };
538
- __proto._bindEvents = function () {
539
- var _this = this;
540
- var flicking = this._vanillaFlicking;
541
- Object.keys(VanillaFlicking.EVENTS).forEach(function (eventKey) {
542
- var eventName = VanillaFlicking.EVENTS[eventKey];
543
- _this._bindEvent(eventName);
1184
+ const { viewportClasses, cameraClasses, cameraProps } = this._getClasses(attributes, props);
1185
+ const panels = !!props.virtual && (props.panelsPerView ?? -1) > 0 ? this._getVirtualPanels() : this._getPanels();
1186
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
1187
+ Viewport,
1188
+ {
1189
+ ...attributes,
1190
+ className: viewportClasses.join(" "),
1191
+ ref: (e) => {
1192
+ e && (this._viewportElement = e);
1193
+ },
1194
+ children: [
1195
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Camera, { className: cameraClasses.join(" "), ...cameraProps, children: panels }),
1196
+ this._getViewportSlot()
1197
+ ]
1198
+ }
1199
+ );
1200
+ }
1201
+ _createPanelRefs(props, children) {
1202
+ const panelsPerView = props.panelsPerView ?? -1;
1203
+ return panelsPerView > 0 && !!props.virtual ? VanillaFlicking.range(panelsPerView + 1).map(() => React__namespace.createRef()) : children.map(() => React__namespace.createRef());
1204
+ }
1205
+ _bindEvents() {
1206
+ const flicking = this._vanillaFlicking;
1207
+ Object.keys(VanillaFlicking.EVENTS).forEach((eventKey) => {
1208
+ const eventName = VanillaFlicking.EVENTS[eventKey];
1209
+ this._bindEvent(eventName);
544
1210
  });
545
- flicking.once(VanillaFlicking.EVENTS.READY, function () {
546
- _this.forceUpdate();
1211
+ flicking.once(VanillaFlicking.EVENTS.READY, () => {
1212
+ this.forceUpdate();
547
1213
  });
548
- };
549
- __proto._bindEvent = function (eventName) {
550
- var _this = this;
551
- var propName = "on".concat(eventName.charAt(0).toUpperCase() + eventName.slice(1));
552
- this._vanillaFlicking.on(eventName, function (e) {
553
- e.currentTarget = _this;
554
- var evtHandler = _this.props[propName];
1214
+ }
1215
+ _bindEvent(eventName) {
1216
+ const propName = `on${eventName.charAt(0).toUpperCase() + eventName.slice(1)}`;
1217
+ this._vanillaFlicking.on(eventName, (e) => {
1218
+ e.currentTarget = this;
1219
+ const evtHandler = this.props[propName];
555
1220
  evtHandler(e);
556
1221
  });
557
- };
558
- __proto._checkPlugins = function () {
559
- var flicking = this._vanillaFlicking;
560
- var _a = this._pluginsDiffer.update(this.props.plugins),
561
- list = _a.list,
562
- added = _a.added,
563
- removed = _a.removed,
564
- prevList = _a.prevList;
565
- flicking.addPlugins.apply(flicking, added.map(function (index) {
566
- return list[index];
567
- }));
568
- flicking.removePlugins.apply(flicking, removed.map(function (index) {
569
- return prevList[index];
570
- }));
571
- };
572
- __proto._getClasses = function (attributes, props) {
573
- var _a;
574
- var flicking = this._vanillaFlicking;
575
- var initialized = flicking && flicking.initialized;
576
- var viewportClasses = ["flicking-viewport"];
577
- var cameraClasses = ["flicking-camera"];
578
- var isHorizontal = flicking ? flicking.horizontal : (_a = props.horizontal) !== null && _a !== void 0 ? _a : true;
1222
+ }
1223
+ _checkPlugins() {
1224
+ const flicking = this._vanillaFlicking;
1225
+ const { list, added, removed, prevList } = this._pluginsDiffer.update(this.props.plugins);
1226
+ flicking.addPlugins(...added.map((index) => list[index]));
1227
+ flicking.removePlugins(...removed.map((index) => prevList[index]));
1228
+ }
1229
+ _getClasses(attributes, props) {
1230
+ const flicking = this._vanillaFlicking;
1231
+ const initialized = flicking?.initialized;
1232
+ const viewportClasses = ["flicking-viewport"];
1233
+ const cameraClasses = ["flicking-camera"];
1234
+ const isHorizontal = flicking ? flicking.horizontal : props.horizontal ?? true;
579
1235
  if (!isHorizontal) {
580
1236
  viewportClasses.push("vertical");
581
1237
  }
@@ -588,112 +1244,391 @@ var Flicking = /*#__PURE__*/function (_super) {
588
1244
  if (props.cameraClass) {
589
1245
  cameraClasses.push(props.cameraClass);
590
1246
  }
591
- var cameraProps = !initialized && props.firstPanelSize ? {
1247
+ const cameraProps = !initialized && props.firstPanelSize ? {
592
1248
  style: {
593
1249
  transform: VanillaFlicking.getDefaultCameraTransform(this.props.align, this.props.horizontal, this.props.firstPanelSize)
594
1250
  }
595
1251
  } : {};
596
1252
  return {
597
- viewportClasses: viewportClasses,
598
- cameraClasses: cameraClasses,
599
- cameraProps: cameraProps
1253
+ viewportClasses,
1254
+ cameraClasses,
1255
+ cameraProps
600
1256
  };
601
- };
602
- __proto._hasSameChildren = function (prevChildren, nextChildren) {
1257
+ }
1258
+ _hasSameChildren(prevChildren, nextChildren) {
603
1259
  if (prevChildren.length !== nextChildren.length || prevChildren.length === 0) return false;
604
- var same = prevChildren.every(function (child, idx) {
605
- var nextChild = nextChildren[idx];
1260
+ const same = prevChildren.every((child, idx) => {
1261
+ const nextChild = nextChildren[idx];
606
1262
  return child === nextChild;
607
1263
  });
608
1264
  return same;
1265
+ }
1266
+ _getChildren(children = this.props.children) {
1267
+ return React__namespace.Children.toArray(children).filter((child) => child.type !== ViewportSlot).reduce((all, child) => {
1268
+ return [...all, ...this._unpackFragment(child)];
1269
+ }, []);
1270
+ }
1271
+ _getViewportSlot() {
1272
+ return React__namespace.Children.toArray(this.props.children).filter(
1273
+ (child) => child.type === ViewportSlot
1274
+ );
1275
+ }
1276
+ _unpackFragment(child) {
1277
+ return this._isFragment(child) ? React__namespace.Children.toArray(child.props.children).reduce(
1278
+ (allChilds, fragChild) => [
1279
+ ...allChilds,
1280
+ ...this._unpackFragment(fragChild)
1281
+ ],
1282
+ []
1283
+ ) : [child];
1284
+ }
1285
+ _getVirtualPanels() {
1286
+ const { panelClass = "flicking-panel" } = this.props.virtual;
1287
+ const panelsPerView = this.props.panelsPerView;
1288
+ const flicking = this._vanillaFlicking;
1289
+ const initialized = flicking?.initialized;
1290
+ const renderingIndexes = initialized ? flicking.renderer.strategy.getRenderingIndexesByOrder(flicking) : VanillaFlicking.range(panelsPerView + 1);
1291
+ const firstPanel = flicking?.panels[0];
1292
+ const size = firstPanel ? flicking.horizontal ? { width: firstPanel.size } : { height: firstPanel.size } : {};
1293
+ return renderingIndexes.map((idx) => {
1294
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StrictPanel, { ref: this._panels[idx], children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "data-element-index": idx, className: panelClass, style: size }) }, idx);
1295
+ });
1296
+ }
1297
+ _getPanels() {
1298
+ const origChildren = this._getChildren();
1299
+ const vanillaFlicking = this._vanillaFlicking;
1300
+ const diffResult = this._diffResult;
1301
+ const children = vanillaFlicking?.initialized ? diffResult ? VanillaFlicking.getRenderingPanels(vanillaFlicking, diffResult) : VanillaFlicking.getRenderingPanels(vanillaFlicking, ListDiffer.diff(origChildren, origChildren)) : origChildren;
1302
+ return children.map((child, idx) => /* @__PURE__ */ jsxRuntimeExports.jsx(StrictPanel, { ref: this._panels[idx], children: child }, child.key));
1303
+ }
1304
+ _isFragment(child) {
1305
+ if (child.type) {
1306
+ return child.type === React__namespace.Fragment;
1307
+ }
1308
+ return child === React__namespace.Fragment;
1309
+ }
1310
+ };
1311
+ _Flicking.defaultProps = DEFAULT_PROPS;
1312
+ let Flicking = _Flicking;
1313
+ __decorateClass([
1314
+ VanillaFlicking.withFlickingMethods
1315
+ ], Flicking.prototype, "_vanillaFlicking");
1316
+ function keys(obj) {
1317
+ return Object.keys(obj);
1318
+ }
1319
+ function camelize(str) {
1320
+ return str.replace(/[\s-_]([a-z])/g, function(all, letter) {
1321
+ return letter.toUpperCase();
1322
+ });
1323
+ }
1324
+ function isFunction(val) {
1325
+ return typeof val === "function";
1326
+ }
1327
+ var OBSERVERS_PATH = "__observers__";
1328
+ var COMPUTED_PATH = "__computed__";
1329
+ function __spreadArray(to, from, pack) {
1330
+ if (arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
1331
+ if (ar || !(i in from)) {
1332
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
1333
+ ar[i] = from[i];
1334
+ }
1335
+ }
1336
+ return to.concat(ar || Array.prototype.slice.call(from));
1337
+ }
1338
+ function withReactiveMethods(ref, methods) {
1339
+ var obj = {};
1340
+ if (!methods) {
1341
+ return obj;
1342
+ }
1343
+ methods.forEach(function(name) {
1344
+ obj[name] = function() {
1345
+ var args = [];
1346
+ for (var _i = 0; _i < arguments.length; _i++) {
1347
+ args[_i] = arguments[_i];
1348
+ }
1349
+ var current = ref.current || ref.value;
1350
+ return current[name].apply(current, args);
1351
+ };
1352
+ });
1353
+ return obj;
1354
+ }
1355
+ function defineObservers(instance) {
1356
+ var observers = {};
1357
+ Object.defineProperty(instance, OBSERVERS_PATH, {
1358
+ get: function() {
1359
+ return observers;
1360
+ }
1361
+ });
1362
+ return observers;
1363
+ }
1364
+ function getObservers(instance, isComputed) {
1365
+ var _a, _b;
1366
+ if (!instance[OBSERVERS_PATH]) {
1367
+ defineObservers(instance);
1368
+ }
1369
+ var observers = instance[OBSERVERS_PATH];
1370
+ {
1371
+ var computedList = (_b = (_a = instance === null || instance === void 0 ? void 0 : instance.constructor) === null || _a === void 0 ? void 0 : _a.prototype) === null || _b === void 0 ? void 0 : _b[COMPUTED_PATH];
1372
+ if (computedList) {
1373
+ computedList.forEach(function(name) {
1374
+ if (!(name in observers) && name in instance) {
1375
+ instance[name];
1376
+ }
1377
+ });
1378
+ }
1379
+ }
1380
+ return observers;
1381
+ }
1382
+ function adaptReactive(adapter, props) {
1383
+ var objectAdapter = isFunction(adapter) ? {
1384
+ setup: adapter
1385
+ } : adapter;
1386
+ function getProps() {
1387
+ var _a, _b, _c, _d, _e;
1388
+ return (_e = (_c = (_a = props === null || props === void 0 ? void 0 : props()) !== null && _a !== void 0 ? _a : (_b = objectAdapter.props) === null || _b === void 0 ? void 0 : _b.call(objectAdapter)) !== null && _c !== void 0 ? _c : (_d = objectAdapter.data) === null || _d === void 0 ? void 0 : _d.call(objectAdapter)) !== null && _e !== void 0 ? _e : {};
1389
+ }
1390
+ var eventEmitter = new Component();
1391
+ var mountedHooks = [];
1392
+ var initHooks = [];
1393
+ var destroyHooks = [];
1394
+ var onHooks = [];
1395
+ var instanceRef = {
1396
+ current: null
1397
+ };
1398
+ var offHooksList = [];
1399
+ var initialState = null;
1400
+ var eventNames = [];
1401
+ var methodNames = [];
1402
+ var onMounted = function(callback) {
1403
+ mountedHooks.push(callback);
1404
+ };
1405
+ var onInit = function(callback) {
1406
+ initHooks.push(callback);
609
1407
  };
610
- __proto._getChildren = function (children) {
611
- var _this = this;
612
- if (children === void 0) {
613
- children = this.props.children;
1408
+ var onDestroy = function(callback) {
1409
+ destroyHooks.push(callback);
1410
+ };
1411
+ var on = function(callback) {
1412
+ onHooks.push(callback);
1413
+ };
1414
+ var emit = function(eventName) {
1415
+ var params = [];
1416
+ for (var _i = 1; _i < arguments.length; _i++) {
1417
+ params[_i - 1] = arguments[_i];
614
1418
  }
615
- return React.Children.toArray(children).filter(function (child) {
616
- return child.type !== ViewportSlot;
617
- }).reduce(function (all, child) {
618
- return __spreadArray(__spreadArray([], all, true), _this._unpackFragment(child), true);
619
- }, []);
1419
+ eventEmitter.trigger.apply(eventEmitter, __spreadArray([eventName], params, false));
620
1420
  };
621
- __proto._getViewportSlot = function () {
622
- return React.Children.toArray(this.props.children).filter(function (child) {
623
- return child.type === ViewportSlot;
624
- });
1421
+ var setInitialState = function(state) {
1422
+ initialState = state;
625
1423
  };
626
- __proto._unpackFragment = function (child) {
627
- var _this = this;
628
- return this._isFragment(child) ? React.Children.toArray(child.props.children).reduce(function (allChilds, fragChild) {
629
- return __spreadArray(__spreadArray([], allChilds, true), _this._unpackFragment(fragChild), true);
630
- }, []) : [child];
1424
+ var setEvents = function(events) {
1425
+ eventNames = events;
631
1426
  };
632
- __proto._getVirtualPanels = function () {
633
- var _this = this;
634
- var _a = this.props.virtual.panelClass,
635
- panelClass = _a === void 0 ? "flicking-panel" : _a;
636
- var panelsPerView = this.props.panelsPerView;
637
- var flicking = this._vanillaFlicking;
638
- var initialized = flicking && flicking.initialized;
639
- var renderingIndexes = initialized ? flicking.renderer.strategy.getRenderingIndexesByOrder(flicking) : VanillaFlicking.range(panelsPerView + 1);
640
- var firstPanel = flicking && flicking.panels[0];
641
- var size = firstPanel ? flicking.horizontal ? {
642
- width: firstPanel.size
643
- } : {
644
- height: firstPanel.size
645
- } : {};
646
- return renderingIndexes.map(function (idx) {
647
- return React.createElement(StrictPanel, {
648
- key: idx,
649
- ref: _this._panels[idx]
650
- }, React.createElement("div", {
651
- "data-element-index": idx,
652
- className: panelClass,
653
- style: size
654
- }));
1427
+ var setMethods = function(methods) {
1428
+ methodNames = methods;
1429
+ };
1430
+ if (objectAdapter.setup) {
1431
+ instanceRef.current = objectAdapter.setup({
1432
+ getProps,
1433
+ setInitialState,
1434
+ setEvents,
1435
+ setMethods,
1436
+ onMounted,
1437
+ onDestroy,
1438
+ onInit,
1439
+ emit,
1440
+ on
1441
+ }) || null;
1442
+ }
1443
+ if (objectAdapter.created) {
1444
+ instanceRef.current = objectAdapter.created(getProps()) || null;
1445
+ }
1446
+ if (objectAdapter.events) {
1447
+ setEvents(objectAdapter.events);
1448
+ }
1449
+ if (objectAdapter.state) {
1450
+ setInitialState(objectAdapter.state);
1451
+ }
1452
+ if (objectAdapter.methods) {
1453
+ setMethods(objectAdapter.methods);
1454
+ }
1455
+ if (objectAdapter.mounted) {
1456
+ onMounted(objectAdapter.mounted);
1457
+ }
1458
+ if (objectAdapter.destroy) {
1459
+ destroyHooks.push(objectAdapter.destroy);
1460
+ }
1461
+ if (objectAdapter.init) {
1462
+ initHooks.push(objectAdapter.init);
1463
+ }
1464
+ if (objectAdapter.on) {
1465
+ onHooks.push(function(instance, eventName, listener) {
1466
+ var off = objectAdapter.on(instance, eventName, listener);
1467
+ return function() {
1468
+ var _a;
1469
+ off && off();
1470
+ (_a = objectAdapter.off) === null || _a === void 0 ? void 0 : _a.call(objectAdapter, instance, eventName, listener);
1471
+ };
655
1472
  });
1473
+ }
1474
+ return {
1475
+ events: function() {
1476
+ return eventNames;
1477
+ },
1478
+ state: function() {
1479
+ var inst = instanceRef.current;
1480
+ if (initialState) {
1481
+ return initialState;
1482
+ }
1483
+ if (inst) {
1484
+ var observers_1 = getObservers(inst);
1485
+ setInitialState(keys(observers_1).reduce(function(prev, cur) {
1486
+ prev[cur] = observers_1[cur].current;
1487
+ return prev;
1488
+ }, {}));
1489
+ }
1490
+ return initialState || {};
1491
+ },
1492
+ instance: function() {
1493
+ return instanceRef.current;
1494
+ },
1495
+ mounted: function() {
1496
+ var props2 = getProps();
1497
+ mountedHooks.forEach(function(hook) {
1498
+ instanceRef.current = hook(props2, instanceRef.current) || instanceRef.current;
1499
+ });
1500
+ },
1501
+ init: function() {
1502
+ var instance = instanceRef.current;
1503
+ var props2 = getProps();
1504
+ offHooksList = eventNames.map(function(eventName) {
1505
+ var listener = function() {
1506
+ var _a;
1507
+ var params = [];
1508
+ for (var _i = 0; _i < arguments.length; _i++) {
1509
+ params[_i] = arguments[_i];
1510
+ }
1511
+ (_a = eventEmitter).trigger.apply(_a, __spreadArray([eventName], params, false));
1512
+ };
1513
+ var instance2 = instanceRef.current;
1514
+ return onHooks.map(function(hook) {
1515
+ return hook(instance2, eventName, listener);
1516
+ }).filter(Boolean);
1517
+ });
1518
+ initHooks.forEach(function(hook) {
1519
+ hook(instance, props2);
1520
+ });
1521
+ },
1522
+ destroy: function() {
1523
+ offHooksList.forEach(function(offHooks) {
1524
+ offHooks.forEach(function(hook) {
1525
+ hook();
1526
+ });
1527
+ });
1528
+ eventEmitter.off();
1529
+ var instance = instanceRef.current;
1530
+ var props2 = getProps();
1531
+ destroyHooks.forEach(function(hook) {
1532
+ hook(instance, props2);
1533
+ });
1534
+ },
1535
+ methods: function() {
1536
+ return withReactiveMethods(instanceRef, methodNames);
1537
+ },
1538
+ on: function(eventName, listener) {
1539
+ eventEmitter.on(eventName, listener);
1540
+ },
1541
+ off: function(eventName, listener) {
1542
+ eventEmitter.off(eventName, listener);
1543
+ }
656
1544
  };
657
- __proto._getPanels = function () {
658
- var _this = this;
659
- var origChildren = this._getChildren();
660
- var vanillaFlicking = this._vanillaFlicking;
661
- var diffResult = this._diffResult;
662
- var children = vanillaFlicking && vanillaFlicking.initialized ? diffResult ? VanillaFlicking.getRenderingPanels(vanillaFlicking, diffResult) : VanillaFlicking.getRenderingPanels(vanillaFlicking, ListDiffer.diff(origChildren, origChildren)) : origChildren;
663
- return children.map(function (child, idx) {
664
- return React.createElement(StrictPanel, {
665
- key: child.key,
666
- ref: _this._panels[idx]
667
- }, child);
1545
+ }
1546
+ function useReactive(reactiveAdapter, props) {
1547
+ var readRef = React.useRef(true);
1548
+ var adaptResult = React.useMemo(function() {
1549
+ return adaptReactive(reactiveAdapter, props);
1550
+ }, []);
1551
+ var reactiveState = adaptResult.state();
1552
+ var names = keys(reactiveState);
1553
+ var states = React.useState({})[0];
1554
+ var _loop_1 = function(name2) {
1555
+ var state = React.useState(function() {
1556
+ return reactiveState[name2];
668
1557
  });
1558
+ states[name2] = {
1559
+ getter: false,
1560
+ set: state[1],
1561
+ value: state[0]
1562
+ };
669
1563
  };
670
- __proto._isFragment = function (child) {
671
- if (child.type) {
672
- return child.type === React.Fragment;
1564
+ for (var name in reactiveState) {
1565
+ _loop_1(name);
1566
+ }
1567
+ readRef.current = true;
1568
+ var methods = React.useMemo(function() {
1569
+ return adaptResult.methods();
1570
+ }, []);
1571
+ React.useEffect(function() {
1572
+ readRef.current = false;
1573
+ });
1574
+ React.useEffect(function() {
1575
+ adaptResult.mounted();
1576
+ var inst = adaptResult.instance();
1577
+ names.forEach(function(name2) {
1578
+ inst.subscribe(name2, function(value) {
1579
+ states[name2].value = value;
1580
+ if (states[name2].getter) {
1581
+ states[name2].set(value);
1582
+ }
1583
+ });
1584
+ });
1585
+ adaptResult.init();
1586
+ return function() {
1587
+ adaptResult.destroy();
1588
+ };
1589
+ }, []);
1590
+ var result = names.reduce(function(result2, name2) {
1591
+ if (!methods[name2]) {
1592
+ Object.defineProperty(result2, name2, {
1593
+ enumerable: true,
1594
+ get: function() {
1595
+ if (readRef.current) {
1596
+ states[name2].getter = true;
1597
+ }
1598
+ return states[name2].value;
1599
+ }
1600
+ });
673
1601
  }
674
- return child === React.Fragment;
675
- };
676
- Flicking.defaultProps = DEFAULT_PROPS;
677
- __decorate([VanillaFlicking.withFlickingMethods], Flicking.prototype, "_vanillaFlicking", void 0);
678
- return Flicking;
679
- }(React.Component);
680
-
681
- var useFlickingReactiveAPI = function (flickingRef, options) {
682
- return react.useReactive(VanillaFlicking.flickingReactiveAPIAdapter, function () {
683
- var _a;
684
- return {
685
- flicking: (_a = flickingRef.current) !== null && _a !== void 0 ? _a : undefined,
686
- options: options
1602
+ return result2;
1603
+ }, {});
1604
+ var reactiveEvents = adaptResult.events();
1605
+ reactiveEvents.forEach(function(name2) {
1606
+ result[camelize("on ".concat(name2))] = function(callback, dependencies) {
1607
+ var listener = React.useMemo(function() {
1608
+ adaptResult.on(name2, callback);
1609
+ return callback;
1610
+ }, dependencies);
1611
+ React.useEffect(function() {
1612
+ adaptResult.off(name2, listener);
1613
+ adaptResult.on(name2, listener);
1614
+ return function() {
1615
+ adaptResult.off(name2, listener);
1616
+ };
1617
+ }, [listener]);
687
1618
  };
688
1619
  });
1620
+ keys(methods).forEach(function(name2) {
1621
+ result[name2] = methods[name2];
1622
+ });
1623
+ return result;
1624
+ }
1625
+ const useFlickingReactiveAPI = (flickingRef, options) => {
1626
+ return useReactive(VanillaFlicking.flickingReactiveAPIAdapter, () => ({
1627
+ flicking: flickingRef.current ?? void 0,
1628
+ options
1629
+ }));
689
1630
  };
690
-
691
- /*
692
- * Copyright (c) 2015 NAVER Corp.
693
- * egjs projects are licensed under the MIT license
694
- */
695
1631
  Flicking.ViewportSlot = ViewportSlot;
696
1632
  Flicking.useFlickingReactiveAPI = useFlickingReactiveAPI;
697
-
698
1633
  module.exports = Flicking;
699
1634
  //# sourceMappingURL=flicking.cjs.js.map