@rubenpazch/autocomplete 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1139 @@
1
+ import require$$0, { useState, useRef, useMemo, useEffect } from 'react';
2
+
3
+ var jsxRuntime$1 = {exports: {}};
4
+
5
+ var reactJsxRuntime_production$1 = {};
6
+
7
+ /**
8
+ * @license React
9
+ * react-jsx-runtime.production.js
10
+ *
11
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
12
+ *
13
+ * This source code is licensed under the MIT license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+
17
+ var hasRequiredReactJsxRuntime_production$1;
18
+
19
+ function requireReactJsxRuntime_production$1 () {
20
+ if (hasRequiredReactJsxRuntime_production$1) return reactJsxRuntime_production$1;
21
+ hasRequiredReactJsxRuntime_production$1 = 1;
22
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
23
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
24
+ function jsxProd(type, config, maybeKey) {
25
+ var key = null;
26
+ void 0 !== maybeKey && (key = "" + maybeKey);
27
+ void 0 !== config.key && (key = "" + config.key);
28
+ if ("key" in config) {
29
+ maybeKey = {};
30
+ for (var propName in config)
31
+ "key" !== propName && (maybeKey[propName] = config[propName]);
32
+ } else maybeKey = config;
33
+ config = maybeKey.ref;
34
+ return {
35
+ $$typeof: REACT_ELEMENT_TYPE,
36
+ type: type,
37
+ key: key,
38
+ ref: void 0 !== config ? config : null,
39
+ props: maybeKey
40
+ };
41
+ }
42
+ reactJsxRuntime_production$1.Fragment = REACT_FRAGMENT_TYPE;
43
+ reactJsxRuntime_production$1.jsx = jsxProd;
44
+ reactJsxRuntime_production$1.jsxs = jsxProd;
45
+ return reactJsxRuntime_production$1;
46
+ }
47
+
48
+ var reactJsxRuntime_development$1 = {};
49
+
50
+ /**
51
+ * @license React
52
+ * react-jsx-runtime.development.js
53
+ *
54
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
55
+ *
56
+ * This source code is licensed under the MIT license found in the
57
+ * LICENSE file in the root directory of this source tree.
58
+ */
59
+
60
+ var hasRequiredReactJsxRuntime_development$1;
61
+
62
+ function requireReactJsxRuntime_development$1 () {
63
+ if (hasRequiredReactJsxRuntime_development$1) return reactJsxRuntime_development$1;
64
+ hasRequiredReactJsxRuntime_development$1 = 1;
65
+ "production" !== process.env.NODE_ENV &&
66
+ (function () {
67
+ function getComponentNameFromType(type) {
68
+ if (null == type) return null;
69
+ if ("function" === typeof type)
70
+ return type.$$typeof === REACT_CLIENT_REFERENCE
71
+ ? null
72
+ : type.displayName || type.name || null;
73
+ if ("string" === typeof type) return type;
74
+ switch (type) {
75
+ case REACT_FRAGMENT_TYPE:
76
+ return "Fragment";
77
+ case REACT_PROFILER_TYPE:
78
+ return "Profiler";
79
+ case REACT_STRICT_MODE_TYPE:
80
+ return "StrictMode";
81
+ case REACT_SUSPENSE_TYPE:
82
+ return "Suspense";
83
+ case REACT_SUSPENSE_LIST_TYPE:
84
+ return "SuspenseList";
85
+ case REACT_ACTIVITY_TYPE:
86
+ return "Activity";
87
+ }
88
+ if ("object" === typeof type)
89
+ switch (
90
+ ("number" === typeof type.tag &&
91
+ console.error(
92
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
93
+ ),
94
+ type.$$typeof)
95
+ ) {
96
+ case REACT_PORTAL_TYPE:
97
+ return "Portal";
98
+ case REACT_CONTEXT_TYPE:
99
+ return type.displayName || "Context";
100
+ case REACT_CONSUMER_TYPE:
101
+ return (type._context.displayName || "Context") + ".Consumer";
102
+ case REACT_FORWARD_REF_TYPE:
103
+ var innerType = type.render;
104
+ type = type.displayName;
105
+ type ||
106
+ ((type = innerType.displayName || innerType.name || ""),
107
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
108
+ return type;
109
+ case REACT_MEMO_TYPE:
110
+ return (
111
+ (innerType = type.displayName || null),
112
+ null !== innerType
113
+ ? innerType
114
+ : getComponentNameFromType(type.type) || "Memo"
115
+ );
116
+ case REACT_LAZY_TYPE:
117
+ innerType = type._payload;
118
+ type = type._init;
119
+ try {
120
+ return getComponentNameFromType(type(innerType));
121
+ } catch (x) {}
122
+ }
123
+ return null;
124
+ }
125
+ function testStringCoercion(value) {
126
+ return "" + value;
127
+ }
128
+ function checkKeyStringCoercion(value) {
129
+ try {
130
+ testStringCoercion(value);
131
+ var JSCompiler_inline_result = !1;
132
+ } catch (e) {
133
+ JSCompiler_inline_result = true;
134
+ }
135
+ if (JSCompiler_inline_result) {
136
+ JSCompiler_inline_result = console;
137
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
138
+ var JSCompiler_inline_result$jscomp$0 =
139
+ ("function" === typeof Symbol &&
140
+ Symbol.toStringTag &&
141
+ value[Symbol.toStringTag]) ||
142
+ value.constructor.name ||
143
+ "Object";
144
+ JSCompiler_temp_const.call(
145
+ JSCompiler_inline_result,
146
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
147
+ JSCompiler_inline_result$jscomp$0
148
+ );
149
+ return testStringCoercion(value);
150
+ }
151
+ }
152
+ function getTaskName(type) {
153
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
154
+ if (
155
+ "object" === typeof type &&
156
+ null !== type &&
157
+ type.$$typeof === REACT_LAZY_TYPE
158
+ )
159
+ return "<...>";
160
+ try {
161
+ var name = getComponentNameFromType(type);
162
+ return name ? "<" + name + ">" : "<...>";
163
+ } catch (x) {
164
+ return "<...>";
165
+ }
166
+ }
167
+ function getOwner() {
168
+ var dispatcher = ReactSharedInternals.A;
169
+ return null === dispatcher ? null : dispatcher.getOwner();
170
+ }
171
+ function UnknownOwner() {
172
+ return Error("react-stack-top-frame");
173
+ }
174
+ function hasValidKey(config) {
175
+ if (hasOwnProperty.call(config, "key")) {
176
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
177
+ if (getter && getter.isReactWarning) return false;
178
+ }
179
+ return void 0 !== config.key;
180
+ }
181
+ function defineKeyPropWarningGetter(props, displayName) {
182
+ function warnAboutAccessingKey() {
183
+ specialPropKeyWarningShown ||
184
+ ((specialPropKeyWarningShown = true),
185
+ console.error(
186
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
187
+ displayName
188
+ ));
189
+ }
190
+ warnAboutAccessingKey.isReactWarning = true;
191
+ Object.defineProperty(props, "key", {
192
+ get: warnAboutAccessingKey,
193
+ configurable: true
194
+ });
195
+ }
196
+ function elementRefGetterWithDeprecationWarning() {
197
+ var componentName = getComponentNameFromType(this.type);
198
+ didWarnAboutElementRef[componentName] ||
199
+ ((didWarnAboutElementRef[componentName] = true),
200
+ console.error(
201
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
202
+ ));
203
+ componentName = this.props.ref;
204
+ return void 0 !== componentName ? componentName : null;
205
+ }
206
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
207
+ var refProp = props.ref;
208
+ type = {
209
+ $$typeof: REACT_ELEMENT_TYPE,
210
+ type: type,
211
+ key: key,
212
+ props: props,
213
+ _owner: owner
214
+ };
215
+ null !== (void 0 !== refProp ? refProp : null)
216
+ ? Object.defineProperty(type, "ref", {
217
+ enumerable: false,
218
+ get: elementRefGetterWithDeprecationWarning
219
+ })
220
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
221
+ type._store = {};
222
+ Object.defineProperty(type._store, "validated", {
223
+ configurable: false,
224
+ enumerable: false,
225
+ writable: true,
226
+ value: 0
227
+ });
228
+ Object.defineProperty(type, "_debugInfo", {
229
+ configurable: false,
230
+ enumerable: false,
231
+ writable: true,
232
+ value: null
233
+ });
234
+ Object.defineProperty(type, "_debugStack", {
235
+ configurable: false,
236
+ enumerable: false,
237
+ writable: true,
238
+ value: debugStack
239
+ });
240
+ Object.defineProperty(type, "_debugTask", {
241
+ configurable: false,
242
+ enumerable: false,
243
+ writable: true,
244
+ value: debugTask
245
+ });
246
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
247
+ return type;
248
+ }
249
+ function jsxDEVImpl(
250
+ type,
251
+ config,
252
+ maybeKey,
253
+ isStaticChildren,
254
+ debugStack,
255
+ debugTask
256
+ ) {
257
+ var children = config.children;
258
+ if (void 0 !== children)
259
+ if (isStaticChildren)
260
+ if (isArrayImpl(children)) {
261
+ for (
262
+ isStaticChildren = 0;
263
+ isStaticChildren < children.length;
264
+ isStaticChildren++
265
+ )
266
+ validateChildKeys(children[isStaticChildren]);
267
+ Object.freeze && Object.freeze(children);
268
+ } else
269
+ console.error(
270
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
271
+ );
272
+ else validateChildKeys(children);
273
+ if (hasOwnProperty.call(config, "key")) {
274
+ children = getComponentNameFromType(type);
275
+ var keys = Object.keys(config).filter(function (k) {
276
+ return "key" !== k;
277
+ });
278
+ isStaticChildren =
279
+ 0 < keys.length
280
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
281
+ : "{key: someKey}";
282
+ didWarnAboutKeySpread[children + isStaticChildren] ||
283
+ ((keys =
284
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
285
+ console.error(
286
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
287
+ isStaticChildren,
288
+ children,
289
+ keys,
290
+ children
291
+ ),
292
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
293
+ }
294
+ children = null;
295
+ void 0 !== maybeKey &&
296
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
297
+ hasValidKey(config) &&
298
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
299
+ if ("key" in config) {
300
+ maybeKey = {};
301
+ for (var propName in config)
302
+ "key" !== propName && (maybeKey[propName] = config[propName]);
303
+ } else maybeKey = config;
304
+ children &&
305
+ defineKeyPropWarningGetter(
306
+ maybeKey,
307
+ "function" === typeof type
308
+ ? type.displayName || type.name || "Unknown"
309
+ : type
310
+ );
311
+ return ReactElement(
312
+ type,
313
+ children,
314
+ maybeKey,
315
+ getOwner(),
316
+ debugStack,
317
+ debugTask
318
+ );
319
+ }
320
+ function validateChildKeys(node) {
321
+ isValidElement(node)
322
+ ? node._store && (node._store.validated = 1)
323
+ : "object" === typeof node &&
324
+ null !== node &&
325
+ node.$$typeof === REACT_LAZY_TYPE &&
326
+ ("fulfilled" === node._payload.status
327
+ ? isValidElement(node._payload.value) &&
328
+ node._payload.value._store &&
329
+ (node._payload.value._store.validated = 1)
330
+ : node._store && (node._store.validated = 1));
331
+ }
332
+ function isValidElement(object) {
333
+ return (
334
+ "object" === typeof object &&
335
+ null !== object &&
336
+ object.$$typeof === REACT_ELEMENT_TYPE
337
+ );
338
+ }
339
+ var React = require$$0,
340
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
341
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
342
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
343
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
344
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
345
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
346
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
347
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
348
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
349
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
350
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
351
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
352
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
353
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
354
+ ReactSharedInternals =
355
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
356
+ hasOwnProperty = Object.prototype.hasOwnProperty,
357
+ isArrayImpl = Array.isArray,
358
+ createTask = console.createTask
359
+ ? console.createTask
360
+ : function () {
361
+ return null;
362
+ };
363
+ React = {
364
+ react_stack_bottom_frame: function (callStackForError) {
365
+ return callStackForError();
366
+ }
367
+ };
368
+ var specialPropKeyWarningShown;
369
+ var didWarnAboutElementRef = {};
370
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
371
+ React,
372
+ UnknownOwner
373
+ )();
374
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
375
+ var didWarnAboutKeySpread = {};
376
+ reactJsxRuntime_development$1.Fragment = REACT_FRAGMENT_TYPE;
377
+ reactJsxRuntime_development$1.jsx = function (type, config, maybeKey) {
378
+ var trackActualOwner =
379
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
380
+ return jsxDEVImpl(
381
+ type,
382
+ config,
383
+ maybeKey,
384
+ false,
385
+ trackActualOwner
386
+ ? Error("react-stack-top-frame")
387
+ : unknownOwnerDebugStack,
388
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
389
+ );
390
+ };
391
+ reactJsxRuntime_development$1.jsxs = function (type, config, maybeKey) {
392
+ var trackActualOwner =
393
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
394
+ return jsxDEVImpl(
395
+ type,
396
+ config,
397
+ maybeKey,
398
+ true,
399
+ trackActualOwner
400
+ ? Error("react-stack-top-frame")
401
+ : unknownOwnerDebugStack,
402
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
403
+ );
404
+ };
405
+ })();
406
+ return reactJsxRuntime_development$1;
407
+ }
408
+
409
+ var hasRequiredJsxRuntime$1;
410
+
411
+ function requireJsxRuntime$1 () {
412
+ if (hasRequiredJsxRuntime$1) return jsxRuntime$1.exports;
413
+ hasRequiredJsxRuntime$1 = 1;
414
+
415
+ if (process.env.NODE_ENV === 'production') {
416
+ jsxRuntime$1.exports = requireReactJsxRuntime_production$1();
417
+ } else {
418
+ jsxRuntime$1.exports = requireReactJsxRuntime_development$1();
419
+ }
420
+ return jsxRuntime$1.exports;
421
+ }
422
+
423
+ var jsxRuntimeExports$1 = requireJsxRuntime$1();
424
+
425
+ var r,s={exports:{}},o={};var t,l,n={};
426
+ /**
427
+ * @license React
428
+ * react-jsx-runtime.development.js
429
+ *
430
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
431
+ *
432
+ * This source code is licensed under the MIT license found in the
433
+ * LICENSE file in the root directory of this source tree.
434
+ */function a(){return t||(t=1,"production"!==process.env.NODE_ENV&&function(){function r(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===$?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case x:return "Fragment";case v:return "Profiler";case p:return "StrictMode";case k:return "Suspense";case y:return "SuspenseList";case C:return "Activity"}if("object"==typeof e)switch("number"==typeof e.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case u:return "Portal";case g:return e.displayName||"Context";case f:return (e._context.displayName||"Context")+".Consumer";case j:var s=e.render;return (e=e.displayName)||(e=""!==(e=s.displayName||s.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case L:return null!==(s=e.displayName||null)?s:r(e.type)||"Memo";case N:s=e._payload,e=e._init;try{return r(e(s))}catch(e){}}return null}function s(e){return ""+e}function o(e){try{s(e);var r=!1;}catch(e){r=true;}if(r){var o=(r=console).error,t="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",t),s(e)}}function t(e){if(e===x)return "<>";if("object"==typeof e&&null!==e&&e.$$typeof===N)return "<...>";try{var s=r(e);return s?"<"+s+">":"<...>"}catch(e){return "<...>"}}function l(){return Error("react-stack-top-frame")}function a(){var e=r(this.type);return W[e]||(W[e]=true,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(e=this.props.ref)?e:null}function i(e,s,t,l,n,i){var h,m=s.children;if(void 0!==m)if(l)if(M(m)){for(l=0;l<m.length;l++)c(m[l]);Object.freeze&&Object.freeze(m);}else console.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.");else c(m);if(z.call(s,"key")){m=r(e);var u=Object.keys(s).filter(function(e){return "key"!==e});l=0<u.length?"{key: someKey, "+u.join(": ..., ")+": ...}":"{key: someKey}",V[m+l]||(u=0<u.length?"{"+u.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',l,m,u,m),V[m+l]=true);}if(m=null,void 0!==t&&(o(t),m=""+t),function(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return false}return void 0!==e.key}(s)&&(o(s.key),m=""+s.key),"key"in s)for(var x in t={},s)"key"!==x&&(t[x]=s[x]);else t=s;return m&&function(e,r){function s(){d||(d=true,console.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://react.dev/link/special-props)",r));}s.isReactWarning=true,Object.defineProperty(e,"key",{get:s,configurable:true});}(t,"function"==typeof e?e.displayName||e.name||"Unknown":e),function(e,r,s,o,t,l){var n=s.ref;return e={$$typeof:w,type:e,key:r,props:s,_owner:o},null!==(void 0!==n?n:null)?Object.defineProperty(e,"ref",{enumerable:false,get:a}):Object.defineProperty(e,"ref",{enumerable:false,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:false,enumerable:false,writable:true,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:false,enumerable:false,writable:true,value:null}),Object.defineProperty(e,"_debugStack",{configurable:false,enumerable:false,writable:true,value:t}),Object.defineProperty(e,"_debugTask",{configurable:false,enumerable:false,writable:true,value:l}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(e,m,t,null===(h=b.A)?null:h.getOwner(),n,i)}function c(e){h(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===N&&("fulfilled"===e._payload.status?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1));}function h(e){return "object"==typeof e&&null!==e&&e.$$typeof===w}var d,m=require$$0,w=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),g=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),L=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),$=Symbol.for("react.client.reference"),b=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,M=Array.isArray,B=console.createTask?console.createTask:function(){return null},W={},_=(m={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(m,l)(),H=B(t(l)),V={};n.Fragment=x,n.jsx=function(e,r,s){var o=1e4>b.recentlyCreatedOwnerStacks++;return i(e,r,s,false,o?Error("react-stack-top-frame"):_,o?B(t(e)):H)},n.jsxs=function(e,r,s){var o=1e4>b.recentlyCreatedOwnerStacks++;return i(e,r,s,true,o?Error("react-stack-top-frame"):_,o?B(t(e)):H)};}()),n}var i=(l||(l=1,"production"===process.env.NODE_ENV?s.exports=function(){if(r)return o;r=1;var e=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function t(r,s,o){var t=null;if(void 0!==o&&(t=""+o),void 0!==s.key&&(t=""+s.key),"key"in s)for(var l in o={},s)"key"!==l&&(o[l]=s[l]);else o=s;return s=o.ref,{$$typeof:e,type:r,key:t,ref:void 0!==s?s:null,props:o}}return o.Fragment=s,o.jsx=t,o.jsxs=t,o}():s.exports=a()),s.exports);function m({className:e="",size:r="md"}){const s=`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`;return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:s,"aria-label":"Check",children:i.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}const u=({className:e="",size:r="md",color:s="currentColor",direction:o="down"})=>i.jsx("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${{up:"rotate-180",down:"",left:"rotate-90",right:"-rotate-90"}[o]} ${e}`,fill:"none",stroke:s,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M6 9l6 6 6-6"})});function g({className:e="",size:r="md",color:s="currentColor"}){return i.jsx("svg",{className:`${{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"}[r]} ${e}`,fill:"none",stroke:s,viewBox:"0 0 24 24",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}
435
+
436
+ var jsxRuntime = {exports: {}};
437
+
438
+ var reactJsxRuntime_production = {};
439
+
440
+ /**
441
+ * @license React
442
+ * react-jsx-runtime.production.js
443
+ *
444
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
445
+ *
446
+ * This source code is licensed under the MIT license found in the
447
+ * LICENSE file in the root directory of this source tree.
448
+ */
449
+
450
+ var hasRequiredReactJsxRuntime_production;
451
+
452
+ function requireReactJsxRuntime_production () {
453
+ if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
454
+ hasRequiredReactJsxRuntime_production = 1;
455
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
456
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
457
+ function jsxProd(type, config, maybeKey) {
458
+ var key = null;
459
+ void 0 !== maybeKey && (key = "" + maybeKey);
460
+ void 0 !== config.key && (key = "" + config.key);
461
+ if ("key" in config) {
462
+ maybeKey = {};
463
+ for (var propName in config)
464
+ "key" !== propName && (maybeKey[propName] = config[propName]);
465
+ } else maybeKey = config;
466
+ config = maybeKey.ref;
467
+ return {
468
+ $$typeof: REACT_ELEMENT_TYPE,
469
+ type: type,
470
+ key: key,
471
+ ref: void 0 !== config ? config : null,
472
+ props: maybeKey
473
+ };
474
+ }
475
+ reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
476
+ reactJsxRuntime_production.jsx = jsxProd;
477
+ reactJsxRuntime_production.jsxs = jsxProd;
478
+ return reactJsxRuntime_production;
479
+ }
480
+
481
+ var reactJsxRuntime_development = {};
482
+
483
+ /**
484
+ * @license React
485
+ * react-jsx-runtime.development.js
486
+ *
487
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
488
+ *
489
+ * This source code is licensed under the MIT license found in the
490
+ * LICENSE file in the root directory of this source tree.
491
+ */
492
+
493
+ var hasRequiredReactJsxRuntime_development;
494
+
495
+ function requireReactJsxRuntime_development () {
496
+ if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
497
+ hasRequiredReactJsxRuntime_development = 1;
498
+ "production" !== process.env.NODE_ENV &&
499
+ (function () {
500
+ function getComponentNameFromType(type) {
501
+ if (null == type) return null;
502
+ if ("function" === typeof type)
503
+ return type.$$typeof === REACT_CLIENT_REFERENCE
504
+ ? null
505
+ : type.displayName || type.name || null;
506
+ if ("string" === typeof type) return type;
507
+ switch (type) {
508
+ case REACT_FRAGMENT_TYPE:
509
+ return "Fragment";
510
+ case REACT_PROFILER_TYPE:
511
+ return "Profiler";
512
+ case REACT_STRICT_MODE_TYPE:
513
+ return "StrictMode";
514
+ case REACT_SUSPENSE_TYPE:
515
+ return "Suspense";
516
+ case REACT_SUSPENSE_LIST_TYPE:
517
+ return "SuspenseList";
518
+ case REACT_ACTIVITY_TYPE:
519
+ return "Activity";
520
+ }
521
+ if ("object" === typeof type)
522
+ switch (
523
+ ("number" === typeof type.tag &&
524
+ console.error(
525
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
526
+ ),
527
+ type.$$typeof)
528
+ ) {
529
+ case REACT_PORTAL_TYPE:
530
+ return "Portal";
531
+ case REACT_CONTEXT_TYPE:
532
+ return type.displayName || "Context";
533
+ case REACT_CONSUMER_TYPE:
534
+ return (type._context.displayName || "Context") + ".Consumer";
535
+ case REACT_FORWARD_REF_TYPE:
536
+ var innerType = type.render;
537
+ type = type.displayName;
538
+ type ||
539
+ ((type = innerType.displayName || innerType.name || ""),
540
+ (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
541
+ return type;
542
+ case REACT_MEMO_TYPE:
543
+ return (
544
+ (innerType = type.displayName || null),
545
+ null !== innerType
546
+ ? innerType
547
+ : getComponentNameFromType(type.type) || "Memo"
548
+ );
549
+ case REACT_LAZY_TYPE:
550
+ innerType = type._payload;
551
+ type = type._init;
552
+ try {
553
+ return getComponentNameFromType(type(innerType));
554
+ } catch (x) {}
555
+ }
556
+ return null;
557
+ }
558
+ function testStringCoercion(value) {
559
+ return "" + value;
560
+ }
561
+ function checkKeyStringCoercion(value) {
562
+ try {
563
+ testStringCoercion(value);
564
+ var JSCompiler_inline_result = !1;
565
+ } catch (e) {
566
+ JSCompiler_inline_result = true;
567
+ }
568
+ if (JSCompiler_inline_result) {
569
+ JSCompiler_inline_result = console;
570
+ var JSCompiler_temp_const = JSCompiler_inline_result.error;
571
+ var JSCompiler_inline_result$jscomp$0 =
572
+ ("function" === typeof Symbol &&
573
+ Symbol.toStringTag &&
574
+ value[Symbol.toStringTag]) ||
575
+ value.constructor.name ||
576
+ "Object";
577
+ JSCompiler_temp_const.call(
578
+ JSCompiler_inline_result,
579
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
580
+ JSCompiler_inline_result$jscomp$0
581
+ );
582
+ return testStringCoercion(value);
583
+ }
584
+ }
585
+ function getTaskName(type) {
586
+ if (type === REACT_FRAGMENT_TYPE) return "<>";
587
+ if (
588
+ "object" === typeof type &&
589
+ null !== type &&
590
+ type.$$typeof === REACT_LAZY_TYPE
591
+ )
592
+ return "<...>";
593
+ try {
594
+ var name = getComponentNameFromType(type);
595
+ return name ? "<" + name + ">" : "<...>";
596
+ } catch (x) {
597
+ return "<...>";
598
+ }
599
+ }
600
+ function getOwner() {
601
+ var dispatcher = ReactSharedInternals.A;
602
+ return null === dispatcher ? null : dispatcher.getOwner();
603
+ }
604
+ function UnknownOwner() {
605
+ return Error("react-stack-top-frame");
606
+ }
607
+ function hasValidKey(config) {
608
+ if (hasOwnProperty.call(config, "key")) {
609
+ var getter = Object.getOwnPropertyDescriptor(config, "key").get;
610
+ if (getter && getter.isReactWarning) return false;
611
+ }
612
+ return void 0 !== config.key;
613
+ }
614
+ function defineKeyPropWarningGetter(props, displayName) {
615
+ function warnAboutAccessingKey() {
616
+ specialPropKeyWarningShown ||
617
+ ((specialPropKeyWarningShown = true),
618
+ console.error(
619
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
620
+ displayName
621
+ ));
622
+ }
623
+ warnAboutAccessingKey.isReactWarning = true;
624
+ Object.defineProperty(props, "key", {
625
+ get: warnAboutAccessingKey,
626
+ configurable: true
627
+ });
628
+ }
629
+ function elementRefGetterWithDeprecationWarning() {
630
+ var componentName = getComponentNameFromType(this.type);
631
+ didWarnAboutElementRef[componentName] ||
632
+ ((didWarnAboutElementRef[componentName] = true),
633
+ console.error(
634
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
635
+ ));
636
+ componentName = this.props.ref;
637
+ return void 0 !== componentName ? componentName : null;
638
+ }
639
+ function ReactElement(type, key, props, owner, debugStack, debugTask) {
640
+ var refProp = props.ref;
641
+ type = {
642
+ $$typeof: REACT_ELEMENT_TYPE,
643
+ type: type,
644
+ key: key,
645
+ props: props,
646
+ _owner: owner
647
+ };
648
+ null !== (void 0 !== refProp ? refProp : null)
649
+ ? Object.defineProperty(type, "ref", {
650
+ enumerable: false,
651
+ get: elementRefGetterWithDeprecationWarning
652
+ })
653
+ : Object.defineProperty(type, "ref", { enumerable: false, value: null });
654
+ type._store = {};
655
+ Object.defineProperty(type._store, "validated", {
656
+ configurable: false,
657
+ enumerable: false,
658
+ writable: true,
659
+ value: 0
660
+ });
661
+ Object.defineProperty(type, "_debugInfo", {
662
+ configurable: false,
663
+ enumerable: false,
664
+ writable: true,
665
+ value: null
666
+ });
667
+ Object.defineProperty(type, "_debugStack", {
668
+ configurable: false,
669
+ enumerable: false,
670
+ writable: true,
671
+ value: debugStack
672
+ });
673
+ Object.defineProperty(type, "_debugTask", {
674
+ configurable: false,
675
+ enumerable: false,
676
+ writable: true,
677
+ value: debugTask
678
+ });
679
+ Object.freeze && (Object.freeze(type.props), Object.freeze(type));
680
+ return type;
681
+ }
682
+ function jsxDEVImpl(
683
+ type,
684
+ config,
685
+ maybeKey,
686
+ isStaticChildren,
687
+ debugStack,
688
+ debugTask
689
+ ) {
690
+ var children = config.children;
691
+ if (void 0 !== children)
692
+ if (isStaticChildren)
693
+ if (isArrayImpl(children)) {
694
+ for (
695
+ isStaticChildren = 0;
696
+ isStaticChildren < children.length;
697
+ isStaticChildren++
698
+ )
699
+ validateChildKeys(children[isStaticChildren]);
700
+ Object.freeze && Object.freeze(children);
701
+ } else
702
+ console.error(
703
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
704
+ );
705
+ else validateChildKeys(children);
706
+ if (hasOwnProperty.call(config, "key")) {
707
+ children = getComponentNameFromType(type);
708
+ var keys = Object.keys(config).filter(function (k) {
709
+ return "key" !== k;
710
+ });
711
+ isStaticChildren =
712
+ 0 < keys.length
713
+ ? "{key: someKey, " + keys.join(": ..., ") + ": ...}"
714
+ : "{key: someKey}";
715
+ didWarnAboutKeySpread[children + isStaticChildren] ||
716
+ ((keys =
717
+ 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}"),
718
+ console.error(
719
+ 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
720
+ isStaticChildren,
721
+ children,
722
+ keys,
723
+ children
724
+ ),
725
+ (didWarnAboutKeySpread[children + isStaticChildren] = true));
726
+ }
727
+ children = null;
728
+ void 0 !== maybeKey &&
729
+ (checkKeyStringCoercion(maybeKey), (children = "" + maybeKey));
730
+ hasValidKey(config) &&
731
+ (checkKeyStringCoercion(config.key), (children = "" + config.key));
732
+ if ("key" in config) {
733
+ maybeKey = {};
734
+ for (var propName in config)
735
+ "key" !== propName && (maybeKey[propName] = config[propName]);
736
+ } else maybeKey = config;
737
+ children &&
738
+ defineKeyPropWarningGetter(
739
+ maybeKey,
740
+ "function" === typeof type
741
+ ? type.displayName || type.name || "Unknown"
742
+ : type
743
+ );
744
+ return ReactElement(
745
+ type,
746
+ children,
747
+ maybeKey,
748
+ getOwner(),
749
+ debugStack,
750
+ debugTask
751
+ );
752
+ }
753
+ function validateChildKeys(node) {
754
+ isValidElement(node)
755
+ ? node._store && (node._store.validated = 1)
756
+ : "object" === typeof node &&
757
+ null !== node &&
758
+ node.$$typeof === REACT_LAZY_TYPE &&
759
+ ("fulfilled" === node._payload.status
760
+ ? isValidElement(node._payload.value) &&
761
+ node._payload.value._store &&
762
+ (node._payload.value._store.validated = 1)
763
+ : node._store && (node._store.validated = 1));
764
+ }
765
+ function isValidElement(object) {
766
+ return (
767
+ "object" === typeof object &&
768
+ null !== object &&
769
+ object.$$typeof === REACT_ELEMENT_TYPE
770
+ );
771
+ }
772
+ var React = require$$0,
773
+ REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
774
+ REACT_PORTAL_TYPE = Symbol.for("react.portal"),
775
+ REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
776
+ REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
777
+ REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
778
+ REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
779
+ REACT_CONTEXT_TYPE = Symbol.for("react.context"),
780
+ REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
781
+ REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
782
+ REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
783
+ REACT_MEMO_TYPE = Symbol.for("react.memo"),
784
+ REACT_LAZY_TYPE = Symbol.for("react.lazy"),
785
+ REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
786
+ REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
787
+ ReactSharedInternals =
788
+ React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
789
+ hasOwnProperty = Object.prototype.hasOwnProperty,
790
+ isArrayImpl = Array.isArray,
791
+ createTask = console.createTask
792
+ ? console.createTask
793
+ : function () {
794
+ return null;
795
+ };
796
+ React = {
797
+ react_stack_bottom_frame: function (callStackForError) {
798
+ return callStackForError();
799
+ }
800
+ };
801
+ var specialPropKeyWarningShown;
802
+ var didWarnAboutElementRef = {};
803
+ var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
804
+ React,
805
+ UnknownOwner
806
+ )();
807
+ var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
808
+ var didWarnAboutKeySpread = {};
809
+ reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
810
+ reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
811
+ var trackActualOwner =
812
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
813
+ return jsxDEVImpl(
814
+ type,
815
+ config,
816
+ maybeKey,
817
+ false,
818
+ trackActualOwner
819
+ ? Error("react-stack-top-frame")
820
+ : unknownOwnerDebugStack,
821
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
822
+ );
823
+ };
824
+ reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
825
+ var trackActualOwner =
826
+ 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
827
+ return jsxDEVImpl(
828
+ type,
829
+ config,
830
+ maybeKey,
831
+ true,
832
+ trackActualOwner
833
+ ? Error("react-stack-top-frame")
834
+ : unknownOwnerDebugStack,
835
+ trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
836
+ );
837
+ };
838
+ })();
839
+ return reactJsxRuntime_development;
840
+ }
841
+
842
+ var hasRequiredJsxRuntime;
843
+
844
+ function requireJsxRuntime () {
845
+ if (hasRequiredJsxRuntime) return jsxRuntime.exports;
846
+ hasRequiredJsxRuntime = 1;
847
+
848
+ if (process.env.NODE_ENV === 'production') {
849
+ jsxRuntime.exports = requireReactJsxRuntime_production();
850
+ } else {
851
+ jsxRuntime.exports = requireReactJsxRuntime_development();
852
+ }
853
+ return jsxRuntime.exports;
854
+ }
855
+
856
+ var jsxRuntimeExports = requireJsxRuntime();
857
+
858
+ /**
859
+ * LoadingSpinner component
860
+ * Displays a loading indicator with multiple style variants
861
+ *
862
+ * @param variant - 'spinner' (default circular spinner), 'dots' (three bouncing dots), 'pulse' (pulsing circle), 'ring' (rotating ring)
863
+ * @param inline - If true, removes centering and margins for inline use (e.g., in buttons or inputs)
864
+ * @param color - Color scheme: 'blue' (default), 'gray', 'white'
865
+ */
866
+ const LoadingSpinner = ({ message, size = "md", className = "", variant = "spinner", inline = false, color = "blue", }) => {
867
+ const sizeClasses = {
868
+ sm: "h-4 w-4",
869
+ md: "h-8 w-8",
870
+ lg: "h-12 w-12",
871
+ };
872
+ const colorClasses = {
873
+ blue: "border-blue-600",
874
+ gray: "border-gray-600",
875
+ white: "border-white",
876
+ };
877
+ const dotColorClasses = {
878
+ blue: "bg-blue-600",
879
+ gray: "bg-gray-600",
880
+ white: "bg-white",
881
+ };
882
+ const dotSizeClasses = {
883
+ sm: "h-1.5 w-1.5",
884
+ md: "h-2.5 w-2.5",
885
+ lg: "h-3.5 w-3.5",
886
+ };
887
+ // Spinner variant (circular border)
888
+ if (variant === "spinner") {
889
+ return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `animate-spin rounded-full border-2 ${colorClasses[color]} ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, style: {
890
+ borderTopColor: "transparent",
891
+ borderRightColor: "transparent",
892
+ } }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
893
+ }
894
+ // Dots variant (three bouncing dots)
895
+ if (variant === "dots") {
896
+ return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "flex gap-1" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `flex gap-1 ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "0ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "150ms" } }), jsxRuntimeExports.jsx("div", { className: `${dotSizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-bounce`, style: { animationDelay: "300ms" } })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
897
+ }
898
+ // Pulse variant (pulsing circle)
899
+ if (variant === "pulse") {
900
+ return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsx("div", { className: `${sizeClasses[size]} ${dotColorClasses[color]} rounded-full animate-pulse ${inline ? "" : "mx-auto mb-4"}` }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
901
+ }
902
+ // Ring variant (rotating ring with gradient)
903
+ if (variant === "ring") {
904
+ const ringColorMap = {
905
+ blue: "border-blue-600",
906
+ gray: "border-gray-600",
907
+ white: "border-white",
908
+ };
909
+ return (jsxRuntimeExports.jsx("div", { className: inline ? className : `flex justify-center items-center ${className}`, children: jsxRuntimeExports.jsxs("div", { className: inline ? "" : "text-center", children: [jsxRuntimeExports.jsxs("div", { className: `relative ${sizeClasses[size]} ${inline ? "" : "mx-auto mb-4"}`, children: [jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 ${colorClasses[color]} opacity-25` }), jsxRuntimeExports.jsx("div", { className: `absolute inset-0 rounded-full border-2 border-transparent ${ringColorMap[color]} animate-spin`, style: {
910
+ borderTopColor: "currentColor",
911
+ borderRightColor: "transparent",
912
+ borderBottomColor: "transparent",
913
+ borderLeftColor: "transparent",
914
+ } })] }), message && jsxRuntimeExports.jsx("p", { className: "text-gray-600 text-sm mt-2", children: message })] }) }));
915
+ }
916
+ return null;
917
+ };
918
+
919
+ // Helper function to highlight matching text
920
+ const highlightMatchText = (text, search, shouldHighlight = true) => {
921
+ if (!shouldHighlight || !search || !text)
922
+ return text;
923
+ const regex = new RegExp(`(${search.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`, "gi");
924
+ const parts = text.split(regex);
925
+ return (jsxRuntimeExports$1.jsx(jsxRuntimeExports$1.Fragment, { children: parts.map((part, index) => regex.test(part) ? (jsxRuntimeExports$1.jsx("mark", { className: "bg-yellow-200 font-semibold text-gray-900", children: part }, index)) : (jsxRuntimeExports$1.jsx("span", { children: part }, index))) }));
926
+ };
927
+ const Autocomplete = ({ label, value, onChange, options = [], placeholder = "Search or select...", error, warning, hint, required = false, disabled = false, loading = false, searchable = true, clearable = true, icon, className = "", maxHeight = "300px", onCreate, onSearch, readOnly = false, renderOption, onBlur, onFocus, createLabel = "Create", noResultsText = "No results found", loadingText = "Loading...", highlightMatch = true, minSearchLength = 0, debounceMs = 300, keepListOpen = false, position = "bottom", }) => {
928
+ const [isOpen, setIsOpen] = useState(false);
929
+ const [searchTerm, setSearchTerm] = useState("");
930
+ const [highlightedIndex, setHighlightedIndex] = useState(-1);
931
+ const [isFocused, setIsFocused] = useState(false);
932
+ const containerRef = useRef(null);
933
+ const inputRef = useRef(null);
934
+ const dropdownRef = useRef(null);
935
+ const optionRefs = useRef([]);
936
+ // Get selected option
937
+ const selectedOption = options.find((opt) => opt.value === value);
938
+ // Filter options based on search
939
+ const filteredOptions = useMemo(() => {
940
+ // When using external search (onSearch provided), don't filter locally
941
+ // The parent component is responsible for filtering via onSearch callback
942
+ if (onSearch)
943
+ return options;
944
+ if (!searchable || searchTerm.length < minSearchLength)
945
+ return options;
946
+ const lowerSearch = searchTerm.toLowerCase();
947
+ return options.filter((opt) => opt.label.toLowerCase().includes(lowerSearch) ||
948
+ opt.description?.toLowerCase().includes(lowerSearch));
949
+ }, [options, searchTerm, searchable, minSearchLength, onSearch]);
950
+ // Display value in input
951
+ const displayValue = useMemo(() => {
952
+ if (searchable && isOpen)
953
+ return searchTerm;
954
+ return selectedOption?.label || "";
955
+ }, [isOpen, searchable, searchTerm, selectedOption]);
956
+ // Call onSearch with debounce
957
+ useEffect(() => {
958
+ if (!onSearch || searchTerm.length < minSearchLength)
959
+ return;
960
+ const timer = setTimeout(() => {
961
+ onSearch(searchTerm);
962
+ }, debounceMs);
963
+ return () => clearTimeout(timer);
964
+ }, [searchTerm, onSearch, debounceMs, minSearchLength]);
965
+ // Close dropdown on outside click
966
+ useEffect(() => {
967
+ const handleClickOutside = (event) => {
968
+ if (containerRef.current &&
969
+ !containerRef.current.contains(event.target)) {
970
+ setIsOpen(false);
971
+ setIsFocused(false);
972
+ if (!keepListOpen) {
973
+ setSearchTerm("");
974
+ }
975
+ }
976
+ };
977
+ document.addEventListener("mousedown", handleClickOutside);
978
+ return () => document.removeEventListener("mousedown", handleClickOutside);
979
+ }, [keepListOpen]);
980
+ // Scroll highlighted option into view
981
+ useEffect(() => {
982
+ if (highlightedIndex >= 0 && optionRefs.current[highlightedIndex]) {
983
+ optionRefs.current[highlightedIndex]?.scrollIntoView({
984
+ block: "nearest",
985
+ behavior: "smooth",
986
+ });
987
+ }
988
+ }, [highlightedIndex]);
989
+ const handleInputChange = (e) => {
990
+ const newValue = e.target.value;
991
+ setSearchTerm(newValue);
992
+ if (!isOpen) {
993
+ setIsOpen(true);
994
+ }
995
+ setHighlightedIndex(-1);
996
+ };
997
+ const handleInputFocus = () => {
998
+ if (disabled || readOnly)
999
+ return;
1000
+ setIsFocused(true);
1001
+ setIsOpen(true);
1002
+ onFocus?.();
1003
+ };
1004
+ const handleInputBlur = () => {
1005
+ // Delay to allow click on dropdown
1006
+ setTimeout(() => {
1007
+ if (!containerRef.current?.contains(document.activeElement)) {
1008
+ setIsFocused(false);
1009
+ if (!keepListOpen) {
1010
+ setSearchTerm("");
1011
+ }
1012
+ onBlur?.();
1013
+ }
1014
+ }, 200);
1015
+ };
1016
+ const handleSelect = (option) => {
1017
+ if (option.disabled)
1018
+ return;
1019
+ onChange(option.value, option);
1020
+ setSearchTerm("");
1021
+ setHighlightedIndex(-1);
1022
+ if (!keepListOpen) {
1023
+ setIsOpen(false);
1024
+ }
1025
+ inputRef.current?.blur();
1026
+ };
1027
+ const handleClear = (e) => {
1028
+ e.stopPropagation();
1029
+ onChange(null);
1030
+ setSearchTerm("");
1031
+ setIsOpen(false);
1032
+ inputRef.current?.focus();
1033
+ };
1034
+ const handleToggle = () => {
1035
+ if (disabled || readOnly)
1036
+ return;
1037
+ const newIsOpen = !isOpen;
1038
+ setIsOpen(newIsOpen);
1039
+ if (newIsOpen) {
1040
+ inputRef.current?.focus();
1041
+ }
1042
+ };
1043
+ const handleKeyDown = (e) => {
1044
+ if (disabled || readOnly)
1045
+ return;
1046
+ switch (e.key) {
1047
+ case "ArrowDown":
1048
+ e.preventDefault();
1049
+ if (!isOpen) {
1050
+ setIsOpen(true);
1051
+ }
1052
+ else {
1053
+ setHighlightedIndex((prev) => prev < filteredOptions.length - 1 ? prev + 1 : prev);
1054
+ }
1055
+ break;
1056
+ case "ArrowUp":
1057
+ e.preventDefault();
1058
+ if (isOpen) {
1059
+ setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : -1));
1060
+ }
1061
+ break;
1062
+ case "Enter":
1063
+ e.preventDefault();
1064
+ if (isOpen &&
1065
+ highlightedIndex >= 0 &&
1066
+ filteredOptions[highlightedIndex]) {
1067
+ handleSelect(filteredOptions[highlightedIndex]);
1068
+ }
1069
+ else if (isOpen && onCreate && searchTerm.trim()) {
1070
+ onCreate(searchTerm.trim());
1071
+ setIsOpen(false);
1072
+ setSearchTerm("");
1073
+ }
1074
+ break;
1075
+ case "Escape":
1076
+ e.preventDefault();
1077
+ setIsOpen(false);
1078
+ setSearchTerm("");
1079
+ inputRef.current?.blur();
1080
+ break;
1081
+ case "Tab":
1082
+ setIsOpen(false);
1083
+ setSearchTerm("");
1084
+ break;
1085
+ }
1086
+ };
1087
+ const getBorderColor = () => {
1088
+ if (error) {
1089
+ return "border-red-500 focus:border-red-500 focus:ring-2 focus:ring-red-200";
1090
+ }
1091
+ if (warning) {
1092
+ return "border-yellow-500 focus:border-yellow-500 focus:ring-2 focus:ring-yellow-200";
1093
+ }
1094
+ if (isFocused) {
1095
+ return "border-blue-500 focus:ring-2 focus:ring-blue-200";
1096
+ }
1097
+ return "border-gray-300 hover:border-gray-400 focus:border-blue-500 focus:ring-2 focus:ring-blue-200";
1098
+ };
1099
+ return (jsxRuntimeExports$1.jsxs("div", { className: `flex flex-col gap-2 ${className}`, children: [label && (jsxRuntimeExports$1.jsxs("label", { className: "block text-sm font-medium text-gray-700", children: [label, required && jsxRuntimeExports$1.jsx("span", { className: "text-red-500 ml-1", children: "*" })] })), jsxRuntimeExports$1.jsxs("div", { ref: containerRef, className: "relative", children: [icon && (jsxRuntimeExports$1.jsx("div", { className: "absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 pointer-events-none flex items-center", children: icon })), jsxRuntimeExports$1.jsx("input", { ref: inputRef, type: "text", value: displayValue, onChange: handleInputChange, onFocus: handleInputFocus, onBlur: handleInputBlur, onKeyDown: handleKeyDown, placeholder: placeholder, disabled: disabled, readOnly: readOnly || !searchable, className: `
1100
+ w-full px-4 py-2 rounded-lg border-2 transition-all outline-none
1101
+ font-medium text-gray-900 placeholder-gray-400
1102
+ disabled:bg-gray-100 disabled:text-gray-500 disabled:cursor-not-allowed
1103
+ ${icon ? "pl-10" : ""}
1104
+ ${clearable && value ? "pr-20" : "pr-12"}
1105
+ ${getBorderColor()}
1106
+ ${readOnly ? "bg-gray-50 cursor-default" : ""}
1107
+ `, "data-testid": "autocomplete-input" }), jsxRuntimeExports$1.jsxs("div", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 flex items-center gap-2", children: [loading && jsxRuntimeExports$1.jsx(LoadingSpinner, { size: "sm", variant: "dots", inline: true }), clearable && value && !loading && !disabled && (jsxRuntimeExports$1.jsx("button", { type: "button", onClick: handleClear, className: "text-gray-400 hover:text-gray-600 transition-colors", "data-testid": "autocomplete-clear", "aria-label": "Clear selection", children: jsxRuntimeExports$1.jsx(g, { className: "w-4 h-4" }) })), jsxRuntimeExports$1.jsx("button", { type: "button", onClick: handleToggle, className: `text-gray-400 transition-all ${disabled || readOnly
1108
+ ? "cursor-not-allowed opacity-50"
1109
+ : "hover:text-gray-600"}`, disabled: disabled, "data-testid": "autocomplete-toggle", "aria-label": isOpen ? "Close dropdown" : "Open dropdown", children: jsxRuntimeExports$1.jsx(u, { className: `w-5 h-5 transition-transform duration-200 ${isOpen ? "rotate-180" : ""}` }) })] }), isOpen && !disabled && !readOnly && (jsxRuntimeExports$1.jsxs("div", { ref: dropdownRef, className: `
1110
+ absolute z-50 left-0 right-0 mt-1
1111
+ bg-white border-2 border-gray-200 rounded-lg shadow-lg
1112
+ overflow-hidden
1113
+ ${position === "top" ? "bottom-full mb-1" : "top-full"}
1114
+ `, style: { maxHeight }, "data-testid": "autocomplete-dropdown", children: [loading && filteredOptions.length === 0 && (jsxRuntimeExports$1.jsxs("div", { className: "px-4 py-3 text-center text-gray-500", children: [jsxRuntimeExports$1.jsx(LoadingSpinner, { size: "sm", variant: "spinner", className: "mx-auto" }), jsxRuntimeExports$1.jsx("span", { className: "block mt-2 text-sm", children: loadingText })] })), jsxRuntimeExports$1.jsx("div", { className: "overflow-y-auto max-h-full", children: !loading && filteredOptions.length > 0 && (jsxRuntimeExports$1.jsx(jsxRuntimeExports$1.Fragment, { children: filteredOptions.map((option, index) => {
1115
+ const isSelected = option.value === value;
1116
+ const isHighlighted = index === highlightedIndex;
1117
+ return (jsxRuntimeExports$1.jsx("div", { ref: (el) => {
1118
+ optionRefs.current[index] = el;
1119
+ }, onClick: () => handleSelect(option), onMouseEnter: () => setHighlightedIndex(index), className: `
1120
+ px-4 py-3 cursor-pointer transition-colors flex items-center justify-between
1121
+ ${option.disabled ? "opacity-50 cursor-not-allowed bg-gray-50" : ""}
1122
+ ${isHighlighted && !option.disabled ? "bg-blue-50" : ""}
1123
+ ${isSelected && !option.disabled ? "bg-blue-100" : ""}
1124
+ ${!isHighlighted && !isSelected && !option.disabled ? "hover:bg-gray-50" : ""}
1125
+ `, "data-testid": `autocomplete-option-${option.value}`, children: renderOption ? (renderOption(option, isSelected)) : (jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsxs("div", { className: "flex-1", children: [jsxRuntimeExports$1.jsx("div", { className: "font-medium text-gray-900", children: highlightMatchText(option.label, searchTerm, highlightMatch) }), option.description && (jsxRuntimeExports$1.jsx("div", { className: "text-xs text-gray-500 mt-0.5", children: option.description }))] }), isSelected && (jsxRuntimeExports$1.jsx(m, { className: "w-5 h-5 text-blue-600 flex-shrink-0" }))] })) }, option.value));
1126
+ }) })) }), onCreate && searchTerm && (jsxRuntimeExports$1.jsxs("div", { onClick: () => {
1127
+ onCreate(searchTerm.trim());
1128
+ setIsOpen(false);
1129
+ setSearchTerm("");
1130
+ }, className: `
1131
+ px-4 py-3 cursor-pointer
1132
+ flex items-center gap-2
1133
+ ${filteredOptions.length > 0 ? "border-t border-gray-200" : ""}
1134
+ transition-colors
1135
+ ${highlightedIndex === filteredOptions.length ? "bg-blue-50" : "hover:bg-gray-50"}
1136
+ `, "data-testid": "autocomplete-create", children: [jsxRuntimeExports$1.jsx("span", { className: "text-blue-600 font-medium", children: "+" }), jsxRuntimeExports$1.jsxs("span", { className: "text-gray-900", children: [createLabel, " \"", searchTerm, "\""] })] })), !loading && filteredOptions.length === 0 && !onCreate && (jsxRuntimeExports$1.jsx("div", { className: "px-4 py-3 text-center text-gray-500 text-sm", children: noResultsText }))] }))] }), hint && !error && !warning && (jsxRuntimeExports$1.jsx("p", { className: "text-xs text-gray-500", children: hint })), warning && !error && (jsxRuntimeExports$1.jsxs("p", { className: "text-xs text-yellow-600 flex items-center gap-1", children: [jsxRuntimeExports$1.jsx("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: jsxRuntimeExports$1.jsx("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }), warning] })), error && (jsxRuntimeExports$1.jsxs("p", { className: "text-xs text-red-600 flex items-center gap-1", children: [jsxRuntimeExports$1.jsx("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: jsxRuntimeExports$1.jsx("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }), error] }))] }));
1137
+ };
1138
+
1139
+ export { Autocomplete as default };