@page-speed/venn-diagram 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +0 -0
  2. package/dist/cjs/esm/components/VennDiagram.d.ts +4 -0
  3. package/dist/cjs/esm/components/VennDiagram.d.ts.map +1 -0
  4. package/dist/cjs/esm/components/VennDiagramContext.d.ts +3 -0
  5. package/dist/cjs/esm/components/VennDiagramContext.d.ts.map +1 -0
  6. package/dist/cjs/esm/components/VennDiagramSVG.d.ts +16 -0
  7. package/dist/cjs/esm/components/VennDiagramSVG.d.ts.map +1 -0
  8. package/dist/cjs/esm/components/index.d.ts +3 -0
  9. package/dist/cjs/esm/components/index.d.ts.map +1 -0
  10. package/dist/cjs/esm/examples/KeywordGapDashboard.d.ts +3 -0
  11. package/dist/cjs/esm/examples/KeywordGapDashboard.d.ts.map +1 -0
  12. package/dist/cjs/esm/hooks/index.d.ts +2 -0
  13. package/dist/cjs/esm/hooks/index.d.ts.map +1 -0
  14. package/dist/cjs/esm/hooks/useVennLayout.d.ts +13 -0
  15. package/dist/cjs/esm/hooks/useVennLayout.d.ts.map +1 -0
  16. package/dist/cjs/esm/index.d.ts +5 -0
  17. package/dist/cjs/esm/index.d.ts.map +1 -0
  18. package/dist/cjs/esm/types/venn.types.d.ts +68 -0
  19. package/dist/cjs/esm/types/venn.types.d.ts.map +1 -0
  20. package/dist/cjs/esm/utils/colorScheme.d.ts +3 -0
  21. package/dist/cjs/esm/utils/colorScheme.d.ts.map +1 -0
  22. package/dist/cjs/esm/utils/index.d.ts +2 -0
  23. package/dist/cjs/esm/utils/index.d.ts.map +1 -0
  24. package/dist/cjs/index.js +1796 -0
  25. package/dist/cjs/index.js.map +1 -0
  26. package/dist/cjs/styles/index.css +162 -0
  27. package/dist/cjs/styles/index.css.map +1 -0
  28. package/dist/esm/_virtual/jsx-runtime.js +4 -0
  29. package/dist/esm/_virtual/jsx-runtime.js.map +1 -0
  30. package/dist/esm/_virtual/react-jsx-runtime.development.js +4 -0
  31. package/dist/esm/_virtual/react-jsx-runtime.development.js.map +1 -0
  32. package/dist/esm/_virtual/react-jsx-runtime.production.min.js +4 -0
  33. package/dist/esm/_virtual/react-jsx-runtime.production.min.js.map +1 -0
  34. package/dist/esm/components/VennDiagram.d.ts +4 -0
  35. package/dist/esm/components/VennDiagram.d.ts.map +1 -0
  36. package/dist/esm/components/VennDiagram.js +137 -0
  37. package/dist/esm/components/VennDiagram.js.map +1 -0
  38. package/dist/esm/components/VennDiagramContext.d.ts +3 -0
  39. package/dist/esm/components/VennDiagramContext.d.ts.map +1 -0
  40. package/dist/esm/components/VennDiagramContext.js +7 -0
  41. package/dist/esm/components/VennDiagramContext.js.map +1 -0
  42. package/dist/esm/components/VennDiagramSVG.d.ts +16 -0
  43. package/dist/esm/components/VennDiagramSVG.d.ts.map +1 -0
  44. package/dist/esm/components/VennDiagramSVG.js +122 -0
  45. package/dist/esm/components/VennDiagramSVG.js.map +1 -0
  46. package/dist/esm/components/index.d.ts +3 -0
  47. package/dist/esm/components/index.d.ts.map +1 -0
  48. package/dist/esm/examples/KeywordGapDashboard.d.ts +3 -0
  49. package/dist/esm/examples/KeywordGapDashboard.d.ts.map +1 -0
  50. package/dist/esm/hooks/index.d.ts +2 -0
  51. package/dist/esm/hooks/index.d.ts.map +1 -0
  52. package/dist/esm/hooks/useVennLayout.d.ts +13 -0
  53. package/dist/esm/hooks/useVennLayout.d.ts.map +1 -0
  54. package/dist/esm/hooks/useVennLayout.js +110 -0
  55. package/dist/esm/hooks/useVennLayout.js.map +1 -0
  56. package/dist/esm/index.d.ts +5 -0
  57. package/dist/esm/index.d.ts.map +1 -0
  58. package/dist/esm/index.js +5 -0
  59. package/dist/esm/index.js.map +1 -0
  60. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js +1344 -0
  61. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js.map +1 -0
  62. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +25 -0
  63. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js.map +1 -0
  64. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +14 -0
  65. package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js.map +1 -0
  66. package/dist/esm/styles/VennDiagram.module.css.js +4 -0
  67. package/dist/esm/styles/VennDiagram.module.css.js.map +1 -0
  68. package/dist/esm/styles/index.css +162 -0
  69. package/dist/esm/styles/index.css.map +1 -0
  70. package/dist/esm/types/venn.types.d.ts +68 -0
  71. package/dist/esm/types/venn.types.d.ts.map +1 -0
  72. package/dist/esm/utils/colorScheme.d.ts +3 -0
  73. package/dist/esm/utils/colorScheme.d.ts.map +1 -0
  74. package/dist/esm/utils/colorScheme.js +42 -0
  75. package/dist/esm/utils/colorScheme.js.map +1 -0
  76. package/dist/esm/utils/index.d.ts +2 -0
  77. package/dist/esm/utils/index.d.ts.map +1 -0
  78. package/package.json +101 -0
@@ -0,0 +1,1796 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('react');
4
+ var venn = require('@upsetjs/venn.js');
5
+
6
+ function _interopNamespaceDefault(e) {
7
+ var n = Object.create(null);
8
+ if (e) {
9
+ Object.keys(e).forEach(function (k) {
10
+ if (k !== 'default') {
11
+ var d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: function () { return e[k]; }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var venn__namespace = /*#__PURE__*/_interopNamespaceDefault(venn);
24
+
25
+ var jsxRuntime = {exports: {}};
26
+
27
+ var reactJsxRuntime_production_min = {};
28
+
29
+ /**
30
+ * @license React
31
+ * react-jsx-runtime.production.min.js
32
+ *
33
+ * Copyright (c) Facebook, Inc. and its affiliates.
34
+ *
35
+ * This source code is licensed under the MIT license found in the
36
+ * LICENSE file in the root directory of this source tree.
37
+ */
38
+
39
+ var hasRequiredReactJsxRuntime_production_min;
40
+
41
+ function requireReactJsxRuntime_production_min () {
42
+ if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
43
+ hasRequiredReactJsxRuntime_production_min = 1;
44
+ var f=require$$0,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:!0,ref:!0,__self:!0,__source:!0};
45
+ function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
46
+ return reactJsxRuntime_production_min;
47
+ }
48
+
49
+ var reactJsxRuntime_development = {};
50
+
51
+ /**
52
+ * @license React
53
+ * react-jsx-runtime.development.js
54
+ *
55
+ * Copyright (c) Facebook, Inc. and its affiliates.
56
+ *
57
+ * This source code is licensed under the MIT license found in the
58
+ * LICENSE file in the root directory of this source tree.
59
+ */
60
+
61
+ var hasRequiredReactJsxRuntime_development;
62
+
63
+ function requireReactJsxRuntime_development () {
64
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
65
+ hasRequiredReactJsxRuntime_development = 1;
66
+
67
+ if (process.env.NODE_ENV !== "production") {
68
+ (function() {
69
+
70
+ var React = require$$0;
71
+
72
+ // ATTENTION
73
+ // When adding new symbols to this file,
74
+ // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
75
+ // The Symbol used to tag the ReactElement-like types.
76
+ var REACT_ELEMENT_TYPE = Symbol.for('react.element');
77
+ var REACT_PORTAL_TYPE = Symbol.for('react.portal');
78
+ var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
79
+ var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
80
+ var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
81
+ var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
82
+ var REACT_CONTEXT_TYPE = Symbol.for('react.context');
83
+ var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
84
+ var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
85
+ var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
86
+ var REACT_MEMO_TYPE = Symbol.for('react.memo');
87
+ var REACT_LAZY_TYPE = Symbol.for('react.lazy');
88
+ var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
89
+ var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
90
+ var FAUX_ITERATOR_SYMBOL = '@@iterator';
91
+ function getIteratorFn(maybeIterable) {
92
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
93
+ return null;
94
+ }
95
+
96
+ var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
97
+
98
+ if (typeof maybeIterator === 'function') {
99
+ return maybeIterator;
100
+ }
101
+
102
+ return null;
103
+ }
104
+
105
+ var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
106
+
107
+ function error(format) {
108
+ {
109
+ {
110
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
111
+ args[_key2 - 1] = arguments[_key2];
112
+ }
113
+
114
+ printWarning('error', format, args);
115
+ }
116
+ }
117
+ }
118
+
119
+ function printWarning(level, format, args) {
120
+ // When changing this logic, you might want to also
121
+ // update consoleWithStackDev.www.js as well.
122
+ {
123
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
124
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
125
+
126
+ if (stack !== '') {
127
+ format += '%s';
128
+ args = args.concat([stack]);
129
+ } // eslint-disable-next-line react-internal/safe-string-coercion
130
+
131
+
132
+ var argsWithFormat = args.map(function (item) {
133
+ return String(item);
134
+ }); // Careful: RN currently depends on this prefix
135
+
136
+ argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
137
+ // breaks IE9: https://github.com/facebook/react/issues/13610
138
+ // eslint-disable-next-line react-internal/no-production-logging
139
+
140
+ Function.prototype.apply.call(console[level], console, argsWithFormat);
141
+ }
142
+ }
143
+
144
+ // -----------------------------------------------------------------------------
145
+
146
+ var enableScopeAPI = false; // Experimental Create Event Handle API.
147
+ var enableCacheElement = false;
148
+ var enableTransitionTracing = false; // No known bugs, but needs performance testing
149
+
150
+ var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
151
+ // stuff. Intended to enable React core members to more easily debug scheduling
152
+ // issues in DEV builds.
153
+
154
+ var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
155
+
156
+ var REACT_MODULE_REFERENCE;
157
+
158
+ {
159
+ REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
160
+ }
161
+
162
+ function isValidElementType(type) {
163
+ if (typeof type === 'string' || typeof type === 'function') {
164
+ return true;
165
+ } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
166
+
167
+
168
+ 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 ) {
169
+ return true;
170
+ }
171
+
172
+ if (typeof type === 'object' && type !== null) {
173
+ 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
174
+ // types supported by any Flight configuration anywhere since
175
+ // we don't know which Flight build this will end up being used
176
+ // with.
177
+ type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
178
+ return true;
179
+ }
180
+ }
181
+
182
+ return false;
183
+ }
184
+
185
+ function getWrappedName(outerType, innerType, wrapperName) {
186
+ var displayName = outerType.displayName;
187
+
188
+ if (displayName) {
189
+ return displayName;
190
+ }
191
+
192
+ var functionName = innerType.displayName || innerType.name || '';
193
+ return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
194
+ } // Keep in sync with react-reconciler/getComponentNameFromFiber
195
+
196
+
197
+ function getContextName(type) {
198
+ return type.displayName || 'Context';
199
+ } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
200
+
201
+
202
+ function getComponentNameFromType(type) {
203
+ if (type == null) {
204
+ // Host root, text node or just invalid type.
205
+ return null;
206
+ }
207
+
208
+ {
209
+ if (typeof type.tag === 'number') {
210
+ error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
211
+ }
212
+ }
213
+
214
+ if (typeof type === 'function') {
215
+ return type.displayName || type.name || null;
216
+ }
217
+
218
+ if (typeof type === 'string') {
219
+ return type;
220
+ }
221
+
222
+ switch (type) {
223
+ case REACT_FRAGMENT_TYPE:
224
+ return 'Fragment';
225
+
226
+ case REACT_PORTAL_TYPE:
227
+ return 'Portal';
228
+
229
+ case REACT_PROFILER_TYPE:
230
+ return 'Profiler';
231
+
232
+ case REACT_STRICT_MODE_TYPE:
233
+ return 'StrictMode';
234
+
235
+ case REACT_SUSPENSE_TYPE:
236
+ return 'Suspense';
237
+
238
+ case REACT_SUSPENSE_LIST_TYPE:
239
+ return 'SuspenseList';
240
+
241
+ }
242
+
243
+ if (typeof type === 'object') {
244
+ switch (type.$$typeof) {
245
+ case REACT_CONTEXT_TYPE:
246
+ var context = type;
247
+ return getContextName(context) + '.Consumer';
248
+
249
+ case REACT_PROVIDER_TYPE:
250
+ var provider = type;
251
+ return getContextName(provider._context) + '.Provider';
252
+
253
+ case REACT_FORWARD_REF_TYPE:
254
+ return getWrappedName(type, type.render, 'ForwardRef');
255
+
256
+ case REACT_MEMO_TYPE:
257
+ var outerName = type.displayName || null;
258
+
259
+ if (outerName !== null) {
260
+ return outerName;
261
+ }
262
+
263
+ return getComponentNameFromType(type.type) || 'Memo';
264
+
265
+ case REACT_LAZY_TYPE:
266
+ {
267
+ var lazyComponent = type;
268
+ var payload = lazyComponent._payload;
269
+ var init = lazyComponent._init;
270
+
271
+ try {
272
+ return getComponentNameFromType(init(payload));
273
+ } catch (x) {
274
+ return null;
275
+ }
276
+ }
277
+
278
+ // eslint-disable-next-line no-fallthrough
279
+ }
280
+ }
281
+
282
+ return null;
283
+ }
284
+
285
+ var assign = Object.assign;
286
+
287
+ // Helpers to patch console.logs to avoid logging during side-effect free
288
+ // replaying on render function. This currently only patches the object
289
+ // lazily which won't cover if the log function was extracted eagerly.
290
+ // We could also eagerly patch the method.
291
+ var disabledDepth = 0;
292
+ var prevLog;
293
+ var prevInfo;
294
+ var prevWarn;
295
+ var prevError;
296
+ var prevGroup;
297
+ var prevGroupCollapsed;
298
+ var prevGroupEnd;
299
+
300
+ function disabledLog() {}
301
+
302
+ disabledLog.__reactDisabledLog = true;
303
+ function disableLogs() {
304
+ {
305
+ if (disabledDepth === 0) {
306
+ /* eslint-disable react-internal/no-production-logging */
307
+ prevLog = console.log;
308
+ prevInfo = console.info;
309
+ prevWarn = console.warn;
310
+ prevError = console.error;
311
+ prevGroup = console.group;
312
+ prevGroupCollapsed = console.groupCollapsed;
313
+ prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
314
+
315
+ var props = {
316
+ configurable: true,
317
+ enumerable: true,
318
+ value: disabledLog,
319
+ writable: true
320
+ }; // $FlowFixMe Flow thinks console is immutable.
321
+
322
+ Object.defineProperties(console, {
323
+ info: props,
324
+ log: props,
325
+ warn: props,
326
+ error: props,
327
+ group: props,
328
+ groupCollapsed: props,
329
+ groupEnd: props
330
+ });
331
+ /* eslint-enable react-internal/no-production-logging */
332
+ }
333
+
334
+ disabledDepth++;
335
+ }
336
+ }
337
+ function reenableLogs() {
338
+ {
339
+ disabledDepth--;
340
+
341
+ if (disabledDepth === 0) {
342
+ /* eslint-disable react-internal/no-production-logging */
343
+ var props = {
344
+ configurable: true,
345
+ enumerable: true,
346
+ writable: true
347
+ }; // $FlowFixMe Flow thinks console is immutable.
348
+
349
+ Object.defineProperties(console, {
350
+ log: assign({}, props, {
351
+ value: prevLog
352
+ }),
353
+ info: assign({}, props, {
354
+ value: prevInfo
355
+ }),
356
+ warn: assign({}, props, {
357
+ value: prevWarn
358
+ }),
359
+ error: assign({}, props, {
360
+ value: prevError
361
+ }),
362
+ group: assign({}, props, {
363
+ value: prevGroup
364
+ }),
365
+ groupCollapsed: assign({}, props, {
366
+ value: prevGroupCollapsed
367
+ }),
368
+ groupEnd: assign({}, props, {
369
+ value: prevGroupEnd
370
+ })
371
+ });
372
+ /* eslint-enable react-internal/no-production-logging */
373
+ }
374
+
375
+ if (disabledDepth < 0) {
376
+ error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
377
+ }
378
+ }
379
+ }
380
+
381
+ var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
382
+ var prefix;
383
+ function describeBuiltInComponentFrame(name, source, ownerFn) {
384
+ {
385
+ if (prefix === undefined) {
386
+ // Extract the VM specific prefix used by each line.
387
+ try {
388
+ throw Error();
389
+ } catch (x) {
390
+ var match = x.stack.trim().match(/\n( *(at )?)/);
391
+ prefix = match && match[1] || '';
392
+ }
393
+ } // We use the prefix to ensure our stacks line up with native stack frames.
394
+
395
+
396
+ return '\n' + prefix + name;
397
+ }
398
+ }
399
+ var reentry = false;
400
+ var componentFrameCache;
401
+
402
+ {
403
+ var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
404
+ componentFrameCache = new PossiblyWeakMap();
405
+ }
406
+
407
+ function describeNativeComponentFrame(fn, construct) {
408
+ // If something asked for a stack inside a fake render, it should get ignored.
409
+ if ( !fn || reentry) {
410
+ return '';
411
+ }
412
+
413
+ {
414
+ var frame = componentFrameCache.get(fn);
415
+
416
+ if (frame !== undefined) {
417
+ return frame;
418
+ }
419
+ }
420
+
421
+ var control;
422
+ reentry = true;
423
+ var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
424
+
425
+ Error.prepareStackTrace = undefined;
426
+ var previousDispatcher;
427
+
428
+ {
429
+ previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
430
+ // for warnings.
431
+
432
+ ReactCurrentDispatcher.current = null;
433
+ disableLogs();
434
+ }
435
+
436
+ try {
437
+ // This should throw.
438
+ if (construct) {
439
+ // Something should be setting the props in the constructor.
440
+ var Fake = function () {
441
+ throw Error();
442
+ }; // $FlowFixMe
443
+
444
+
445
+ Object.defineProperty(Fake.prototype, 'props', {
446
+ set: function () {
447
+ // We use a throwing setter instead of frozen or non-writable props
448
+ // because that won't throw in a non-strict mode function.
449
+ throw Error();
450
+ }
451
+ });
452
+
453
+ if (typeof Reflect === 'object' && Reflect.construct) {
454
+ // We construct a different control for this case to include any extra
455
+ // frames added by the construct call.
456
+ try {
457
+ Reflect.construct(Fake, []);
458
+ } catch (x) {
459
+ control = x;
460
+ }
461
+
462
+ Reflect.construct(fn, [], Fake);
463
+ } else {
464
+ try {
465
+ Fake.call();
466
+ } catch (x) {
467
+ control = x;
468
+ }
469
+
470
+ fn.call(Fake.prototype);
471
+ }
472
+ } else {
473
+ try {
474
+ throw Error();
475
+ } catch (x) {
476
+ control = x;
477
+ }
478
+
479
+ fn();
480
+ }
481
+ } catch (sample) {
482
+ // This is inlined manually because closure doesn't do it for us.
483
+ if (sample && control && typeof sample.stack === 'string') {
484
+ // This extracts the first frame from the sample that isn't also in the control.
485
+ // Skipping one frame that we assume is the frame that calls the two.
486
+ var sampleLines = sample.stack.split('\n');
487
+ var controlLines = control.stack.split('\n');
488
+ var s = sampleLines.length - 1;
489
+ var c = controlLines.length - 1;
490
+
491
+ while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
492
+ // We expect at least one stack frame to be shared.
493
+ // Typically this will be the root most one. However, stack frames may be
494
+ // cut off due to maximum stack limits. In this case, one maybe cut off
495
+ // earlier than the other. We assume that the sample is longer or the same
496
+ // and there for cut off earlier. So we should find the root most frame in
497
+ // the sample somewhere in the control.
498
+ c--;
499
+ }
500
+
501
+ for (; s >= 1 && c >= 0; s--, c--) {
502
+ // Next we find the first one that isn't the same which should be the
503
+ // frame that called our sample function and the control.
504
+ if (sampleLines[s] !== controlLines[c]) {
505
+ // In V8, the first line is describing the message but other VMs don't.
506
+ // If we're about to return the first line, and the control is also on the same
507
+ // line, that's a pretty good indicator that our sample threw at same line as
508
+ // the control. I.e. before we entered the sample frame. So we ignore this result.
509
+ // This can happen if you passed a class to function component, or non-function.
510
+ if (s !== 1 || c !== 1) {
511
+ do {
512
+ s--;
513
+ c--; // We may still have similar intermediate frames from the construct call.
514
+ // The next one that isn't the same should be our match though.
515
+
516
+ if (c < 0 || sampleLines[s] !== controlLines[c]) {
517
+ // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
518
+ var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
519
+ // but we have a user-provided "displayName"
520
+ // splice it in to make the stack more readable.
521
+
522
+
523
+ if (fn.displayName && _frame.includes('<anonymous>')) {
524
+ _frame = _frame.replace('<anonymous>', fn.displayName);
525
+ }
526
+
527
+ {
528
+ if (typeof fn === 'function') {
529
+ componentFrameCache.set(fn, _frame);
530
+ }
531
+ } // Return the line we found.
532
+
533
+
534
+ return _frame;
535
+ }
536
+ } while (s >= 1 && c >= 0);
537
+ }
538
+
539
+ break;
540
+ }
541
+ }
542
+ }
543
+ } finally {
544
+ reentry = false;
545
+
546
+ {
547
+ ReactCurrentDispatcher.current = previousDispatcher;
548
+ reenableLogs();
549
+ }
550
+
551
+ Error.prepareStackTrace = previousPrepareStackTrace;
552
+ } // Fallback to just using the name if we couldn't make it throw.
553
+
554
+
555
+ var name = fn ? fn.displayName || fn.name : '';
556
+ var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
557
+
558
+ {
559
+ if (typeof fn === 'function') {
560
+ componentFrameCache.set(fn, syntheticFrame);
561
+ }
562
+ }
563
+
564
+ return syntheticFrame;
565
+ }
566
+ function describeFunctionComponentFrame(fn, source, ownerFn) {
567
+ {
568
+ return describeNativeComponentFrame(fn, false);
569
+ }
570
+ }
571
+
572
+ function shouldConstruct(Component) {
573
+ var prototype = Component.prototype;
574
+ return !!(prototype && prototype.isReactComponent);
575
+ }
576
+
577
+ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
578
+
579
+ if (type == null) {
580
+ return '';
581
+ }
582
+
583
+ if (typeof type === 'function') {
584
+ {
585
+ return describeNativeComponentFrame(type, shouldConstruct(type));
586
+ }
587
+ }
588
+
589
+ if (typeof type === 'string') {
590
+ return describeBuiltInComponentFrame(type);
591
+ }
592
+
593
+ switch (type) {
594
+ case REACT_SUSPENSE_TYPE:
595
+ return describeBuiltInComponentFrame('Suspense');
596
+
597
+ case REACT_SUSPENSE_LIST_TYPE:
598
+ return describeBuiltInComponentFrame('SuspenseList');
599
+ }
600
+
601
+ if (typeof type === 'object') {
602
+ switch (type.$$typeof) {
603
+ case REACT_FORWARD_REF_TYPE:
604
+ return describeFunctionComponentFrame(type.render);
605
+
606
+ case REACT_MEMO_TYPE:
607
+ // Memo may contain any component type so we recursively resolve it.
608
+ return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
609
+
610
+ case REACT_LAZY_TYPE:
611
+ {
612
+ var lazyComponent = type;
613
+ var payload = lazyComponent._payload;
614
+ var init = lazyComponent._init;
615
+
616
+ try {
617
+ // Lazy may contain any component type so we recursively resolve it.
618
+ return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
619
+ } catch (x) {}
620
+ }
621
+ }
622
+ }
623
+
624
+ return '';
625
+ }
626
+
627
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
628
+
629
+ var loggedTypeFailures = {};
630
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
631
+
632
+ function setCurrentlyValidatingElement(element) {
633
+ {
634
+ if (element) {
635
+ var owner = element._owner;
636
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
637
+ ReactDebugCurrentFrame.setExtraStackFrame(stack);
638
+ } else {
639
+ ReactDebugCurrentFrame.setExtraStackFrame(null);
640
+ }
641
+ }
642
+ }
643
+
644
+ function checkPropTypes(typeSpecs, values, location, componentName, element) {
645
+ {
646
+ // $FlowFixMe This is okay but Flow doesn't know it.
647
+ var has = Function.call.bind(hasOwnProperty);
648
+
649
+ for (var typeSpecName in typeSpecs) {
650
+ if (has(typeSpecs, typeSpecName)) {
651
+ var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
652
+ // fail the render phase where it didn't fail before. So we log it.
653
+ // After these have been cleaned up, we'll let them throw.
654
+
655
+ try {
656
+ // This is intentionally an invariant that gets caught. It's the same
657
+ // behavior as without this statement except with a better message.
658
+ if (typeof typeSpecs[typeSpecName] !== 'function') {
659
+ // eslint-disable-next-line react-internal/prod-error-codes
660
+ 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`.');
661
+ err.name = 'Invariant Violation';
662
+ throw err;
663
+ }
664
+
665
+ error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
666
+ } catch (ex) {
667
+ error$1 = ex;
668
+ }
669
+
670
+ if (error$1 && !(error$1 instanceof Error)) {
671
+ setCurrentlyValidatingElement(element);
672
+
673
+ 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);
674
+
675
+ setCurrentlyValidatingElement(null);
676
+ }
677
+
678
+ if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
679
+ // Only monitor this failure once because there tends to be a lot of the
680
+ // same error.
681
+ loggedTypeFailures[error$1.message] = true;
682
+ setCurrentlyValidatingElement(element);
683
+
684
+ error('Failed %s type: %s', location, error$1.message);
685
+
686
+ setCurrentlyValidatingElement(null);
687
+ }
688
+ }
689
+ }
690
+ }
691
+ }
692
+
693
+ var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
694
+
695
+ function isArray(a) {
696
+ return isArrayImpl(a);
697
+ }
698
+
699
+ /*
700
+ * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
701
+ * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
702
+ *
703
+ * The functions in this module will throw an easier-to-understand,
704
+ * easier-to-debug exception with a clear errors message message explaining the
705
+ * problem. (Instead of a confusing exception thrown inside the implementation
706
+ * of the `value` object).
707
+ */
708
+ // $FlowFixMe only called in DEV, so void return is not possible.
709
+ function typeName(value) {
710
+ {
711
+ // toStringTag is needed for namespaced types like Temporal.Instant
712
+ var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
713
+ var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
714
+ return type;
715
+ }
716
+ } // $FlowFixMe only called in DEV, so void return is not possible.
717
+
718
+
719
+ function willCoercionThrow(value) {
720
+ {
721
+ try {
722
+ testStringCoercion(value);
723
+ return false;
724
+ } catch (e) {
725
+ return true;
726
+ }
727
+ }
728
+ }
729
+
730
+ function testStringCoercion(value) {
731
+ // If you ended up here by following an exception call stack, here's what's
732
+ // happened: you supplied an object or symbol value to React (as a prop, key,
733
+ // DOM attribute, CSS property, string ref, etc.) and when React tried to
734
+ // coerce it to a string using `'' + value`, an exception was thrown.
735
+ //
736
+ // The most common types that will cause this exception are `Symbol` instances
737
+ // and Temporal objects like `Temporal.Instant`. But any object that has a
738
+ // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
739
+ // exception. (Library authors do this to prevent users from using built-in
740
+ // numeric operators like `+` or comparison operators like `>=` because custom
741
+ // methods are needed to perform accurate arithmetic or comparison.)
742
+ //
743
+ // To fix the problem, coerce this object or symbol value to a string before
744
+ // passing it to React. The most reliable way is usually `String(value)`.
745
+ //
746
+ // To find which value is throwing, check the browser or debugger console.
747
+ // Before this exception was thrown, there should be `console.error` output
748
+ // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
749
+ // problem and how that type was used: key, atrribute, input value prop, etc.
750
+ // In most cases, this console output also shows the component and its
751
+ // ancestor components where the exception happened.
752
+ //
753
+ // eslint-disable-next-line react-internal/safe-string-coercion
754
+ return '' + value;
755
+ }
756
+ function checkKeyStringCoercion(value) {
757
+ {
758
+ if (willCoercionThrow(value)) {
759
+ error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
760
+
761
+ return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
762
+ }
763
+ }
764
+ }
765
+
766
+ var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
767
+ var RESERVED_PROPS = {
768
+ key: true,
769
+ ref: true,
770
+ __self: true,
771
+ __source: true
772
+ };
773
+ var specialPropKeyWarningShown;
774
+ var specialPropRefWarningShown;
775
+ var didWarnAboutStringRefs;
776
+
777
+ {
778
+ didWarnAboutStringRefs = {};
779
+ }
780
+
781
+ function hasValidRef(config) {
782
+ {
783
+ if (hasOwnProperty.call(config, 'ref')) {
784
+ var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
785
+
786
+ if (getter && getter.isReactWarning) {
787
+ return false;
788
+ }
789
+ }
790
+ }
791
+
792
+ return config.ref !== undefined;
793
+ }
794
+
795
+ function hasValidKey(config) {
796
+ {
797
+ if (hasOwnProperty.call(config, 'key')) {
798
+ var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
799
+
800
+ if (getter && getter.isReactWarning) {
801
+ return false;
802
+ }
803
+ }
804
+ }
805
+
806
+ return config.key !== undefined;
807
+ }
808
+
809
+ function warnIfStringRefCannotBeAutoConverted(config, self) {
810
+ {
811
+ if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
812
+ var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
813
+
814
+ if (!didWarnAboutStringRefs[componentName]) {
815
+ error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
816
+
817
+ didWarnAboutStringRefs[componentName] = true;
818
+ }
819
+ }
820
+ }
821
+ }
822
+
823
+ function defineKeyPropWarningGetter(props, displayName) {
824
+ {
825
+ var warnAboutAccessingKey = function () {
826
+ if (!specialPropKeyWarningShown) {
827
+ specialPropKeyWarningShown = true;
828
+
829
+ 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);
830
+ }
831
+ };
832
+
833
+ warnAboutAccessingKey.isReactWarning = true;
834
+ Object.defineProperty(props, 'key', {
835
+ get: warnAboutAccessingKey,
836
+ configurable: true
837
+ });
838
+ }
839
+ }
840
+
841
+ function defineRefPropWarningGetter(props, displayName) {
842
+ {
843
+ var warnAboutAccessingRef = function () {
844
+ if (!specialPropRefWarningShown) {
845
+ specialPropRefWarningShown = true;
846
+
847
+ 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);
848
+ }
849
+ };
850
+
851
+ warnAboutAccessingRef.isReactWarning = true;
852
+ Object.defineProperty(props, 'ref', {
853
+ get: warnAboutAccessingRef,
854
+ configurable: true
855
+ });
856
+ }
857
+ }
858
+ /**
859
+ * Factory method to create a new React element. This no longer adheres to
860
+ * the class pattern, so do not use new to call it. Also, instanceof check
861
+ * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
862
+ * if something is a React Element.
863
+ *
864
+ * @param {*} type
865
+ * @param {*} props
866
+ * @param {*} key
867
+ * @param {string|object} ref
868
+ * @param {*} owner
869
+ * @param {*} self A *temporary* helper to detect places where `this` is
870
+ * different from the `owner` when React.createElement is called, so that we
871
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
872
+ * functions, and as long as `this` and owner are the same, there will be no
873
+ * change in behavior.
874
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
875
+ * indicating filename, line number, and/or other information.
876
+ * @internal
877
+ */
878
+
879
+
880
+ var ReactElement = function (type, key, ref, self, source, owner, props) {
881
+ var element = {
882
+ // This tag allows us to uniquely identify this as a React Element
883
+ $$typeof: REACT_ELEMENT_TYPE,
884
+ // Built-in properties that belong on the element
885
+ type: type,
886
+ key: key,
887
+ ref: ref,
888
+ props: props,
889
+ // Record the component responsible for creating this element.
890
+ _owner: owner
891
+ };
892
+
893
+ {
894
+ // The validation flag is currently mutative. We put it on
895
+ // an external backing store so that we can freeze the whole object.
896
+ // This can be replaced with a WeakMap once they are implemented in
897
+ // commonly used development environments.
898
+ element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
899
+ // the validation flag non-enumerable (where possible, which should
900
+ // include every environment we run tests in), so the test framework
901
+ // ignores it.
902
+
903
+ Object.defineProperty(element._store, 'validated', {
904
+ configurable: false,
905
+ enumerable: false,
906
+ writable: true,
907
+ value: false
908
+ }); // self and source are DEV only properties.
909
+
910
+ Object.defineProperty(element, '_self', {
911
+ configurable: false,
912
+ enumerable: false,
913
+ writable: false,
914
+ value: self
915
+ }); // Two elements created in two different places should be considered
916
+ // equal for testing purposes and therefore we hide it from enumeration.
917
+
918
+ Object.defineProperty(element, '_source', {
919
+ configurable: false,
920
+ enumerable: false,
921
+ writable: false,
922
+ value: source
923
+ });
924
+
925
+ if (Object.freeze) {
926
+ Object.freeze(element.props);
927
+ Object.freeze(element);
928
+ }
929
+ }
930
+
931
+ return element;
932
+ };
933
+ /**
934
+ * https://github.com/reactjs/rfcs/pull/107
935
+ * @param {*} type
936
+ * @param {object} props
937
+ * @param {string} key
938
+ */
939
+
940
+ function jsxDEV(type, config, maybeKey, source, self) {
941
+ {
942
+ var propName; // Reserved names are extracted
943
+
944
+ var props = {};
945
+ var key = null;
946
+ var ref = null; // Currently, key can be spread in as a prop. This causes a potential
947
+ // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
948
+ // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
949
+ // but as an intermediary step, we will use jsxDEV for everything except
950
+ // <div {...props} key="Hi" />, because we aren't currently able to tell if
951
+ // key is explicitly declared to be undefined or not.
952
+
953
+ if (maybeKey !== undefined) {
954
+ {
955
+ checkKeyStringCoercion(maybeKey);
956
+ }
957
+
958
+ key = '' + maybeKey;
959
+ }
960
+
961
+ if (hasValidKey(config)) {
962
+ {
963
+ checkKeyStringCoercion(config.key);
964
+ }
965
+
966
+ key = '' + config.key;
967
+ }
968
+
969
+ if (hasValidRef(config)) {
970
+ ref = config.ref;
971
+ warnIfStringRefCannotBeAutoConverted(config, self);
972
+ } // Remaining properties are added to a new props object
973
+
974
+
975
+ for (propName in config) {
976
+ if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
977
+ props[propName] = config[propName];
978
+ }
979
+ } // Resolve default props
980
+
981
+
982
+ if (type && type.defaultProps) {
983
+ var defaultProps = type.defaultProps;
984
+
985
+ for (propName in defaultProps) {
986
+ if (props[propName] === undefined) {
987
+ props[propName] = defaultProps[propName];
988
+ }
989
+ }
990
+ }
991
+
992
+ if (key || ref) {
993
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
994
+
995
+ if (key) {
996
+ defineKeyPropWarningGetter(props, displayName);
997
+ }
998
+
999
+ if (ref) {
1000
+ defineRefPropWarningGetter(props, displayName);
1001
+ }
1002
+ }
1003
+
1004
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1005
+ }
1006
+ }
1007
+
1008
+ var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1009
+ var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1010
+
1011
+ function setCurrentlyValidatingElement$1(element) {
1012
+ {
1013
+ if (element) {
1014
+ var owner = element._owner;
1015
+ var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1016
+ ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1017
+ } else {
1018
+ ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1019
+ }
1020
+ }
1021
+ }
1022
+
1023
+ var propTypesMisspellWarningShown;
1024
+
1025
+ {
1026
+ propTypesMisspellWarningShown = false;
1027
+ }
1028
+ /**
1029
+ * Verifies the object is a ReactElement.
1030
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
1031
+ * @param {?object} object
1032
+ * @return {boolean} True if `object` is a ReactElement.
1033
+ * @final
1034
+ */
1035
+
1036
+
1037
+ function isValidElement(object) {
1038
+ {
1039
+ return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1040
+ }
1041
+ }
1042
+
1043
+ function getDeclarationErrorAddendum() {
1044
+ {
1045
+ if (ReactCurrentOwner$1.current) {
1046
+ var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1047
+
1048
+ if (name) {
1049
+ return '\n\nCheck the render method of `' + name + '`.';
1050
+ }
1051
+ }
1052
+
1053
+ return '';
1054
+ }
1055
+ }
1056
+
1057
+ function getSourceInfoErrorAddendum(source) {
1058
+ {
1059
+ if (source !== undefined) {
1060
+ var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1061
+ var lineNumber = source.lineNumber;
1062
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1063
+ }
1064
+
1065
+ return '';
1066
+ }
1067
+ }
1068
+ /**
1069
+ * Warn if there's no key explicitly set on dynamic arrays of children or
1070
+ * object keys are not valid. This allows us to keep track of children between
1071
+ * updates.
1072
+ */
1073
+
1074
+
1075
+ var ownerHasKeyUseWarning = {};
1076
+
1077
+ function getCurrentComponentErrorInfo(parentType) {
1078
+ {
1079
+ var info = getDeclarationErrorAddendum();
1080
+
1081
+ if (!info) {
1082
+ var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1083
+
1084
+ if (parentName) {
1085
+ info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1086
+ }
1087
+ }
1088
+
1089
+ return info;
1090
+ }
1091
+ }
1092
+ /**
1093
+ * Warn if the element doesn't have an explicit key assigned to it.
1094
+ * This element is in an array. The array could grow and shrink or be
1095
+ * reordered. All children that haven't already been validated are required to
1096
+ * have a "key" property assigned to it. Error statuses are cached so a warning
1097
+ * will only be shown once.
1098
+ *
1099
+ * @internal
1100
+ * @param {ReactElement} element Element that requires a key.
1101
+ * @param {*} parentType element's parent's type.
1102
+ */
1103
+
1104
+
1105
+ function validateExplicitKey(element, parentType) {
1106
+ {
1107
+ if (!element._store || element._store.validated || element.key != null) {
1108
+ return;
1109
+ }
1110
+
1111
+ element._store.validated = true;
1112
+ var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1113
+
1114
+ if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1115
+ return;
1116
+ }
1117
+
1118
+ ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1119
+ // property, it may be the creator of the child that's responsible for
1120
+ // assigning it a key.
1121
+
1122
+ var childOwner = '';
1123
+
1124
+ if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1125
+ // Give the component that originally created this child.
1126
+ childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1127
+ }
1128
+
1129
+ setCurrentlyValidatingElement$1(element);
1130
+
1131
+ 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);
1132
+
1133
+ setCurrentlyValidatingElement$1(null);
1134
+ }
1135
+ }
1136
+ /**
1137
+ * Ensure that every element either is passed in a static location, in an
1138
+ * array with an explicit keys property defined, or in an object literal
1139
+ * with valid key property.
1140
+ *
1141
+ * @internal
1142
+ * @param {ReactNode} node Statically passed child of any type.
1143
+ * @param {*} parentType node's parent's type.
1144
+ */
1145
+
1146
+
1147
+ function validateChildKeys(node, parentType) {
1148
+ {
1149
+ if (typeof node !== 'object') {
1150
+ return;
1151
+ }
1152
+
1153
+ if (isArray(node)) {
1154
+ for (var i = 0; i < node.length; i++) {
1155
+ var child = node[i];
1156
+
1157
+ if (isValidElement(child)) {
1158
+ validateExplicitKey(child, parentType);
1159
+ }
1160
+ }
1161
+ } else if (isValidElement(node)) {
1162
+ // This element was passed in a valid location.
1163
+ if (node._store) {
1164
+ node._store.validated = true;
1165
+ }
1166
+ } else if (node) {
1167
+ var iteratorFn = getIteratorFn(node);
1168
+
1169
+ if (typeof iteratorFn === 'function') {
1170
+ // Entry iterators used to provide implicit keys,
1171
+ // but now we print a separate warning for them later.
1172
+ if (iteratorFn !== node.entries) {
1173
+ var iterator = iteratorFn.call(node);
1174
+ var step;
1175
+
1176
+ while (!(step = iterator.next()).done) {
1177
+ if (isValidElement(step.value)) {
1178
+ validateExplicitKey(step.value, parentType);
1179
+ }
1180
+ }
1181
+ }
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+ /**
1187
+ * Given an element, validate that its props follow the propTypes definition,
1188
+ * provided by the type.
1189
+ *
1190
+ * @param {ReactElement} element
1191
+ */
1192
+
1193
+
1194
+ function validatePropTypes(element) {
1195
+ {
1196
+ var type = element.type;
1197
+
1198
+ if (type === null || type === undefined || typeof type === 'string') {
1199
+ return;
1200
+ }
1201
+
1202
+ var propTypes;
1203
+
1204
+ if (typeof type === 'function') {
1205
+ propTypes = type.propTypes;
1206
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1207
+ // Inner props are checked in the reconciler.
1208
+ type.$$typeof === REACT_MEMO_TYPE)) {
1209
+ propTypes = type.propTypes;
1210
+ } else {
1211
+ return;
1212
+ }
1213
+
1214
+ if (propTypes) {
1215
+ // Intentionally inside to avoid triggering lazy initializers:
1216
+ var name = getComponentNameFromType(type);
1217
+ checkPropTypes(propTypes, element.props, 'prop', name, element);
1218
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1219
+ propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1220
+
1221
+ var _name = getComponentNameFromType(type);
1222
+
1223
+ error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1224
+ }
1225
+
1226
+ if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1227
+ error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1228
+ }
1229
+ }
1230
+ }
1231
+ /**
1232
+ * Given a fragment, validate that it can only be provided with fragment props
1233
+ * @param {ReactElement} fragment
1234
+ */
1235
+
1236
+
1237
+ function validateFragmentProps(fragment) {
1238
+ {
1239
+ var keys = Object.keys(fragment.props);
1240
+
1241
+ for (var i = 0; i < keys.length; i++) {
1242
+ var key = keys[i];
1243
+
1244
+ if (key !== 'children' && key !== 'key') {
1245
+ setCurrentlyValidatingElement$1(fragment);
1246
+
1247
+ error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1248
+
1249
+ setCurrentlyValidatingElement$1(null);
1250
+ break;
1251
+ }
1252
+ }
1253
+
1254
+ if (fragment.ref !== null) {
1255
+ setCurrentlyValidatingElement$1(fragment);
1256
+
1257
+ error('Invalid attribute `ref` supplied to `React.Fragment`.');
1258
+
1259
+ setCurrentlyValidatingElement$1(null);
1260
+ }
1261
+ }
1262
+ }
1263
+
1264
+ var didWarnAboutKeySpread = {};
1265
+ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1266
+ {
1267
+ var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1268
+ // succeed and there will likely be errors in render.
1269
+
1270
+ if (!validType) {
1271
+ var info = '';
1272
+
1273
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1274
+ 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.";
1275
+ }
1276
+
1277
+ var sourceInfo = getSourceInfoErrorAddendum(source);
1278
+
1279
+ if (sourceInfo) {
1280
+ info += sourceInfo;
1281
+ } else {
1282
+ info += getDeclarationErrorAddendum();
1283
+ }
1284
+
1285
+ var typeString;
1286
+
1287
+ if (type === null) {
1288
+ typeString = 'null';
1289
+ } else if (isArray(type)) {
1290
+ typeString = 'array';
1291
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1292
+ typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1293
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1294
+ } else {
1295
+ typeString = typeof type;
1296
+ }
1297
+
1298
+ 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);
1299
+ }
1300
+
1301
+ var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1302
+ // TODO: Drop this when these are no longer allowed as the type argument.
1303
+
1304
+ if (element == null) {
1305
+ return element;
1306
+ } // Skip key warning if the type isn't valid since our key validation logic
1307
+ // doesn't expect a non-string/function type and can throw confusing errors.
1308
+ // We don't want exception behavior to differ between dev and prod.
1309
+ // (Rendering will throw with a helpful message and as soon as the type is
1310
+ // fixed, the key warnings will appear.)
1311
+
1312
+
1313
+ if (validType) {
1314
+ var children = props.children;
1315
+
1316
+ if (children !== undefined) {
1317
+ if (isStaticChildren) {
1318
+ if (isArray(children)) {
1319
+ for (var i = 0; i < children.length; i++) {
1320
+ validateChildKeys(children[i], type);
1321
+ }
1322
+
1323
+ if (Object.freeze) {
1324
+ Object.freeze(children);
1325
+ }
1326
+ } else {
1327
+ 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.');
1328
+ }
1329
+ } else {
1330
+ validateChildKeys(children, type);
1331
+ }
1332
+ }
1333
+ }
1334
+
1335
+ {
1336
+ if (hasOwnProperty.call(props, 'key')) {
1337
+ var componentName = getComponentNameFromType(type);
1338
+ var keys = Object.keys(props).filter(function (k) {
1339
+ return k !== 'key';
1340
+ });
1341
+ var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
1342
+
1343
+ if (!didWarnAboutKeySpread[componentName + beforeExample]) {
1344
+ var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
1345
+
1346
+ error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
1347
+
1348
+ didWarnAboutKeySpread[componentName + beforeExample] = true;
1349
+ }
1350
+ }
1351
+ }
1352
+
1353
+ if (type === REACT_FRAGMENT_TYPE) {
1354
+ validateFragmentProps(element);
1355
+ } else {
1356
+ validatePropTypes(element);
1357
+ }
1358
+
1359
+ return element;
1360
+ }
1361
+ } // These two functions exist to still get child warnings in dev
1362
+ // even with the prod transform. This means that jsxDEV is purely
1363
+ // opt-in behavior for better messages but that we won't stop
1364
+ // giving you warnings if you use production apis.
1365
+
1366
+ function jsxWithValidationStatic(type, props, key) {
1367
+ {
1368
+ return jsxWithValidation(type, props, key, true);
1369
+ }
1370
+ }
1371
+ function jsxWithValidationDynamic(type, props, key) {
1372
+ {
1373
+ return jsxWithValidation(type, props, key, false);
1374
+ }
1375
+ }
1376
+
1377
+ var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1378
+ // for now we can ship identical prod functions
1379
+
1380
+ var jsxs = jsxWithValidationStatic ;
1381
+
1382
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1383
+ reactJsxRuntime_development.jsx = jsx;
1384
+ reactJsxRuntime_development.jsxs = jsxs;
1385
+ })();
1386
+ }
1387
+ return reactJsxRuntime_development;
1388
+ }
1389
+
1390
+ if (process.env.NODE_ENV === 'production') {
1391
+ jsxRuntime.exports = requireReactJsxRuntime_production_min();
1392
+ } else {
1393
+ jsxRuntime.exports = requireReactJsxRuntime_development();
1394
+ }
1395
+
1396
+ var jsxRuntimeExports = jsxRuntime.exports;
1397
+
1398
+ const useVennLayout = (data, options = {}) => {
1399
+ const {
1400
+ width = 600,
1401
+ height = 400,
1402
+ padding = 40
1403
+ } = options;
1404
+ const [error, setError] = require$$0.useState(null);
1405
+ const [isLoading, setIsLoading] = require$$0.useState(false);
1406
+ const vennData = require$$0.useMemo(() => {
1407
+ const sets = data.sets.map(set => ({
1408
+ sets: [set.name],
1409
+ size: set.size
1410
+ }));
1411
+ const intersections = data.intersections.map(intersection => ({
1412
+ sets: intersection.sets,
1413
+ size: intersection.size
1414
+ }));
1415
+ return [...sets, ...intersections];
1416
+ }, [data]);
1417
+ const layout = require$$0.useMemo(() => {
1418
+ try {
1419
+ setIsLoading(true);
1420
+ setError(null);
1421
+ const computed = venn__namespace.layout(vennData, {
1422
+ width: width - padding * 2,
1423
+ height: height - padding * 2
1424
+ });
1425
+ const circles = computed.filter(d => d.circles && d.circles.length === 1).map(d => ({
1426
+ x: padding + (d.x || 0) + (width - padding * 2) / 2,
1427
+ y: padding + (d.y || 0) + (height - padding * 2) / 2,
1428
+ radius: d.radius || 0,
1429
+ set: d.sets[0]
1430
+ }));
1431
+ return circles;
1432
+ } catch (err) {
1433
+ const error = err instanceof Error ? err : new Error(String(err));
1434
+ setError(error);
1435
+ console.error("Venn diagram layout error:", error);
1436
+ return [];
1437
+ } finally {
1438
+ setIsLoading(false);
1439
+ }
1440
+ }, [vennData, width, height, padding]);
1441
+ const paths = require$$0.useMemo(() => {
1442
+ return layout.map(circle => {
1443
+ const {
1444
+ x,
1445
+ y,
1446
+ radius
1447
+ } = circle;
1448
+ return `M ${x - radius} ${y} A ${radius} ${radius} 0 1 0 ${x + radius} ${y} A ${radius} ${radius} 0 1 0 ${x - radius} ${y}`;
1449
+ });
1450
+ }, [layout]);
1451
+ const textPositions = require$$0.useMemo(() => {
1452
+ try {
1453
+ const computed = venn__namespace.layout(vennData, {
1454
+ width: width - padding * 2,
1455
+ height: height - padding * 2
1456
+ });
1457
+ return computed.map(d => ({
1458
+ x: padding + (d.x || 0) + (width - padding * 2) / 2,
1459
+ y: padding + (d.y || 0) + (height - padding * 2) / 2,
1460
+ setNames: d.sets
1461
+ }));
1462
+ } catch {
1463
+ return [];
1464
+ }
1465
+ }, [vennData, width, height, padding]);
1466
+ return {
1467
+ layout,
1468
+ paths,
1469
+ textPositions,
1470
+ error,
1471
+ isLoading
1472
+ };
1473
+ };
1474
+ const useResponsiveVennSize = (containerRef, defaultWidth = 600, defaultHeight = 400) => {
1475
+ const [dimensions, setDimensions] = require$$0.useState({
1476
+ width: defaultWidth,
1477
+ height: defaultHeight
1478
+ });
1479
+ require$$0.useEffect(() => {
1480
+ const handleResize = () => {
1481
+ if (!containerRef.current) return;
1482
+ const {
1483
+ offsetWidth,
1484
+ offsetHeight
1485
+ } = containerRef.current;
1486
+ if (offsetWidth && offsetHeight) {
1487
+ setDimensions({
1488
+ width: offsetWidth,
1489
+ height: offsetHeight
1490
+ });
1491
+ }
1492
+ };
1493
+ handleResize();
1494
+ const resizeObserver = new ResizeObserver(handleResize);
1495
+ if (containerRef.current) {
1496
+ resizeObserver.observe(containerRef.current);
1497
+ }
1498
+ return () => resizeObserver.disconnect();
1499
+ }, [containerRef]);
1500
+ return dimensions;
1501
+ };
1502
+
1503
+ const COLOR_SCHEMES = {
1504
+ default: ["#3B82F6", "#10B981", "#F59E0B", "#EF4444", "#8B5CF6", "#EC4899"],
1505
+ pastel: ["#A7F3D0", "#BFDBFE", "#FCD34D", "#FBCFE8", "#DDD6FE", "#FED7AA"],
1506
+ dark: ["#1E40AF", "#065F46", "#92400E", "#7F1D1D", "#4C1D95", "#9A3412"]
1507
+ };
1508
+ const getColorScheme = (circleCount, scheme = "default") => {
1509
+ const colors = COLOR_SCHEMES[scheme];
1510
+ return Array.from({
1511
+ length: circleCount
1512
+ }, (_, i) => colors[i % colors.length]);
1513
+ };
1514
+ const isAccessibleContrast = (foreground, background) => {
1515
+ const hexToRgb = hex => {
1516
+ const cleaned = hex.replace("#", "");
1517
+ if (cleaned.length !== 6) return null;
1518
+ const r = parseInt(cleaned.slice(0, 2), 16);
1519
+ const g = parseInt(cleaned.slice(2, 4), 16);
1520
+ const b = parseInt(cleaned.slice(4, 6), 16);
1521
+ if ([r, g, b].some(v => Number.isNaN(v))) return null;
1522
+ return [r, g, b];
1523
+ };
1524
+ const relativeLuminance = ([r, g, b]) => {
1525
+ const toLinear = value => {
1526
+ const c = value / 255;
1527
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
1528
+ };
1529
+ const [R, G, B] = [toLinear(r), toLinear(g), toLinear(b)];
1530
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
1531
+ };
1532
+ const fgRgb = hexToRgb(foreground);
1533
+ const bgRgb = hexToRgb(background);
1534
+ if (!fgRgb || !bgRgb) {
1535
+ return false;
1536
+ }
1537
+ const L1 = relativeLuminance(fgRgb);
1538
+ const L2 = relativeLuminance(bgRgb);
1539
+ const contrastRatio = (Math.max(L1, L2) + 0.05) / (Math.min(L1, L2) + 0.05);
1540
+ return contrastRatio >= 4.5;
1541
+ };
1542
+
1543
+ var styles = {"vennContainer":"VennDiagram-module_vennContainer__zE5Q4","svg":"VennDiagram-module_svg__8SEMM","circleGroup":"VennDiagram-module_circleGroup__9MTB2","circle":"VennDiagram-module_circle__sXeUM","selected":"VennDiagram-module_selected__U2SLC","labelGroup":"VennDiagram-module_labelGroup__bbeK2","value":"VennDiagram-module_value__0wKIt","label":"VennDiagram-module_label__fsN9f","legend":"VennDiagram-module_legend__ZOQL5","legendItem":"VennDiagram-module_legendItem__G3upl","legendLabel":"VennDiagram-module_legendLabel__yK6aP","legendValue":"VennDiagram-module_legendValue__cuwMv","error":"VennDiagram-module_error__czgBP","loading":"VennDiagram-module_loading__8lTBq"};
1544
+
1545
+ const VennDiagramContext = /*#__PURE__*/require$$0.createContext(null);
1546
+ VennDiagramContext.displayName = "VennDiagramContext";
1547
+
1548
+ const VennDiagramSVG = ({
1549
+ layout,
1550
+ textPositions,
1551
+ width,
1552
+ height,
1553
+ onClick
1554
+ }) => {
1555
+ const context = require$$0.useContext(VennDiagramContext);
1556
+ if (!context) {
1557
+ throw new Error("VennDiagramSVG must be used within VennDiagram");
1558
+ }
1559
+ const {
1560
+ data,
1561
+ config,
1562
+ hoveredSets,
1563
+ setHoveredSets,
1564
+ selectedSets,
1565
+ setSelectedSets
1566
+ } = context;
1567
+ const {
1568
+ colorScheme,
1569
+ showLabels,
1570
+ showValues,
1571
+ animated,
1572
+ strokeWidth
1573
+ } = config;
1574
+ const handleCircleHover = require$$0.useCallback((setName, isEntering) => {
1575
+ if (config.interactive) {
1576
+ setHoveredSets(isEntering ? [setName] : null);
1577
+ }
1578
+ }, [setHoveredSets, config.interactive]);
1579
+ const handleCircleClick = require$$0.useCallback(setName => {
1580
+ if (config.interactive) {
1581
+ const isSelected = selectedSets?.includes(setName);
1582
+ setSelectedSets(isSelected ? (selectedSets || []).filter(s => s !== setName) : [setName]);
1583
+ onClick?.([setName]);
1584
+ }
1585
+ }, [selectedSets, setSelectedSets, config.interactive, onClick]);
1586
+ return jsxRuntimeExports.jsxs("svg", {
1587
+ viewBox: `0 0 ${width} ${height}`,
1588
+ width: width,
1589
+ height: height,
1590
+ className: styles.svg,
1591
+ role: "img",
1592
+ "aria-label": "Venn diagram",
1593
+ children: [layout.map((circle, idx) => {
1594
+ const set = data.sets[idx];
1595
+ const color = colorScheme ? colorScheme[idx] : "#ccc";
1596
+ const isHovered = hoveredSets?.includes(set.name);
1597
+ const isSelected = selectedSets?.includes(set.name);
1598
+ return jsxRuntimeExports.jsx("g", {
1599
+ className: styles.circleGroup,
1600
+ children: jsxRuntimeExports.jsx("circle", {
1601
+ cx: circle.x,
1602
+ cy: circle.y,
1603
+ r: circle.radius,
1604
+ fill: color,
1605
+ fillOpacity: isHovered ? config.hoverOpacity : 0.4,
1606
+ stroke: color,
1607
+ strokeWidth: strokeWidth,
1608
+ className: `${styles.circle} ${isSelected ? styles.selected : ""}`,
1609
+ style: {
1610
+ transition: animated ? "all 300ms ease-in-out" : "none",
1611
+ cursor: config.interactive ? "pointer" : "default"
1612
+ },
1613
+ onMouseEnter: () => handleCircleHover(set.name, true),
1614
+ onMouseLeave: () => handleCircleHover(set.name, false),
1615
+ onClick: () => handleCircleClick(set.name),
1616
+ role: "button",
1617
+ tabIndex: 0,
1618
+ "aria-label": `Circle: ${set.label || set.name}`,
1619
+ onKeyDown: e => {
1620
+ if (e.key === "Enter" || e.key === " ") {
1621
+ handleCircleClick(set.name);
1622
+ }
1623
+ }
1624
+ })
1625
+ }, set.name);
1626
+ }), textPositions.map(pos => {
1627
+ const setNames = pos.setNames;
1628
+ const value = setNames.length === 1 ? data.sets.find(s => s.name === setNames[0])?.size : data.intersections.find(i => i.sets.length === setNames.length && i.sets.every(s => setNames.includes(s)))?.size;
1629
+ if (!value) return null;
1630
+ const isHovered = hoveredSets && setNames.some(s => hoveredSets.includes(s));
1631
+ const singleSet = setNames.length === 1 ? data.sets.find(s => s.name === setNames[0]) : undefined;
1632
+ const rawLabel = singleSet?.label ?? setNames[0];
1633
+ const renderedLabel = typeof rawLabel === "string" ? config.formatLabel ? config.formatLabel(rawLabel) : rawLabel : rawLabel;
1634
+ return jsxRuntimeExports.jsxs("g", {
1635
+ className: styles.labelGroup,
1636
+ style: {
1637
+ opacity: isHovered ? 1 : 0.7,
1638
+ transition: animated ? "opacity 300ms ease-in-out" : "none"
1639
+ },
1640
+ children: [showValues && jsxRuntimeExports.jsx("text", {
1641
+ x: pos.x,
1642
+ y: pos.y - 8,
1643
+ textAnchor: "middle",
1644
+ className: styles.value,
1645
+ fill: config.textFill,
1646
+ fontSize: "16",
1647
+ fontWeight: "600",
1648
+ children: config.formatValue ? config.formatValue(value) : value
1649
+ }), showLabels && setNames.length === 1 && jsxRuntimeExports.jsx("text", {
1650
+ x: pos.x,
1651
+ y: pos.y + 20,
1652
+ textAnchor: "middle",
1653
+ className: styles.label,
1654
+ fill: config.textFill,
1655
+ fontSize: "14",
1656
+ children: renderedLabel
1657
+ })]
1658
+ }, setNames.join(","));
1659
+ })]
1660
+ });
1661
+ };
1662
+
1663
+ const VennDiagram = ({
1664
+ data,
1665
+ width = 600,
1666
+ height = 400,
1667
+ renderer = "svg",
1668
+ showLabels = true,
1669
+ showValues = true,
1670
+ showLegend = false,
1671
+ colorScheme: customColorScheme,
1672
+ animated = true,
1673
+ hoverOpacity = 0.5,
1674
+ interactive = true,
1675
+ responsive = true,
1676
+ padding = 40,
1677
+ textFill = "currentColor",
1678
+ strokeWidth = 2,
1679
+ formatValue,
1680
+ formatLabel,
1681
+ className,
1682
+ style,
1683
+ onSetHover,
1684
+ onClick,
1685
+ testId
1686
+ }) => {
1687
+ const containerRef = require$$0.useRef(null);
1688
+ const [hoveredSets, setHoveredSets] = require$$0.useState(null);
1689
+ const [selectedSets, setSelectedSets] = require$$0.useState(null);
1690
+ const dimensions = useResponsiveVennSize(containerRef, width, responsive ? width : undefined);
1691
+ const finalWidth = responsive ? dimensions.width : width;
1692
+ const finalHeight = responsive ? dimensions.height : height;
1693
+ const {
1694
+ layout,
1695
+ textPositions,
1696
+ error,
1697
+ isLoading
1698
+ } = useVennLayout(data, {
1699
+ width: finalWidth,
1700
+ height: finalHeight,
1701
+ padding
1702
+ });
1703
+ const colorScheme = require$$0.useMemo(() => customColorScheme || getColorScheme(data.sets.length), [customColorScheme, data.sets.length]);
1704
+ const contextValue = require$$0.useMemo(() => ({
1705
+ data,
1706
+ config: {
1707
+ width: finalWidth,
1708
+ height: finalHeight,
1709
+ showLabels,
1710
+ showValues,
1711
+ colorScheme,
1712
+ animated,
1713
+ hoverOpacity,
1714
+ interactive,
1715
+ padding,
1716
+ textFill,
1717
+ strokeWidth,
1718
+ formatValue,
1719
+ formatLabel
1720
+ },
1721
+ hoveredSets,
1722
+ setHoveredSets: sets => {
1723
+ setHoveredSets(sets);
1724
+ onSetHover?.(sets);
1725
+ },
1726
+ selectedSets,
1727
+ setSelectedSets
1728
+ }), [data, finalWidth, finalHeight, showLabels, showValues, colorScheme, animated, hoverOpacity, interactive, padding, textFill, strokeWidth, formatValue, formatLabel, hoveredSets, selectedSets, onSetHover]);
1729
+ if (error) {
1730
+ return jsxRuntimeExports.jsxs("div", {
1731
+ className: styles.error,
1732
+ role: "alert",
1733
+ "data-testid": testId ? `${testId}-error` : undefined,
1734
+ children: [jsxRuntimeExports.jsx("p", {
1735
+ children: "Error rendering Venn diagram:"
1736
+ }), jsxRuntimeExports.jsx("code", {
1737
+ children: error.message
1738
+ })]
1739
+ });
1740
+ }
1741
+ if (isLoading && layout.length === 0) {
1742
+ return jsxRuntimeExports.jsx("div", {
1743
+ className: styles.loading,
1744
+ role: "status",
1745
+ "aria-busy": true,
1746
+ "data-testid": testId ? `${testId}-loading` : undefined,
1747
+ children: jsxRuntimeExports.jsx("span", {
1748
+ children: "Loading diagram..."
1749
+ })
1750
+ });
1751
+ }
1752
+ return jsxRuntimeExports.jsx(VennDiagramContext.Provider, {
1753
+ value: contextValue,
1754
+ children: jsxRuntimeExports.jsxs("div", {
1755
+ ref: containerRef,
1756
+ className: `${styles.vennContainer} ${className || ""}`,
1757
+ style: {
1758
+ width: responsive ? "100%" : finalWidth,
1759
+ height: responsive ? "100%" : finalHeight,
1760
+ ...style
1761
+ },
1762
+ "data-testid": testId,
1763
+ children: [renderer === "svg" && jsxRuntimeExports.jsx(VennDiagramSVG, {
1764
+ layout: layout,
1765
+ textPositions: textPositions,
1766
+ width: finalWidth,
1767
+ height: finalHeight,
1768
+ onClick: onClick
1769
+ }), showLegend && jsxRuntimeExports.jsx("div", {
1770
+ className: styles.legend,
1771
+ children: data.sets.map((set, idx) => jsxRuntimeExports.jsxs("div", {
1772
+ className: styles.legendItem,
1773
+ style: {
1774
+ borderLeftColor: colorScheme[idx]
1775
+ },
1776
+ children: [jsxRuntimeExports.jsx("span", {
1777
+ className: styles.legendLabel,
1778
+ children: formatLabel && typeof (set.label || set.name) === "string" ? formatLabel(set.label || set.name) : set.label || set.name
1779
+ }), jsxRuntimeExports.jsx("span", {
1780
+ className: styles.legendValue,
1781
+ children: formatValue ? formatValue(set.size) : set.size
1782
+ })]
1783
+ }, set.name))
1784
+ })]
1785
+ })
1786
+ });
1787
+ };
1788
+ VennDiagram.displayName = "VennDiagram";
1789
+
1790
+ exports.VennDiagram = VennDiagram;
1791
+ exports.VennDiagramSVG = VennDiagramSVG;
1792
+ exports.getColorScheme = getColorScheme;
1793
+ exports.isAccessibleContrast = isAccessibleContrast;
1794
+ exports.useResponsiveVennSize = useResponsiveVennSize;
1795
+ exports.useVennLayout = useVennLayout;
1796
+ //# sourceMappingURL=index.js.map