react-simple-phone-input 4.6.4 → 4.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,2753 +1,2 @@
1
- import React from 'react';
2
-
3
- /******************************************************************************
4
- Copyright (c) Microsoft Corporation.
5
-
6
- Permission to use, copy, modify, and/or distribute this software for any
7
- purpose with or without fee is hereby granted.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- PERFORMANCE OF THIS SOFTWARE.
16
- ***************************************************************************** */
17
-
18
- var __assign = function() {
19
- __assign = Object.assign || function __assign(t) {
20
- for (var s, i = 1, n = arguments.length; i < n; i++) {
21
- s = arguments[i];
22
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
-
29
- var jsxRuntime = {exports: {}};
30
-
31
- var reactJsxRuntime_production_min = {};
32
-
33
- /**
34
- * @license React
35
- * react-jsx-runtime.production.min.js
36
- *
37
- * Copyright (c) Facebook, Inc. and its affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */
42
-
43
- var hasRequiredReactJsxRuntime_production_min;
44
-
45
- function requireReactJsxRuntime_production_min () {
46
- if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
47
- hasRequiredReactJsxRuntime_production_min = 1;
48
- 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:!0,ref:!0,__self:!0,__source:!0};
49
- 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;
50
- return reactJsxRuntime_production_min;
51
- }
52
-
53
- var reactJsxRuntime_development = {};
54
-
55
- /**
56
- * @license React
57
- * react-jsx-runtime.development.js
58
- *
59
- * Copyright (c) Facebook, Inc. and its affiliates.
60
- *
61
- * This source code is licensed under the MIT license found in the
62
- * LICENSE file in the root directory of this source tree.
63
- */
64
-
65
- var hasRequiredReactJsxRuntime_development;
66
-
67
- function requireReactJsxRuntime_development () {
68
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
69
- hasRequiredReactJsxRuntime_development = 1;
70
-
71
- if (process.env.NODE_ENV !== "production") {
72
- (function() {
73
-
74
- var React$1 = React;
75
-
76
- // ATTENTION
77
- // When adding new symbols to this file,
78
- // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
79
- // The Symbol used to tag the ReactElement-like types.
80
- var REACT_ELEMENT_TYPE = Symbol.for('react.element');
81
- var REACT_PORTAL_TYPE = Symbol.for('react.portal');
82
- var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
83
- var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
84
- var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
85
- var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
86
- var REACT_CONTEXT_TYPE = Symbol.for('react.context');
87
- var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
88
- var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
89
- var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
90
- var REACT_MEMO_TYPE = Symbol.for('react.memo');
91
- var REACT_LAZY_TYPE = Symbol.for('react.lazy');
92
- var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
93
- var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
94
- var FAUX_ITERATOR_SYMBOL = '@@iterator';
95
- function getIteratorFn(maybeIterable) {
96
- if (maybeIterable === null || typeof maybeIterable !== 'object') {
97
- return null;
98
- }
99
-
100
- var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
101
-
102
- if (typeof maybeIterator === 'function') {
103
- return maybeIterator;
104
- }
105
-
106
- return null;
107
- }
108
-
109
- var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
110
-
111
- function error(format) {
112
- {
113
- {
114
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
115
- args[_key2 - 1] = arguments[_key2];
116
- }
117
-
118
- printWarning('error', format, args);
119
- }
120
- }
121
- }
122
-
123
- function printWarning(level, format, args) {
124
- // When changing this logic, you might want to also
125
- // update consoleWithStackDev.www.js as well.
126
- {
127
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
128
- var stack = ReactDebugCurrentFrame.getStackAddendum();
129
-
130
- if (stack !== '') {
131
- format += '%s';
132
- args = args.concat([stack]);
133
- } // eslint-disable-next-line react-internal/safe-string-coercion
134
-
135
-
136
- var argsWithFormat = args.map(function (item) {
137
- return String(item);
138
- }); // Careful: RN currently depends on this prefix
139
-
140
- argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
141
- // breaks IE9: https://github.com/facebook/react/issues/13610
142
- // eslint-disable-next-line react-internal/no-production-logging
143
-
144
- Function.prototype.apply.call(console[level], console, argsWithFormat);
145
- }
146
- }
147
-
148
- // -----------------------------------------------------------------------------
149
-
150
- var enableScopeAPI = false; // Experimental Create Event Handle API.
151
- var enableCacheElement = false;
152
- var enableTransitionTracing = false; // No known bugs, but needs performance testing
153
-
154
- var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
155
- // stuff. Intended to enable React core members to more easily debug scheduling
156
- // issues in DEV builds.
157
-
158
- var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
159
-
160
- var REACT_MODULE_REFERENCE;
161
-
162
- {
163
- REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
164
- }
165
-
166
- function isValidElementType(type) {
167
- if (typeof type === 'string' || typeof type === 'function') {
168
- return true;
169
- } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
170
-
171
-
172
- 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 ) {
173
- return true;
174
- }
175
-
176
- if (typeof type === 'object' && type !== null) {
177
- 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
178
- // types supported by any Flight configuration anywhere since
179
- // we don't know which Flight build this will end up being used
180
- // with.
181
- type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
182
- return true;
183
- }
184
- }
185
-
186
- return false;
187
- }
188
-
189
- function getWrappedName(outerType, innerType, wrapperName) {
190
- var displayName = outerType.displayName;
191
-
192
- if (displayName) {
193
- return displayName;
194
- }
195
-
196
- var functionName = innerType.displayName || innerType.name || '';
197
- return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
198
- } // Keep in sync with react-reconciler/getComponentNameFromFiber
199
-
200
-
201
- function getContextName(type) {
202
- return type.displayName || 'Context';
203
- } // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
204
-
205
-
206
- function getComponentNameFromType(type) {
207
- if (type == null) {
208
- // Host root, text node or just invalid type.
209
- return null;
210
- }
211
-
212
- {
213
- if (typeof type.tag === 'number') {
214
- error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
215
- }
216
- }
217
-
218
- if (typeof type === 'function') {
219
- return type.displayName || type.name || null;
220
- }
221
-
222
- if (typeof type === 'string') {
223
- return type;
224
- }
225
-
226
- switch (type) {
227
- case REACT_FRAGMENT_TYPE:
228
- return 'Fragment';
229
-
230
- case REACT_PORTAL_TYPE:
231
- return 'Portal';
232
-
233
- case REACT_PROFILER_TYPE:
234
- return 'Profiler';
235
-
236
- case REACT_STRICT_MODE_TYPE:
237
- return 'StrictMode';
238
-
239
- case REACT_SUSPENSE_TYPE:
240
- return 'Suspense';
241
-
242
- case REACT_SUSPENSE_LIST_TYPE:
243
- return 'SuspenseList';
244
-
245
- }
246
-
247
- if (typeof type === 'object') {
248
- switch (type.$$typeof) {
249
- case REACT_CONTEXT_TYPE:
250
- var context = type;
251
- return getContextName(context) + '.Consumer';
252
-
253
- case REACT_PROVIDER_TYPE:
254
- var provider = type;
255
- return getContextName(provider._context) + '.Provider';
256
-
257
- case REACT_FORWARD_REF_TYPE:
258
- return getWrappedName(type, type.render, 'ForwardRef');
259
-
260
- case REACT_MEMO_TYPE:
261
- var outerName = type.displayName || null;
262
-
263
- if (outerName !== null) {
264
- return outerName;
265
- }
266
-
267
- return getComponentNameFromType(type.type) || 'Memo';
268
-
269
- case REACT_LAZY_TYPE:
270
- {
271
- var lazyComponent = type;
272
- var payload = lazyComponent._payload;
273
- var init = lazyComponent._init;
274
-
275
- try {
276
- return getComponentNameFromType(init(payload));
277
- } catch (x) {
278
- return null;
279
- }
280
- }
281
-
282
- // eslint-disable-next-line no-fallthrough
283
- }
284
- }
285
-
286
- return null;
287
- }
288
-
289
- var assign = Object.assign;
290
-
291
- // Helpers to patch console.logs to avoid logging during side-effect free
292
- // replaying on render function. This currently only patches the object
293
- // lazily which won't cover if the log function was extracted eagerly.
294
- // We could also eagerly patch the method.
295
- var disabledDepth = 0;
296
- var prevLog;
297
- var prevInfo;
298
- var prevWarn;
299
- var prevError;
300
- var prevGroup;
301
- var prevGroupCollapsed;
302
- var prevGroupEnd;
303
-
304
- function disabledLog() {}
305
-
306
- disabledLog.__reactDisabledLog = true;
307
- function disableLogs() {
308
- {
309
- if (disabledDepth === 0) {
310
- /* eslint-disable react-internal/no-production-logging */
311
- prevLog = console.log;
312
- prevInfo = console.info;
313
- prevWarn = console.warn;
314
- prevError = console.error;
315
- prevGroup = console.group;
316
- prevGroupCollapsed = console.groupCollapsed;
317
- prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
318
-
319
- var props = {
320
- configurable: true,
321
- enumerable: true,
322
- value: disabledLog,
323
- writable: true
324
- }; // $FlowFixMe Flow thinks console is immutable.
325
-
326
- Object.defineProperties(console, {
327
- info: props,
328
- log: props,
329
- warn: props,
330
- error: props,
331
- group: props,
332
- groupCollapsed: props,
333
- groupEnd: props
334
- });
335
- /* eslint-enable react-internal/no-production-logging */
336
- }
337
-
338
- disabledDepth++;
339
- }
340
- }
341
- function reenableLogs() {
342
- {
343
- disabledDepth--;
344
-
345
- if (disabledDepth === 0) {
346
- /* eslint-disable react-internal/no-production-logging */
347
- var props = {
348
- configurable: true,
349
- enumerable: true,
350
- writable: true
351
- }; // $FlowFixMe Flow thinks console is immutable.
352
-
353
- Object.defineProperties(console, {
354
- log: assign({}, props, {
355
- value: prevLog
356
- }),
357
- info: assign({}, props, {
358
- value: prevInfo
359
- }),
360
- warn: assign({}, props, {
361
- value: prevWarn
362
- }),
363
- error: assign({}, props, {
364
- value: prevError
365
- }),
366
- group: assign({}, props, {
367
- value: prevGroup
368
- }),
369
- groupCollapsed: assign({}, props, {
370
- value: prevGroupCollapsed
371
- }),
372
- groupEnd: assign({}, props, {
373
- value: prevGroupEnd
374
- })
375
- });
376
- /* eslint-enable react-internal/no-production-logging */
377
- }
378
-
379
- if (disabledDepth < 0) {
380
- error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
381
- }
382
- }
383
- }
384
-
385
- var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
386
- var prefix;
387
- function describeBuiltInComponentFrame(name, source, ownerFn) {
388
- {
389
- if (prefix === undefined) {
390
- // Extract the VM specific prefix used by each line.
391
- try {
392
- throw Error();
393
- } catch (x) {
394
- var match = x.stack.trim().match(/\n( *(at )?)/);
395
- prefix = match && match[1] || '';
396
- }
397
- } // We use the prefix to ensure our stacks line up with native stack frames.
398
-
399
-
400
- return '\n' + prefix + name;
401
- }
402
- }
403
- var reentry = false;
404
- var componentFrameCache;
405
-
406
- {
407
- var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
408
- componentFrameCache = new PossiblyWeakMap();
409
- }
410
-
411
- function describeNativeComponentFrame(fn, construct) {
412
- // If something asked for a stack inside a fake render, it should get ignored.
413
- if ( !fn || reentry) {
414
- return '';
415
- }
416
-
417
- {
418
- var frame = componentFrameCache.get(fn);
419
-
420
- if (frame !== undefined) {
421
- return frame;
422
- }
423
- }
424
-
425
- var control;
426
- reentry = true;
427
- var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
428
-
429
- Error.prepareStackTrace = undefined;
430
- var previousDispatcher;
431
-
432
- {
433
- previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
434
- // for warnings.
435
-
436
- ReactCurrentDispatcher.current = null;
437
- disableLogs();
438
- }
439
-
440
- try {
441
- // This should throw.
442
- if (construct) {
443
- // Something should be setting the props in the constructor.
444
- var Fake = function () {
445
- throw Error();
446
- }; // $FlowFixMe
447
-
448
-
449
- Object.defineProperty(Fake.prototype, 'props', {
450
- set: function () {
451
- // We use a throwing setter instead of frozen or non-writable props
452
- // because that won't throw in a non-strict mode function.
453
- throw Error();
454
- }
455
- });
456
-
457
- if (typeof Reflect === 'object' && Reflect.construct) {
458
- // We construct a different control for this case to include any extra
459
- // frames added by the construct call.
460
- try {
461
- Reflect.construct(Fake, []);
462
- } catch (x) {
463
- control = x;
464
- }
465
-
466
- Reflect.construct(fn, [], Fake);
467
- } else {
468
- try {
469
- Fake.call();
470
- } catch (x) {
471
- control = x;
472
- }
473
-
474
- fn.call(Fake.prototype);
475
- }
476
- } else {
477
- try {
478
- throw Error();
479
- } catch (x) {
480
- control = x;
481
- }
482
-
483
- fn();
484
- }
485
- } catch (sample) {
486
- // This is inlined manually because closure doesn't do it for us.
487
- if (sample && control && typeof sample.stack === 'string') {
488
- // This extracts the first frame from the sample that isn't also in the control.
489
- // Skipping one frame that we assume is the frame that calls the two.
490
- var sampleLines = sample.stack.split('\n');
491
- var controlLines = control.stack.split('\n');
492
- var s = sampleLines.length - 1;
493
- var c = controlLines.length - 1;
494
-
495
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
496
- // We expect at least one stack frame to be shared.
497
- // Typically this will be the root most one. However, stack frames may be
498
- // cut off due to maximum stack limits. In this case, one maybe cut off
499
- // earlier than the other. We assume that the sample is longer or the same
500
- // and there for cut off earlier. So we should find the root most frame in
501
- // the sample somewhere in the control.
502
- c--;
503
- }
504
-
505
- for (; s >= 1 && c >= 0; s--, c--) {
506
- // Next we find the first one that isn't the same which should be the
507
- // frame that called our sample function and the control.
508
- if (sampleLines[s] !== controlLines[c]) {
509
- // In V8, the first line is describing the message but other VMs don't.
510
- // If we're about to return the first line, and the control is also on the same
511
- // line, that's a pretty good indicator that our sample threw at same line as
512
- // the control. I.e. before we entered the sample frame. So we ignore this result.
513
- // This can happen if you passed a class to function component, or non-function.
514
- if (s !== 1 || c !== 1) {
515
- do {
516
- s--;
517
- c--; // We may still have similar intermediate frames from the construct call.
518
- // The next one that isn't the same should be our match though.
519
-
520
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
521
- // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
522
- var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
523
- // but we have a user-provided "displayName"
524
- // splice it in to make the stack more readable.
525
-
526
-
527
- if (fn.displayName && _frame.includes('<anonymous>')) {
528
- _frame = _frame.replace('<anonymous>', fn.displayName);
529
- }
530
-
531
- {
532
- if (typeof fn === 'function') {
533
- componentFrameCache.set(fn, _frame);
534
- }
535
- } // Return the line we found.
536
-
537
-
538
- return _frame;
539
- }
540
- } while (s >= 1 && c >= 0);
541
- }
542
-
543
- break;
544
- }
545
- }
546
- }
547
- } finally {
548
- reentry = false;
549
-
550
- {
551
- ReactCurrentDispatcher.current = previousDispatcher;
552
- reenableLogs();
553
- }
554
-
555
- Error.prepareStackTrace = previousPrepareStackTrace;
556
- } // Fallback to just using the name if we couldn't make it throw.
557
-
558
-
559
- var name = fn ? fn.displayName || fn.name : '';
560
- var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
561
-
562
- {
563
- if (typeof fn === 'function') {
564
- componentFrameCache.set(fn, syntheticFrame);
565
- }
566
- }
567
-
568
- return syntheticFrame;
569
- }
570
- function describeFunctionComponentFrame(fn, source, ownerFn) {
571
- {
572
- return describeNativeComponentFrame(fn, false);
573
- }
574
- }
575
-
576
- function shouldConstruct(Component) {
577
- var prototype = Component.prototype;
578
- return !!(prototype && prototype.isReactComponent);
579
- }
580
-
581
- function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
582
-
583
- if (type == null) {
584
- return '';
585
- }
586
-
587
- if (typeof type === 'function') {
588
- {
589
- return describeNativeComponentFrame(type, shouldConstruct(type));
590
- }
591
- }
592
-
593
- if (typeof type === 'string') {
594
- return describeBuiltInComponentFrame(type);
595
- }
596
-
597
- switch (type) {
598
- case REACT_SUSPENSE_TYPE:
599
- return describeBuiltInComponentFrame('Suspense');
600
-
601
- case REACT_SUSPENSE_LIST_TYPE:
602
- return describeBuiltInComponentFrame('SuspenseList');
603
- }
604
-
605
- if (typeof type === 'object') {
606
- switch (type.$$typeof) {
607
- case REACT_FORWARD_REF_TYPE:
608
- return describeFunctionComponentFrame(type.render);
609
-
610
- case REACT_MEMO_TYPE:
611
- // Memo may contain any component type so we recursively resolve it.
612
- return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
613
-
614
- case REACT_LAZY_TYPE:
615
- {
616
- var lazyComponent = type;
617
- var payload = lazyComponent._payload;
618
- var init = lazyComponent._init;
619
-
620
- try {
621
- // Lazy may contain any component type so we recursively resolve it.
622
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
623
- } catch (x) {}
624
- }
625
- }
626
- }
627
-
628
- return '';
629
- }
630
-
631
- var hasOwnProperty = Object.prototype.hasOwnProperty;
632
-
633
- var loggedTypeFailures = {};
634
- var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
635
-
636
- function setCurrentlyValidatingElement(element) {
637
- {
638
- if (element) {
639
- var owner = element._owner;
640
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
641
- ReactDebugCurrentFrame.setExtraStackFrame(stack);
642
- } else {
643
- ReactDebugCurrentFrame.setExtraStackFrame(null);
644
- }
645
- }
646
- }
647
-
648
- function checkPropTypes(typeSpecs, values, location, componentName, element) {
649
- {
650
- // $FlowFixMe This is okay but Flow doesn't know it.
651
- var has = Function.call.bind(hasOwnProperty);
652
-
653
- for (var typeSpecName in typeSpecs) {
654
- if (has(typeSpecs, typeSpecName)) {
655
- var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
656
- // fail the render phase where it didn't fail before. So we log it.
657
- // After these have been cleaned up, we'll let them throw.
658
-
659
- try {
660
- // This is intentionally an invariant that gets caught. It's the same
661
- // behavior as without this statement except with a better message.
662
- if (typeof typeSpecs[typeSpecName] !== 'function') {
663
- // eslint-disable-next-line react-internal/prod-error-codes
664
- 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`.');
665
- err.name = 'Invariant Violation';
666
- throw err;
667
- }
668
-
669
- error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
670
- } catch (ex) {
671
- error$1 = ex;
672
- }
673
-
674
- if (error$1 && !(error$1 instanceof Error)) {
675
- setCurrentlyValidatingElement(element);
676
-
677
- 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);
678
-
679
- setCurrentlyValidatingElement(null);
680
- }
681
-
682
- if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
683
- // Only monitor this failure once because there tends to be a lot of the
684
- // same error.
685
- loggedTypeFailures[error$1.message] = true;
686
- setCurrentlyValidatingElement(element);
687
-
688
- error('Failed %s type: %s', location, error$1.message);
689
-
690
- setCurrentlyValidatingElement(null);
691
- }
692
- }
693
- }
694
- }
695
- }
696
-
697
- var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
698
-
699
- function isArray(a) {
700
- return isArrayImpl(a);
701
- }
702
-
703
- /*
704
- * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
705
- * and Temporal.* types. See https://github.com/facebook/react/pull/22064.
706
- *
707
- * The functions in this module will throw an easier-to-understand,
708
- * easier-to-debug exception with a clear errors message message explaining the
709
- * problem. (Instead of a confusing exception thrown inside the implementation
710
- * of the `value` object).
711
- */
712
- // $FlowFixMe only called in DEV, so void return is not possible.
713
- function typeName(value) {
714
- {
715
- // toStringTag is needed for namespaced types like Temporal.Instant
716
- var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
717
- var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
718
- return type;
719
- }
720
- } // $FlowFixMe only called in DEV, so void return is not possible.
721
-
722
-
723
- function willCoercionThrow(value) {
724
- {
725
- try {
726
- testStringCoercion(value);
727
- return false;
728
- } catch (e) {
729
- return true;
730
- }
731
- }
732
- }
733
-
734
- function testStringCoercion(value) {
735
- // If you ended up here by following an exception call stack, here's what's
736
- // happened: you supplied an object or symbol value to React (as a prop, key,
737
- // DOM attribute, CSS property, string ref, etc.) and when React tried to
738
- // coerce it to a string using `'' + value`, an exception was thrown.
739
- //
740
- // The most common types that will cause this exception are `Symbol` instances
741
- // and Temporal objects like `Temporal.Instant`. But any object that has a
742
- // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
743
- // exception. (Library authors do this to prevent users from using built-in
744
- // numeric operators like `+` or comparison operators like `>=` because custom
745
- // methods are needed to perform accurate arithmetic or comparison.)
746
- //
747
- // To fix the problem, coerce this object or symbol value to a string before
748
- // passing it to React. The most reliable way is usually `String(value)`.
749
- //
750
- // To find which value is throwing, check the browser or debugger console.
751
- // Before this exception was thrown, there should be `console.error` output
752
- // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
753
- // problem and how that type was used: key, atrribute, input value prop, etc.
754
- // In most cases, this console output also shows the component and its
755
- // ancestor components where the exception happened.
756
- //
757
- // eslint-disable-next-line react-internal/safe-string-coercion
758
- return '' + value;
759
- }
760
- function checkKeyStringCoercion(value) {
761
- {
762
- if (willCoercionThrow(value)) {
763
- error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
764
-
765
- return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
766
- }
767
- }
768
- }
769
-
770
- var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
771
- var RESERVED_PROPS = {
772
- key: true,
773
- ref: true,
774
- __self: true,
775
- __source: true
776
- };
777
- var specialPropKeyWarningShown;
778
- var specialPropRefWarningShown;
779
- var didWarnAboutStringRefs;
780
-
781
- {
782
- didWarnAboutStringRefs = {};
783
- }
784
-
785
- function hasValidRef(config) {
786
- {
787
- if (hasOwnProperty.call(config, 'ref')) {
788
- var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
789
-
790
- if (getter && getter.isReactWarning) {
791
- return false;
792
- }
793
- }
794
- }
795
-
796
- return config.ref !== undefined;
797
- }
798
-
799
- function hasValidKey(config) {
800
- {
801
- if (hasOwnProperty.call(config, 'key')) {
802
- var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
803
-
804
- if (getter && getter.isReactWarning) {
805
- return false;
806
- }
807
- }
808
- }
809
-
810
- return config.key !== undefined;
811
- }
812
-
813
- function warnIfStringRefCannotBeAutoConverted(config, self) {
814
- {
815
- if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
816
- var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
817
-
818
- if (!didWarnAboutStringRefs[componentName]) {
819
- 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);
820
-
821
- didWarnAboutStringRefs[componentName] = true;
822
- }
823
- }
824
- }
825
- }
826
-
827
- function defineKeyPropWarningGetter(props, displayName) {
828
- {
829
- var warnAboutAccessingKey = function () {
830
- if (!specialPropKeyWarningShown) {
831
- specialPropKeyWarningShown = true;
832
-
833
- 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);
834
- }
835
- };
836
-
837
- warnAboutAccessingKey.isReactWarning = true;
838
- Object.defineProperty(props, 'key', {
839
- get: warnAboutAccessingKey,
840
- configurable: true
841
- });
842
- }
843
- }
844
-
845
- function defineRefPropWarningGetter(props, displayName) {
846
- {
847
- var warnAboutAccessingRef = function () {
848
- if (!specialPropRefWarningShown) {
849
- specialPropRefWarningShown = true;
850
-
851
- 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);
852
- }
853
- };
854
-
855
- warnAboutAccessingRef.isReactWarning = true;
856
- Object.defineProperty(props, 'ref', {
857
- get: warnAboutAccessingRef,
858
- configurable: true
859
- });
860
- }
861
- }
862
- /**
863
- * Factory method to create a new React element. This no longer adheres to
864
- * the class pattern, so do not use new to call it. Also, instanceof check
865
- * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
866
- * if something is a React Element.
867
- *
868
- * @param {*} type
869
- * @param {*} props
870
- * @param {*} key
871
- * @param {string|object} ref
872
- * @param {*} owner
873
- * @param {*} self A *temporary* helper to detect places where `this` is
874
- * different from the `owner` when React.createElement is called, so that we
875
- * can warn. We want to get rid of owner and replace string `ref`s with arrow
876
- * functions, and as long as `this` and owner are the same, there will be no
877
- * change in behavior.
878
- * @param {*} source An annotation object (added by a transpiler or otherwise)
879
- * indicating filename, line number, and/or other information.
880
- * @internal
881
- */
882
-
883
-
884
- var ReactElement = function (type, key, ref, self, source, owner, props) {
885
- var element = {
886
- // This tag allows us to uniquely identify this as a React Element
887
- $$typeof: REACT_ELEMENT_TYPE,
888
- // Built-in properties that belong on the element
889
- type: type,
890
- key: key,
891
- ref: ref,
892
- props: props,
893
- // Record the component responsible for creating this element.
894
- _owner: owner
895
- };
896
-
897
- {
898
- // The validation flag is currently mutative. We put it on
899
- // an external backing store so that we can freeze the whole object.
900
- // This can be replaced with a WeakMap once they are implemented in
901
- // commonly used development environments.
902
- element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
903
- // the validation flag non-enumerable (where possible, which should
904
- // include every environment we run tests in), so the test framework
905
- // ignores it.
906
-
907
- Object.defineProperty(element._store, 'validated', {
908
- configurable: false,
909
- enumerable: false,
910
- writable: true,
911
- value: false
912
- }); // self and source are DEV only properties.
913
-
914
- Object.defineProperty(element, '_self', {
915
- configurable: false,
916
- enumerable: false,
917
- writable: false,
918
- value: self
919
- }); // Two elements created in two different places should be considered
920
- // equal for testing purposes and therefore we hide it from enumeration.
921
-
922
- Object.defineProperty(element, '_source', {
923
- configurable: false,
924
- enumerable: false,
925
- writable: false,
926
- value: source
927
- });
928
-
929
- if (Object.freeze) {
930
- Object.freeze(element.props);
931
- Object.freeze(element);
932
- }
933
- }
934
-
935
- return element;
936
- };
937
- /**
938
- * https://github.com/reactjs/rfcs/pull/107
939
- * @param {*} type
940
- * @param {object} props
941
- * @param {string} key
942
- */
943
-
944
- function jsxDEV(type, config, maybeKey, source, self) {
945
- {
946
- var propName; // Reserved names are extracted
947
-
948
- var props = {};
949
- var key = null;
950
- var ref = null; // Currently, key can be spread in as a prop. This causes a potential
951
- // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
952
- // or <div key="Hi" {...props} /> ). We want to deprecate key spread,
953
- // but as an intermediary step, we will use jsxDEV for everything except
954
- // <div {...props} key="Hi" />, because we aren't currently able to tell if
955
- // key is explicitly declared to be undefined or not.
956
-
957
- if (maybeKey !== undefined) {
958
- {
959
- checkKeyStringCoercion(maybeKey);
960
- }
961
-
962
- key = '' + maybeKey;
963
- }
964
-
965
- if (hasValidKey(config)) {
966
- {
967
- checkKeyStringCoercion(config.key);
968
- }
969
-
970
- key = '' + config.key;
971
- }
972
-
973
- if (hasValidRef(config)) {
974
- ref = config.ref;
975
- warnIfStringRefCannotBeAutoConverted(config, self);
976
- } // Remaining properties are added to a new props object
977
-
978
-
979
- for (propName in config) {
980
- if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
981
- props[propName] = config[propName];
982
- }
983
- } // Resolve default props
984
-
985
-
986
- if (type && type.defaultProps) {
987
- var defaultProps = type.defaultProps;
988
-
989
- for (propName in defaultProps) {
990
- if (props[propName] === undefined) {
991
- props[propName] = defaultProps[propName];
992
- }
993
- }
994
- }
995
-
996
- if (key || ref) {
997
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
998
-
999
- if (key) {
1000
- defineKeyPropWarningGetter(props, displayName);
1001
- }
1002
-
1003
- if (ref) {
1004
- defineRefPropWarningGetter(props, displayName);
1005
- }
1006
- }
1007
-
1008
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
1009
- }
1010
- }
1011
-
1012
- var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
1013
- var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
1014
-
1015
- function setCurrentlyValidatingElement$1(element) {
1016
- {
1017
- if (element) {
1018
- var owner = element._owner;
1019
- var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
1020
- ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
1021
- } else {
1022
- ReactDebugCurrentFrame$1.setExtraStackFrame(null);
1023
- }
1024
- }
1025
- }
1026
-
1027
- var propTypesMisspellWarningShown;
1028
-
1029
- {
1030
- propTypesMisspellWarningShown = false;
1031
- }
1032
- /**
1033
- * Verifies the object is a ReactElement.
1034
- * See https://reactjs.org/docs/react-api.html#isvalidelement
1035
- * @param {?object} object
1036
- * @return {boolean} True if `object` is a ReactElement.
1037
- * @final
1038
- */
1039
-
1040
-
1041
- function isValidElement(object) {
1042
- {
1043
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
1044
- }
1045
- }
1046
-
1047
- function getDeclarationErrorAddendum() {
1048
- {
1049
- if (ReactCurrentOwner$1.current) {
1050
- var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
1051
-
1052
- if (name) {
1053
- return '\n\nCheck the render method of `' + name + '`.';
1054
- }
1055
- }
1056
-
1057
- return '';
1058
- }
1059
- }
1060
-
1061
- function getSourceInfoErrorAddendum(source) {
1062
- {
1063
- if (source !== undefined) {
1064
- var fileName = source.fileName.replace(/^.*[\\\/]/, '');
1065
- var lineNumber = source.lineNumber;
1066
- return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
1067
- }
1068
-
1069
- return '';
1070
- }
1071
- }
1072
- /**
1073
- * Warn if there's no key explicitly set on dynamic arrays of children or
1074
- * object keys are not valid. This allows us to keep track of children between
1075
- * updates.
1076
- */
1077
-
1078
-
1079
- var ownerHasKeyUseWarning = {};
1080
-
1081
- function getCurrentComponentErrorInfo(parentType) {
1082
- {
1083
- var info = getDeclarationErrorAddendum();
1084
-
1085
- if (!info) {
1086
- var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
1087
-
1088
- if (parentName) {
1089
- info = "\n\nCheck the top-level render call using <" + parentName + ">.";
1090
- }
1091
- }
1092
-
1093
- return info;
1094
- }
1095
- }
1096
- /**
1097
- * Warn if the element doesn't have an explicit key assigned to it.
1098
- * This element is in an array. The array could grow and shrink or be
1099
- * reordered. All children that haven't already been validated are required to
1100
- * have a "key" property assigned to it. Error statuses are cached so a warning
1101
- * will only be shown once.
1102
- *
1103
- * @internal
1104
- * @param {ReactElement} element Element that requires a key.
1105
- * @param {*} parentType element's parent's type.
1106
- */
1107
-
1108
-
1109
- function validateExplicitKey(element, parentType) {
1110
- {
1111
- if (!element._store || element._store.validated || element.key != null) {
1112
- return;
1113
- }
1114
-
1115
- element._store.validated = true;
1116
- var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
1117
-
1118
- if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
1119
- return;
1120
- }
1121
-
1122
- ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
1123
- // property, it may be the creator of the child that's responsible for
1124
- // assigning it a key.
1125
-
1126
- var childOwner = '';
1127
-
1128
- if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
1129
- // Give the component that originally created this child.
1130
- childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
1131
- }
1132
-
1133
- setCurrentlyValidatingElement$1(element);
1134
-
1135
- 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);
1136
-
1137
- setCurrentlyValidatingElement$1(null);
1138
- }
1139
- }
1140
- /**
1141
- * Ensure that every element either is passed in a static location, in an
1142
- * array with an explicit keys property defined, or in an object literal
1143
- * with valid key property.
1144
- *
1145
- * @internal
1146
- * @param {ReactNode} node Statically passed child of any type.
1147
- * @param {*} parentType node's parent's type.
1148
- */
1149
-
1150
-
1151
- function validateChildKeys(node, parentType) {
1152
- {
1153
- if (typeof node !== 'object') {
1154
- return;
1155
- }
1156
-
1157
- if (isArray(node)) {
1158
- for (var i = 0; i < node.length; i++) {
1159
- var child = node[i];
1160
-
1161
- if (isValidElement(child)) {
1162
- validateExplicitKey(child, parentType);
1163
- }
1164
- }
1165
- } else if (isValidElement(node)) {
1166
- // This element was passed in a valid location.
1167
- if (node._store) {
1168
- node._store.validated = true;
1169
- }
1170
- } else if (node) {
1171
- var iteratorFn = getIteratorFn(node);
1172
-
1173
- if (typeof iteratorFn === 'function') {
1174
- // Entry iterators used to provide implicit keys,
1175
- // but now we print a separate warning for them later.
1176
- if (iteratorFn !== node.entries) {
1177
- var iterator = iteratorFn.call(node);
1178
- var step;
1179
-
1180
- while (!(step = iterator.next()).done) {
1181
- if (isValidElement(step.value)) {
1182
- validateExplicitKey(step.value, parentType);
1183
- }
1184
- }
1185
- }
1186
- }
1187
- }
1188
- }
1189
- }
1190
- /**
1191
- * Given an element, validate that its props follow the propTypes definition,
1192
- * provided by the type.
1193
- *
1194
- * @param {ReactElement} element
1195
- */
1196
-
1197
-
1198
- function validatePropTypes(element) {
1199
- {
1200
- var type = element.type;
1201
-
1202
- if (type === null || type === undefined || typeof type === 'string') {
1203
- return;
1204
- }
1205
-
1206
- var propTypes;
1207
-
1208
- if (typeof type === 'function') {
1209
- propTypes = type.propTypes;
1210
- } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
1211
- // Inner props are checked in the reconciler.
1212
- type.$$typeof === REACT_MEMO_TYPE)) {
1213
- propTypes = type.propTypes;
1214
- } else {
1215
- return;
1216
- }
1217
-
1218
- if (propTypes) {
1219
- // Intentionally inside to avoid triggering lazy initializers:
1220
- var name = getComponentNameFromType(type);
1221
- checkPropTypes(propTypes, element.props, 'prop', name, element);
1222
- } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1223
- propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
1224
-
1225
- var _name = getComponentNameFromType(type);
1226
-
1227
- error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
1228
- }
1229
-
1230
- if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
1231
- error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1232
- }
1233
- }
1234
- }
1235
- /**
1236
- * Given a fragment, validate that it can only be provided with fragment props
1237
- * @param {ReactElement} fragment
1238
- */
1239
-
1240
-
1241
- function validateFragmentProps(fragment) {
1242
- {
1243
- var keys = Object.keys(fragment.props);
1244
-
1245
- for (var i = 0; i < keys.length; i++) {
1246
- var key = keys[i];
1247
-
1248
- if (key !== 'children' && key !== 'key') {
1249
- setCurrentlyValidatingElement$1(fragment);
1250
-
1251
- error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1252
-
1253
- setCurrentlyValidatingElement$1(null);
1254
- break;
1255
- }
1256
- }
1257
-
1258
- if (fragment.ref !== null) {
1259
- setCurrentlyValidatingElement$1(fragment);
1260
-
1261
- error('Invalid attribute `ref` supplied to `React.Fragment`.');
1262
-
1263
- setCurrentlyValidatingElement$1(null);
1264
- }
1265
- }
1266
- }
1267
-
1268
- function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
1269
- {
1270
- var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
1271
- // succeed and there will likely be errors in render.
1272
-
1273
- if (!validType) {
1274
- var info = '';
1275
-
1276
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1277
- 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.";
1278
- }
1279
-
1280
- var sourceInfo = getSourceInfoErrorAddendum(source);
1281
-
1282
- if (sourceInfo) {
1283
- info += sourceInfo;
1284
- } else {
1285
- info += getDeclarationErrorAddendum();
1286
- }
1287
-
1288
- var typeString;
1289
-
1290
- if (type === null) {
1291
- typeString = 'null';
1292
- } else if (isArray(type)) {
1293
- typeString = 'array';
1294
- } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1295
- typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
1296
- info = ' Did you accidentally export a JSX literal instead of a component?';
1297
- } else {
1298
- typeString = typeof type;
1299
- }
1300
-
1301
- 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);
1302
- }
1303
-
1304
- var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
1305
- // TODO: Drop this when these are no longer allowed as the type argument.
1306
-
1307
- if (element == null) {
1308
- return element;
1309
- } // Skip key warning if the type isn't valid since our key validation logic
1310
- // doesn't expect a non-string/function type and can throw confusing errors.
1311
- // We don't want exception behavior to differ between dev and prod.
1312
- // (Rendering will throw with a helpful message and as soon as the type is
1313
- // fixed, the key warnings will appear.)
1314
-
1315
-
1316
- if (validType) {
1317
- var children = props.children;
1318
-
1319
- if (children !== undefined) {
1320
- if (isStaticChildren) {
1321
- if (isArray(children)) {
1322
- for (var i = 0; i < children.length; i++) {
1323
- validateChildKeys(children[i], type);
1324
- }
1325
-
1326
- if (Object.freeze) {
1327
- Object.freeze(children);
1328
- }
1329
- } else {
1330
- 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.');
1331
- }
1332
- } else {
1333
- validateChildKeys(children, type);
1334
- }
1335
- }
1336
- }
1337
-
1338
- if (type === REACT_FRAGMENT_TYPE) {
1339
- validateFragmentProps(element);
1340
- } else {
1341
- validatePropTypes(element);
1342
- }
1343
-
1344
- return element;
1345
- }
1346
- } // These two functions exist to still get child warnings in dev
1347
- // even with the prod transform. This means that jsxDEV is purely
1348
- // opt-in behavior for better messages but that we won't stop
1349
- // giving you warnings if you use production apis.
1350
-
1351
- function jsxWithValidationStatic(type, props, key) {
1352
- {
1353
- return jsxWithValidation(type, props, key, true);
1354
- }
1355
- }
1356
- function jsxWithValidationDynamic(type, props, key) {
1357
- {
1358
- return jsxWithValidation(type, props, key, false);
1359
- }
1360
- }
1361
-
1362
- var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
1363
- // for now we can ship identical prod functions
1364
-
1365
- var jsxs = jsxWithValidationStatic ;
1366
-
1367
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
1368
- reactJsxRuntime_development.jsx = jsx;
1369
- reactJsxRuntime_development.jsxs = jsxs;
1370
- })();
1371
- }
1372
- return reactJsxRuntime_development;
1373
- }
1374
-
1375
- (function (module) {
1376
-
1377
- if (process.env.NODE_ENV === 'production') {
1378
- module.exports = requireReactJsxRuntime_production_min();
1379
- } else {
1380
- module.exports = requireReactJsxRuntime_development();
1381
- }
1382
- } (jsxRuntime));
1383
-
1384
- var countryData = [
1385
- {
1386
- country: "Afghanistan",
1387
- countryCode: "AF",
1388
- callingCode: "+93"
1389
- },
1390
- {
1391
- country: "Albania",
1392
- countryCode: "AL",
1393
- callingCode: "+355"
1394
- },
1395
- {
1396
- country: "Algeria",
1397
- countryCode: "DZ",
1398
- callingCode: "+213"
1399
- },
1400
- {
1401
- country: "American Samoa",
1402
- countryCode: "AS",
1403
- callingCode: "+1684"
1404
- },
1405
- {
1406
- country: "Andorra",
1407
- countryCode: "AD",
1408
- callingCode: "+376"
1409
- },
1410
- {
1411
- country: "Angola",
1412
- countryCode: "AO",
1413
- callingCode: "+244"
1414
- },
1415
- {
1416
- country: "Anguilla",
1417
- countryCode: "AI",
1418
- callingCode: "+1264"
1419
- },
1420
- {
1421
- country: "Antarctica",
1422
- countryCode: "AQ",
1423
- callingCode: "+672"
1424
- },
1425
- {
1426
- country: "Antigua and Barbuda",
1427
- countryCode: "AG",
1428
- callingCode: "+1268"
1429
- },
1430
- {
1431
- country: "Argentina",
1432
- countryCode: "AR",
1433
- callingCode: "+54"
1434
- },
1435
- {
1436
- country: "Armenia",
1437
- countryCode: "AM",
1438
- callingCode: "+374"
1439
- },
1440
- {
1441
- country: "Aruba",
1442
- countryCode: "AW",
1443
- callingCode: "+297"
1444
- },
1445
- {
1446
- country: "Australia",
1447
- countryCode: "AU",
1448
- callingCode: "+61"
1449
- },
1450
- {
1451
- country: "Austria",
1452
- countryCode: "AT",
1453
- callingCode: "+43"
1454
- },
1455
- {
1456
- country: "Azerbaijan",
1457
- countryCode: "AZ",
1458
- callingCode: "+994"
1459
- },
1460
- {
1461
- country: "Bahamas",
1462
- countryCode: "BS",
1463
- callingCode: "+1242"
1464
- },
1465
- {
1466
- country: "Bahrain",
1467
- countryCode: "BH",
1468
- callingCode: "+973"
1469
- },
1470
- {
1471
- country: "Bangladesh",
1472
- countryCode: "BD",
1473
- callingCode: "+880"
1474
- },
1475
- {
1476
- country: "Barbados",
1477
- countryCode: "BB",
1478
- callingCode: "+1246"
1479
- },
1480
- {
1481
- country: "Belarus",
1482
- countryCode: "BY",
1483
- callingCode: "+375"
1484
- },
1485
- {
1486
- country: "Belgium",
1487
- countryCode: "BE",
1488
- callingCode: "+32"
1489
- },
1490
- {
1491
- country: "Belize",
1492
- countryCode: "BZ",
1493
- callingCode: "+501"
1494
- },
1495
- {
1496
- country: "Benin",
1497
- countryCode: "BJ",
1498
- callingCode: "+229"
1499
- },
1500
- {
1501
- country: "Bermuda",
1502
- countryCode: "BM",
1503
- callingCode: "+1441"
1504
- },
1505
- {
1506
- country: "Bhutan",
1507
- countryCode: "BT",
1508
- callingCode: "+975"
1509
- },
1510
- {
1511
- country: "Bolivia",
1512
- countryCode: "BO",
1513
- callingCode: "+591"
1514
- },
1515
- {
1516
- country: "Bosnia and Herzegovina",
1517
- countryCode: "BA",
1518
- callingCode: "+387"
1519
- },
1520
- {
1521
- country: "Botswana",
1522
- countryCode: "BW",
1523
- callingCode: "+267"
1524
- },
1525
- {
1526
- country: "Bouvet Island",
1527
- countryCode: "BV",
1528
- callingCode: "+47"
1529
- },
1530
- {
1531
- country: "Brazil",
1532
- countryCode: "BR",
1533
- callingCode: "+55"
1534
- },
1535
- {
1536
- country: "British Indian Ocean Territory",
1537
- countryCode: "IO",
1538
- callingCode: "+246"
1539
- },
1540
- {
1541
- country: "British Virgin Islands",
1542
- countryCode: "VG",
1543
- callingCode: "+1284"
1544
- },
1545
- {
1546
- country: "Brunei",
1547
- countryCode: "BN",
1548
- callingCode: "+673"
1549
- },
1550
- {
1551
- country: "Bulgaria",
1552
- countryCode: "BG",
1553
- callingCode: "+359"
1554
- },
1555
- {
1556
- country: "Burkina Faso",
1557
- countryCode: "BF",
1558
- callingCode: "+226"
1559
- },
1560
- {
1561
- country: "Burundi",
1562
- countryCode: "BI",
1563
- callingCode: "+257"
1564
- },
1565
- {
1566
- country: "Cambodia",
1567
- countryCode: "KH",
1568
- callingCode: "+855"
1569
- },
1570
- {
1571
- country: "Cameroon",
1572
- countryCode: "CM",
1573
- callingCode: "+237"
1574
- },
1575
- {
1576
- country: "Canada",
1577
- countryCode: "CA",
1578
- callingCode: "+1"
1579
- },
1580
- {
1581
- country: "Cape Verde",
1582
- countryCode: "CV",
1583
- callingCode: "+238"
1584
- },
1585
- {
1586
- country: "Cayman Islands",
1587
- countryCode: "KY",
1588
- callingCode: "+1345"
1589
- },
1590
- {
1591
- country: "Central African Republic",
1592
- countryCode: "CF",
1593
- callingCode: "+236"
1594
- },
1595
- {
1596
- country: "Chad",
1597
- countryCode: "TD",
1598
- callingCode: "+235"
1599
- },
1600
- {
1601
- country: "Chile",
1602
- countryCode: "CL",
1603
- callingCode: "+56"
1604
- },
1605
- {
1606
- country: "China",
1607
- countryCode: "CN",
1608
- callingCode: "+86"
1609
- },
1610
- {
1611
- country: "Christmas Island",
1612
- countryCode: "CX",
1613
- callingCode: "+61"
1614
- },
1615
- {
1616
- country: "Cocos Islands",
1617
- countryCode: "CC",
1618
- callingCode: "+61"
1619
- },
1620
- {
1621
- country: "Colombia",
1622
- countryCode: "CO",
1623
- callingCode: "+57"
1624
- },
1625
- {
1626
- country: "Comoros",
1627
- countryCode: "KM",
1628
- callingCode: "+269"
1629
- },
1630
- {
1631
- country: "Cook Islands",
1632
- countryCode: "CK",
1633
- callingCode: "+682"
1634
- },
1635
- {
1636
- country: "Costa Rica",
1637
- countryCode: "CR",
1638
- callingCode: "+506"
1639
- },
1640
- {
1641
- country: "Croatia",
1642
- countryCode: "HR",
1643
- callingCode: "+385"
1644
- },
1645
- {
1646
- country: "Cuba",
1647
- countryCode: "CU",
1648
- callingCode: "+53"
1649
- },
1650
- {
1651
- country: "Cyprus",
1652
- countryCode: "CY",
1653
- callingCode: "+357"
1654
- },
1655
- {
1656
- country: "Czech Republic",
1657
- countryCode: "CZ",
1658
- callingCode: "+420"
1659
- },
1660
- {
1661
- country: "Democratic Republic of the Congo",
1662
- countryCode: "CD",
1663
- callingCode: "+243"
1664
- },
1665
- {
1666
- country: "Denmark",
1667
- countryCode: "DK",
1668
- callingCode: "+45"
1669
- },
1670
- {
1671
- country: "Djibouti",
1672
- countryCode: "DJ",
1673
- callingCode: "+253"
1674
- },
1675
- {
1676
- country: "Dominica",
1677
- countryCode: "DM",
1678
- callingCode: "+1767"
1679
- },
1680
- {
1681
- country: "Dominican Republic",
1682
- countryCode: "DO",
1683
- callingCode: "+1"
1684
- },
1685
- {
1686
- country: "East Timor",
1687
- countryCode: "TL",
1688
- callingCode: "+670"
1689
- },
1690
- {
1691
- country: "Ecuador",
1692
- countryCode: "EC",
1693
- callingCode: "+593"
1694
- },
1695
- {
1696
- country: "Egypt",
1697
- countryCode: "EG",
1698
- callingCode: "+20"
1699
- },
1700
- {
1701
- country: "El Salvador",
1702
- countryCode: "SV",
1703
- callingCode: "+503"
1704
- },
1705
- {
1706
- country: "Equatorial Guinea",
1707
- countryCode: "GQ",
1708
- callingCode: "+240"
1709
- },
1710
- {
1711
- country: "Eritrea",
1712
- countryCode: "ER",
1713
- callingCode: "+291"
1714
- },
1715
- {
1716
- country: "Estonia",
1717
- countryCode: "EE",
1718
- callingCode: "+372"
1719
- },
1720
- {
1721
- country: "Ethiopia",
1722
- countryCode: "ET",
1723
- callingCode: "+251"
1724
- },
1725
- {
1726
- country: "Falkland Islands",
1727
- countryCode: "FK",
1728
- callingCode: "+500"
1729
- },
1730
- {
1731
- country: "Faroe Islands",
1732
- countryCode: "FO",
1733
- callingCode: "+298"
1734
- },
1735
- {
1736
- country: "Fiji",
1737
- countryCode: "FJ",
1738
- callingCode: "+679"
1739
- },
1740
- {
1741
- country: "Finland",
1742
- countryCode: "FI",
1743
- callingCode: "+358"
1744
- },
1745
- {
1746
- country: "France",
1747
- countryCode: "FR",
1748
- callingCode: "+33"
1749
- },
1750
- {
1751
- country: "French Guiana",
1752
- countryCode: "GF",
1753
- callingCode: "+594"
1754
- },
1755
- {
1756
- country: "French Polynesia",
1757
- countryCode: "PF",
1758
- callingCode: "+689"
1759
- },
1760
- {
1761
- country: "French Southern Territories",
1762
- countryCode: "TF",
1763
- callingCode: "+262"
1764
- },
1765
- {
1766
- country: "Gabon",
1767
- countryCode: "GA",
1768
- callingCode: "+241"
1769
- },
1770
- {
1771
- country: "Gambia",
1772
- countryCode: "GM",
1773
- callingCode: "+220"
1774
- },
1775
- {
1776
- country: "Georgia",
1777
- countryCode: "GE",
1778
- callingCode: "+995"
1779
- },
1780
- {
1781
- country: "Germany",
1782
- countryCode: "DE",
1783
- callingCode: "+49"
1784
- },
1785
- {
1786
- country: "Ghana",
1787
- countryCode: "GH",
1788
- callingCode: "+233"
1789
- },
1790
- {
1791
- country: "Gibraltar",
1792
- countryCode: "GI",
1793
- callingCode: "+350"
1794
- },
1795
- {
1796
- country: "Greece",
1797
- countryCode: "GR",
1798
- callingCode: "+30"
1799
- },
1800
- {
1801
- country: "Greenland",
1802
- countryCode: "GL",
1803
- callingCode: "+299"
1804
- },
1805
- {
1806
- country: "Grenada",
1807
- countryCode: "GD",
1808
- callingCode: "+473"
1809
- },
1810
- {
1811
- country: "Guadeloupe",
1812
- countryCode: "GP",
1813
- callingCode: "+590"
1814
- },
1815
- {
1816
- country: "Guam",
1817
- countryCode: "GU",
1818
- callingCode: "+1671"
1819
- },
1820
- {
1821
- country: "Guatemala",
1822
- countryCode: "GT",
1823
- callingCode: "+502"
1824
- },
1825
- {
1826
- country: "Guinea",
1827
- countryCode: "GN",
1828
- callingCode: "+224"
1829
- },
1830
- {
1831
- country: "Guinea-Bissau",
1832
- countryCode: "GW",
1833
- callingCode: "+245"
1834
- },
1835
- {
1836
- country: "Guyana",
1837
- countryCode: "GY",
1838
- callingCode: "+592"
1839
- },
1840
- {
1841
- country: "Haiti",
1842
- countryCode: "HT",
1843
- callingCode: "+509"
1844
- },
1845
- {
1846
- country: "Honduras",
1847
- countryCode: "HN",
1848
- callingCode: "+504"
1849
- },
1850
- {
1851
- country: "Hong Kong",
1852
- countryCode: "HK",
1853
- callingCode: "+852"
1854
- },
1855
- {
1856
- country: "Hungary",
1857
- countryCode: "HU",
1858
- callingCode: "+36"
1859
- },
1860
- {
1861
- country: "Iceland",
1862
- countryCode: "IS",
1863
- callingCode: "+354"
1864
- },
1865
- {
1866
- country: "India",
1867
- countryCode: "IN",
1868
- callingCode: "+91"
1869
- },
1870
- {
1871
- country: "Indonesia",
1872
- countryCode: "ID",
1873
- callingCode: "+62"
1874
- },
1875
- {
1876
- country: "Iran",
1877
- countryCode: "IR",
1878
- callingCode: "+98"
1879
- },
1880
- {
1881
- country: "Iraq",
1882
- countryCode: "IQ",
1883
- callingCode: "+964"
1884
- },
1885
- {
1886
- country: "Ireland",
1887
- countryCode: "IE",
1888
- callingCode: "+353"
1889
- },
1890
- {
1891
- country: "Israel",
1892
- countryCode: "IL",
1893
- callingCode: "+972"
1894
- },
1895
- {
1896
- country: "Italy",
1897
- countryCode: "IT",
1898
- callingCode: "+39"
1899
- },
1900
- {
1901
- country: "Ivory Coast",
1902
- countryCode: "CI",
1903
- callingCode: "+225"
1904
- },
1905
- {
1906
- country: "Jamaica",
1907
- countryCode: "JM",
1908
- callingCode: "+1876"
1909
- },
1910
- {
1911
- country: "Japan",
1912
- countryCode: "JP",
1913
- callingCode: "+81"
1914
- },
1915
- {
1916
- country: "Jordan",
1917
- countryCode: "JO",
1918
- callingCode: "+962"
1919
- },
1920
- {
1921
- country: "Kazakhstan",
1922
- countryCode: "KZ",
1923
- callingCode: "+7"
1924
- },
1925
- {
1926
- country: "Kenya",
1927
- countryCode: "KE",
1928
- callingCode: "+254"
1929
- },
1930
- {
1931
- country: "Kiribati",
1932
- countryCode: "KI",
1933
- callingCode: "+686"
1934
- },
1935
- {
1936
- country: "Kuwait",
1937
- countryCode: "KW",
1938
- callingCode: "+965"
1939
- },
1940
- {
1941
- country: "Kyrgyzstan",
1942
- countryCode: "KG",
1943
- callingCode: "+996"
1944
- },
1945
- {
1946
- country: "Laos",
1947
- countryCode: "LA",
1948
- callingCode: "+856"
1949
- },
1950
- {
1951
- country: "Latvia",
1952
- countryCode: "LV",
1953
- callingCode: "+371"
1954
- },
1955
- {
1956
- country: "Lebanon",
1957
- countryCode: "LB",
1958
- callingCode: "+961"
1959
- },
1960
- {
1961
- country: "Lesotho",
1962
- countryCode: "LS",
1963
- callingCode: "+266"
1964
- },
1965
- {
1966
- country: "Liberia",
1967
- countryCode: "LR",
1968
- callingCode: "+231"
1969
- },
1970
- {
1971
- country: "Libya",
1972
- countryCode: "LY",
1973
- callingCode: "+218"
1974
- },
1975
- {
1976
- country: "Liechtenstein",
1977
- countryCode: "LI",
1978
- callingCode: "+423"
1979
- },
1980
- {
1981
- country: "Lithuania",
1982
- countryCode: "LT",
1983
- callingCode: "+370"
1984
- },
1985
- {
1986
- country: "Luxembourg",
1987
- countryCode: "LU",
1988
- callingCode: "+352"
1989
- },
1990
- {
1991
- country: "Macao",
1992
- countryCode: "MO",
1993
- callingCode: "+853"
1994
- },
1995
- {
1996
- country: "Macedonia",
1997
- countryCode: "MK",
1998
- callingCode: "+389"
1999
- },
2000
- {
2001
- country: "Madagascar",
2002
- countryCode: "MG",
2003
- callingCode: "+261"
2004
- },
2005
- {
2006
- country: "Malawi",
2007
- countryCode: "MW",
2008
- callingCode: "+265"
2009
- },
2010
- {
2011
- country: "Malaysia",
2012
- countryCode: "MY",
2013
- callingCode: "+60"
2014
- },
2015
- {
2016
- country: "Maldives",
2017
- countryCode: "MV",
2018
- callingCode: "+960"
2019
- },
2020
- {
2021
- country: "Mali",
2022
- countryCode: "ML",
2023
- callingCode: "+223"
2024
- },
2025
- {
2026
- country: "Malta",
2027
- countryCode: "MT",
2028
- callingCode: "+356"
2029
- },
2030
- {
2031
- country: "Marshall Islands",
2032
- countryCode: "MH",
2033
- callingCode: "+692"
2034
- },
2035
- {
2036
- country: "Martinique",
2037
- countryCode: "MQ",
2038
- callingCode: "+596"
2039
- },
2040
- {
2041
- country: "Mauritania",
2042
- countryCode: "MR",
2043
- callingCode: "+222"
2044
- },
2045
- {
2046
- country: "Mauritius",
2047
- countryCode: "MU",
2048
- callingCode: "+230"
2049
- },
2050
- {
2051
- country: "Mayotte",
2052
- countryCode: "YT",
2053
- callingCode: "+262"
2054
- },
2055
- {
2056
- country: "Mexico",
2057
- countryCode: "MX",
2058
- callingCode: "+52"
2059
- },
2060
- {
2061
- country: "Micronesia",
2062
- countryCode: "FM",
2063
- callingCode: "+691"
2064
- },
2065
- {
2066
- country: "Moldova",
2067
- countryCode: "MD",
2068
- callingCode: "+373"
2069
- },
2070
- {
2071
- country: "Monaco",
2072
- countryCode: "MC",
2073
- callingCode: "+377"
2074
- },
2075
- {
2076
- country: "Mongolia",
2077
- countryCode: "MN",
2078
- callingCode: "+976"
2079
- },
2080
- {
2081
- country: "Montserrat",
2082
- countryCode: "MS",
2083
- callingCode: "+1664"
2084
- },
2085
- {
2086
- country: "Morocco",
2087
- countryCode: "MA",
2088
- callingCode: "+212"
2089
- },
2090
- {
2091
- country: "Mozambique",
2092
- countryCode: "MZ",
2093
- callingCode: "+258"
2094
- },
2095
- {
2096
- country: "Myanmar",
2097
- countryCode: "MM",
2098
- callingCode: "+95"
2099
- },
2100
- {
2101
- country: "Namibia",
2102
- countryCode: "NA",
2103
- callingCode: "+264"
2104
- },
2105
- {
2106
- country: "Nauru",
2107
- countryCode: "NR",
2108
- callingCode: "+674"
2109
- },
2110
- {
2111
- country: "Nepal",
2112
- countryCode: "NP",
2113
- callingCode: "+977"
2114
- },
2115
- {
2116
- country: "Netherlands",
2117
- countryCode: "NL",
2118
- callingCode: "+31"
2119
- },
2120
- {
2121
- country: "New Caledonia",
2122
- countryCode: "NC",
2123
- callingCode: "+687"
2124
- },
2125
- {
2126
- country: "New Zealand",
2127
- countryCode: "NZ",
2128
- callingCode: "+64"
2129
- },
2130
- {
2131
- country: "Nicaragua",
2132
- countryCode: "NI",
2133
- callingCode: "+505"
2134
- },
2135
- {
2136
- country: "Niger",
2137
- countryCode: "NE",
2138
- callingCode: "+227"
2139
- },
2140
- {
2141
- country: "Nigeria",
2142
- countryCode: "NG",
2143
- callingCode: "+234"
2144
- },
2145
- {
2146
- country: "Niue",
2147
- countryCode: "NU",
2148
- callingCode: "+683"
2149
- },
2150
- {
2151
- country: "Norfolk Island",
2152
- countryCode: "NF",
2153
- callingCode: "+672"
2154
- },
2155
- {
2156
- country: "North Korea",
2157
- countryCode: "KP",
2158
- callingCode: "+850"
2159
- },
2160
- {
2161
- country: "Northern Mariana Islands",
2162
- countryCode: "MP",
2163
- callingCode: "+1670"
2164
- },
2165
- {
2166
- country: "Norway",
2167
- countryCode: "NO",
2168
- callingCode: "+47"
2169
- },
2170
- {
2171
- country: "Oman",
2172
- countryCode: "OM",
2173
- callingCode: "+968"
2174
- },
2175
- {
2176
- country: "Pakistan",
2177
- countryCode: "PK",
2178
- callingCode: "+92"
2179
- },
2180
- {
2181
- country: "Palau",
2182
- countryCode: "PW",
2183
- callingCode: "+680"
2184
- },
2185
- {
2186
- country: "Palestinian Territory",
2187
- countryCode: "PS",
2188
- callingCode: "+970"
2189
- },
2190
- {
2191
- country: "Panama",
2192
- countryCode: "PA",
2193
- callingCode: "+507"
2194
- },
2195
- {
2196
- country: "Papua New Guinea",
2197
- countryCode: "PG",
2198
- callingCode: "+675"
2199
- },
2200
- {
2201
- country: "Paraguay",
2202
- countryCode: "PY",
2203
- callingCode: "+595"
2204
- },
2205
- {
2206
- country: "Peru",
2207
- countryCode: "PE",
2208
- callingCode: "+51"
2209
- },
2210
- {
2211
- country: "Philippines",
2212
- countryCode: "PH",
2213
- callingCode: "+63"
2214
- },
2215
- {
2216
- country: "Pitcairn",
2217
- countryCode: "PN",
2218
- callingCode: "+872"
2219
- },
2220
- {
2221
- country: "Poland",
2222
- countryCode: "PL",
2223
- callingCode: "+48"
2224
- },
2225
- {
2226
- country: "Portugal",
2227
- countryCode: "PT",
2228
- callingCode: "+351"
2229
- },
2230
- {
2231
- country: "Puerto Rico",
2232
- countryCode: "PR",
2233
- callingCode: "+1"
2234
- },
2235
- {
2236
- country: "Qatar",
2237
- countryCode: "QA",
2238
- callingCode: "+974"
2239
- },
2240
- {
2241
- country: "Republic of the Congo",
2242
- countryCode: "CG",
2243
- callingCode: "+242"
2244
- },
2245
- {
2246
- country: "Reunion",
2247
- countryCode: "RE",
2248
- callingCode: "+262"
2249
- },
2250
- {
2251
- country: "Romania",
2252
- countryCode: "RO",
2253
- callingCode: "+40"
2254
- },
2255
- {
2256
- country: "Russia",
2257
- countryCode: "RU",
2258
- callingCode: "+7"
2259
- },
2260
- {
2261
- country: "Rwanda",
2262
- countryCode: "RW",
2263
- callingCode: "+250"
2264
- },
2265
- {
2266
- country: "Saint Helena",
2267
- countryCode: "SH",
2268
- callingCode: "+290"
2269
- },
2270
- {
2271
- country: "Saint Kitts and Nevis",
2272
- countryCode: "KN",
2273
- callingCode: "+1869"
2274
- },
2275
- {
2276
- country: "Saint Lucia",
2277
- countryCode: "LC",
2278
- callingCode: "+1758"
2279
- },
2280
- {
2281
- country: "Saint Pierre and Miquelon",
2282
- countryCode: "PM",
2283
- callingCode: "+508"
2284
- },
2285
- {
2286
- country: "Saint Vincent and the Grenadines",
2287
- countryCode: "VC",
2288
- callingCode: "+1784"
2289
- },
2290
- {
2291
- country: "Samoa",
2292
- countryCode: "WS",
2293
- callingCode: "+685"
2294
- },
2295
- {
2296
- country: "San Marino",
2297
- countryCode: "SM",
2298
- callingCode: "+378"
2299
- },
2300
- {
2301
- country: "Sao Tome and Principe",
2302
- countryCode: "ST",
2303
- callingCode: "+239"
2304
- },
2305
- {
2306
- country: "Saudi Arabia",
2307
- countryCode: "SA",
2308
- callingCode: "+966"
2309
- },
2310
- {
2311
- country: "Senegal",
2312
- countryCode: "SN",
2313
- callingCode: "+221"
2314
- },
2315
- {
2316
- country: "Seychelles",
2317
- countryCode: "SC",
2318
- callingCode: "+248"
2319
- },
2320
- {
2321
- country: "Sierra Leone",
2322
- countryCode: "SL",
2323
- callingCode: "+232"
2324
- },
2325
- {
2326
- country: "Singapore",
2327
- countryCode: "SG",
2328
- callingCode: "+65"
2329
- },
2330
- {
2331
- country: "Slovakia",
2332
- countryCode: "SK",
2333
- callingCode: "+421"
2334
- },
2335
- {
2336
- country: "Slovenia",
2337
- countryCode: "SI",
2338
- callingCode: "+386"
2339
- },
2340
- {
2341
- country: "Solomon Islands",
2342
- countryCode: "SB",
2343
- callingCode: "+677"
2344
- },
2345
- {
2346
- country: "Somalia",
2347
- countryCode: "SO",
2348
- callingCode: "+252"
2349
- },
2350
- {
2351
- country: "South Africa",
2352
- countryCode: "ZA",
2353
- callingCode: "+27"
2354
- },
2355
- {
2356
- country: "South Georgia and the South Sandwich Islands",
2357
- countryCode: "GS",
2358
- callingCode: "+500"
2359
- },
2360
- {
2361
- country: "South Korea",
2362
- countryCode: "KR",
2363
- callingCode: "+82"
2364
- },
2365
- {
2366
- country: "Spain",
2367
- countryCode: "ES",
2368
- callingCode: "+34"
2369
- },
2370
- {
2371
- country: "Sri Lanka",
2372
- countryCode: "LK",
2373
- callingCode: "+94"
2374
- },
2375
- {
2376
- country: "Sudan",
2377
- countryCode: "SD",
2378
- callingCode: "+249"
2379
- },
2380
- {
2381
- country: "Suriname",
2382
- countryCode: "SR",
2383
- callingCode: "+597"
2384
- },
2385
- {
2386
- country: "Svalbard and Jan Mayen",
2387
- countryCode: "SJ",
2388
- callingCode: "+47"
2389
- },
2390
- {
2391
- country: "Swaziland",
2392
- countryCode: "SZ",
2393
- callingCode: "+268"
2394
- },
2395
- {
2396
- country: "Sweden",
2397
- countryCode: "SE",
2398
- callingCode: "+46"
2399
- },
2400
- {
2401
- country: "Switzerland",
2402
- countryCode: "CH",
2403
- callingCode: "+41"
2404
- },
2405
- {
2406
- country: "Syria",
2407
- countryCode: "SY",
2408
- callingCode: "+963"
2409
- },
2410
- {
2411
- country: "Taiwan",
2412
- countryCode: "TW",
2413
- callingCode: "+886"
2414
- },
2415
- {
2416
- country: "Tajikistan",
2417
- countryCode: "TJ",
2418
- callingCode: "+992"
2419
- },
2420
- {
2421
- country: "Tanzania",
2422
- countryCode: "TZ",
2423
- callingCode: "+255"
2424
- },
2425
- {
2426
- country: "Thailand",
2427
- countryCode: "TH",
2428
- callingCode: "+66"
2429
- },
2430
- {
2431
- country: "Togo",
2432
- countryCode: "TG",
2433
- callingCode: "+228"
2434
- },
2435
- {
2436
- country: "Tokelau",
2437
- countryCode: "TK",
2438
- callingCode: "+690"
2439
- },
2440
- {
2441
- country: "Tonga",
2442
- countryCode: "TO",
2443
- callingCode: "+676"
2444
- },
2445
- {
2446
- country: "Trinidad and Tobago",
2447
- countryCode: "TT",
2448
- callingCode: "+1868"
2449
- },
2450
- {
2451
- country: "Tunisia",
2452
- countryCode: "TN",
2453
- callingCode: "+216"
2454
- },
2455
- {
2456
- country: "Turkey",
2457
- countryCode: "TR",
2458
- callingCode: "+90"
2459
- },
2460
- {
2461
- country: "Turkmenistan",
2462
- countryCode: "TM",
2463
- callingCode: "+993"
2464
- },
2465
- {
2466
- country: "Turks and Caicos Islands",
2467
- countryCode: "TC",
2468
- callingCode: "+1649"
2469
- },
2470
- {
2471
- country: "Tuvalu",
2472
- countryCode: "TV",
2473
- callingCode: "+688"
2474
- },
2475
- {
2476
- country: "U.S. Virgin Islands",
2477
- countryCode: "VI",
2478
- callingCode: "+1340"
2479
- },
2480
- {
2481
- country: "Uganda",
2482
- countryCode: "UG",
2483
- callingCode: "+256"
2484
- },
2485
- {
2486
- country: "Ukraine",
2487
- countryCode: "UA",
2488
- callingCode: "+380"
2489
- },
2490
- {
2491
- country: "United Arab Emirates",
2492
- countryCode: "AE",
2493
- callingCode: "+971"
2494
- },
2495
- {
2496
- country: "United Kingdom",
2497
- countryCode: "GB",
2498
- callingCode: "+44"
2499
- },
2500
- {
2501
- country: "United States",
2502
- countryCode: "US",
2503
- callingCode: "+1"
2504
- },
2505
- {
2506
- country: "United States Minor Outlying Islands",
2507
- countryCode: "UM",
2508
- callingCode: "+1"
2509
- },
2510
- {
2511
- country: "Uruguay",
2512
- countryCode: "UY",
2513
- callingCode: "+598"
2514
- },
2515
- {
2516
- country: "Uzbekistan",
2517
- countryCode: "UZ",
2518
- callingCode: "+998"
2519
- },
2520
- {
2521
- country: "Vanuatu",
2522
- countryCode: "VU",
2523
- callingCode: "+678"
2524
- },
2525
- {
2526
- country: "Vatican",
2527
- countryCode: "VA",
2528
- callingCode: "+379"
2529
- },
2530
- {
2531
- country: "Venezuela",
2532
- countryCode: "VE",
2533
- callingCode: "+58"
2534
- },
2535
- {
2536
- country: "Vietnam",
2537
- countryCode: "VN",
2538
- callingCode: "+84"
2539
- },
2540
- {
2541
- country: "Wallis and Futuna",
2542
- countryCode: "WF",
2543
- callingCode: "+681"
2544
- },
2545
- {
2546
- country: "Western Sahara",
2547
- countryCode: "EH",
2548
- callingCode: "+212"
2549
- },
2550
- {
2551
- country: "Yemen",
2552
- countryCode: "YE",
2553
- callingCode: "+967"
2554
- },
2555
- {
2556
- country: "Zambia",
2557
- countryCode: "ZM",
2558
- callingCode: "+260"
2559
- },
2560
- {
2561
- country: "Zimbabwe",
2562
- countryCode: "ZW",
2563
- callingCode: "+263"
2564
- }
2565
- ];
2566
-
2567
- //Get default country function
2568
- var getDefaultCountry = function (code) {
2569
- var result = countryData.find(function (item) { return item.countryCode === code; });
2570
- return result;
2571
- };
2572
- //Get country data by search
2573
- var getBySearch = function (search, onlyCountry, excludeCountry) {
2574
- var countries = [];
2575
- if (excludeCountry && excludeCountry.length > 0) {
2576
- countries = countryData.filter(function (item) { return !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)); });
2577
- }
2578
- else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
2579
- countries = countryData.filter(function (item) { return onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode); });
2580
- }
2581
- else {
2582
- countries = countryData;
2583
- }
2584
- var result = countries.filter(function (item) {
2585
- var escapeRegExp = function (str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); };
2586
- var regex = new RegExp(escapeRegExp(search), "gi");
2587
- return item.country.match(regex);
2588
- });
2589
- return result;
2590
- };
2591
- //Get country data by filter
2592
- var getCountryByFilter = function (onlyCountry, excludeCountry, preferredCountry) {
2593
- var countries = [];
2594
- if (excludeCountry && excludeCountry.length > 0) {
2595
- countries = countryData.filter(function (item) { return !(excludeCountry === null || excludeCountry === void 0 ? void 0 : excludeCountry.includes(item.countryCode)); });
2596
- }
2597
- else if (onlyCountry && (onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.length) > 0) {
2598
- countries = countryData.filter(function (item) { return onlyCountry === null || onlyCountry === void 0 ? void 0 : onlyCountry.includes(item.countryCode); });
2599
- }
2600
- else {
2601
- countries = countryData;
2602
- }
2603
- var result = countries.sort(function (a, b) {
2604
- return (Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(b.countryCode)) - Number(preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.includes(a.countryCode)))
2605
- || ((preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(a.countryCode)) - (preferredCountry === null || preferredCountry === void 0 ? void 0 : preferredCountry.indexOf(b.countryCode)));
2606
- });
2607
- return result;
2608
- };
2609
-
2610
- //Click out side hook
2611
- function useOnClickOutside(ref, handler) {
2612
- React.useEffect(function () {
2613
- var listener = function (event) {
2614
- if (!ref.current || ref.current.contains(event.target)) {
2615
- return;
2616
- }
2617
- handler(event);
2618
- };
2619
- document.addEventListener("mousedown", listener);
2620
- document.addEventListener("touchstart", listener);
2621
- return function () {
2622
- document.removeEventListener("mousedown", listener);
2623
- document.removeEventListener("touchstart", listener);
2624
- };
2625
- }, [ref, handler]);
2626
- }
2627
-
2628
- //Component
2629
- var PhoneInput = function (_a) {
2630
- var placeholder = _a.placeholder, country = _a.country, onChange = _a.onChange, value = _a.value, iconComponent = _a.iconComponent, inputProps = _a.inputProps, onlyCountries = _a.onlyCountries, excludeCountries = _a.excludeCountries, preferredCountries = _a.preferredCountries, _b = _a.showDropdownIcon, showDropdownIcon = _b === void 0 ? true : _b, _c = _a.dialCodeInputField, dialCodeInputField = _c === void 0 ? false : _c, _d = _a.search, search = _d === void 0 ? true : _d, _e = _a.searchPlaceholder, searchPlaceholder = _e === void 0 ? "Search country" : _e, _f = _a.showSearchIcon, showSearchIcon = _f === void 0 ? true : _f, searchIconComponent = _a.searchIconComponent, searchProps = _a.searchProps, _g = _a.searchNotFound, searchNotFound = _g === void 0 ? "Not found" : _g;
2631
- //State
2632
- var _h = React.useState({}), selected = _h[0], setSelected = _h[1];
2633
- var _j = React.useState(false), isDropdown = _j[0], setDropdown = _j[1];
2634
- var _k = React.useState(value || ""), inputValue = _k[0], setInputValue = _k[1];
2635
- var _l = React.useState(countryData), countryDataInfo = _l[0], setCountryData = _l[1];
2636
- var _m = React.useState(0), cursor = _m[0], setCursor = _m[1];
2637
- //Ref
2638
- var dropdownRef = React.useRef(null);
2639
- var listRef = React.useRef(null);
2640
- //Custom Hook Call
2641
- useOnClickOutside(dropdownRef, function () { return setDropdown(false); });
2642
- //Handler
2643
- //---Input Onchange Handler//
2644
- var handleChange = function (e) {
2645
- var onlyNumber = e.target.value.replace(/\D/g, '');
2646
- if (dialCodeInputField) {
2647
- onChange("+" + onlyNumber);
2648
- setInputValue("+" + onlyNumber);
2649
- }
2650
- else {
2651
- setInputValue(onlyNumber);
2652
- onChange(selected.callingCode + onlyNumber);
2653
- }
2654
- };
2655
- //---Search Input Onchange Handler//
2656
- var onSearchHandler = function (e) {
2657
- var search = e.target.value;
2658
- setCountryData(getBySearch(search, onlyCountries, excludeCountries));
2659
- };
2660
- //---Set Selected Handler//
2661
- var handleSelected = function (item, i) {
2662
- if (dialCodeInputField) {
2663
- var result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, item.callingCode);
2664
- setInputValue(result.length > 0 ? result : item.callingCode);
2665
- onChange(result.length > 0 ? result : item.callingCode);
2666
- }
2667
- else {
2668
- onChange(item.callingCode + inputValue);
2669
- }
2670
- setSelected(item);
2671
- setDropdown(false);
2672
- setCursor(i);
2673
- };
2674
- //---Scroll To View Handler//
2675
- var scrollIntoView = function (position) {
2676
- var _a;
2677
- if (search) {
2678
- if (countryDataInfo.length > 0) {
2679
- (_a = listRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
2680
- top: position,
2681
- behavior: "smooth"
2682
- });
2683
- }
2684
- }
2685
- };
2686
- //---Keyboard Navigation//
2687
- var keyBoardNav = function (e) {
2688
- if (isDropdown) {
2689
- if (e.key === "ArrowDown") {
2690
- e.preventDefault();
2691
- setCursor(function (c) { return (c < countryDataInfo.length - 1 ? c + 1 : c); });
2692
- }
2693
- if (e.key === "ArrowUp") {
2694
- e.preventDefault();
2695
- setCursor(function (c) { return (c > 0 ? c - 1 : 0); });
2696
- }
2697
- if (e.key === "Escape") {
2698
- setDropdown(false);
2699
- }
2700
- if (e.key === "Enter" && cursor >= 0) {
2701
- setSelected(countryDataInfo[cursor]);
2702
- setDropdown(false);
2703
- }
2704
- }
2705
- };
2706
- //React Hook
2707
- //---Scroll to view hook//
2708
- React.useEffect(function () {
2709
- var _a;
2710
- if (cursor < 0 || cursor > countryDataInfo.length || !listRef) {
2711
- return function () {
2712
- };
2713
- }
2714
- if (isDropdown && listRef) {
2715
- if (countryDataInfo.length > 0) {
2716
- var listItems = Array.from((_a = listRef.current) === null || _a === void 0 ? void 0 : _a.children);
2717
- listItems[cursor] && scrollIntoView(listItems[cursor].offsetTop - 65);
2718
- }
2719
- }
2720
- }, [cursor]);
2721
- //---Dial Code Field Effect//
2722
- React.useMemo(function () {
2723
- if (dialCodeInputField) {
2724
- var result = inputValue === null || inputValue === void 0 ? void 0 : inputValue.replace(selected.callingCode, getDefaultCountry(country).callingCode);
2725
- console.log(result);
2726
- setInputValue(result.length > 0 ? result : getDefaultCountry(country).callingCode);
2727
- }
2728
- setSelected(getDefaultCountry(country));
2729
- }, [country, dialCodeInputField]);
2730
- //---Country search hook//
2731
- React.useMemo(function () {
2732
- setCountryData(getCountryByFilter(onlyCountries, excludeCountries, preferredCountries));
2733
- }, [onlyCountries, excludeCountries, preferredCountries]);
2734
- return (jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-container", onKeyDown: function (e) { return keyBoardNav(e); }, tabIndex: -1 }, { children: jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-main" }, { children: [jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-dropdown-container", ref: dropdownRef }, { children: [jsxRuntime.exports.jsxs("div", __assign({ onClick: function () { return setDropdown(!isDropdown); }, className: dialCodeInputField ? "simple-phone-input-sri198-dropdown-container-button dial" : "simple-phone-input-sri198-dropdown-container-button" }, { children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + selected.countryCode + ".svg", alt: selected.country, width: "20px" }), !dialCodeInputField &&
2735
- jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-selected-code" }, { children: selected.callingCode })), showDropdownIcon &&
2736
- jsxRuntime.exports.jsx("div", __assign({ className: isDropdown ? "simple-phone-input-sri198-dropdown-icon" : "simple-phone-input-sri198-dropdown-icon active" }, { children: iconComponent ? iconComponent : (jsxRuntime.exports.jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 24 24" }, { children: jsxRuntime.exports.jsx("path", { fill: "currentColor", d: "m7 10l5 5l5-5z" }) }))) }))] })), jsxRuntime.exports.jsxs("ul", __assign({ className: isDropdown ? "simple-phone-input-sri198-dropdown active" : "simple-phone-input-sri198-dropdown", ref: listRef }, { children: [search &&
2737
- jsxRuntime.exports.jsxs("div", __assign({ className: "simple-phone-input-sri198-search-container" }, { children: [jsxRuntime.exports.jsx("input", __assign({ placeholder: searchPlaceholder }, searchProps, { onChange: onSearchHandler })), showSearchIcon &&
2738
- jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-search-icon" }, { children: searchIconComponent !== null && searchIconComponent !== void 0 ? searchIconComponent : (jsxRuntime.exports.jsxs("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 48 48" }, { children: [jsxRuntime.exports.jsxs("g", __assign({ fill: "#616161" }, { children: [jsxRuntime.exports.jsx("path", { d: "m29.175 31.99l2.828-2.827l12.019 12.019l-2.828 2.827z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "16" })] })), jsxRuntime.exports.jsx("path", { fill: "#37474F", d: "m32.45 35.34l2.827-2.828l8.696 8.696l-2.828 2.828z" }), jsxRuntime.exports.jsx("circle", { cx: "20", cy: "20", r: "13", fill: "#64B5F6" }), jsxRuntime.exports.jsx("path", { fill: "#BBDEFB", d: "M26.9 14.2c-1.7-2-4.2-3.2-6.9-3.2s-5.2 1.2-6.9 3.2c-.4.4-.3 1.1.1 1.4c.4.4 1.1.3 1.4-.1C16 13.9 17.9 13 20 13s4 .9 5.4 2.5c.2.2.5.4.8.4c.2 0 .5-.1.6-.2c.4-.4.4-1.1.1-1.5z" })] }))) }))] })), countryDataInfo.length === 0 &&
2739
- jsxRuntime.exports.jsx("div", __assign({ className: "simple-phone-input-sri198-not-found" }, { children: searchNotFound })), countryDataInfo.map(function (item, i) { return (jsxRuntime.exports.jsxs("li", __assign({ onClick: function () { return handleSelected(item, i); }, className: i === cursor ? "active" : "" }, { children: [jsxRuntime.exports.jsx("img", { src: "https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/" + item.countryCode + ".svg", alt: item.country, width: "20px" }), jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-dropdown-text" }, { children: item.country })), jsxRuntime.exports.jsx("span", __assign({ className: "simple-phone-input-sri198-dropdown-country-code" }, { children: item.callingCode }))] }), i)); })] }))] })), jsxRuntime.exports.jsx("input", __assign({ className: "simple-phone-input-sri198-input", placeholder: placeholder, onChange: handleChange, type: "tel", onInput: function (e) {
2740
- if (dialCodeInputField) {
2741
- var oldVal = inputValue.slice(selected.callingCode.length);
2742
- if (e.target.value.startsWith(selected.callingCode)) {
2743
- e.target.value = e.target.value;
2744
- }
2745
- else {
2746
- e.target.value = selected.callingCode + oldVal;
2747
- }
2748
- }
2749
- }, onKeyDown: function (e) { return keyBoardNav(e); }, value: inputValue }, inputProps))] })) })));
2750
- };
2751
-
2752
- export { PhoneInput };
1
+ import{jsx as o,jsxs as n}from"react/jsx-runtime";import c from"react";var e=function(){return e=Object.assign||function(o){for(var n,c=1,e=arguments.length;c<e;c++)for(var r in n=arguments[c])Object.prototype.hasOwnProperty.call(n,r)&&(o[r]=n[r]);return o},e.apply(this,arguments)},r=[{country:"Afghanistan",countryCode:"AF",callingCode:"+93"},{country:"Albania",countryCode:"AL",callingCode:"+355"},{country:"Algeria",countryCode:"DZ",callingCode:"+213"},{country:"American Samoa",countryCode:"AS",callingCode:"+1684"},{country:"Andorra",countryCode:"AD",callingCode:"+376"},{country:"Angola",countryCode:"AO",callingCode:"+244"},{country:"Anguilla",countryCode:"AI",callingCode:"+1264"},{country:"Antarctica",countryCode:"AQ",callingCode:"+672"},{country:"Antigua and Barbuda",countryCode:"AG",callingCode:"+1268"},{country:"Argentina",countryCode:"AR",callingCode:"+54"},{country:"Armenia",countryCode:"AM",callingCode:"+374"},{country:"Aruba",countryCode:"AW",callingCode:"+297"},{country:"Australia",countryCode:"AU",callingCode:"+61"},{country:"Austria",countryCode:"AT",callingCode:"+43"},{country:"Azerbaijan",countryCode:"AZ",callingCode:"+994"},{country:"Bahamas",countryCode:"BS",callingCode:"+1242"},{country:"Bahrain",countryCode:"BH",callingCode:"+973"},{country:"Bangladesh",countryCode:"BD",callingCode:"+880"},{country:"Barbados",countryCode:"BB",callingCode:"+1246"},{country:"Belarus",countryCode:"BY",callingCode:"+375"},{country:"Belgium",countryCode:"BE",callingCode:"+32"},{country:"Belize",countryCode:"BZ",callingCode:"+501"},{country:"Benin",countryCode:"BJ",callingCode:"+229"},{country:"Bermuda",countryCode:"BM",callingCode:"+1441"},{country:"Bhutan",countryCode:"BT",callingCode:"+975"},{country:"Bolivia",countryCode:"BO",callingCode:"+591"},{country:"Bosnia and Herzegovina",countryCode:"BA",callingCode:"+387"},{country:"Botswana",countryCode:"BW",callingCode:"+267"},{country:"Bouvet Island",countryCode:"BV",callingCode:"+47"},{country:"Brazil",countryCode:"BR",callingCode:"+55"},{country:"British Indian Ocean Territory",countryCode:"IO",callingCode:"+246"},{country:"British Virgin Islands",countryCode:"VG",callingCode:"+1284"},{country:"Brunei",countryCode:"BN",callingCode:"+673"},{country:"Bulgaria",countryCode:"BG",callingCode:"+359"},{country:"Burkina Faso",countryCode:"BF",callingCode:"+226"},{country:"Burundi",countryCode:"BI",callingCode:"+257"},{country:"Cambodia",countryCode:"KH",callingCode:"+855"},{country:"Cameroon",countryCode:"CM",callingCode:"+237"},{country:"Canada",countryCode:"CA",callingCode:"+1"},{country:"Cape Verde",countryCode:"CV",callingCode:"+238"},{country:"Cayman Islands",countryCode:"KY",callingCode:"+1345"},{country:"Central African Republic",countryCode:"CF",callingCode:"+236"},{country:"Chad",countryCode:"TD",callingCode:"+235"},{country:"Chile",countryCode:"CL",callingCode:"+56"},{country:"China",countryCode:"CN",callingCode:"+86"},{country:"Christmas Island",countryCode:"CX",callingCode:"+61"},{country:"Cocos Islands",countryCode:"CC",callingCode:"+61"},{country:"Colombia",countryCode:"CO",callingCode:"+57"},{country:"Comoros",countryCode:"KM",callingCode:"+269"},{country:"Cook Islands",countryCode:"CK",callingCode:"+682"},{country:"Costa Rica",countryCode:"CR",callingCode:"+506"},{country:"Croatia",countryCode:"HR",callingCode:"+385"},{country:"Cuba",countryCode:"CU",callingCode:"+53"},{country:"Cyprus",countryCode:"CY",callingCode:"+357"},{country:"Czech Republic",countryCode:"CZ",callingCode:"+420"},{country:"Democratic Republic of the Congo",countryCode:"CD",callingCode:"+243"},{country:"Denmark",countryCode:"DK",callingCode:"+45"},{country:"Djibouti",countryCode:"DJ",callingCode:"+253"},{country:"Dominica",countryCode:"DM",callingCode:"+1767"},{country:"Dominican Republic",countryCode:"DO",callingCode:"+1"},{country:"East Timor",countryCode:"TL",callingCode:"+670"},{country:"Ecuador",countryCode:"EC",callingCode:"+593"},{country:"Egypt",countryCode:"EG",callingCode:"+20"},{country:"El Salvador",countryCode:"SV",callingCode:"+503"},{country:"Equatorial Guinea",countryCode:"GQ",callingCode:"+240"},{country:"Eritrea",countryCode:"ER",callingCode:"+291"},{country:"Estonia",countryCode:"EE",callingCode:"+372"},{country:"Ethiopia",countryCode:"ET",callingCode:"+251"},{country:"Falkland Islands",countryCode:"FK",callingCode:"+500"},{country:"Faroe Islands",countryCode:"FO",callingCode:"+298"},{country:"Fiji",countryCode:"FJ",callingCode:"+679"},{country:"Finland",countryCode:"FI",callingCode:"+358"},{country:"France",countryCode:"FR",callingCode:"+33"},{country:"French Guiana",countryCode:"GF",callingCode:"+594"},{country:"French Polynesia",countryCode:"PF",callingCode:"+689"},{country:"French Southern Territories",countryCode:"TF",callingCode:"+262"},{country:"Gabon",countryCode:"GA",callingCode:"+241"},{country:"Gambia",countryCode:"GM",callingCode:"+220"},{country:"Georgia",countryCode:"GE",callingCode:"+995"},{country:"Germany",countryCode:"DE",callingCode:"+49"},{country:"Ghana",countryCode:"GH",callingCode:"+233"},{country:"Gibraltar",countryCode:"GI",callingCode:"+350"},{country:"Greece",countryCode:"GR",callingCode:"+30"},{country:"Greenland",countryCode:"GL",callingCode:"+299"},{country:"Grenada",countryCode:"GD",callingCode:"+473"},{country:"Guadeloupe",countryCode:"GP",callingCode:"+590"},{country:"Guam",countryCode:"GU",callingCode:"+1671"},{country:"Guatemala",countryCode:"GT",callingCode:"+502"},{country:"Guinea",countryCode:"GN",callingCode:"+224"},{country:"Guinea-Bissau",countryCode:"GW",callingCode:"+245"},{country:"Guyana",countryCode:"GY",callingCode:"+592"},{country:"Haiti",countryCode:"HT",callingCode:"+509"},{country:"Honduras",countryCode:"HN",callingCode:"+504"},{country:"Hong Kong",countryCode:"HK",callingCode:"+852"},{country:"Hungary",countryCode:"HU",callingCode:"+36"},{country:"Iceland",countryCode:"IS",callingCode:"+354"},{country:"India",countryCode:"IN",callingCode:"+91"},{country:"Indonesia",countryCode:"ID",callingCode:"+62"},{country:"Iran",countryCode:"IR",callingCode:"+98"},{country:"Iraq",countryCode:"IQ",callingCode:"+964"},{country:"Ireland",countryCode:"IE",callingCode:"+353"},{country:"Israel",countryCode:"IL",callingCode:"+972"},{country:"Italy",countryCode:"IT",callingCode:"+39"},{country:"Ivory Coast",countryCode:"CI",callingCode:"+225"},{country:"Jamaica",countryCode:"JM",callingCode:"+1876"},{country:"Japan",countryCode:"JP",callingCode:"+81"},{country:"Jordan",countryCode:"JO",callingCode:"+962"},{country:"Kazakhstan",countryCode:"KZ",callingCode:"+7"},{country:"Kenya",countryCode:"KE",callingCode:"+254"},{country:"Kiribati",countryCode:"KI",callingCode:"+686"},{country:"Kuwait",countryCode:"KW",callingCode:"+965"},{country:"Kyrgyzstan",countryCode:"KG",callingCode:"+996"},{country:"Laos",countryCode:"LA",callingCode:"+856"},{country:"Latvia",countryCode:"LV",callingCode:"+371"},{country:"Lebanon",countryCode:"LB",callingCode:"+961"},{country:"Lesotho",countryCode:"LS",callingCode:"+266"},{country:"Liberia",countryCode:"LR",callingCode:"+231"},{country:"Libya",countryCode:"LY",callingCode:"+218"},{country:"Liechtenstein",countryCode:"LI",callingCode:"+423"},{country:"Lithuania",countryCode:"LT",callingCode:"+370"},{country:"Luxembourg",countryCode:"LU",callingCode:"+352"},{country:"Macao",countryCode:"MO",callingCode:"+853"},{country:"Macedonia",countryCode:"MK",callingCode:"+389"},{country:"Madagascar",countryCode:"MG",callingCode:"+261"},{country:"Malawi",countryCode:"MW",callingCode:"+265"},{country:"Malaysia",countryCode:"MY",callingCode:"+60"},{country:"Maldives",countryCode:"MV",callingCode:"+960"},{country:"Mali",countryCode:"ML",callingCode:"+223"},{country:"Malta",countryCode:"MT",callingCode:"+356"},{country:"Marshall Islands",countryCode:"MH",callingCode:"+692"},{country:"Martinique",countryCode:"MQ",callingCode:"+596"},{country:"Mauritania",countryCode:"MR",callingCode:"+222"},{country:"Mauritius",countryCode:"MU",callingCode:"+230"},{country:"Mayotte",countryCode:"YT",callingCode:"+262"},{country:"Mexico",countryCode:"MX",callingCode:"+52"},{country:"Micronesia",countryCode:"FM",callingCode:"+691"},{country:"Moldova",countryCode:"MD",callingCode:"+373"},{country:"Monaco",countryCode:"MC",callingCode:"+377"},{country:"Mongolia",countryCode:"MN",callingCode:"+976"},{country:"Montserrat",countryCode:"MS",callingCode:"+1664"},{country:"Morocco",countryCode:"MA",callingCode:"+212"},{country:"Mozambique",countryCode:"MZ",callingCode:"+258"},{country:"Myanmar",countryCode:"MM",callingCode:"+95"},{country:"Namibia",countryCode:"NA",callingCode:"+264"},{country:"Nauru",countryCode:"NR",callingCode:"+674"},{country:"Nepal",countryCode:"NP",callingCode:"+977"},{country:"Netherlands",countryCode:"NL",callingCode:"+31"},{country:"New Caledonia",countryCode:"NC",callingCode:"+687"},{country:"New Zealand",countryCode:"NZ",callingCode:"+64"},{country:"Nicaragua",countryCode:"NI",callingCode:"+505"},{country:"Niger",countryCode:"NE",callingCode:"+227"},{country:"Nigeria",countryCode:"NG",callingCode:"+234"},{country:"Niue",countryCode:"NU",callingCode:"+683"},{country:"Norfolk Island",countryCode:"NF",callingCode:"+672"},{country:"North Korea",countryCode:"KP",callingCode:"+850"},{country:"Northern Mariana Islands",countryCode:"MP",callingCode:"+1670"},{country:"Norway",countryCode:"NO",callingCode:"+47"},{country:"Oman",countryCode:"OM",callingCode:"+968"},{country:"Pakistan",countryCode:"PK",callingCode:"+92"},{country:"Palau",countryCode:"PW",callingCode:"+680"},{country:"Palestinian Territory",countryCode:"PS",callingCode:"+970"},{country:"Panama",countryCode:"PA",callingCode:"+507"},{country:"Papua New Guinea",countryCode:"PG",callingCode:"+675"},{country:"Paraguay",countryCode:"PY",callingCode:"+595"},{country:"Peru",countryCode:"PE",callingCode:"+51"},{country:"Philippines",countryCode:"PH",callingCode:"+63"},{country:"Pitcairn",countryCode:"PN",callingCode:"+872"},{country:"Poland",countryCode:"PL",callingCode:"+48"},{country:"Portugal",countryCode:"PT",callingCode:"+351"},{country:"Puerto Rico",countryCode:"PR",callingCode:"+1"},{country:"Qatar",countryCode:"QA",callingCode:"+974"},{country:"Republic of the Congo",countryCode:"CG",callingCode:"+242"},{country:"Reunion",countryCode:"RE",callingCode:"+262"},{country:"Romania",countryCode:"RO",callingCode:"+40"},{country:"Russia",countryCode:"RU",callingCode:"+7"},{country:"Rwanda",countryCode:"RW",callingCode:"+250"},{country:"Saint Helena",countryCode:"SH",callingCode:"+290"},{country:"Saint Kitts and Nevis",countryCode:"KN",callingCode:"+1869"},{country:"Saint Lucia",countryCode:"LC",callingCode:"+1758"},{country:"Saint Pierre and Miquelon",countryCode:"PM",callingCode:"+508"},{country:"Saint Vincent and the Grenadines",countryCode:"VC",callingCode:"+1784"},{country:"Samoa",countryCode:"WS",callingCode:"+685"},{country:"San Marino",countryCode:"SM",callingCode:"+378"},{country:"Sao Tome and Principe",countryCode:"ST",callingCode:"+239"},{country:"Saudi Arabia",countryCode:"SA",callingCode:"+966"},{country:"Senegal",countryCode:"SN",callingCode:"+221"},{country:"Seychelles",countryCode:"SC",callingCode:"+248"},{country:"Sierra Leone",countryCode:"SL",callingCode:"+232"},{country:"Singapore",countryCode:"SG",callingCode:"+65"},{country:"Slovakia",countryCode:"SK",callingCode:"+421"},{country:"Slovenia",countryCode:"SI",callingCode:"+386"},{country:"Solomon Islands",countryCode:"SB",callingCode:"+677"},{country:"Somalia",countryCode:"SO",callingCode:"+252"},{country:"South Africa",countryCode:"ZA",callingCode:"+27"},{country:"South Georgia and the South Sandwich Islands",countryCode:"GS",callingCode:"+500"},{country:"South Korea",countryCode:"KR",callingCode:"+82"},{country:"Spain",countryCode:"ES",callingCode:"+34"},{country:"Sri Lanka",countryCode:"LK",callingCode:"+94"},{country:"Sudan",countryCode:"SD",callingCode:"+249"},{country:"Suriname",countryCode:"SR",callingCode:"+597"},{country:"Svalbard and Jan Mayen",countryCode:"SJ",callingCode:"+47"},{country:"Swaziland",countryCode:"SZ",callingCode:"+268"},{country:"Sweden",countryCode:"SE",callingCode:"+46"},{country:"Switzerland",countryCode:"CH",callingCode:"+41"},{country:"Syria",countryCode:"SY",callingCode:"+963"},{country:"Taiwan",countryCode:"TW",callingCode:"+886"},{country:"Tajikistan",countryCode:"TJ",callingCode:"+992"},{country:"Tanzania",countryCode:"TZ",callingCode:"+255"},{country:"Thailand",countryCode:"TH",callingCode:"+66"},{country:"Togo",countryCode:"TG",callingCode:"+228"},{country:"Tokelau",countryCode:"TK",callingCode:"+690"},{country:"Tonga",countryCode:"TO",callingCode:"+676"},{country:"Trinidad and Tobago",countryCode:"TT",callingCode:"+1868"},{country:"Tunisia",countryCode:"TN",callingCode:"+216"},{country:"Turkey",countryCode:"TR",callingCode:"+90"},{country:"Turkmenistan",countryCode:"TM",callingCode:"+993"},{country:"Turks and Caicos Islands",countryCode:"TC",callingCode:"+1649"},{country:"Tuvalu",countryCode:"TV",callingCode:"+688"},{country:"U.S. Virgin Islands",countryCode:"VI",callingCode:"+1340"},{country:"Uganda",countryCode:"UG",callingCode:"+256"},{country:"Ukraine",countryCode:"UA",callingCode:"+380"},{country:"United Arab Emirates",countryCode:"AE",callingCode:"+971"},{country:"United Kingdom",countryCode:"GB",callingCode:"+44"},{country:"United States",countryCode:"US",callingCode:"+1"},{country:"United States Minor Outlying Islands",countryCode:"UM",callingCode:"+1"},{country:"Uruguay",countryCode:"UY",callingCode:"+598"},{country:"Uzbekistan",countryCode:"UZ",callingCode:"+998"},{country:"Vanuatu",countryCode:"VU",callingCode:"+678"},{country:"Vatican",countryCode:"VA",callingCode:"+379"},{country:"Venezuela",countryCode:"VE",callingCode:"+58"},{country:"Vietnam",countryCode:"VN",callingCode:"+84"},{country:"Wallis and Futuna",countryCode:"WF",callingCode:"+681"},{country:"Western Sahara",countryCode:"EH",callingCode:"+212"},{country:"Yemen",countryCode:"YE",callingCode:"+967"},{country:"Zambia",countryCode:"ZM",callingCode:"+260"},{country:"Zimbabwe",countryCode:"ZW",callingCode:"+263"}],t=function(o){return r.find((function(n){return n.countryCode===o}))};var l=function(l){var u,a,d=l.placeholder,i=l.country,C=l.onChange,y=l.value,g=l.iconComponent,s=l.inputProps,h=l.onlyCountries,p=l.excludeCountries,m=l.preferredCountries,v=l.showDropdownIcon,f=void 0===v||v,S=l.dialCodeInputField,M=void 0!==S&&S,N=l.search,B=void 0===N||N,A=l.searchPlaceholder,I=void 0===A?"Search country":A,G=l.showSearchIcon,w=void 0===G||G,T=l.searchIconComponent,b=l.searchProps,E=l.searchNotFound,P=void 0===E?"Not found":E,L=c.useState({}),R=L[0],K=L[1],F=c.useState(!1),D=F[0],U=F[1],k=c.useState(y||""),O=k[0],V=k[1],x=c.useState(r),H=x[0],z=x[1],Z=c.useState(0),W=Z[0],Y=Z[1],J=c.useRef(null),j=c.useRef(null);u=J,a=function(){return U(!1)},c.useEffect((function(){var o=function(o){u.current&&!u.current.contains(o.target)&&a(o)};return document.addEventListener("mousedown",o),document.addEventListener("touchstart",o),function(){document.removeEventListener("mousedown",o),document.removeEventListener("touchstart",o)}}),[u,a]);var Q=function(o){D&&("ArrowDown"===o.key&&(o.preventDefault(),Y((function(o){return o<H.length-1?o+1:o}))),"ArrowUp"===o.key&&(o.preventDefault(),Y((function(o){return o>0?o-1:0}))),"Escape"===o.key&&U(!1),"Enter"===o.key&&W>=0&&(K(H[W]),U(!1)))};return c.useEffect((function(){var o;if(W<0||W>H.length||!j)return function(){};if(D&&j&&H.length>0){var n=Array.from(null===(o=j.current)||void 0===o?void 0:o.children);n[W]&&function(o){var n;B&&H.length>0&&(null===(n=j.current)||void 0===n||n.scrollTo({top:o,behavior:"smooth"}))}(n[W].offsetTop-65)}}),[W]),c.useMemo((function(){if(M){var o=null==O?void 0:O.replace(R.callingCode,t(i).callingCode);console.log(o),V(o.length>0?o:t(i).callingCode)}K(t(i))}),[i,M]),c.useMemo((function(){var o,n,c;z((o=h,c=m,((n=p)&&n.length>0?r.filter((function(o){return!(null==n?void 0:n.includes(o.countryCode))})):o&&(null==o?void 0:o.length)>0?r.filter((function(n){return null==o?void 0:o.includes(n.countryCode)})):r).sort((function(o,n){return Number(null==c?void 0:c.includes(n.countryCode))-Number(null==c?void 0:c.includes(o.countryCode))||(null==c?void 0:c.indexOf(o.countryCode))-(null==c?void 0:c.indexOf(n.countryCode))}))))}),[h,p,m]),o("div",e({className:"simple-phone-input-sri198-container",onKeyDown:function(o){return Q(o)},tabIndex:-1},{children:n("div",e({className:"simple-phone-input-sri198-main"},{children:[n("div",e({className:"simple-phone-input-sri198-dropdown-container",ref:J},{children:[n("div",e({onClick:function(){return U(!D)},className:M?"simple-phone-input-sri198-dropdown-container-button dial":"simple-phone-input-sri198-dropdown-container-button"},{children:[o("img",{src:"https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/"+R.countryCode+".svg",alt:R.country,width:"20px"}),!M&&o("span",e({className:"simple-phone-input-sri198-selected-code"},{children:R.callingCode})),f&&o("div",e({className:D?"simple-phone-input-sri198-dropdown-icon":"simple-phone-input-sri198-dropdown-icon active"},{children:g||o("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 24 24"},{children:o("path",{fill:"currentColor",d:"m7 10l5 5l5-5z"})}))}))]})),n("ul",e({className:D?"simple-phone-input-sri198-dropdown active":"simple-phone-input-sri198-dropdown",ref:j},{children:[B&&n("div",e({className:"simple-phone-input-sri198-search-container"},{children:[o("input",e({placeholder:I},b,{onChange:function(o){var n=o.target.value;z(function(o,n,c){return(c&&c.length>0?r.filter((function(o){return!(null==c?void 0:c.includes(o.countryCode))})):n&&(null==n?void 0:n.length)>0?r.filter((function(o){return null==n?void 0:n.includes(o.countryCode)})):r).filter((function(n){var c=new RegExp(o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"gi");return n.country.match(c)}))}(n,h,p))}})),w&&o("div",e({className:"simple-phone-input-sri198-search-icon"},{children:null!=T?T:n("svg",e({xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid meet",viewBox:"0 0 48 48"},{children:[n("g",e({fill:"#616161"},{children:[o("path",{d:"m29.175 31.99l2.828-2.827l12.019 12.019l-2.828 2.827z"}),o("circle",{cx:"20",cy:"20",r:"16"})]})),o("path",{fill:"#37474F",d:"m32.45 35.34l2.827-2.828l8.696 8.696l-2.828 2.828z"}),o("circle",{cx:"20",cy:"20",r:"13",fill:"#64B5F6"}),o("path",{fill:"#BBDEFB",d:"M26.9 14.2c-1.7-2-4.2-3.2-6.9-3.2s-5.2 1.2-6.9 3.2c-.4.4-.3 1.1.1 1.4c.4.4 1.1.3 1.4-.1C16 13.9 17.9 13 20 13s4 .9 5.4 2.5c.2.2.5.4.8.4c.2 0 .5-.1.6-.2c.4-.4.4-1.1.1-1.5z"})]}))}))]})),0===H.length&&o("div",e({className:"simple-phone-input-sri198-not-found"},{children:P})),H.map((function(c,r){return n("li",e({onClick:function(){return function(o,n){if(M){var c=null==O?void 0:O.replace(R.callingCode,o.callingCode);V(c.length>0?c:o.callingCode),C(c.length>0?c:o.callingCode)}else C(o.callingCode+O);K(o),U(!1),Y(n)}(c,r)},className:r===W?"active":""},{children:[o("img",{src:"https://cdn.jsdelivr.net/gh/siamahnaf198/country-flags@main/img/"+c.countryCode+".svg",alt:c.country,width:"20px"}),o("span",e({className:"simple-phone-input-sri198-dropdown-text"},{children:c.country})),o("span",e({className:"simple-phone-input-sri198-dropdown-country-code"},{children:c.callingCode}))]}),r)}))]}))]})),o("input",e({className:"simple-phone-input-sri198-input",placeholder:d,onChange:function(o){var n=o.target.value.replace(/\D/g,"");M?(C("+"+n),V("+"+n)):(V(n),C(R.callingCode+n))},type:"tel",onInput:function(o){if(M){var n=O.slice(R.callingCode.length);o.target.value.startsWith(R.callingCode)?o.target.value=o.target.value:o.target.value=R.callingCode+n}},onKeyDown:function(o){return Q(o)},value:O},s))]}))}))};export{l as PhoneInput};
2753
2
  //# sourceMappingURL=index.js.map