@starasia/date 1.0.1 → 1.0.2

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/date.es.js CHANGED
@@ -1,647 +1,6 @@
1
- import Ke, { useState as B, useRef as Q, useEffect as I, forwardRef as be } from "react";
2
- var ve = { exports: {} }, X = {};
3
- /**
4
- * @license React
5
- * react-jsx-runtime.production.min.js
6
- *
7
- * Copyright (c) Facebook, Inc. and its affiliates.
8
- *
9
- * This source code is licensed under the MIT license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- var Ue;
13
- function Sr() {
14
- if (Ue)
15
- return X;
16
- Ue = 1;
17
- var t = Ke, n = Symbol.for("react.element"), l = Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, u = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
18
- function b(j, f, a) {
19
- var E, w = {}, _ = null, S = null;
20
- a !== void 0 && (_ = "" + a), f.key !== void 0 && (_ = "" + f.key), f.ref !== void 0 && (S = f.ref);
21
- for (E in f)
22
- i.call(f, E) && !m.hasOwnProperty(E) && (w[E] = f[E]);
23
- if (j && j.defaultProps)
24
- for (E in f = j.defaultProps, f)
25
- w[E] === void 0 && (w[E] = f[E]);
26
- return { $$typeof: n, type: j, key: _, ref: S, props: w, _owner: u.current };
27
- }
28
- return X.Fragment = l, X.jsx = b, X.jsxs = b, X;
29
- }
30
- var Z = {};
31
- /**
32
- * @license React
33
- * react-jsx-runtime.development.js
34
- *
35
- * Copyright (c) Facebook, Inc. and its affiliates.
36
- *
37
- * This source code is licensed under the MIT license found in the
38
- * LICENSE file in the root directory of this source tree.
39
- */
40
- var ze;
41
- function Mr() {
42
- return ze || (ze = 1, process.env.NODE_ENV !== "production" && function() {
43
- var t = Ke, n = Symbol.for("react.element"), l = Symbol.for("react.portal"), i = Symbol.for("react.fragment"), u = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), b = Symbol.for("react.provider"), j = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), a = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), S = Symbol.for("react.offscreen"), v = Symbol.iterator, c = "@@iterator";
44
- function g(e) {
45
- if (e === null || typeof e != "object")
46
- return null;
47
- var r = v && e[v] || e[c];
48
- return typeof r == "function" ? r : null;
49
- }
50
- var d = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
- function p(e) {
52
- {
53
- for (var r = arguments.length, s = new Array(r > 1 ? r - 1 : 0), y = 1; y < r; y++)
54
- s[y - 1] = arguments[y];
55
- h("error", e, s);
56
- }
57
- }
58
- function h(e, r, s) {
59
- {
60
- var y = d.ReactDebugCurrentFrame, T = y.getStackAddendum();
61
- T !== "" && (r += "%s", s = s.concat([T]));
62
- var D = s.map(function(R) {
63
- return String(R);
64
- });
65
- D.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, D);
66
- }
67
- }
68
- var x = !1, Y = !1, $ = !1, C = !1, P = !1, we;
69
- we = Symbol.for("react.module.reference");
70
- function rr(e) {
71
- return !!(typeof e == "string" || typeof e == "function" || e === i || e === m || P || e === u || e === a || e === E || C || e === S || x || Y || $ || typeof e == "object" && e !== null && (e.$$typeof === _ || e.$$typeof === w || e.$$typeof === b || e.$$typeof === j || e.$$typeof === f || // This needs to include all possible module reference object
72
- // types supported by any Flight configuration anywhere since
73
- // we don't know which Flight build this will end up being used
74
- // with.
75
- e.$$typeof === we || e.getModuleId !== void 0));
76
- }
77
- function ar(e, r, s) {
78
- var y = e.displayName;
79
- if (y)
80
- return y;
81
- var T = r.displayName || r.name || "";
82
- return T !== "" ? s + "(" + T + ")" : s;
83
- }
84
- function xe(e) {
85
- return e.displayName || "Context";
86
- }
87
- function A(e) {
88
- if (e == null)
89
- return null;
90
- if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
- return e.displayName || e.name || null;
92
- if (typeof e == "string")
93
- return e;
94
- switch (e) {
95
- case i:
96
- return "Fragment";
97
- case l:
98
- return "Portal";
99
- case m:
100
- return "Profiler";
101
- case u:
102
- return "StrictMode";
103
- case a:
104
- return "Suspense";
105
- case E:
106
- return "SuspenseList";
107
- }
108
- if (typeof e == "object")
109
- switch (e.$$typeof) {
110
- case j:
111
- var r = e;
112
- return xe(r) + ".Consumer";
113
- case b:
114
- var s = e;
115
- return xe(s._context) + ".Provider";
116
- case f:
117
- return ar(e, e.render, "ForwardRef");
118
- case w:
119
- var y = e.displayName || null;
120
- return y !== null ? y : A(e.type) || "Memo";
121
- case _: {
122
- var T = e, D = T._payload, R = T._init;
123
- try {
124
- return A(R(D));
125
- } catch {
126
- return null;
127
- }
128
- }
129
- }
130
- return null;
131
- }
132
- var W = Object.assign, H = 0, Ee, je, Ce, ke, Re, _e, Te;
133
- function De() {
134
- }
135
- De.__reactDisabledLog = !0;
136
- function nr() {
137
- {
138
- if (H === 0) {
139
- Ee = console.log, je = console.info, Ce = console.warn, ke = console.error, Re = console.group, _e = console.groupCollapsed, Te = console.groupEnd;
140
- var e = {
141
- configurable: !0,
142
- enumerable: !0,
143
- value: De,
144
- writable: !0
145
- };
146
- Object.defineProperties(console, {
147
- info: e,
148
- log: e,
149
- warn: e,
150
- error: e,
151
- group: e,
152
- groupCollapsed: e,
153
- groupEnd: e
154
- });
155
- }
156
- H++;
157
- }
158
- }
159
- function tr() {
160
- {
161
- if (H--, H === 0) {
162
- var e = {
163
- configurable: !0,
164
- enumerable: !0,
165
- writable: !0
166
- };
167
- Object.defineProperties(console, {
168
- log: W({}, e, {
169
- value: Ee
170
- }),
171
- info: W({}, e, {
172
- value: je
173
- }),
174
- warn: W({}, e, {
175
- value: Ce
176
- }),
177
- error: W({}, e, {
178
- value: ke
179
- }),
180
- group: W({}, e, {
181
- value: Re
182
- }),
183
- groupCollapsed: W({}, e, {
184
- value: _e
185
- }),
186
- groupEnd: W({}, e, {
187
- value: Te
188
- })
189
- });
190
- }
191
- H < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
- }
193
- }
194
- var oe = d.ReactCurrentDispatcher, le;
195
- function ee(e, r, s) {
196
- {
197
- if (le === void 0)
198
- try {
199
- throw Error();
200
- } catch (T) {
201
- var y = T.stack.trim().match(/\n( *(at )?)/);
202
- le = y && y[1] || "";
203
- }
204
- return `
205
- ` + le + e;
206
- }
207
- }
208
- var ce = !1, re;
209
- {
210
- var sr = typeof WeakMap == "function" ? WeakMap : Map;
211
- re = new sr();
212
- }
213
- function Se(e, r) {
214
- if (!e || ce)
215
- return "";
216
- {
217
- var s = re.get(e);
218
- if (s !== void 0)
219
- return s;
220
- }
221
- var y;
222
- ce = !0;
223
- var T = Error.prepareStackTrace;
224
- Error.prepareStackTrace = void 0;
225
- var D;
226
- D = oe.current, oe.current = null, nr();
227
- try {
228
- if (r) {
229
- var R = function() {
230
- throw Error();
231
- };
232
- if (Object.defineProperty(R.prototype, "props", {
233
- set: function() {
234
- throw Error();
235
- }
236
- }), typeof Reflect == "object" && Reflect.construct) {
237
- try {
238
- Reflect.construct(R, []);
239
- } catch (N) {
240
- y = N;
241
- }
242
- Reflect.construct(e, [], R);
243
- } else {
244
- try {
245
- R.call();
246
- } catch (N) {
247
- y = N;
248
- }
249
- e.call(R.prototype);
250
- }
251
- } else {
252
- try {
253
- throw Error();
254
- } catch (N) {
255
- y = N;
256
- }
257
- e();
258
- }
259
- } catch (N) {
260
- if (N && y && typeof N.stack == "string") {
261
- for (var k = N.stack.split(`
262
- `), O = y.stack.split(`
263
- `), M = k.length - 1, F = O.length - 1; M >= 1 && F >= 0 && k[M] !== O[F]; )
264
- F--;
265
- for (; M >= 1 && F >= 0; M--, F--)
266
- if (k[M] !== O[F]) {
267
- if (M !== 1 || F !== 1)
268
- do
269
- if (M--, F--, F < 0 || k[M] !== O[F]) {
270
- var L = `
271
- ` + k[M].replace(" at new ", " at ");
272
- return e.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", e.displayName)), typeof e == "function" && re.set(e, L), L;
273
- }
274
- while (M >= 1 && F >= 0);
275
- break;
276
- }
277
- }
278
- } finally {
279
- ce = !1, oe.current = D, tr(), Error.prepareStackTrace = T;
280
- }
281
- var J = e ? e.displayName || e.name : "", V = J ? ee(J) : "";
282
- return typeof e == "function" && re.set(e, V), V;
283
- }
284
- function ir(e, r, s) {
285
- return Se(e, !1);
286
- }
287
- function or(e) {
288
- var r = e.prototype;
289
- return !!(r && r.isReactComponent);
290
- }
291
- function ae(e, r, s) {
292
- if (e == null)
293
- return "";
294
- if (typeof e == "function")
295
- return Se(e, or(e));
296
- if (typeof e == "string")
297
- return ee(e);
298
- switch (e) {
299
- case a:
300
- return ee("Suspense");
301
- case E:
302
- return ee("SuspenseList");
303
- }
304
- if (typeof e == "object")
305
- switch (e.$$typeof) {
306
- case f:
307
- return ir(e.render);
308
- case w:
309
- return ae(e.type, r, s);
310
- case _: {
311
- var y = e, T = y._payload, D = y._init;
312
- try {
313
- return ae(D(T), r, s);
314
- } catch {
315
- }
316
- }
317
- }
318
- return "";
319
- }
320
- var G = Object.prototype.hasOwnProperty, Me = {}, Fe = d.ReactDebugCurrentFrame;
321
- function ne(e) {
322
- if (e) {
323
- var r = e._owner, s = ae(e.type, e._source, r ? r.type : null);
324
- Fe.setExtraStackFrame(s);
325
- } else
326
- Fe.setExtraStackFrame(null);
327
- }
328
- function lr(e, r, s, y, T) {
329
- {
330
- var D = Function.call.bind(G);
331
- for (var R in e)
332
- if (D(e, R)) {
333
- var k = void 0;
334
- try {
335
- if (typeof e[R] != "function") {
336
- var O = Error((y || "React class") + ": " + s + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
- throw O.name = "Invariant Violation", O;
338
- }
339
- k = e[R](r, R, y, s, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
- } catch (M) {
341
- k = M;
342
- }
343
- k && !(k instanceof Error) && (ne(T), p("%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).", y || "React class", s, R, typeof k), ne(null)), k instanceof Error && !(k.message in Me) && (Me[k.message] = !0, ne(T), p("Failed %s type: %s", s, k.message), ne(null));
344
- }
345
- }
346
- }
347
- var cr = Array.isArray;
348
- function ue(e) {
349
- return cr(e);
350
- }
351
- function ur(e) {
352
- {
353
- var r = typeof Symbol == "function" && Symbol.toStringTag, s = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
- return s;
355
- }
356
- }
357
- function dr(e) {
358
- try {
359
- return $e(e), !1;
360
- } catch {
361
- return !0;
362
- }
363
- }
364
- function $e(e) {
365
- return "" + e;
366
- }
367
- function Ye(e) {
368
- if (dr(e))
369
- return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ur(e)), $e(e);
370
- }
371
- var K = d.ReactCurrentOwner, fr = {
372
- key: !0,
373
- ref: !0,
374
- __self: !0,
375
- __source: !0
376
- }, Oe, Pe, de;
377
- de = {};
378
- function hr(e) {
379
- if (G.call(e, "ref")) {
380
- var r = Object.getOwnPropertyDescriptor(e, "ref").get;
381
- if (r && r.isReactWarning)
382
- return !1;
383
- }
384
- return e.ref !== void 0;
385
- }
386
- function gr(e) {
387
- if (G.call(e, "key")) {
388
- var r = Object.getOwnPropertyDescriptor(e, "key").get;
389
- if (r && r.isReactWarning)
390
- return !1;
391
- }
392
- return e.key !== void 0;
393
- }
394
- function pr(e, r) {
395
- if (typeof e.ref == "string" && K.current && r && K.current.stateNode !== r) {
396
- var s = A(K.current.type);
397
- de[s] || (p('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', A(K.current.type), e.ref), de[s] = !0);
398
- }
399
- }
400
- function vr(e, r) {
401
- {
402
- var s = function() {
403
- Oe || (Oe = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
404
- };
405
- s.isReactWarning = !0, Object.defineProperty(e, "key", {
406
- get: s,
407
- configurable: !0
408
- });
409
- }
410
- }
411
- function yr(e, r) {
412
- {
413
- var s = function() {
414
- Pe || (Pe = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
415
- };
416
- s.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
- get: s,
418
- configurable: !0
419
- });
420
- }
421
- }
422
- var mr = function(e, r, s, y, T, D, R) {
423
- var k = {
424
- // This tag allows us to uniquely identify this as a React Element
425
- $$typeof: n,
426
- // Built-in properties that belong on the element
427
- type: e,
428
- key: r,
429
- ref: s,
430
- props: R,
431
- // Record the component responsible for creating this element.
432
- _owner: D
433
- };
434
- return k._store = {}, Object.defineProperty(k._store, "validated", {
435
- configurable: !1,
436
- enumerable: !1,
437
- writable: !0,
438
- value: !1
439
- }), Object.defineProperty(k, "_self", {
440
- configurable: !1,
441
- enumerable: !1,
442
- writable: !1,
443
- value: y
444
- }), Object.defineProperty(k, "_source", {
445
- configurable: !1,
446
- enumerable: !1,
447
- writable: !1,
448
- value: T
449
- }), Object.freeze && (Object.freeze(k.props), Object.freeze(k)), k;
450
- };
451
- function br(e, r, s, y, T) {
452
- {
453
- var D, R = {}, k = null, O = null;
454
- s !== void 0 && (Ye(s), k = "" + s), gr(r) && (Ye(r.key), k = "" + r.key), hr(r) && (O = r.ref, pr(r, T));
455
- for (D in r)
456
- G.call(r, D) && !fr.hasOwnProperty(D) && (R[D] = r[D]);
457
- if (e && e.defaultProps) {
458
- var M = e.defaultProps;
459
- for (D in M)
460
- R[D] === void 0 && (R[D] = M[D]);
461
- }
462
- if (k || O) {
463
- var F = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
- k && vr(R, F), O && yr(R, F);
465
- }
466
- return mr(e, k, O, T, y, K.current, R);
467
- }
468
- }
469
- var fe = d.ReactCurrentOwner, Ne = d.ReactDebugCurrentFrame;
470
- function z(e) {
471
- if (e) {
472
- var r = e._owner, s = ae(e.type, e._source, r ? r.type : null);
473
- Ne.setExtraStackFrame(s);
474
- } else
475
- Ne.setExtraStackFrame(null);
476
- }
477
- var he;
478
- he = !1;
479
- function ge(e) {
480
- return typeof e == "object" && e !== null && e.$$typeof === n;
481
- }
482
- function Ie() {
483
- {
484
- if (fe.current) {
485
- var e = A(fe.current.type);
486
- if (e)
487
- return `
488
-
489
- Check the render method of \`` + e + "`.";
490
- }
491
- return "";
492
- }
493
- }
494
- function wr(e) {
495
- {
496
- if (e !== void 0) {
497
- var r = e.fileName.replace(/^.*[\\\/]/, ""), s = e.lineNumber;
498
- return `
499
-
500
- Check your code at ` + r + ":" + s + ".";
501
- }
502
- return "";
503
- }
504
- }
505
- var Le = {};
506
- function xr(e) {
507
- {
508
- var r = Ie();
509
- if (!r) {
510
- var s = typeof e == "string" ? e : e.displayName || e.name;
511
- s && (r = `
512
-
513
- Check the top-level render call using <` + s + ">.");
514
- }
515
- return r;
516
- }
517
- }
518
- function Ae(e, r) {
519
- {
520
- if (!e._store || e._store.validated || e.key != null)
521
- return;
522
- e._store.validated = !0;
523
- var s = xr(r);
524
- if (Le[s])
525
- return;
526
- Le[s] = !0;
527
- var y = "";
528
- e && e._owner && e._owner !== fe.current && (y = " It was passed a child from " + A(e._owner.type) + "."), z(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', s, y), z(null);
529
- }
530
- }
531
- function We(e, r) {
532
- {
533
- if (typeof e != "object")
534
- return;
535
- if (ue(e))
536
- for (var s = 0; s < e.length; s++) {
537
- var y = e[s];
538
- ge(y) && Ae(y, r);
539
- }
540
- else if (ge(e))
541
- e._store && (e._store.validated = !0);
542
- else if (e) {
543
- var T = g(e);
544
- if (typeof T == "function" && T !== e.entries)
545
- for (var D = T.call(e), R; !(R = D.next()).done; )
546
- ge(R.value) && Ae(R.value, r);
547
- }
548
- }
549
- }
550
- function Er(e) {
551
- {
552
- var r = e.type;
553
- if (r == null || typeof r == "string")
554
- return;
555
- var s;
556
- if (typeof r == "function")
557
- s = r.propTypes;
558
- else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
559
- // Inner props are checked in the reconciler.
560
- r.$$typeof === w))
561
- s = r.propTypes;
562
- else
563
- return;
564
- if (s) {
565
- var y = A(r);
566
- lr(s, e.props, "prop", y, e);
567
- } else if (r.PropTypes !== void 0 && !he) {
568
- he = !0;
569
- var T = A(r);
570
- p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", T || "Unknown");
571
- }
572
- typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
- }
574
- }
575
- function jr(e) {
576
- {
577
- for (var r = Object.keys(e.props), s = 0; s < r.length; s++) {
578
- var y = r[s];
579
- if (y !== "children" && y !== "key") {
580
- z(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", y), z(null);
581
- break;
582
- }
583
- }
584
- e.ref !== null && (z(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
585
- }
586
- }
587
- var Ve = {};
588
- function Be(e, r, s, y, T, D) {
589
- {
590
- var R = rr(e);
591
- if (!R) {
592
- var k = "";
593
- (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (k += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
594
- var O = wr(T);
595
- O ? k += O : k += Ie();
596
- var M;
597
- e === null ? M = "null" : ue(e) ? M = "array" : e !== void 0 && e.$$typeof === n ? (M = "<" + (A(e.type) || "Unknown") + " />", k = " Did you accidentally export a JSX literal instead of a component?") : M = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", M, k);
598
- }
599
- var F = br(e, r, s, T, D);
600
- if (F == null)
601
- return F;
602
- if (R) {
603
- var L = r.children;
604
- if (L !== void 0)
605
- if (y)
606
- if (ue(L)) {
607
- for (var J = 0; J < L.length; J++)
608
- We(L[J], e);
609
- Object.freeze && Object.freeze(L);
610
- } else
611
- p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
612
- else
613
- We(L, e);
614
- }
615
- if (G.call(r, "key")) {
616
- var V = A(e), N = Object.keys(r).filter(function(Dr) {
617
- return Dr !== "key";
618
- }), pe = N.length > 0 ? "{key: someKey, " + N.join(": ..., ") + ": ...}" : "{key: someKey}";
619
- if (!Ve[V + pe]) {
620
- var Tr = N.length > 0 ? "{" + N.join(": ..., ") + ": ...}" : "{}";
621
- p(`A props object containing a "key" prop is being spread into JSX:
622
- let props = %s;
623
- <%s {...props} />
624
- React keys must be passed directly to JSX without using spread:
625
- let props = %s;
626
- <%s key={someKey} {...props} />`, pe, V, Tr, V), Ve[V + pe] = !0;
627
- }
628
- }
629
- return e === i ? jr(F) : Er(F), F;
630
- }
631
- }
632
- function Cr(e, r, s) {
633
- return Be(e, r, s, !0);
634
- }
635
- function kr(e, r, s) {
636
- return Be(e, r, s, !1);
637
- }
638
- var Rr = kr, _r = Cr;
639
- Z.Fragment = i, Z.jsx = Rr, Z.jsxs = _r;
640
- }()), Z;
641
- }
642
- process.env.NODE_ENV === "production" ? ve.exports = Sr() : ve.exports = Mr();
643
- var o = ve.exports;
644
- const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
1
+ import { jsxs as $, jsx as l, Fragment as R } from "react/jsx-runtime";
2
+ import { useState as F, useRef as E, useEffect as D, forwardRef as W } from "react";
3
+ const I = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
645
4
 
646
5
  * {
647
6
  margin: 0;
@@ -974,7 +333,7 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
974
333
  .starasia-calendar-input-container-warning {
975
334
  border-color: var(--starasia-ui-input-color-secondary-yellow) !important;
976
335
  }
977
- `, Xe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], U = [
336
+ `, A = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], N = [
978
337
  "January",
979
338
  "February",
980
339
  "March",
@@ -987,7 +346,7 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
987
346
  "October",
988
347
  "November",
989
348
  "December"
990
- ], Fr = [
349
+ ], G = [
991
350
  "Jan",
992
351
  "Feb",
993
352
  "Mar",
@@ -1001,47 +360,47 @@ const ie = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,w
1001
360
  "Nov",
1002
361
  "Dec"
1003
362
  ];
1004
- function Ze(t) {
1005
- const [n, l] = B(t), i = Q(null), u = (m) => {
1006
- i.current && !i.current.contains(m.target) && l(!1);
363
+ function J(n) {
364
+ const [a, t] = F(n), s = E(null), i = (g) => {
365
+ s.current && !s.current.contains(g.target) && t(!1);
1007
366
  };
1008
- return I(() => (document.addEventListener("click", u, !0), () => {
1009
- document.removeEventListener("click", u, !0);
1010
- }), []), { ref: i, isComponentVisible: n, setIsComponentVisible: l };
367
+ return D(() => (document.addEventListener("click", i, !0), () => {
368
+ document.removeEventListener("click", i, !0);
369
+ }), []), { ref: s, isComponentVisible: a, setIsComponentVisible: t };
1011
370
  }
1012
- const Je = "starasia-calendar-input-styles", $r = (t) => {
1013
- if (!document.getElementById(Je)) {
1014
- const n = document.createElement("style");
1015
- n.id = Je, n.textContent = t, document.head.appendChild(n);
371
+ const j = "starasia-calendar-input-styles", U = (n) => {
372
+ if (!document.getElementById(j)) {
373
+ const a = document.createElement("style");
374
+ a.id = j, a.textContent = n, document.head.appendChild(a);
1016
375
  }
1017
376
  };
1018
- $r(ie);
1019
- const te = (t) => {
1020
- if (t === "sm")
377
+ U(I);
378
+ const T = (n) => {
379
+ if (n === "sm")
1021
380
  return 16;
1022
- if (t === "md")
381
+ if (n === "md")
1023
382
  return 16;
1024
- if (t === "lg")
383
+ if (n === "lg")
1025
384
  return 20;
1026
- }, Yr = (t) => {
1027
- const { size: n = "md", status: l = "default", variant: i = "outline", ...u } = t, m = Q(null), b = () => {
1028
- m.current && u.onClick && (m.current.focus(), u.onClick(""));
385
+ }, K = (n) => {
386
+ const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = n, g = E(null), f = () => {
387
+ g.current && i.onClick && (g.current.focus(), i.onClick(""));
1029
388
  };
1030
- return /* @__PURE__ */ o.jsxs(
389
+ return /* @__PURE__ */ $(
1031
390
  "div",
1032
391
  {
1033
- className: `starasia-calendar-input-container starasia-calendar-input-${i} starasia-calendar-input-container-${l} ${n} `,
1034
- onClick: b,
392
+ className: `starasia-calendar-input-container starasia-calendar-input-${s} starasia-calendar-input-container-${t} ${a} `,
393
+ onClick: f,
1035
394
  children: [
1036
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ o.jsx(
395
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ l(
1037
396
  "svg",
1038
397
  {
1039
398
  xmlns: "http://www.w3.org/2000/svg",
1040
- width: te(n),
1041
- height: te(n),
399
+ width: T(a),
400
+ height: T(a),
1042
401
  viewBox: "0 0 20 20",
1043
402
  fill: "none",
1044
- children: /* @__PURE__ */ o.jsx(
403
+ children: /* @__PURE__ */ l(
1045
404
  "path",
1046
405
  {
1047
406
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -1053,25 +412,25 @@ const te = (t) => {
1053
412
  )
1054
413
  }
1055
414
  ) }),
1056
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ o.jsx(
415
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ l(
1057
416
  "input",
1058
417
  {
1059
418
  className: "starasia-calendar-input",
1060
- ...u,
1061
- disabled: l === "disable" ? !0 : u.disabled,
1062
- value: u.value,
1063
- ref: m
419
+ ...i,
420
+ disabled: t === "disable" ? !0 : i.disabled,
421
+ value: i.value,
422
+ ref: g
1064
423
  }
1065
424
  ) }),
1066
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ o.jsx(
425
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ l(
1067
426
  "svg",
1068
427
  {
1069
428
  xmlns: "http://www.w3.org/2000/svg",
1070
- width: te(n),
1071
- height: te(n),
429
+ width: T(a),
430
+ height: T(a),
1072
431
  viewBox: "0 0 20 20",
1073
432
  fill: "none",
1074
- children: /* @__PURE__ */ o.jsx(
433
+ children: /* @__PURE__ */ l(
1075
434
  "path",
1076
435
  {
1077
436
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1086,178 +445,178 @@ const te = (t) => {
1086
445
  ]
1087
446
  }
1088
447
  );
1089
- }, Or = ({
1090
- date: t,
1091
- setDate: n,
1092
- dateRange: l,
1093
- setDateRange: i,
1094
- onChange: u,
1095
- minDate: m,
1096
- maxDate: b,
1097
- input: j
448
+ }, Q = ({
449
+ date: n,
450
+ setDate: a,
451
+ dateRange: t,
452
+ setDateRange: s,
453
+ onChange: i,
454
+ minDate: g,
455
+ maxDate: f,
456
+ input: v
1098
457
  }) => {
1099
- var v, c, g;
1100
- let f = new Date(t.getFullYear(), t.getMonth(), 1), a = f.getDay(), E = [];
1101
- const w = t.getMonth();
458
+ var u, r, c;
459
+ let h = new Date(n.getFullYear(), n.getMonth(), 1), e = h.getDay(), w = [];
460
+ const b = n.getMonth();
1102
461
  for (let d = 0; d < 42; d++) {
1103
- d === 0 && a === 0 ? f.setDate(f.getDate() - 7) : d === 0 ? f.setDate(
1104
- f.getDate() + (d - a)
1105
- ) : f.setDate(f.getDate() + 1);
1106
- let p = {
1107
- currentMonth: f.getMonth() === w,
1108
- date: new Date(f),
1109
- month: f.getMonth(),
1110
- number: f.getDate(),
1111
- selected: f.toDateString() === ((v = l.from) == null ? void 0 : v.toDateString()) || f.toDateString() === (((c = l.to) == null ? void 0 : c.toDateString()) || ((g = l.from) == null ? void 0 : g.toDateString())),
1112
- year: f.getFullYear(),
1113
- isDisabled: m && f < m || b && f > b
462
+ d === 0 && e === 0 ? h.setDate(h.getDate() - 7) : d === 0 ? h.setDate(
463
+ h.getDate() + (d - e)
464
+ ) : h.setDate(h.getDate() + 1);
465
+ let y = {
466
+ currentMonth: h.getMonth() === b,
467
+ date: new Date(h),
468
+ month: h.getMonth(),
469
+ number: h.getDate(),
470
+ selected: h.toDateString() === ((u = t.from) == null ? void 0 : u.toDateString()) || h.toDateString() === (((r = t.to) == null ? void 0 : r.toDateString()) || ((c = t.from) == null ? void 0 : c.toDateString())),
471
+ year: h.getFullYear(),
472
+ isDisabled: g && h < g || f && h > f
1114
473
  };
1115
- E.push(p);
474
+ w.push(y);
1116
475
  }
1117
- const _ = (d) => {
1118
- n(d);
1119
- }, S = (d) => {
1120
- var h;
1121
- let p = { ...l };
1122
- if (p.from && p.to)
1123
- p = { from: d, to: null };
476
+ const k = (d) => {
477
+ a(d);
478
+ }, M = (d) => {
479
+ var o;
480
+ let y = { ...t };
481
+ if (y.from && y.to)
482
+ y = { from: d, to: null };
1124
483
  else {
1125
- const x = ((h = p.from) == null ? void 0 : h.getTime()) || 0;
1126
- d.getTime() > x ? p = { from: p.from, to: d } : p = { from: d, to: p.from };
484
+ const p = ((o = y.from) == null ? void 0 : o.getTime()) || 0;
485
+ d.getTime() > p ? y = { from: y.from, to: d } : y = { from: d, to: y.from };
1127
486
  }
1128
- i(p), u(p);
487
+ s(y), i(y);
1129
488
  };
1130
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-days-preivew", children: [
1131
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-name-preivew", children: Xe.map((d, p) => /* @__PURE__ */ o.jsx("p", { children: d }, p)) }),
1132
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-number-preivew", children: E.map((d, p) => {
1133
- var Y;
1134
- const h = d.date.getTime() > l.from.getTime() && d.date.getTime() < (((Y = l.to) == null ? void 0 : Y.getTime()) || l.from.getTime()), x = d.isDisabled;
1135
- return /* @__PURE__ */ o.jsx(
489
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-days-preivew", children: [
490
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-name-preivew", children: A.map((d, y) => /* @__PURE__ */ l("p", { children: d }, y)) }),
491
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-number-preivew", children: w.map((d, y) => {
492
+ var C;
493
+ const o = d.date.getTime() > t.from.getTime() && d.date.getTime() < (((C = t.to) == null ? void 0 : C.getTime()) || t.from.getTime()), p = d.isDisabled;
494
+ return /* @__PURE__ */ l(
1136
495
  "p",
1137
496
  {
1138
497
  className: `${d.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${d.selected ? "starasia-calendar-days-active" : ""}`,
1139
498
  style: {
1140
- backgroundColor: h ? "rgba(100, 181, 246, 0.1)" : "",
1141
- pointerEvents: x ? "none" : void 0,
1142
- cursor: x ? "not-allowed" : "pointer",
1143
- color: x ? "#ccc" : h ? "#b0b0b0" : "",
1144
- ...j ? {} : { width: "100%" }
499
+ backgroundColor: o ? "rgba(100, 181, 246, 0.1)" : "",
500
+ pointerEvents: p ? "none" : void 0,
501
+ cursor: p ? "not-allowed" : "pointer",
502
+ color: p ? "#ccc" : o ? "#b0b0b0" : "",
503
+ ...v ? {} : { width: "100%" }
1145
504
  },
1146
505
  onClick: () => {
1147
- x || (_(d.date), S(d.date));
506
+ p || (k(d.date), M(d.date));
1148
507
  },
1149
508
  children: d.number
1150
509
  },
1151
- p
510
+ y
1152
511
  );
1153
512
  }) })
1154
513
  ] });
1155
- }, Pr = ({
1156
- date: t,
1157
- setDate: n,
1158
- filter: l,
1159
- setViews: i,
1160
- dateRange: u,
1161
- setDateRange: m,
1162
- onChange: b,
1163
- minDate: j,
1164
- maxDate: f,
1165
- input: a
514
+ }, X = ({
515
+ date: n,
516
+ setDate: a,
517
+ filter: t,
518
+ setViews: s,
519
+ dateRange: i,
520
+ setDateRange: g,
521
+ onChange: f,
522
+ minDate: v,
523
+ maxDate: h,
524
+ input: e
1166
525
  }) => {
1167
- const E = u.from.getFullYear(), w = t.getFullYear(), _ = (v) => {
1168
- l ? (S(v), n(v)) : (i("days"), n(v));
1169
- }, S = (v) => {
1170
- var g;
1171
- let c = { ...u };
1172
- if (c.from && c.to)
1173
- c = { from: v, to: null };
526
+ const w = i.from.getFullYear(), b = n.getFullYear(), k = (u) => {
527
+ t ? (M(u), a(u)) : (s("days"), a(u));
528
+ }, M = (u) => {
529
+ var c;
530
+ let r = { ...i };
531
+ if (r.from && r.to)
532
+ r = { from: u, to: null };
1174
533
  else {
1175
- const d = ((g = c.from) == null ? void 0 : g.getTime()) || 0;
1176
- v.getTime() > d ? c = { from: c.from, to: v } : c = { from: v, to: c.from };
534
+ const d = ((c = r.from) == null ? void 0 : c.getTime()) || 0;
535
+ u.getTime() > d ? r = { from: r.from, to: u } : r = { from: u, to: r.from };
1177
536
  }
1178
- m(c), b(c);
537
+ g(r), f(r);
1179
538
  };
1180
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-months-preview", children: U.map((v, c) => {
1181
- var p, h, x;
1182
- const g = new Date(w, c).getTime() > u.from.getTime() && new Date(w, c).getTime() < (((p = u.to) == null ? void 0 : p.getTime()) || u.from.getTime()), d = j && new Date(w, c) < j || f && new Date(w, c) > f;
1183
- return /* @__PURE__ */ o.jsx(
539
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-months-preview", children: N.map((u, r) => {
540
+ var y, o, p;
541
+ const c = new Date(b, r).getTime() > i.from.getTime() && new Date(b, r).getTime() < (((y = i.to) == null ? void 0 : y.getTime()) || i.from.getTime()), d = v && new Date(b, r) < v || h && new Date(b, r) > h;
542
+ return /* @__PURE__ */ l(
1184
543
  "p",
1185
544
  {
1186
- className: E === w && (c === ((h = u.from) == null ? void 0 : h.getMonth()) || c === ((x = u.to) == null ? void 0 : x.getMonth())) ? "starasia-calendar-months-active" : "",
545
+ className: w === b && (r === ((o = i.from) == null ? void 0 : o.getMonth()) || r === ((p = i.to) == null ? void 0 : p.getMonth())) ? "starasia-calendar-months-active" : "",
1187
546
  style: {
1188
- backgroundColor: g ? "rgba(100, 181, 246, 0.1)" : "",
547
+ backgroundColor: c ? "rgba(100, 181, 246, 0.1)" : "",
1189
548
  pointerEvents: d ? "none" : void 0,
1190
549
  cursor: d ? "not-allowed" : "pointer",
1191
- color: d ? "#ccc" : g ? "#b0b0b0" : "",
1192
- ...a ? {} : { width: "100%" }
550
+ color: d ? "#ccc" : c ? "#b0b0b0" : "",
551
+ ...e ? {} : { width: "100%" }
1193
552
  },
1194
553
  onClick: () => {
1195
- d || _(new Date(w, c));
554
+ d || k(new Date(b, r));
1196
555
  },
1197
- children: v.slice(0, 3)
556
+ children: u.slice(0, 3)
1198
557
  },
1199
- c
558
+ r
1200
559
  );
1201
560
  }) });
1202
- }, ye = (t) => {
1203
- const n = Math.floor(t / 10) * 10, l = n + 10;
1204
- return { start: n, end: l };
1205
- }, Nr = ({
1206
- date: t,
1207
- filter: n,
1208
- setViews: l,
1209
- setDate: i,
1210
- dateRange: u,
1211
- setDateRange: m,
1212
- onChange: b,
1213
- minDate: j,
1214
- maxDate: f,
1215
- input: a
561
+ }, B = (n) => {
562
+ const a = Math.floor(n / 10) * 10, t = a + 10;
563
+ return { start: a, end: t };
564
+ }, Z = ({
565
+ date: n,
566
+ filter: a,
567
+ setViews: t,
568
+ setDate: s,
569
+ dateRange: i,
570
+ setDateRange: g,
571
+ onChange: f,
572
+ minDate: v,
573
+ maxDate: h,
574
+ input: e
1216
575
  }) => {
1217
- var p;
1218
- let E = [];
1219
- const w = t.getFullYear(), { start: _, end: S } = ye(w), v = u.from.getFullYear(), c = (p = u.to) == null ? void 0 : p.getFullYear();
1220
- for (let h = _; h < S; h++) {
1221
- const x = new Date(h, 0), Y = (!j || x >= j) && (!f || x <= f), $ = h === v || h === c, C = x > u.from && x < u.to;
1222
- E.push({
1223
- year: h,
1224
- active: $ && Y,
1225
- highlight: C && Y,
1226
- disabled: !Y
576
+ var y;
577
+ let w = [];
578
+ const b = n.getFullYear(), { start: k, end: M } = B(b), u = i.from.getFullYear(), r = (y = i.to) == null ? void 0 : y.getFullYear();
579
+ for (let o = k; o < M; o++) {
580
+ const p = new Date(o, 0), C = (!v || p >= v) && (!h || p <= h), x = o === u || o === r, m = p > i.from && p < i.to;
581
+ w.push({
582
+ year: o,
583
+ active: x && C,
584
+ highlight: m && C,
585
+ disabled: !C
1227
586
  });
1228
587
  }
1229
- const g = (h) => {
1230
- n ? (d(h), i(h)) : (i(h), l("months"));
1231
- }, d = (h) => {
1232
- var Y;
1233
- let x = { ...u };
1234
- if (x.from && x.to)
1235
- x = { from: h, to: null };
588
+ const c = (o) => {
589
+ a ? (d(o), s(o)) : (s(o), t("months"));
590
+ }, d = (o) => {
591
+ var C;
592
+ let p = { ...i };
593
+ if (p.from && p.to)
594
+ p = { from: o, to: null };
1236
595
  else {
1237
- const $ = ((Y = x.from) == null ? void 0 : Y.getTime()) || 0;
1238
- h.getTime() > $ ? x = { from: x.from, to: h } : x = { from: h, to: x.from };
596
+ const x = ((C = p.from) == null ? void 0 : C.getTime()) || 0;
597
+ o.getTime() > x ? p = { from: p.from, to: o } : p = { from: o, to: p.from };
1239
598
  }
1240
- m(x), b(x);
599
+ g(p), f(p);
1241
600
  };
1242
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-years-preview", children: E.map((h, x) => /* @__PURE__ */ o.jsx(
601
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-years-preview", children: w.map((o, p) => /* @__PURE__ */ l(
1243
602
  "p",
1244
603
  {
1245
- className: `${h.active ? "starasia-calendar-months-active" : ""} ${h.highlight ? "starasia-calendar-months-highlight" : ""} ${h.disabled ? "starasia-calendar-disabled" : ""}`,
604
+ className: `${o.active ? "starasia-calendar-months-active" : ""} ${o.highlight ? "starasia-calendar-months-highlight" : ""} ${o.disabled ? "starasia-calendar-disabled" : ""}`,
1246
605
  onClick: () => {
1247
- h.disabled || g(new Date(h.year, 0));
606
+ o.disabled || c(new Date(o.year, 0));
1248
607
  },
1249
608
  style: {
1250
- backgroundColor: h.highlight ? "rgba(100, 181, 246, 0.1)" : "",
1251
- color: h.highlight ? "#b0b0b0" : h.active ? "" : h.disabled ? "#ccc" : "",
1252
- cursor: h.disabled ? "not-allowed" : "pointer",
1253
- pointerEvents: h.disbled ? "none" : "all",
1254
- ...a ? {} : { width: "100%" }
609
+ backgroundColor: o.highlight ? "rgba(100, 181, 246, 0.1)" : "",
610
+ color: o.highlight ? "#b0b0b0" : o.active ? "" : o.disabled ? "#ccc" : "",
611
+ cursor: o.disabled ? "not-allowed" : "pointer",
612
+ pointerEvents: o.disbled ? "none" : "all",
613
+ ...e ? {} : { width: "100%" }
1255
614
  },
1256
- children: h.year
615
+ children: o.year
1257
616
  },
1258
- x
617
+ p
1259
618
  )) });
1260
- }, Qe = ({ ...t }) => /* @__PURE__ */ o.jsx(
619
+ }, q = ({ ...n }) => /* @__PURE__ */ l(
1261
620
  "svg",
1262
621
  {
1263
622
  xmlns: "http://www.w3.org/2000/svg",
@@ -1265,8 +624,8 @@ const te = (t) => {
1265
624
  height: "20",
1266
625
  viewBox: "0 0 20 20",
1267
626
  fill: "none",
1268
- ...t,
1269
- children: /* @__PURE__ */ o.jsx(
627
+ ...n,
628
+ children: /* @__PURE__ */ l(
1270
629
  "path",
1271
630
  {
1272
631
  d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
@@ -1277,7 +636,7 @@ const te = (t) => {
1277
636
  }
1278
637
  )
1279
638
  }
1280
- ), er = ({ ...t }) => /* @__PURE__ */ o.jsx(
639
+ ), P = ({ ...n }) => /* @__PURE__ */ l(
1281
640
  "svg",
1282
641
  {
1283
642
  xmlns: "http://www.w3.org/2000/svg",
@@ -1285,8 +644,8 @@ const te = (t) => {
1285
644
  height: "20",
1286
645
  viewBox: "0 0 20 20",
1287
646
  fill: "none",
1288
- ...t,
1289
- children: /* @__PURE__ */ o.jsx(
647
+ ...n,
648
+ children: /* @__PURE__ */ l(
1290
649
  "path",
1291
650
  {
1292
651
  d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
@@ -1297,201 +656,201 @@ const te = (t) => {
1297
656
  }
1298
657
  )
1299
658
  }
1300
- ), Ir = ({
1301
- setViews: t,
1302
- views: n,
1303
- filter: l,
1304
- date: i,
1305
- setDate: u
659
+ ), _ = ({
660
+ setViews: n,
661
+ views: a,
662
+ filter: t,
663
+ date: s,
664
+ setDate: i
1306
665
  }) => {
1307
- const m = () => {
1308
- l || t((a) => a === "days" ? "months" : a === "months" ? "years" : "days");
1309
- }, b = () => {
1310
- if (n === "years") {
1311
- u((a) => new Date(a.getFullYear() + 10, 0));
666
+ const g = () => {
667
+ t || n((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
668
+ }, f = () => {
669
+ if (a === "years") {
670
+ i((e) => new Date(e.getFullYear() + 10, 0));
1312
671
  return;
1313
672
  }
1314
- if (n === "months") {
1315
- u((a) => new Date(a.getFullYear() + 1, a.getMonth()));
673
+ if (a === "months") {
674
+ i((e) => new Date(e.getFullYear() + 1, e.getMonth()));
1316
675
  return;
1317
676
  }
1318
- u((a) => new Date(a.getFullYear(), a.getMonth() + 1));
1319
- }, j = () => {
1320
- if (n === "years") {
1321
- u((a) => new Date(a.getFullYear() - 10, 0));
677
+ i((e) => new Date(e.getFullYear(), e.getMonth() + 1));
678
+ }, v = () => {
679
+ if (a === "years") {
680
+ i((e) => new Date(e.getFullYear() - 10, 0));
1322
681
  return;
1323
682
  }
1324
- if (n === "months") {
1325
- u((a) => new Date(a.getFullYear() - 1, a.getMonth()));
683
+ if (a === "months") {
684
+ i((e) => new Date(e.getFullYear() - 1, e.getMonth()));
1326
685
  return;
1327
686
  }
1328
- u(
1329
- (a) => new Date(
1330
- a.getMonth() === 0 ? a.getFullYear() - 1 : a.getFullYear(),
1331
- a.getMonth() === 0 ? 11 : a.getMonth() - 1
687
+ i(
688
+ (e) => new Date(
689
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
690
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
1332
691
  )
1333
692
  );
1334
- }, f = () => {
1335
- if (n === "days")
1336
- return `${U[i.getMonth()]} ${i.getFullYear()}`;
1337
- if (n === "months")
1338
- return `${i.getFullYear()}`;
1339
- if (n === "years")
1340
- return `${ye(i.getFullYear()).start} ~ ${ye(i.getFullYear()).end}`;
1341
693
  };
1342
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-header", children: [
1343
- /* @__PURE__ */ o.jsx(Qe, { onClick: () => j() }),
1344
- /* @__PURE__ */ o.jsx("div", { style: { cursor: "pointer" }, onClick: m, children: f() }),
1345
- /* @__PURE__ */ o.jsx(er, { onClick: () => b() })
694
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-header", children: [
695
+ /* @__PURE__ */ l(q, { onClick: () => v() }),
696
+ /* @__PURE__ */ l("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
697
+ if (a === "days")
698
+ return `${N[s.getMonth()]} ${s.getFullYear()}`;
699
+ if (a === "months")
700
+ return `${s.getFullYear()}`;
701
+ if (a === "years")
702
+ return `${B(s.getFullYear()).start} ~ ${B(s.getFullYear()).end}`;
703
+ })() }),
704
+ /* @__PURE__ */ l(P, { onClick: () => f() })
1346
705
  ] });
1347
706
  };
1348
- function q(t) {
1349
- const n = new Date(t), l = n.getFullYear(), i = n.getMonth();
1350
- return `${n.getDate().toString().padStart(2, "0")} ${Fr[i]} ${l}`;
707
+ function L(n) {
708
+ const a = new Date(n), t = a.getFullYear(), s = a.getMonth();
709
+ return `${a.getDate().toString().padStart(2, "0")} ${G[s]} ${t}`;
1351
710
  }
1352
- const qe = "starasia-calendar-styles", Lr = (t) => {
1353
- if (!document.getElementById(qe)) {
1354
- const n = document.createElement("style");
1355
- n.id = qe, n.textContent = t, document.head.appendChild(n);
711
+ const z = "starasia-calendar-styles", aa = (n) => {
712
+ if (!document.getElementById(z)) {
713
+ const a = document.createElement("style");
714
+ a.id = z, a.textContent = n, document.head.appendChild(a);
1356
715
  }
1357
716
  };
1358
- Lr(ie);
1359
- const Ar = be(
717
+ aa(I);
718
+ const ea = W(
1360
719
  ({
1361
- value: t,
1362
- onChange: n,
1363
- filter: l,
1364
- input: i = !0,
1365
- disabled: u,
1366
- minDate: m,
1367
- maxDate: b,
1368
- placeholder: j,
1369
- size: f,
1370
- status: a
1371
- }, E) => {
1372
- const { ref: w, isComponentVisible: _, setIsComponentVisible: S } = Ze(!1), v = Q(null), [c, g] = B("days"), [d, p] = B(/* @__PURE__ */ new Date()), [h, x] = B({
1373
- from: (t == null ? void 0 : t.from) || /* @__PURE__ */ new Date(),
1374
- to: (t == null ? void 0 : t.to) || /* @__PURE__ */ new Date()
720
+ value: n,
721
+ onChange: a,
722
+ filter: t,
723
+ input: s = !0,
724
+ disabled: i,
725
+ minDate: g,
726
+ maxDate: f,
727
+ placeholder: v,
728
+ size: h,
729
+ status: e
730
+ }, w) => {
731
+ const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [r, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F({
732
+ from: (n == null ? void 0 : n.from) || /* @__PURE__ */ new Date(),
733
+ to: (n == null ? void 0 : n.to) || /* @__PURE__ */ new Date()
1375
734
  });
1376
- I(() => {
1377
- t ? (p(t.from), x(t)) : (p(/* @__PURE__ */ new Date()), x({
735
+ D(() => {
736
+ n ? (y(n.from), p(n)) : (y(/* @__PURE__ */ new Date()), p({
1378
737
  from: /* @__PURE__ */ new Date(),
1379
738
  to: /* @__PURE__ */ new Date()
1380
739
  }));
1381
- }, [t]), I(() => {
1382
- l && g(l);
1383
- }, [l]), I(() => {
1384
- l || g("days");
1385
- }, [_]), I(() => {
1386
- i || S(!0);
1387
- }, [i]);
1388
- const Y = () => {
1389
- var C, P;
1390
- if (!t)
740
+ }, [n]), D(() => {
741
+ t && c(t);
742
+ }, [t]), D(() => {
743
+ t || c("days");
744
+ }, [k]), D(() => {
745
+ s || M(!0);
746
+ }, [s]);
747
+ const C = () => {
748
+ var m, Y;
749
+ if (!n)
1391
750
  return "";
1392
- if (l) {
1393
- if (c === "days")
1394
- return `${q(h.from)} ~ ${q(h.to || h.from) || "-"}`;
1395
- if (c === "months")
1396
- return `${U[h.from.getMonth()]} ~ ${h.to ? U[h.to.getMonth()] : "-"}`;
1397
- if (c === "years")
1398
- return `${(C = h.from) == null ? void 0 : C.getFullYear()} ~ ${((P = h.to) == null ? void 0 : P.getFullYear()) || "-"}`;
751
+ if (t) {
752
+ if (r === "days")
753
+ return `${L(o.from)} ~ ${L(o.to || o.from) || "-"}`;
754
+ if (r === "months")
755
+ return `${N[o.from.getMonth()]} ~ ${o.to ? N[o.to.getMonth()] : "-"}`;
756
+ if (r === "years")
757
+ return `${(m = o.from) == null ? void 0 : m.getFullYear()} ~ ${((Y = o.to) == null ? void 0 : Y.getFullYear()) || "-"}`;
1399
758
  } else
1400
- return `${q(h.from)} ~ ${q(h.to || h.from) || "-"}`;
1401
- }, $ = () => {
1402
- if (v.current && w.current && i) {
1403
- const C = w.current.getBoundingClientRect(), P = v.current.getBoundingClientRect();
1404
- window.innerWidth < C.left + P.width ? v.current.style.left = `${C.left - P.width + C.width}px` : v.current.style.left = `${C.left}px`, C.top + P.height > window.innerHeight ? v.current.style.top = `${C.y - (C.height + P.height - 28)}px` : v.current.style.top = `${C.y + C.height}px`;
759
+ return `${L(o.from)} ~ ${L(o.to || o.from) || "-"}`;
760
+ }, x = () => {
761
+ if (u.current && b.current && s) {
762
+ const m = b.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
763
+ window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
1405
764
  }
1406
765
  };
1407
- return I(() => {
1408
- v.current && w.current && i && $();
1409
- }, [v, w, _]), I(() => {
1410
- const C = E == null ? void 0 : E.current;
1411
- return C && C.addEventListener("scroll", $), window.addEventListener("scroll", $), () => {
1412
- C && C.removeEventListener("scroll", $), window.removeEventListener("scroll", $);
766
+ return D(() => {
767
+ u.current && b.current && s && x();
768
+ }, [u, b, k]), D(() => {
769
+ const m = w == null ? void 0 : w.current;
770
+ return m && m.addEventListener("scroll", x), window.addEventListener("scroll", x), () => {
771
+ m && m.removeEventListener("scroll", x), window.removeEventListener("scroll", x);
1413
772
  };
1414
- }, []), /* @__PURE__ */ o.jsxs(
773
+ }, []), /* @__PURE__ */ $(
1415
774
  "div",
1416
775
  {
1417
776
  className: "starasia-calendar-wrapper",
1418
- style: { height: i ? "auto" : "100%" },
1419
- ref: i ? w : null,
777
+ style: { height: s ? "auto" : "100%" },
778
+ ref: s ? b : null,
1420
779
  children: [
1421
- i ? /* @__PURE__ */ o.jsx(
1422
- Yr,
780
+ s ? /* @__PURE__ */ l(
781
+ K,
1423
782
  {
1424
- value: Y(),
783
+ value: C(),
1425
784
  inputMode: "none",
1426
785
  onClick: () => {
1427
- S(!0);
786
+ M(!0);
1428
787
  },
1429
788
  onChange: () => {
1430
789
  },
1431
- disabled: u,
1432
- placeholder: j,
1433
- size: f,
1434
- status: a
790
+ disabled: i,
791
+ placeholder: v,
792
+ size: h,
793
+ status: e
1435
794
  }
1436
795
  ) : null,
1437
- _ ? /* @__PURE__ */ o.jsxs(
796
+ k ? /* @__PURE__ */ $(
1438
797
  "div",
1439
798
  {
1440
- className: `starasia-calendar ${i ? "" : "starasia-calendar-no-input"}`,
1441
- ref: v,
799
+ className: `starasia-calendar ${s ? "" : "starasia-calendar-no-input"}`,
800
+ ref: u,
1442
801
  children: [
1443
- /* @__PURE__ */ o.jsx(
1444
- Ir,
802
+ /* @__PURE__ */ l(
803
+ _,
1445
804
  {
1446
- setViews: g,
1447
- views: c,
1448
- filter: l,
805
+ setViews: c,
806
+ views: r,
807
+ filter: t,
1449
808
  date: d,
1450
- setDate: p
809
+ setDate: y
1451
810
  }
1452
811
  ),
1453
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-body", children: c === "days" ? /* @__PURE__ */ o.jsx(
1454
- Or,
812
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-body", children: r === "days" ? /* @__PURE__ */ l(
813
+ Q,
1455
814
  {
1456
815
  date: d,
1457
- setDate: p,
1458
- setIsComponentVisible: S,
1459
- dateRange: h,
1460
- setDateRange: x,
1461
- input: i,
1462
- onChange: n,
1463
- minDate: m,
1464
- maxDate: b
816
+ setDate: y,
817
+ setIsComponentVisible: M,
818
+ dateRange: o,
819
+ setDateRange: p,
820
+ input: s,
821
+ onChange: a,
822
+ minDate: g,
823
+ maxDate: f
1465
824
  }
1466
- ) : c === "months" ? /* @__PURE__ */ o.jsx(
1467
- Pr,
825
+ ) : r === "months" ? /* @__PURE__ */ l(
826
+ X,
1468
827
  {
1469
828
  date: d,
1470
- setDate: p,
1471
- filter: l,
1472
- setViews: g,
1473
- dateRange: h,
1474
- setDateRange: x,
1475
- setIsComponentVisible: S,
1476
- input: i,
1477
- onChange: n,
1478
- minDate: m,
1479
- maxDate: b
829
+ setDate: y,
830
+ filter: t,
831
+ setViews: c,
832
+ dateRange: o,
833
+ setDateRange: p,
834
+ setIsComponentVisible: M,
835
+ input: s,
836
+ onChange: a,
837
+ minDate: g,
838
+ maxDate: f
1480
839
  }
1481
- ) : /* @__PURE__ */ o.jsx(
1482
- Nr,
840
+ ) : /* @__PURE__ */ l(
841
+ Z,
1483
842
  {
1484
843
  date: d,
1485
- setDate: p,
1486
- filter: l,
1487
- setViews: g,
1488
- dateRange: h,
1489
- setDateRange: x,
1490
- setIsComponentVisible: S,
1491
- input: i,
1492
- onChange: n,
1493
- minDate: m,
1494
- maxDate: b
844
+ setDate: y,
845
+ filter: t,
846
+ setViews: c,
847
+ dateRange: o,
848
+ setDateRange: p,
849
+ setIsComponentVisible: M,
850
+ input: s,
851
+ onChange: a,
852
+ minDate: g,
853
+ maxDate: f
1495
854
  }
1496
855
  ) })
1497
856
  ]
@@ -1501,39 +860,39 @@ const Ar = be(
1501
860
  }
1502
861
  );
1503
862
  }
1504
- ), He = "starasia-calendar-input-styles", Wr = (t) => {
1505
- if (!document.getElementById(He)) {
1506
- const n = document.createElement("style");
1507
- n.id = He, n.textContent = t, document.head.appendChild(n);
863
+ ), O = "starasia-calendar-input-styles", na = (n) => {
864
+ if (!document.getElementById(O)) {
865
+ const a = document.createElement("style");
866
+ a.id = O, a.textContent = n, document.head.appendChild(a);
1508
867
  }
1509
868
  };
1510
- Wr(ie);
1511
- const se = (t) => {
1512
- if (t === "sm")
869
+ na(I);
870
+ const S = (n) => {
871
+ if (n === "sm")
1513
872
  return 16;
1514
- if (t === "md")
873
+ if (n === "md")
1515
874
  return 16;
1516
- if (t === "lg")
875
+ if (n === "lg")
1517
876
  return 20;
1518
- }, Vr = (t) => {
1519
- const { size: n = "md", status: l = "default", variant: i = "outline", ...u } = t, m = Q(null), b = () => {
1520
- m.current && u.onClick && (m.current.focus(), u.onClick(""));
877
+ }, ra = (n) => {
878
+ const { size: a = "md", status: t = "default", variant: s = "outline", ...i } = n, g = E(null), f = () => {
879
+ g.current && i.onClick && (g.current.focus(), i.onClick(""));
1521
880
  };
1522
- return /* @__PURE__ */ o.jsxs(
881
+ return /* @__PURE__ */ $(
1523
882
  "div",
1524
883
  {
1525
- className: `starasia-calendar-input-container starasia-calendar-input-${i} starasia-calendar-input-container-${l} ${n} `,
1526
- onClick: b,
884
+ className: `starasia-calendar-input-container starasia-calendar-input-${s} starasia-calendar-input-container-${t} ${a} `,
885
+ onClick: f,
1527
886
  children: [
1528
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ o.jsx(
887
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-left", children: /* @__PURE__ */ l(
1529
888
  "svg",
1530
889
  {
1531
890
  xmlns: "http://www.w3.org/2000/svg",
1532
- width: se(n),
1533
- height: se(n),
891
+ width: S(a),
892
+ height: S(a),
1534
893
  viewBox: "0 0 20 20",
1535
894
  fill: "none",
1536
- children: /* @__PURE__ */ o.jsx(
895
+ children: /* @__PURE__ */ l(
1537
896
  "path",
1538
897
  {
1539
898
  d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
@@ -1545,25 +904,25 @@ const se = (t) => {
1545
904
  )
1546
905
  }
1547
906
  ) }),
1548
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ o.jsx(
907
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-preview-container", children: /* @__PURE__ */ l(
1549
908
  "input",
1550
909
  {
1551
910
  className: "starasia-calendar-input",
1552
- ...u,
1553
- disabled: l === "disable" ? !0 : u.disabled,
1554
- value: u.value,
1555
- ref: m
911
+ ...i,
912
+ disabled: t === "disable" ? !0 : i.disabled,
913
+ value: i.value,
914
+ ref: g
1556
915
  }
1557
916
  ) }),
1558
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ o.jsx(
917
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-input-container-icon-right", children: /* @__PURE__ */ l(
1559
918
  "svg",
1560
919
  {
1561
920
  xmlns: "http://www.w3.org/2000/svg",
1562
- width: se(n),
1563
- height: se(n),
921
+ width: S(a),
922
+ height: S(a),
1564
923
  viewBox: "0 0 20 20",
1565
924
  fill: "none",
1566
- children: /* @__PURE__ */ o.jsx(
925
+ children: /* @__PURE__ */ l(
1567
926
  "path",
1568
927
  {
1569
928
  d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
@@ -1578,312 +937,312 @@ const se = (t) => {
1578
937
  ]
1579
938
  }
1580
939
  );
1581
- }, Br = ({
1582
- date: t,
1583
- setDate: n,
1584
- previewDate: l,
1585
- setPreviewDate: i,
1586
- setIsComponentVisible: u,
1587
- minDate: m,
1588
- maxDate: b,
1589
- input: j,
1590
- onChange: f
940
+ }, ta = ({
941
+ date: n,
942
+ setDate: a,
943
+ previewDate: t,
944
+ setPreviewDate: s,
945
+ setIsComponentVisible: i,
946
+ minDate: g,
947
+ maxDate: f,
948
+ input: v,
949
+ onChange: h
1591
950
  }) => {
1592
- let a = new Date(
1593
- l.getFullYear(),
1594
- l.getMonth(),
951
+ let e = new Date(
952
+ t.getFullYear(),
953
+ t.getMonth(),
1595
954
  1
1596
- ), E = a.getDay(), w = [];
1597
- const _ = t.toDateString(), S = l.getMonth();
1598
- for (let c = 0; c < 42; c++) {
1599
- c === 0 && E === 0 ? a.setDate(a.getDate() - 7) : c === 0 ? a.setDate(
1600
- a.getDate() + (c - E)
1601
- ) : a.setDate(a.getDate() + 1);
1602
- let g = {
1603
- currentMonth: a.getMonth() === S,
1604
- date: new Date(a),
1605
- month: a.getMonth(),
1606
- number: a.getDate(),
1607
- selected: a.toDateString() === _,
1608
- year: a.getFullYear(),
1609
- isDisabled: m && a < m || b && a > b
955
+ ), w = e.getDay(), b = [];
956
+ const k = n.toDateString(), M = t.getMonth();
957
+ for (let r = 0; r < 42; r++) {
958
+ r === 0 && w === 0 ? e.setDate(e.getDate() - 7) : r === 0 ? e.setDate(
959
+ e.getDate() + (r - w)
960
+ ) : e.setDate(e.getDate() + 1);
961
+ let c = {
962
+ currentMonth: e.getMonth() === M,
963
+ date: new Date(e),
964
+ month: e.getMonth(),
965
+ number: e.getDate(),
966
+ selected: e.toDateString() === k,
967
+ year: e.getFullYear(),
968
+ isDisabled: g && e < g || f && e > f
1610
969
  };
1611
- w.push(g);
970
+ b.push(c);
1612
971
  }
1613
- const v = (c) => {
1614
- (!m || c >= m) && (!b || c <= b) && (n(c), f(c), i(c), j && u(!1));
972
+ const u = (r) => {
973
+ (!g || r >= g) && (!f || r <= f) && (a(r), h(r), s(r), v && i(!1));
1615
974
  };
1616
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-days-preivew", children: [
1617
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-name-preivew", children: Xe.map((c, g) => /* @__PURE__ */ o.jsx("p", { children: c }, g)) }),
1618
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-days-number-preivew", children: w.map((c, g) => {
1619
- const d = c.isDisabled;
1620
- return /* @__PURE__ */ o.jsx(
975
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-days-preivew", children: [
976
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-name-preivew", children: A.map((r, c) => /* @__PURE__ */ l("p", { children: r }, c)) }),
977
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-days-number-preivew", children: b.map((r, c) => {
978
+ const d = r.isDisabled;
979
+ return /* @__PURE__ */ l(
1621
980
  "p",
1622
981
  {
1623
- className: `${c.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${c.selected ? "starasia-calendar-days-active" : ""}`,
982
+ className: `${r.currentMonth ? "starasia-calendar-days-current" : "starasia-calendar-days"} ${r.selected ? "starasia-calendar-days-active" : ""}`,
1624
983
  style: {
1625
984
  color: d ? "#ccc" : void 0,
1626
985
  pointerEvents: d ? "none" : void 0,
1627
986
  cursor: d ? "not-allowed" : "pointer",
1628
- ...j ? {} : { width: "100%" }
987
+ ...v ? {} : { width: "100%" }
1629
988
  },
1630
989
  onClick: () => {
1631
- d || v(c.date);
990
+ d || u(r.date);
1632
991
  },
1633
- children: c.number
992
+ children: r.number
1634
993
  },
1635
- g
994
+ c
1636
995
  );
1637
996
  }) })
1638
997
  ] });
1639
- }, Ur = ({
1640
- date: t,
1641
- setDate: n,
1642
- filter: l,
1643
- setViews: i,
1644
- onChange: u,
1645
- previewDate: m,
1646
- setPreviewDate: b,
1647
- minDate: j,
1648
- maxDate: f,
1649
- input: a
998
+ }, sa = ({
999
+ date: n,
1000
+ setDate: a,
1001
+ filter: t,
1002
+ setViews: s,
1003
+ onChange: i,
1004
+ previewDate: g,
1005
+ setPreviewDate: f,
1006
+ minDate: v,
1007
+ maxDate: h,
1008
+ input: e
1650
1009
  }) => {
1651
- const E = t.getMonth(), w = t.getFullYear(), _ = m.getFullYear(), S = (v) => {
1652
- (!j || v >= j) && (!f || v <= f) && (l ? (u(v), n(v), b(v)) : (i("days"), b(v)));
1010
+ const w = n.getMonth(), b = n.getFullYear(), k = g.getFullYear(), M = (u) => {
1011
+ (!v || u >= v) && (!h || u <= h) && (t ? (i(u), a(u), f(u)) : (s("days"), f(u)));
1653
1012
  };
1654
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-months-preview", children: U.map((v, c) => {
1655
- const g = j && new Date(_, c, 1) < j || f && new Date(_, c + 1, 0) > f;
1656
- return /* @__PURE__ */ o.jsx(
1013
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-months-preview", children: N.map((u, r) => {
1014
+ const c = v && new Date(k, r, 1) < v || h && new Date(k, r + 1, 0) > h;
1015
+ return /* @__PURE__ */ l(
1657
1016
  "p",
1658
1017
  {
1659
- className: c === E && _ === w ? "starasia-calendar-months-active" : "",
1018
+ className: r === w && k === b ? "starasia-calendar-months-active" : "",
1660
1019
  style: {
1661
- color: g ? "#ccc" : void 0,
1662
- pointerEvents: g ? "none" : void 0,
1663
- cursor: g ? "not-allowed" : "pointer",
1664
- ...a ? {} : { width: "100%" }
1020
+ color: c ? "#ccc" : void 0,
1021
+ pointerEvents: c ? "none" : void 0,
1022
+ cursor: c ? "not-allowed" : "pointer",
1023
+ ...e ? {} : { width: "100%" }
1665
1024
  },
1666
1025
  onClick: () => {
1667
- g || S(new Date(_, c));
1026
+ c || M(new Date(k, r));
1668
1027
  },
1669
- children: v.slice(0, 3)
1028
+ children: u.slice(0, 3)
1670
1029
  },
1671
- c
1030
+ r
1672
1031
  );
1673
1032
  }) });
1674
- }, me = (t) => {
1675
- const n = Math.floor(t / 10) * 10, l = n + 10;
1676
- return { start: n, end: l };
1677
- }, zr = ({
1678
- date: t,
1679
- filter: n,
1680
- setViews: l,
1681
- setDate: i,
1682
- onChange: u,
1683
- previewDate: m,
1684
- setPreviewDate: b,
1685
- minDate: j,
1686
- maxDate: f,
1687
- input: a
1033
+ }, V = (n) => {
1034
+ const a = Math.floor(n / 10) * 10, t = a + 10;
1035
+ return { start: a, end: t };
1036
+ }, ia = ({
1037
+ date: n,
1038
+ filter: a,
1039
+ setViews: t,
1040
+ setDate: s,
1041
+ onChange: i,
1042
+ previewDate: g,
1043
+ setPreviewDate: f,
1044
+ minDate: v,
1045
+ maxDate: h,
1046
+ input: e
1688
1047
  }) => {
1689
- let E = [];
1690
- const w = m.getFullYear(), { start: _, end: S } = me(w), v = t.getFullYear();
1691
- for (let g = _; g < S; g++) {
1692
- let d = j && new Date(g, 0, 1) < j || f && new Date(g, 11, 31) > f;
1693
- E.push({ year: g, active: g === v, isDisabled: d });
1048
+ let w = [];
1049
+ const b = g.getFullYear(), { start: k, end: M } = V(b), u = n.getFullYear();
1050
+ for (let c = k; c < M; c++) {
1051
+ let d = v && new Date(c, 0, 1) < v || h && new Date(c, 11, 31) > h;
1052
+ w.push({ year: c, active: c === u, isDisabled: d });
1694
1053
  }
1695
- const c = (g) => {
1696
- (!j || g >= j) && (!f || g <= f) && (n ? (u(g), i(g), b(g)) : (l("months"), b(g)));
1054
+ const r = (c) => {
1055
+ (!v || c >= v) && (!h || c <= h) && (a ? (i(c), s(c), f(c)) : (t("months"), f(c)));
1697
1056
  };
1698
- return /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-years-preview", children: E.map((g, d) => /* @__PURE__ */ o.jsx(
1057
+ return /* @__PURE__ */ l("div", { className: "starasia-calendar-years-preview", children: w.map((c, d) => /* @__PURE__ */ l(
1699
1058
  "p",
1700
1059
  {
1701
- className: g.active ? "starasia-calendar-months-active" : "",
1060
+ className: c.active ? "starasia-calendar-months-active" : "",
1702
1061
  style: {
1703
- color: g.isDisabled ? "#ccc" : void 0,
1704
- pointerEvents: g.isDisabled ? "none" : void 0,
1705
- cursor: g.isDisabled ? "not-allowed" : "pointer",
1706
- ...a ? {} : { width: "100%" }
1062
+ color: c.isDisabled ? "#ccc" : void 0,
1063
+ pointerEvents: c.isDisabled ? "none" : void 0,
1064
+ cursor: c.isDisabled ? "not-allowed" : "pointer",
1065
+ ...e ? {} : { width: "100%" }
1707
1066
  },
1708
1067
  onClick: () => {
1709
- g.isDisabled || c(new Date(g.year, 0));
1068
+ c.isDisabled || r(new Date(c.year, 0));
1710
1069
  },
1711
- children: g.year
1070
+ children: c.year
1712
1071
  },
1713
1072
  d
1714
1073
  )) });
1715
- }, Jr = ({
1716
- setViews: t,
1717
- views: n,
1718
- filter: l,
1719
- previewDate: i,
1720
- setPreviewDate: u
1074
+ }, oa = ({
1075
+ setViews: n,
1076
+ views: a,
1077
+ filter: t,
1078
+ previewDate: s,
1079
+ setPreviewDate: i
1721
1080
  }) => {
1722
- const m = () => {
1723
- l || t((a) => a === "days" ? "months" : a === "months" ? "years" : "days");
1724
- }, b = () => {
1725
- if (n === "years") {
1726
- u((a) => new Date(a.getFullYear() + 10, 0));
1081
+ const g = () => {
1082
+ t || n((e) => e === "days" ? "months" : e === "months" ? "years" : "days");
1083
+ }, f = () => {
1084
+ if (a === "years") {
1085
+ i((e) => new Date(e.getFullYear() + 10, 0));
1727
1086
  return;
1728
1087
  }
1729
- if (n === "months") {
1730
- u(
1731
- (a) => new Date(a.getFullYear() + 1, a.getMonth())
1088
+ if (a === "months") {
1089
+ i(
1090
+ (e) => new Date(e.getFullYear() + 1, e.getMonth())
1732
1091
  );
1733
1092
  return;
1734
1093
  }
1735
- u((a) => new Date(a.getFullYear(), a.getMonth() + 1));
1736
- }, j = () => {
1737
- if (n === "years") {
1738
- u((a) => new Date(a.getFullYear() - 10, 0));
1094
+ i((e) => new Date(e.getFullYear(), e.getMonth() + 1));
1095
+ }, v = () => {
1096
+ if (a === "years") {
1097
+ i((e) => new Date(e.getFullYear() - 10, 0));
1739
1098
  return;
1740
1099
  }
1741
- if (n === "months") {
1742
- u(
1743
- (a) => new Date(a.getFullYear() - 1, a.getMonth())
1100
+ if (a === "months") {
1101
+ i(
1102
+ (e) => new Date(e.getFullYear() - 1, e.getMonth())
1744
1103
  );
1745
1104
  return;
1746
1105
  }
1747
- u(
1748
- (a) => new Date(
1749
- a.getMonth() === 0 ? a.getFullYear() - 1 : a.getFullYear(),
1750
- a.getMonth() === 0 ? 11 : a.getMonth() - 1
1106
+ i(
1107
+ (e) => new Date(
1108
+ e.getMonth() === 0 ? e.getFullYear() - 1 : e.getFullYear(),
1109
+ e.getMonth() === 0 ? 11 : e.getMonth() - 1
1751
1110
  )
1752
1111
  );
1753
- }, f = () => {
1754
- if (n === "days")
1755
- return `${U[i.getMonth()]} ${i.getFullYear()}`;
1756
- if (n === "months")
1757
- return `${i.getFullYear()}`;
1758
- if (n === "years")
1759
- return `${me(i.getFullYear()).start} ~ ${me(i.getFullYear()).end}`;
1760
1112
  };
1761
- return /* @__PURE__ */ o.jsxs("div", { className: "starasia-calendar-header", children: [
1762
- /* @__PURE__ */ o.jsx(Qe, { onClick: () => j() }),
1763
- /* @__PURE__ */ o.jsx("div", { style: { cursor: "pointer" }, onClick: m, children: f() }),
1764
- /* @__PURE__ */ o.jsx(er, { onClick: () => b() })
1113
+ return /* @__PURE__ */ $("div", { className: "starasia-calendar-header", children: [
1114
+ /* @__PURE__ */ l(q, { onClick: () => v() }),
1115
+ /* @__PURE__ */ l("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
1116
+ if (a === "days")
1117
+ return `${N[s.getMonth()]} ${s.getFullYear()}`;
1118
+ if (a === "months")
1119
+ return `${s.getFullYear()}`;
1120
+ if (a === "years")
1121
+ return `${V(s.getFullYear()).start} ~ ${V(s.getFullYear()).end}`;
1122
+ })() }),
1123
+ /* @__PURE__ */ l(P, { onClick: () => f() })
1765
1124
  ] });
1766
- }, Ge = "starasia-calendar-styles", qr = (t) => {
1767
- if (!document.getElementById(Ge)) {
1768
- const n = document.createElement("style");
1769
- n.id = Ge, n.textContent = t, document.head.appendChild(n);
1125
+ }, H = "starasia-calendar-styles", la = (n) => {
1126
+ if (!document.getElementById(H)) {
1127
+ const a = document.createElement("style");
1128
+ a.id = H, a.textContent = n, document.head.appendChild(a);
1770
1129
  }
1771
1130
  };
1772
- qr(ie);
1773
- const Hr = be(
1131
+ la(I);
1132
+ const ca = W(
1774
1133
  ({
1775
- value: t,
1776
- onChange: n,
1777
- filter: l,
1778
- input: i = !0,
1779
- disabled: u,
1780
- minDate: m,
1781
- maxDate: b,
1782
- placeholder: j,
1783
- size: f,
1784
- status: a
1785
- }, E) => {
1786
- const { ref: w, isComponentVisible: _, setIsComponentVisible: S } = Ze(!1), v = Q(null), [c, g] = B("days"), [d, p] = B(/* @__PURE__ */ new Date()), [h, x] = B(/* @__PURE__ */ new Date());
1787
- I(() => {
1788
- t ? (p(t), x(t)) : (p(/* @__PURE__ */ new Date()), x(/* @__PURE__ */ new Date()));
1789
- }, [t]), I(() => {
1790
- l && g(l);
1791
- }, [l]), I(() => {
1792
- l || g("days");
1793
- }, [_]), I(() => {
1794
- i || S(!0);
1795
- }, [i]);
1796
- const Y = () => t ? l === "days" ? q(d) : l === "months" ? `${U[d.getMonth()]} ${d.getFullYear()}` : l === "years" ? d.getFullYear() : q(d) : "", $ = () => {
1797
- if (v.current && w.current && i) {
1798
- const C = w.current.getBoundingClientRect(), P = v.current.getBoundingClientRect();
1799
- window.innerWidth < C.left + P.width ? v.current.style.left = `${C.left - P.width + C.width}px` : v.current.style.left = `${C.left}px`, C.top + P.height > window.innerHeight ? v.current.style.top = `${C.y - (C.height + P.height - 28)}px` : v.current.style.top = `${C.y + C.height}px`;
1134
+ value: n,
1135
+ onChange: a,
1136
+ filter: t,
1137
+ input: s = !0,
1138
+ disabled: i,
1139
+ minDate: g,
1140
+ maxDate: f,
1141
+ placeholder: v,
1142
+ size: h,
1143
+ status: e
1144
+ }, w) => {
1145
+ const { ref: b, isComponentVisible: k, setIsComponentVisible: M } = J(!1), u = E(null), [r, c] = F("days"), [d, y] = F(/* @__PURE__ */ new Date()), [o, p] = F(/* @__PURE__ */ new Date());
1146
+ D(() => {
1147
+ n ? (y(n), p(n)) : (y(/* @__PURE__ */ new Date()), p(/* @__PURE__ */ new Date()));
1148
+ }, [n]), D(() => {
1149
+ t && c(t);
1150
+ }, [t]), D(() => {
1151
+ t || c("days");
1152
+ }, [k]), D(() => {
1153
+ s || M(!0);
1154
+ }, [s]);
1155
+ const C = () => n ? t === "days" ? L(d) : t === "months" ? `${N[d.getMonth()]} ${d.getFullYear()}` : t === "years" ? d.getFullYear() : L(d) : "", x = () => {
1156
+ if (u.current && b.current && s) {
1157
+ const m = b.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
1158
+ window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
1800
1159
  }
1801
1160
  };
1802
- return I(() => {
1803
- v.current && w.current && i && $();
1804
- }, [v, w, _]), I(() => {
1805
- const C = E == null ? void 0 : E.current;
1806
- return C && C.addEventListener("scroll", $), window.addEventListener("scroll", $), () => {
1807
- C && C.removeEventListener("scroll", $), window.removeEventListener("scroll", $);
1161
+ return D(() => {
1162
+ u.current && b.current && s && x();
1163
+ }, [u, b, k]), D(() => {
1164
+ const m = w == null ? void 0 : w.current;
1165
+ return m && m.addEventListener("scroll", x), window.addEventListener("scroll", x), () => {
1166
+ m && m.removeEventListener("scroll", x), window.removeEventListener("scroll", x);
1808
1167
  };
1809
- }, []), /* @__PURE__ */ o.jsxs(
1168
+ }, []), /* @__PURE__ */ $(
1810
1169
  "div",
1811
1170
  {
1812
1171
  className: "starasia-calendar-wrapper",
1813
- style: { height: i ? "auto" : "100%" },
1814
- ref: i ? w : null,
1172
+ style: { height: s ? "auto" : "100%" },
1173
+ ref: s ? b : null,
1815
1174
  children: [
1816
- i ? /* @__PURE__ */ o.jsx(
1817
- Vr,
1175
+ s ? /* @__PURE__ */ l(
1176
+ ra,
1818
1177
  {
1819
- value: Y(),
1820
- onClick: () => S(!0),
1178
+ value: C(),
1179
+ onClick: () => M(!0),
1821
1180
  onChange: () => {
1822
1181
  },
1823
- placeholder: j,
1824
- disabled: u,
1825
- size: f,
1826
- status: a,
1182
+ placeholder: v,
1183
+ disabled: i,
1184
+ size: h,
1185
+ status: e,
1827
1186
  inputMode: "none"
1828
1187
  }
1829
1188
  ) : null,
1830
- _ ? /* @__PURE__ */ o.jsxs(
1189
+ k ? /* @__PURE__ */ $(
1831
1190
  "div",
1832
1191
  {
1833
- className: `starasia-calendar ${i ? "" : "starasia-calendar-no-input"}`,
1834
- ref: v,
1192
+ className: `starasia-calendar ${s ? "" : "starasia-calendar-no-input"}`,
1193
+ ref: u,
1835
1194
  children: [
1836
- /* @__PURE__ */ o.jsx(
1837
- Jr,
1195
+ /* @__PURE__ */ l(
1196
+ oa,
1838
1197
  {
1839
- setViews: g,
1840
- views: c,
1841
- filter: l,
1842
- previewDate: h,
1843
- setPreviewDate: x,
1844
- isComponentVisible: _
1198
+ setViews: c,
1199
+ views: r,
1200
+ filter: t,
1201
+ previewDate: o,
1202
+ setPreviewDate: p,
1203
+ isComponentVisible: k
1845
1204
  }
1846
1205
  ),
1847
- /* @__PURE__ */ o.jsx("div", { className: "starasia-calendar-body", children: c === "days" ? /* @__PURE__ */ o.jsx(
1848
- Br,
1206
+ /* @__PURE__ */ l("div", { className: "starasia-calendar-body", children: r === "days" ? /* @__PURE__ */ l(
1207
+ ta,
1849
1208
  {
1850
1209
  date: d,
1851
- setDate: p,
1852
- previewDate: h,
1853
- setPreviewDate: x,
1854
- setIsComponentVisible: S,
1855
- input: i,
1856
- minDate: m,
1857
- maxDate: b,
1858
- onChange: n
1210
+ setDate: y,
1211
+ previewDate: o,
1212
+ setPreviewDate: p,
1213
+ setIsComponentVisible: M,
1214
+ input: s,
1215
+ minDate: g,
1216
+ maxDate: f,
1217
+ onChange: a
1859
1218
  }
1860
- ) : c === "months" ? /* @__PURE__ */ o.jsx(
1861
- Ur,
1219
+ ) : r === "months" ? /* @__PURE__ */ l(
1220
+ sa,
1862
1221
  {
1863
1222
  date: d,
1864
- setDate: p,
1865
- previewDate: h,
1866
- setPreviewDate: x,
1867
- filter: l,
1868
- setViews: g,
1869
- onChange: n,
1870
- minDate: m,
1871
- maxDate: b,
1872
- input: i
1223
+ setDate: y,
1224
+ previewDate: o,
1225
+ setPreviewDate: p,
1226
+ filter: t,
1227
+ setViews: c,
1228
+ onChange: a,
1229
+ minDate: g,
1230
+ maxDate: f,
1231
+ input: s
1873
1232
  }
1874
- ) : /* @__PURE__ */ o.jsx(
1875
- zr,
1233
+ ) : /* @__PURE__ */ l(
1234
+ ia,
1876
1235
  {
1877
1236
  date: d,
1878
- setDate: p,
1879
- previewDate: h,
1880
- setPreviewDate: x,
1881
- filter: l,
1882
- setViews: g,
1883
- onChange: n,
1884
- minDate: m,
1885
- maxDate: b,
1886
- input: i
1237
+ setDate: y,
1238
+ previewDate: o,
1239
+ setPreviewDate: p,
1240
+ filter: t,
1241
+ setViews: c,
1242
+ onChange: a,
1243
+ minDate: g,
1244
+ maxDate: f,
1245
+ input: s
1887
1246
  }
1888
1247
  ) })
1889
1248
  ]
@@ -1893,51 +1252,51 @@ const Hr = be(
1893
1252
  }
1894
1253
  );
1895
1254
  }
1896
- ), Kr = be(
1255
+ ), ha = W(
1897
1256
  ({
1898
- value: t,
1899
- onChange: n,
1900
- filter: l,
1901
- input: i = !0,
1902
- rangedDate: u,
1903
- disabled: m,
1904
- minDate: b,
1905
- maxDate: j,
1906
- placeholder: f,
1907
- size: a,
1908
- status: E
1909
- }, w) => /* @__PURE__ */ o.jsx(o.Fragment, { children: u ? /* @__PURE__ */ o.jsx(
1910
- Ar,
1257
+ value: n,
1258
+ onChange: a,
1259
+ filter: t,
1260
+ input: s = !0,
1261
+ rangedDate: i,
1262
+ disabled: g,
1263
+ minDate: f,
1264
+ maxDate: v,
1265
+ placeholder: h,
1266
+ size: e,
1267
+ status: w
1268
+ }, b) => /* @__PURE__ */ l(R, { children: i ? /* @__PURE__ */ l(
1269
+ ea,
1911
1270
  {
1912
- onChange: n,
1913
- value: t,
1914
- input: i,
1915
- filter: l,
1916
- disabled: m,
1917
- ref: w,
1918
- minDate: b,
1919
- maxDate: j,
1920
- placeholder: f,
1921
- size: a,
1922
- status: E
1271
+ onChange: a,
1272
+ value: n,
1273
+ input: s,
1274
+ filter: t,
1275
+ disabled: g,
1276
+ ref: b,
1277
+ minDate: f,
1278
+ maxDate: v,
1279
+ placeholder: h,
1280
+ size: e,
1281
+ status: w
1923
1282
  }
1924
- ) : /* @__PURE__ */ o.jsx(
1925
- Hr,
1283
+ ) : /* @__PURE__ */ l(
1284
+ ca,
1926
1285
  {
1927
- onChange: n,
1928
- value: t,
1929
- input: i,
1930
- filter: l,
1931
- disabled: m,
1932
- ref: w,
1933
- minDate: b,
1934
- maxDate: j,
1935
- placeholder: f,
1936
- size: a,
1937
- status: E
1286
+ onChange: a,
1287
+ value: n,
1288
+ input: s,
1289
+ filter: t,
1290
+ disabled: g,
1291
+ ref: b,
1292
+ minDate: f,
1293
+ maxDate: v,
1294
+ placeholder: h,
1295
+ size: e,
1296
+ status: w
1938
1297
  }
1939
1298
  ) })
1940
1299
  );
1941
1300
  export {
1942
- Kr as StarasiaDate
1301
+ ha as StarasiaDate
1943
1302
  };