@elqnt/chat 2.0.5 → 2.0.8

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/index.mjs CHANGED
@@ -1967,1576 +1967,8 @@ var ChatInput = ({ userId, orgId, onFileUpload }) => {
1967
1967
  // components/customer/chat-messages.tsx
1968
1968
  import { useEffect as useEffect2, useRef as useRef4 } from "react";
1969
1969
 
1970
- // ../../node_modules/date-fns/constants.js
1971
- var daysInYear = 365.2425;
1972
- var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
1973
- var minTime = -maxTime;
1974
- var millisecondsInWeek = 6048e5;
1975
- var millisecondsInDay = 864e5;
1976
- var secondsInHour = 3600;
1977
- var secondsInDay = secondsInHour * 24;
1978
- var secondsInWeek = secondsInDay * 7;
1979
- var secondsInYear = secondsInDay * daysInYear;
1980
- var secondsInMonth = secondsInYear / 12;
1981
- var secondsInQuarter = secondsInMonth * 3;
1982
- var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom");
1983
-
1984
- // ../../node_modules/date-fns/constructFrom.js
1985
- function constructFrom(date, value) {
1986
- if (typeof date === "function") return date(value);
1987
- if (date && typeof date === "object" && constructFromSymbol in date)
1988
- return date[constructFromSymbol](value);
1989
- if (date instanceof Date) return new date.constructor(value);
1990
- return new Date(value);
1991
- }
1992
-
1993
- // ../../node_modules/date-fns/toDate.js
1994
- function toDate(argument, context) {
1995
- return constructFrom(context || argument, argument);
1996
- }
1997
-
1998
- // ../../node_modules/date-fns/_lib/defaultOptions.js
1999
- var defaultOptions = {};
2000
- function getDefaultOptions() {
2001
- return defaultOptions;
2002
- }
2003
-
2004
- // ../../node_modules/date-fns/startOfWeek.js
2005
- function startOfWeek(date, options) {
2006
- const defaultOptions2 = getDefaultOptions();
2007
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
2008
- const _date = toDate(date, options?.in);
2009
- const day = _date.getDay();
2010
- const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
2011
- _date.setDate(_date.getDate() - diff);
2012
- _date.setHours(0, 0, 0, 0);
2013
- return _date;
2014
- }
2015
-
2016
- // ../../node_modules/date-fns/startOfISOWeek.js
2017
- function startOfISOWeek(date, options) {
2018
- return startOfWeek(date, { ...options, weekStartsOn: 1 });
2019
- }
2020
-
2021
- // ../../node_modules/date-fns/getISOWeekYear.js
2022
- function getISOWeekYear(date, options) {
2023
- const _date = toDate(date, options?.in);
2024
- const year = _date.getFullYear();
2025
- const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
2026
- fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
2027
- fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
2028
- const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
2029
- const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
2030
- fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
2031
- fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
2032
- const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
2033
- if (_date.getTime() >= startOfNextYear.getTime()) {
2034
- return year + 1;
2035
- } else if (_date.getTime() >= startOfThisYear.getTime()) {
2036
- return year;
2037
- } else {
2038
- return year - 1;
2039
- }
2040
- }
2041
-
2042
- // ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
2043
- function getTimezoneOffsetInMilliseconds(date) {
2044
- const _date = toDate(date);
2045
- const utcDate = new Date(
2046
- Date.UTC(
2047
- _date.getFullYear(),
2048
- _date.getMonth(),
2049
- _date.getDate(),
2050
- _date.getHours(),
2051
- _date.getMinutes(),
2052
- _date.getSeconds(),
2053
- _date.getMilliseconds()
2054
- )
2055
- );
2056
- utcDate.setUTCFullYear(_date.getFullYear());
2057
- return +date - +utcDate;
2058
- }
2059
-
2060
- // ../../node_modules/date-fns/_lib/normalizeDates.js
2061
- function normalizeDates(context, ...dates) {
2062
- const normalize = constructFrom.bind(
2063
- null,
2064
- context || dates.find((date) => typeof date === "object")
2065
- );
2066
- return dates.map(normalize);
2067
- }
2068
-
2069
- // ../../node_modules/date-fns/startOfDay.js
2070
- function startOfDay(date, options) {
2071
- const _date = toDate(date, options?.in);
2072
- _date.setHours(0, 0, 0, 0);
2073
- return _date;
2074
- }
2075
-
2076
- // ../../node_modules/date-fns/differenceInCalendarDays.js
2077
- function differenceInCalendarDays(laterDate, earlierDate, options) {
2078
- const [laterDate_, earlierDate_] = normalizeDates(
2079
- options?.in,
2080
- laterDate,
2081
- earlierDate
2082
- );
2083
- const laterStartOfDay = startOfDay(laterDate_);
2084
- const earlierStartOfDay = startOfDay(earlierDate_);
2085
- const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
2086
- const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
2087
- return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
2088
- }
2089
-
2090
- // ../../node_modules/date-fns/startOfISOWeekYear.js
2091
- function startOfISOWeekYear(date, options) {
2092
- const year = getISOWeekYear(date, options);
2093
- const fourthOfJanuary = constructFrom(options?.in || date, 0);
2094
- fourthOfJanuary.setFullYear(year, 0, 4);
2095
- fourthOfJanuary.setHours(0, 0, 0, 0);
2096
- return startOfISOWeek(fourthOfJanuary);
2097
- }
2098
-
2099
- // ../../node_modules/date-fns/isDate.js
2100
- function isDate(value) {
2101
- return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
2102
- }
2103
-
2104
- // ../../node_modules/date-fns/isValid.js
2105
- function isValid(date) {
2106
- return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
2107
- }
2108
-
2109
- // ../../node_modules/date-fns/startOfYear.js
2110
- function startOfYear(date, options) {
2111
- const date_ = toDate(date, options?.in);
2112
- date_.setFullYear(date_.getFullYear(), 0, 1);
2113
- date_.setHours(0, 0, 0, 0);
2114
- return date_;
2115
- }
2116
-
2117
- // ../../node_modules/date-fns/locale/en-US/_lib/formatDistance.js
2118
- var formatDistanceLocale = {
2119
- lessThanXSeconds: {
2120
- one: "less than a second",
2121
- other: "less than {{count}} seconds"
2122
- },
2123
- xSeconds: {
2124
- one: "1 second",
2125
- other: "{{count}} seconds"
2126
- },
2127
- halfAMinute: "half a minute",
2128
- lessThanXMinutes: {
2129
- one: "less than a minute",
2130
- other: "less than {{count}} minutes"
2131
- },
2132
- xMinutes: {
2133
- one: "1 minute",
2134
- other: "{{count}} minutes"
2135
- },
2136
- aboutXHours: {
2137
- one: "about 1 hour",
2138
- other: "about {{count}} hours"
2139
- },
2140
- xHours: {
2141
- one: "1 hour",
2142
- other: "{{count}} hours"
2143
- },
2144
- xDays: {
2145
- one: "1 day",
2146
- other: "{{count}} days"
2147
- },
2148
- aboutXWeeks: {
2149
- one: "about 1 week",
2150
- other: "about {{count}} weeks"
2151
- },
2152
- xWeeks: {
2153
- one: "1 week",
2154
- other: "{{count}} weeks"
2155
- },
2156
- aboutXMonths: {
2157
- one: "about 1 month",
2158
- other: "about {{count}} months"
2159
- },
2160
- xMonths: {
2161
- one: "1 month",
2162
- other: "{{count}} months"
2163
- },
2164
- aboutXYears: {
2165
- one: "about 1 year",
2166
- other: "about {{count}} years"
2167
- },
2168
- xYears: {
2169
- one: "1 year",
2170
- other: "{{count}} years"
2171
- },
2172
- overXYears: {
2173
- one: "over 1 year",
2174
- other: "over {{count}} years"
2175
- },
2176
- almostXYears: {
2177
- one: "almost 1 year",
2178
- other: "almost {{count}} years"
2179
- }
2180
- };
2181
- var formatDistance = (token, count, options) => {
2182
- let result;
2183
- const tokenValue = formatDistanceLocale[token];
2184
- if (typeof tokenValue === "string") {
2185
- result = tokenValue;
2186
- } else if (count === 1) {
2187
- result = tokenValue.one;
2188
- } else {
2189
- result = tokenValue.other.replace("{{count}}", count.toString());
2190
- }
2191
- if (options?.addSuffix) {
2192
- if (options.comparison && options.comparison > 0) {
2193
- return "in " + result;
2194
- } else {
2195
- return result + " ago";
2196
- }
2197
- }
2198
- return result;
2199
- };
2200
-
2201
- // ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.js
2202
- function buildFormatLongFn(args) {
2203
- return (options = {}) => {
2204
- const width = options.width ? String(options.width) : args.defaultWidth;
2205
- const format2 = args.formats[width] || args.formats[args.defaultWidth];
2206
- return format2;
2207
- };
2208
- }
2209
-
2210
- // ../../node_modules/date-fns/locale/en-US/_lib/formatLong.js
2211
- var dateFormats = {
2212
- full: "EEEE, MMMM do, y",
2213
- long: "MMMM do, y",
2214
- medium: "MMM d, y",
2215
- short: "MM/dd/yyyy"
2216
- };
2217
- var timeFormats = {
2218
- full: "h:mm:ss a zzzz",
2219
- long: "h:mm:ss a z",
2220
- medium: "h:mm:ss a",
2221
- short: "h:mm a"
2222
- };
2223
- var dateTimeFormats = {
2224
- full: "{{date}} 'at' {{time}}",
2225
- long: "{{date}} 'at' {{time}}",
2226
- medium: "{{date}}, {{time}}",
2227
- short: "{{date}}, {{time}}"
2228
- };
2229
- var formatLong = {
2230
- date: buildFormatLongFn({
2231
- formats: dateFormats,
2232
- defaultWidth: "full"
2233
- }),
2234
- time: buildFormatLongFn({
2235
- formats: timeFormats,
2236
- defaultWidth: "full"
2237
- }),
2238
- dateTime: buildFormatLongFn({
2239
- formats: dateTimeFormats,
2240
- defaultWidth: "full"
2241
- })
2242
- };
2243
-
2244
- // ../../node_modules/date-fns/locale/en-US/_lib/formatRelative.js
2245
- var formatRelativeLocale = {
2246
- lastWeek: "'last' eeee 'at' p",
2247
- yesterday: "'yesterday at' p",
2248
- today: "'today at' p",
2249
- tomorrow: "'tomorrow at' p",
2250
- nextWeek: "eeee 'at' p",
2251
- other: "P"
2252
- };
2253
- var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
2254
-
2255
- // ../../node_modules/date-fns/locale/_lib/buildLocalizeFn.js
2256
- function buildLocalizeFn(args) {
2257
- return (value, options) => {
2258
- const context = options?.context ? String(options.context) : "standalone";
2259
- let valuesArray;
2260
- if (context === "formatting" && args.formattingValues) {
2261
- const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
2262
- const width = options?.width ? String(options.width) : defaultWidth;
2263
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
2264
- } else {
2265
- const defaultWidth = args.defaultWidth;
2266
- const width = options?.width ? String(options.width) : args.defaultWidth;
2267
- valuesArray = args.values[width] || args.values[defaultWidth];
2268
- }
2269
- const index = args.argumentCallback ? args.argumentCallback(value) : value;
2270
- return valuesArray[index];
2271
- };
2272
- }
2273
-
2274
- // ../../node_modules/date-fns/locale/en-US/_lib/localize.js
2275
- var eraValues = {
2276
- narrow: ["B", "A"],
2277
- abbreviated: ["BC", "AD"],
2278
- wide: ["Before Christ", "Anno Domini"]
2279
- };
2280
- var quarterValues = {
2281
- narrow: ["1", "2", "3", "4"],
2282
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
2283
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
2284
- };
2285
- var monthValues = {
2286
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
2287
- abbreviated: [
2288
- "Jan",
2289
- "Feb",
2290
- "Mar",
2291
- "Apr",
2292
- "May",
2293
- "Jun",
2294
- "Jul",
2295
- "Aug",
2296
- "Sep",
2297
- "Oct",
2298
- "Nov",
2299
- "Dec"
2300
- ],
2301
- wide: [
2302
- "January",
2303
- "February",
2304
- "March",
2305
- "April",
2306
- "May",
2307
- "June",
2308
- "July",
2309
- "August",
2310
- "September",
2311
- "October",
2312
- "November",
2313
- "December"
2314
- ]
2315
- };
2316
- var dayValues = {
2317
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
2318
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
2319
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
2320
- wide: [
2321
- "Sunday",
2322
- "Monday",
2323
- "Tuesday",
2324
- "Wednesday",
2325
- "Thursday",
2326
- "Friday",
2327
- "Saturday"
2328
- ]
2329
- };
2330
- var dayPeriodValues = {
2331
- narrow: {
2332
- am: "a",
2333
- pm: "p",
2334
- midnight: "mi",
2335
- noon: "n",
2336
- morning: "morning",
2337
- afternoon: "afternoon",
2338
- evening: "evening",
2339
- night: "night"
2340
- },
2341
- abbreviated: {
2342
- am: "AM",
2343
- pm: "PM",
2344
- midnight: "midnight",
2345
- noon: "noon",
2346
- morning: "morning",
2347
- afternoon: "afternoon",
2348
- evening: "evening",
2349
- night: "night"
2350
- },
2351
- wide: {
2352
- am: "a.m.",
2353
- pm: "p.m.",
2354
- midnight: "midnight",
2355
- noon: "noon",
2356
- morning: "morning",
2357
- afternoon: "afternoon",
2358
- evening: "evening",
2359
- night: "night"
2360
- }
2361
- };
2362
- var formattingDayPeriodValues = {
2363
- narrow: {
2364
- am: "a",
2365
- pm: "p",
2366
- midnight: "mi",
2367
- noon: "n",
2368
- morning: "in the morning",
2369
- afternoon: "in the afternoon",
2370
- evening: "in the evening",
2371
- night: "at night"
2372
- },
2373
- abbreviated: {
2374
- am: "AM",
2375
- pm: "PM",
2376
- midnight: "midnight",
2377
- noon: "noon",
2378
- morning: "in the morning",
2379
- afternoon: "in the afternoon",
2380
- evening: "in the evening",
2381
- night: "at night"
2382
- },
2383
- wide: {
2384
- am: "a.m.",
2385
- pm: "p.m.",
2386
- midnight: "midnight",
2387
- noon: "noon",
2388
- morning: "in the morning",
2389
- afternoon: "in the afternoon",
2390
- evening: "in the evening",
2391
- night: "at night"
2392
- }
2393
- };
2394
- var ordinalNumber = (dirtyNumber, _options) => {
2395
- const number = Number(dirtyNumber);
2396
- const rem100 = number % 100;
2397
- if (rem100 > 20 || rem100 < 10) {
2398
- switch (rem100 % 10) {
2399
- case 1:
2400
- return number + "st";
2401
- case 2:
2402
- return number + "nd";
2403
- case 3:
2404
- return number + "rd";
2405
- }
2406
- }
2407
- return number + "th";
2408
- };
2409
- var localize = {
2410
- ordinalNumber,
2411
- era: buildLocalizeFn({
2412
- values: eraValues,
2413
- defaultWidth: "wide"
2414
- }),
2415
- quarter: buildLocalizeFn({
2416
- values: quarterValues,
2417
- defaultWidth: "wide",
2418
- argumentCallback: (quarter) => quarter - 1
2419
- }),
2420
- month: buildLocalizeFn({
2421
- values: monthValues,
2422
- defaultWidth: "wide"
2423
- }),
2424
- day: buildLocalizeFn({
2425
- values: dayValues,
2426
- defaultWidth: "wide"
2427
- }),
2428
- dayPeriod: buildLocalizeFn({
2429
- values: dayPeriodValues,
2430
- defaultWidth: "wide",
2431
- formattingValues: formattingDayPeriodValues,
2432
- defaultFormattingWidth: "wide"
2433
- })
2434
- };
2435
-
2436
- // ../../node_modules/date-fns/locale/_lib/buildMatchFn.js
2437
- function buildMatchFn(args) {
2438
- return (string, options = {}) => {
2439
- const width = options.width;
2440
- const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
2441
- const matchResult = string.match(matchPattern);
2442
- if (!matchResult) {
2443
- return null;
2444
- }
2445
- const matchedString = matchResult[0];
2446
- const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
2447
- const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
2448
- // [TODO] -- I challenge you to fix the type
2449
- findKey(parsePatterns, (pattern) => pattern.test(matchedString))
2450
- );
2451
- let value;
2452
- value = args.valueCallback ? args.valueCallback(key) : key;
2453
- value = options.valueCallback ? (
2454
- // [TODO] -- I challenge you to fix the type
2455
- options.valueCallback(value)
2456
- ) : value;
2457
- const rest = string.slice(matchedString.length);
2458
- return { value, rest };
2459
- };
2460
- }
2461
- function findKey(object, predicate) {
2462
- for (const key in object) {
2463
- if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
2464
- return key;
2465
- }
2466
- }
2467
- return void 0;
2468
- }
2469
- function findIndex(array, predicate) {
2470
- for (let key = 0; key < array.length; key++) {
2471
- if (predicate(array[key])) {
2472
- return key;
2473
- }
2474
- }
2475
- return void 0;
2476
- }
2477
-
2478
- // ../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
2479
- function buildMatchPatternFn(args) {
2480
- return (string, options = {}) => {
2481
- const matchResult = string.match(args.matchPattern);
2482
- if (!matchResult) return null;
2483
- const matchedString = matchResult[0];
2484
- const parseResult = string.match(args.parsePattern);
2485
- if (!parseResult) return null;
2486
- let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
2487
- value = options.valueCallback ? options.valueCallback(value) : value;
2488
- const rest = string.slice(matchedString.length);
2489
- return { value, rest };
2490
- };
2491
- }
2492
-
2493
- // ../../node_modules/date-fns/locale/en-US/_lib/match.js
2494
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
2495
- var parseOrdinalNumberPattern = /\d+/i;
2496
- var matchEraPatterns = {
2497
- narrow: /^(b|a)/i,
2498
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
2499
- wide: /^(before christ|before common era|anno domini|common era)/i
2500
- };
2501
- var parseEraPatterns = {
2502
- any: [/^b/i, /^(a|c)/i]
2503
- };
2504
- var matchQuarterPatterns = {
2505
- narrow: /^[1234]/i,
2506
- abbreviated: /^q[1234]/i,
2507
- wide: /^[1234](th|st|nd|rd)? quarter/i
2508
- };
2509
- var parseQuarterPatterns = {
2510
- any: [/1/i, /2/i, /3/i, /4/i]
2511
- };
2512
- var matchMonthPatterns = {
2513
- narrow: /^[jfmasond]/i,
2514
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
2515
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
2516
- };
2517
- var parseMonthPatterns = {
2518
- narrow: [
2519
- /^j/i,
2520
- /^f/i,
2521
- /^m/i,
2522
- /^a/i,
2523
- /^m/i,
2524
- /^j/i,
2525
- /^j/i,
2526
- /^a/i,
2527
- /^s/i,
2528
- /^o/i,
2529
- /^n/i,
2530
- /^d/i
2531
- ],
2532
- any: [
2533
- /^ja/i,
2534
- /^f/i,
2535
- /^mar/i,
2536
- /^ap/i,
2537
- /^may/i,
2538
- /^jun/i,
2539
- /^jul/i,
2540
- /^au/i,
2541
- /^s/i,
2542
- /^o/i,
2543
- /^n/i,
2544
- /^d/i
2545
- ]
2546
- };
2547
- var matchDayPatterns = {
2548
- narrow: /^[smtwf]/i,
2549
- short: /^(su|mo|tu|we|th|fr|sa)/i,
2550
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
2551
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
2552
- };
2553
- var parseDayPatterns = {
2554
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
2555
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
2556
- };
2557
- var matchDayPeriodPatterns = {
2558
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
2559
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
2560
- };
2561
- var parseDayPeriodPatterns = {
2562
- any: {
2563
- am: /^a/i,
2564
- pm: /^p/i,
2565
- midnight: /^mi/i,
2566
- noon: /^no/i,
2567
- morning: /morning/i,
2568
- afternoon: /afternoon/i,
2569
- evening: /evening/i,
2570
- night: /night/i
2571
- }
2572
- };
2573
- var match = {
2574
- ordinalNumber: buildMatchPatternFn({
2575
- matchPattern: matchOrdinalNumberPattern,
2576
- parsePattern: parseOrdinalNumberPattern,
2577
- valueCallback: (value) => parseInt(value, 10)
2578
- }),
2579
- era: buildMatchFn({
2580
- matchPatterns: matchEraPatterns,
2581
- defaultMatchWidth: "wide",
2582
- parsePatterns: parseEraPatterns,
2583
- defaultParseWidth: "any"
2584
- }),
2585
- quarter: buildMatchFn({
2586
- matchPatterns: matchQuarterPatterns,
2587
- defaultMatchWidth: "wide",
2588
- parsePatterns: parseQuarterPatterns,
2589
- defaultParseWidth: "any",
2590
- valueCallback: (index) => index + 1
2591
- }),
2592
- month: buildMatchFn({
2593
- matchPatterns: matchMonthPatterns,
2594
- defaultMatchWidth: "wide",
2595
- parsePatterns: parseMonthPatterns,
2596
- defaultParseWidth: "any"
2597
- }),
2598
- day: buildMatchFn({
2599
- matchPatterns: matchDayPatterns,
2600
- defaultMatchWidth: "wide",
2601
- parsePatterns: parseDayPatterns,
2602
- defaultParseWidth: "any"
2603
- }),
2604
- dayPeriod: buildMatchFn({
2605
- matchPatterns: matchDayPeriodPatterns,
2606
- defaultMatchWidth: "any",
2607
- parsePatterns: parseDayPeriodPatterns,
2608
- defaultParseWidth: "any"
2609
- })
2610
- };
2611
-
2612
- // ../../node_modules/date-fns/locale/en-US.js
2613
- var enUS = {
2614
- code: "en-US",
2615
- formatDistance,
2616
- formatLong,
2617
- formatRelative,
2618
- localize,
2619
- match,
2620
- options: {
2621
- weekStartsOn: 0,
2622
- firstWeekContainsDate: 1
2623
- }
2624
- };
2625
-
2626
- // ../../node_modules/date-fns/getDayOfYear.js
2627
- function getDayOfYear(date, options) {
2628
- const _date = toDate(date, options?.in);
2629
- const diff = differenceInCalendarDays(_date, startOfYear(_date));
2630
- const dayOfYear = diff + 1;
2631
- return dayOfYear;
2632
- }
2633
-
2634
- // ../../node_modules/date-fns/getISOWeek.js
2635
- function getISOWeek(date, options) {
2636
- const _date = toDate(date, options?.in);
2637
- const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
2638
- return Math.round(diff / millisecondsInWeek) + 1;
2639
- }
2640
-
2641
- // ../../node_modules/date-fns/getWeekYear.js
2642
- function getWeekYear(date, options) {
2643
- const _date = toDate(date, options?.in);
2644
- const year = _date.getFullYear();
2645
- const defaultOptions2 = getDefaultOptions();
2646
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2647
- const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
2648
- firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
2649
- firstWeekOfNextYear.setHours(0, 0, 0, 0);
2650
- const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
2651
- const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
2652
- firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
2653
- firstWeekOfThisYear.setHours(0, 0, 0, 0);
2654
- const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
2655
- if (+_date >= +startOfNextYear) {
2656
- return year + 1;
2657
- } else if (+_date >= +startOfThisYear) {
2658
- return year;
2659
- } else {
2660
- return year - 1;
2661
- }
2662
- }
2663
-
2664
- // ../../node_modules/date-fns/startOfWeekYear.js
2665
- function startOfWeekYear(date, options) {
2666
- const defaultOptions2 = getDefaultOptions();
2667
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
2668
- const year = getWeekYear(date, options);
2669
- const firstWeek = constructFrom(options?.in || date, 0);
2670
- firstWeek.setFullYear(year, 0, firstWeekContainsDate);
2671
- firstWeek.setHours(0, 0, 0, 0);
2672
- const _date = startOfWeek(firstWeek, options);
2673
- return _date;
2674
- }
2675
-
2676
- // ../../node_modules/date-fns/getWeek.js
2677
- function getWeek(date, options) {
2678
- const _date = toDate(date, options?.in);
2679
- const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
2680
- return Math.round(diff / millisecondsInWeek) + 1;
2681
- }
2682
-
2683
- // ../../node_modules/date-fns/_lib/addLeadingZeros.js
2684
- function addLeadingZeros(number, targetLength) {
2685
- const sign = number < 0 ? "-" : "";
2686
- const output = Math.abs(number).toString().padStart(targetLength, "0");
2687
- return sign + output;
2688
- }
2689
-
2690
- // ../../node_modules/date-fns/_lib/format/lightFormatters.js
2691
- var lightFormatters = {
2692
- // Year
2693
- y(date, token) {
2694
- const signedYear = date.getFullYear();
2695
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
2696
- return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
2697
- },
2698
- // Month
2699
- M(date, token) {
2700
- const month = date.getMonth();
2701
- return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
2702
- },
2703
- // Day of the month
2704
- d(date, token) {
2705
- return addLeadingZeros(date.getDate(), token.length);
2706
- },
2707
- // AM or PM
2708
- a(date, token) {
2709
- const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
2710
- switch (token) {
2711
- case "a":
2712
- case "aa":
2713
- return dayPeriodEnumValue.toUpperCase();
2714
- case "aaa":
2715
- return dayPeriodEnumValue;
2716
- case "aaaaa":
2717
- return dayPeriodEnumValue[0];
2718
- case "aaaa":
2719
- default:
2720
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
2721
- }
2722
- },
2723
- // Hour [1-12]
2724
- h(date, token) {
2725
- return addLeadingZeros(date.getHours() % 12 || 12, token.length);
2726
- },
2727
- // Hour [0-23]
2728
- H(date, token) {
2729
- return addLeadingZeros(date.getHours(), token.length);
2730
- },
2731
- // Minute
2732
- m(date, token) {
2733
- return addLeadingZeros(date.getMinutes(), token.length);
2734
- },
2735
- // Second
2736
- s(date, token) {
2737
- return addLeadingZeros(date.getSeconds(), token.length);
2738
- },
2739
- // Fraction of second
2740
- S(date, token) {
2741
- const numberOfDigits = token.length;
2742
- const milliseconds = date.getMilliseconds();
2743
- const fractionalSeconds = Math.trunc(
2744
- milliseconds * Math.pow(10, numberOfDigits - 3)
2745
- );
2746
- return addLeadingZeros(fractionalSeconds, token.length);
2747
- }
2748
- };
2749
-
2750
- // ../../node_modules/date-fns/_lib/format/formatters.js
2751
- var dayPeriodEnum = {
2752
- am: "am",
2753
- pm: "pm",
2754
- midnight: "midnight",
2755
- noon: "noon",
2756
- morning: "morning",
2757
- afternoon: "afternoon",
2758
- evening: "evening",
2759
- night: "night"
2760
- };
2761
- var formatters = {
2762
- // Era
2763
- G: function(date, token, localize2) {
2764
- const era = date.getFullYear() > 0 ? 1 : 0;
2765
- switch (token) {
2766
- // AD, BC
2767
- case "G":
2768
- case "GG":
2769
- case "GGG":
2770
- return localize2.era(era, { width: "abbreviated" });
2771
- // A, B
2772
- case "GGGGG":
2773
- return localize2.era(era, { width: "narrow" });
2774
- // Anno Domini, Before Christ
2775
- case "GGGG":
2776
- default:
2777
- return localize2.era(era, { width: "wide" });
2778
- }
2779
- },
2780
- // Year
2781
- y: function(date, token, localize2) {
2782
- if (token === "yo") {
2783
- const signedYear = date.getFullYear();
2784
- const year = signedYear > 0 ? signedYear : 1 - signedYear;
2785
- return localize2.ordinalNumber(year, { unit: "year" });
2786
- }
2787
- return lightFormatters.y(date, token);
2788
- },
2789
- // Local week-numbering year
2790
- Y: function(date, token, localize2, options) {
2791
- const signedWeekYear = getWeekYear(date, options);
2792
- const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
2793
- if (token === "YY") {
2794
- const twoDigitYear = weekYear % 100;
2795
- return addLeadingZeros(twoDigitYear, 2);
2796
- }
2797
- if (token === "Yo") {
2798
- return localize2.ordinalNumber(weekYear, { unit: "year" });
2799
- }
2800
- return addLeadingZeros(weekYear, token.length);
2801
- },
2802
- // ISO week-numbering year
2803
- R: function(date, token) {
2804
- const isoWeekYear = getISOWeekYear(date);
2805
- return addLeadingZeros(isoWeekYear, token.length);
2806
- },
2807
- // Extended year. This is a single number designating the year of this calendar system.
2808
- // The main difference between `y` and `u` localizers are B.C. years:
2809
- // | Year | `y` | `u` |
2810
- // |------|-----|-----|
2811
- // | AC 1 | 1 | 1 |
2812
- // | BC 1 | 1 | 0 |
2813
- // | BC 2 | 2 | -1 |
2814
- // Also `yy` always returns the last two digits of a year,
2815
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
2816
- u: function(date, token) {
2817
- const year = date.getFullYear();
2818
- return addLeadingZeros(year, token.length);
2819
- },
2820
- // Quarter
2821
- Q: function(date, token, localize2) {
2822
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
2823
- switch (token) {
2824
- // 1, 2, 3, 4
2825
- case "Q":
2826
- return String(quarter);
2827
- // 01, 02, 03, 04
2828
- case "QQ":
2829
- return addLeadingZeros(quarter, 2);
2830
- // 1st, 2nd, 3rd, 4th
2831
- case "Qo":
2832
- return localize2.ordinalNumber(quarter, { unit: "quarter" });
2833
- // Q1, Q2, Q3, Q4
2834
- case "QQQ":
2835
- return localize2.quarter(quarter, {
2836
- width: "abbreviated",
2837
- context: "formatting"
2838
- });
2839
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2840
- case "QQQQQ":
2841
- return localize2.quarter(quarter, {
2842
- width: "narrow",
2843
- context: "formatting"
2844
- });
2845
- // 1st quarter, 2nd quarter, ...
2846
- case "QQQQ":
2847
- default:
2848
- return localize2.quarter(quarter, {
2849
- width: "wide",
2850
- context: "formatting"
2851
- });
2852
- }
2853
- },
2854
- // Stand-alone quarter
2855
- q: function(date, token, localize2) {
2856
- const quarter = Math.ceil((date.getMonth() + 1) / 3);
2857
- switch (token) {
2858
- // 1, 2, 3, 4
2859
- case "q":
2860
- return String(quarter);
2861
- // 01, 02, 03, 04
2862
- case "qq":
2863
- return addLeadingZeros(quarter, 2);
2864
- // 1st, 2nd, 3rd, 4th
2865
- case "qo":
2866
- return localize2.ordinalNumber(quarter, { unit: "quarter" });
2867
- // Q1, Q2, Q3, Q4
2868
- case "qqq":
2869
- return localize2.quarter(quarter, {
2870
- width: "abbreviated",
2871
- context: "standalone"
2872
- });
2873
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
2874
- case "qqqqq":
2875
- return localize2.quarter(quarter, {
2876
- width: "narrow",
2877
- context: "standalone"
2878
- });
2879
- // 1st quarter, 2nd quarter, ...
2880
- case "qqqq":
2881
- default:
2882
- return localize2.quarter(quarter, {
2883
- width: "wide",
2884
- context: "standalone"
2885
- });
2886
- }
2887
- },
2888
- // Month
2889
- M: function(date, token, localize2) {
2890
- const month = date.getMonth();
2891
- switch (token) {
2892
- case "M":
2893
- case "MM":
2894
- return lightFormatters.M(date, token);
2895
- // 1st, 2nd, ..., 12th
2896
- case "Mo":
2897
- return localize2.ordinalNumber(month + 1, { unit: "month" });
2898
- // Jan, Feb, ..., Dec
2899
- case "MMM":
2900
- return localize2.month(month, {
2901
- width: "abbreviated",
2902
- context: "formatting"
2903
- });
2904
- // J, F, ..., D
2905
- case "MMMMM":
2906
- return localize2.month(month, {
2907
- width: "narrow",
2908
- context: "formatting"
2909
- });
2910
- // January, February, ..., December
2911
- case "MMMM":
2912
- default:
2913
- return localize2.month(month, { width: "wide", context: "formatting" });
2914
- }
2915
- },
2916
- // Stand-alone month
2917
- L: function(date, token, localize2) {
2918
- const month = date.getMonth();
2919
- switch (token) {
2920
- // 1, 2, ..., 12
2921
- case "L":
2922
- return String(month + 1);
2923
- // 01, 02, ..., 12
2924
- case "LL":
2925
- return addLeadingZeros(month + 1, 2);
2926
- // 1st, 2nd, ..., 12th
2927
- case "Lo":
2928
- return localize2.ordinalNumber(month + 1, { unit: "month" });
2929
- // Jan, Feb, ..., Dec
2930
- case "LLL":
2931
- return localize2.month(month, {
2932
- width: "abbreviated",
2933
- context: "standalone"
2934
- });
2935
- // J, F, ..., D
2936
- case "LLLLL":
2937
- return localize2.month(month, {
2938
- width: "narrow",
2939
- context: "standalone"
2940
- });
2941
- // January, February, ..., December
2942
- case "LLLL":
2943
- default:
2944
- return localize2.month(month, { width: "wide", context: "standalone" });
2945
- }
2946
- },
2947
- // Local week of year
2948
- w: function(date, token, localize2, options) {
2949
- const week = getWeek(date, options);
2950
- if (token === "wo") {
2951
- return localize2.ordinalNumber(week, { unit: "week" });
2952
- }
2953
- return addLeadingZeros(week, token.length);
2954
- },
2955
- // ISO week of year
2956
- I: function(date, token, localize2) {
2957
- const isoWeek = getISOWeek(date);
2958
- if (token === "Io") {
2959
- return localize2.ordinalNumber(isoWeek, { unit: "week" });
2960
- }
2961
- return addLeadingZeros(isoWeek, token.length);
2962
- },
2963
- // Day of the month
2964
- d: function(date, token, localize2) {
2965
- if (token === "do") {
2966
- return localize2.ordinalNumber(date.getDate(), { unit: "date" });
2967
- }
2968
- return lightFormatters.d(date, token);
2969
- },
2970
- // Day of year
2971
- D: function(date, token, localize2) {
2972
- const dayOfYear = getDayOfYear(date);
2973
- if (token === "Do") {
2974
- return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
2975
- }
2976
- return addLeadingZeros(dayOfYear, token.length);
2977
- },
2978
- // Day of week
2979
- E: function(date, token, localize2) {
2980
- const dayOfWeek = date.getDay();
2981
- switch (token) {
2982
- // Tue
2983
- case "E":
2984
- case "EE":
2985
- case "EEE":
2986
- return localize2.day(dayOfWeek, {
2987
- width: "abbreviated",
2988
- context: "formatting"
2989
- });
2990
- // T
2991
- case "EEEEE":
2992
- return localize2.day(dayOfWeek, {
2993
- width: "narrow",
2994
- context: "formatting"
2995
- });
2996
- // Tu
2997
- case "EEEEEE":
2998
- return localize2.day(dayOfWeek, {
2999
- width: "short",
3000
- context: "formatting"
3001
- });
3002
- // Tuesday
3003
- case "EEEE":
3004
- default:
3005
- return localize2.day(dayOfWeek, {
3006
- width: "wide",
3007
- context: "formatting"
3008
- });
3009
- }
3010
- },
3011
- // Local day of week
3012
- e: function(date, token, localize2, options) {
3013
- const dayOfWeek = date.getDay();
3014
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
3015
- switch (token) {
3016
- // Numerical value (Nth day of week with current locale or weekStartsOn)
3017
- case "e":
3018
- return String(localDayOfWeek);
3019
- // Padded numerical value
3020
- case "ee":
3021
- return addLeadingZeros(localDayOfWeek, 2);
3022
- // 1st, 2nd, ..., 7th
3023
- case "eo":
3024
- return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
3025
- case "eee":
3026
- return localize2.day(dayOfWeek, {
3027
- width: "abbreviated",
3028
- context: "formatting"
3029
- });
3030
- // T
3031
- case "eeeee":
3032
- return localize2.day(dayOfWeek, {
3033
- width: "narrow",
3034
- context: "formatting"
3035
- });
3036
- // Tu
3037
- case "eeeeee":
3038
- return localize2.day(dayOfWeek, {
3039
- width: "short",
3040
- context: "formatting"
3041
- });
3042
- // Tuesday
3043
- case "eeee":
3044
- default:
3045
- return localize2.day(dayOfWeek, {
3046
- width: "wide",
3047
- context: "formatting"
3048
- });
3049
- }
3050
- },
3051
- // Stand-alone local day of week
3052
- c: function(date, token, localize2, options) {
3053
- const dayOfWeek = date.getDay();
3054
- const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
3055
- switch (token) {
3056
- // Numerical value (same as in `e`)
3057
- case "c":
3058
- return String(localDayOfWeek);
3059
- // Padded numerical value
3060
- case "cc":
3061
- return addLeadingZeros(localDayOfWeek, token.length);
3062
- // 1st, 2nd, ..., 7th
3063
- case "co":
3064
- return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
3065
- case "ccc":
3066
- return localize2.day(dayOfWeek, {
3067
- width: "abbreviated",
3068
- context: "standalone"
3069
- });
3070
- // T
3071
- case "ccccc":
3072
- return localize2.day(dayOfWeek, {
3073
- width: "narrow",
3074
- context: "standalone"
3075
- });
3076
- // Tu
3077
- case "cccccc":
3078
- return localize2.day(dayOfWeek, {
3079
- width: "short",
3080
- context: "standalone"
3081
- });
3082
- // Tuesday
3083
- case "cccc":
3084
- default:
3085
- return localize2.day(dayOfWeek, {
3086
- width: "wide",
3087
- context: "standalone"
3088
- });
3089
- }
3090
- },
3091
- // ISO day of week
3092
- i: function(date, token, localize2) {
3093
- const dayOfWeek = date.getDay();
3094
- const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
3095
- switch (token) {
3096
- // 2
3097
- case "i":
3098
- return String(isoDayOfWeek);
3099
- // 02
3100
- case "ii":
3101
- return addLeadingZeros(isoDayOfWeek, token.length);
3102
- // 2nd
3103
- case "io":
3104
- return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
3105
- // Tue
3106
- case "iii":
3107
- return localize2.day(dayOfWeek, {
3108
- width: "abbreviated",
3109
- context: "formatting"
3110
- });
3111
- // T
3112
- case "iiiii":
3113
- return localize2.day(dayOfWeek, {
3114
- width: "narrow",
3115
- context: "formatting"
3116
- });
3117
- // Tu
3118
- case "iiiiii":
3119
- return localize2.day(dayOfWeek, {
3120
- width: "short",
3121
- context: "formatting"
3122
- });
3123
- // Tuesday
3124
- case "iiii":
3125
- default:
3126
- return localize2.day(dayOfWeek, {
3127
- width: "wide",
3128
- context: "formatting"
3129
- });
3130
- }
3131
- },
3132
- // AM or PM
3133
- a: function(date, token, localize2) {
3134
- const hours = date.getHours();
3135
- const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
3136
- switch (token) {
3137
- case "a":
3138
- case "aa":
3139
- return localize2.dayPeriod(dayPeriodEnumValue, {
3140
- width: "abbreviated",
3141
- context: "formatting"
3142
- });
3143
- case "aaa":
3144
- return localize2.dayPeriod(dayPeriodEnumValue, {
3145
- width: "abbreviated",
3146
- context: "formatting"
3147
- }).toLowerCase();
3148
- case "aaaaa":
3149
- return localize2.dayPeriod(dayPeriodEnumValue, {
3150
- width: "narrow",
3151
- context: "formatting"
3152
- });
3153
- case "aaaa":
3154
- default:
3155
- return localize2.dayPeriod(dayPeriodEnumValue, {
3156
- width: "wide",
3157
- context: "formatting"
3158
- });
3159
- }
3160
- },
3161
- // AM, PM, midnight, noon
3162
- b: function(date, token, localize2) {
3163
- const hours = date.getHours();
3164
- let dayPeriodEnumValue;
3165
- if (hours === 12) {
3166
- dayPeriodEnumValue = dayPeriodEnum.noon;
3167
- } else if (hours === 0) {
3168
- dayPeriodEnumValue = dayPeriodEnum.midnight;
3169
- } else {
3170
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
3171
- }
3172
- switch (token) {
3173
- case "b":
3174
- case "bb":
3175
- return localize2.dayPeriod(dayPeriodEnumValue, {
3176
- width: "abbreviated",
3177
- context: "formatting"
3178
- });
3179
- case "bbb":
3180
- return localize2.dayPeriod(dayPeriodEnumValue, {
3181
- width: "abbreviated",
3182
- context: "formatting"
3183
- }).toLowerCase();
3184
- case "bbbbb":
3185
- return localize2.dayPeriod(dayPeriodEnumValue, {
3186
- width: "narrow",
3187
- context: "formatting"
3188
- });
3189
- case "bbbb":
3190
- default:
3191
- return localize2.dayPeriod(dayPeriodEnumValue, {
3192
- width: "wide",
3193
- context: "formatting"
3194
- });
3195
- }
3196
- },
3197
- // in the morning, in the afternoon, in the evening, at night
3198
- B: function(date, token, localize2) {
3199
- const hours = date.getHours();
3200
- let dayPeriodEnumValue;
3201
- if (hours >= 17) {
3202
- dayPeriodEnumValue = dayPeriodEnum.evening;
3203
- } else if (hours >= 12) {
3204
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
3205
- } else if (hours >= 4) {
3206
- dayPeriodEnumValue = dayPeriodEnum.morning;
3207
- } else {
3208
- dayPeriodEnumValue = dayPeriodEnum.night;
3209
- }
3210
- switch (token) {
3211
- case "B":
3212
- case "BB":
3213
- case "BBB":
3214
- return localize2.dayPeriod(dayPeriodEnumValue, {
3215
- width: "abbreviated",
3216
- context: "formatting"
3217
- });
3218
- case "BBBBB":
3219
- return localize2.dayPeriod(dayPeriodEnumValue, {
3220
- width: "narrow",
3221
- context: "formatting"
3222
- });
3223
- case "BBBB":
3224
- default:
3225
- return localize2.dayPeriod(dayPeriodEnumValue, {
3226
- width: "wide",
3227
- context: "formatting"
3228
- });
3229
- }
3230
- },
3231
- // Hour [1-12]
3232
- h: function(date, token, localize2) {
3233
- if (token === "ho") {
3234
- let hours = date.getHours() % 12;
3235
- if (hours === 0) hours = 12;
3236
- return localize2.ordinalNumber(hours, { unit: "hour" });
3237
- }
3238
- return lightFormatters.h(date, token);
3239
- },
3240
- // Hour [0-23]
3241
- H: function(date, token, localize2) {
3242
- if (token === "Ho") {
3243
- return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
3244
- }
3245
- return lightFormatters.H(date, token);
3246
- },
3247
- // Hour [0-11]
3248
- K: function(date, token, localize2) {
3249
- const hours = date.getHours() % 12;
3250
- if (token === "Ko") {
3251
- return localize2.ordinalNumber(hours, { unit: "hour" });
3252
- }
3253
- return addLeadingZeros(hours, token.length);
3254
- },
3255
- // Hour [1-24]
3256
- k: function(date, token, localize2) {
3257
- let hours = date.getHours();
3258
- if (hours === 0) hours = 24;
3259
- if (token === "ko") {
3260
- return localize2.ordinalNumber(hours, { unit: "hour" });
3261
- }
3262
- return addLeadingZeros(hours, token.length);
3263
- },
3264
- // Minute
3265
- m: function(date, token, localize2) {
3266
- if (token === "mo") {
3267
- return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
3268
- }
3269
- return lightFormatters.m(date, token);
3270
- },
3271
- // Second
3272
- s: function(date, token, localize2) {
3273
- if (token === "so") {
3274
- return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
3275
- }
3276
- return lightFormatters.s(date, token);
3277
- },
3278
- // Fraction of second
3279
- S: function(date, token) {
3280
- return lightFormatters.S(date, token);
3281
- },
3282
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
3283
- X: function(date, token, _localize) {
3284
- const timezoneOffset = date.getTimezoneOffset();
3285
- if (timezoneOffset === 0) {
3286
- return "Z";
3287
- }
3288
- switch (token) {
3289
- // Hours and optional minutes
3290
- case "X":
3291
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3292
- // Hours, minutes and optional seconds without `:` delimiter
3293
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3294
- // so this token always has the same output as `XX`
3295
- case "XXXX":
3296
- case "XX":
3297
- return formatTimezone(timezoneOffset);
3298
- // Hours, minutes and optional seconds with `:` delimiter
3299
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3300
- // so this token always has the same output as `XXX`
3301
- case "XXXXX":
3302
- case "XXX":
3303
- // Hours and minutes with `:` delimiter
3304
- default:
3305
- return formatTimezone(timezoneOffset, ":");
3306
- }
3307
- },
3308
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
3309
- x: function(date, token, _localize) {
3310
- const timezoneOffset = date.getTimezoneOffset();
3311
- switch (token) {
3312
- // Hours and optional minutes
3313
- case "x":
3314
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
3315
- // Hours, minutes and optional seconds without `:` delimiter
3316
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3317
- // so this token always has the same output as `xx`
3318
- case "xxxx":
3319
- case "xx":
3320
- return formatTimezone(timezoneOffset);
3321
- // Hours, minutes and optional seconds with `:` delimiter
3322
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
3323
- // so this token always has the same output as `xxx`
3324
- case "xxxxx":
3325
- case "xxx":
3326
- // Hours and minutes with `:` delimiter
3327
- default:
3328
- return formatTimezone(timezoneOffset, ":");
3329
- }
3330
- },
3331
- // Timezone (GMT)
3332
- O: function(date, token, _localize) {
3333
- const timezoneOffset = date.getTimezoneOffset();
3334
- switch (token) {
3335
- // Short
3336
- case "O":
3337
- case "OO":
3338
- case "OOO":
3339
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
3340
- // Long
3341
- case "OOOO":
3342
- default:
3343
- return "GMT" + formatTimezone(timezoneOffset, ":");
3344
- }
3345
- },
3346
- // Timezone (specific non-location)
3347
- z: function(date, token, _localize) {
3348
- const timezoneOffset = date.getTimezoneOffset();
3349
- switch (token) {
3350
- // Short
3351
- case "z":
3352
- case "zz":
3353
- case "zzz":
3354
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
3355
- // Long
3356
- case "zzzz":
3357
- default:
3358
- return "GMT" + formatTimezone(timezoneOffset, ":");
3359
- }
3360
- },
3361
- // Seconds timestamp
3362
- t: function(date, token, _localize) {
3363
- const timestamp = Math.trunc(+date / 1e3);
3364
- return addLeadingZeros(timestamp, token.length);
3365
- },
3366
- // Milliseconds timestamp
3367
- T: function(date, token, _localize) {
3368
- return addLeadingZeros(+date, token.length);
3369
- }
3370
- };
3371
- function formatTimezoneShort(offset, delimiter = "") {
3372
- const sign = offset > 0 ? "-" : "+";
3373
- const absOffset = Math.abs(offset);
3374
- const hours = Math.trunc(absOffset / 60);
3375
- const minutes = absOffset % 60;
3376
- if (minutes === 0) {
3377
- return sign + String(hours);
3378
- }
3379
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
3380
- }
3381
- function formatTimezoneWithOptionalMinutes(offset, delimiter) {
3382
- if (offset % 60 === 0) {
3383
- const sign = offset > 0 ? "-" : "+";
3384
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
3385
- }
3386
- return formatTimezone(offset, delimiter);
3387
- }
3388
- function formatTimezone(offset, delimiter = "") {
3389
- const sign = offset > 0 ? "-" : "+";
3390
- const absOffset = Math.abs(offset);
3391
- const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
3392
- const minutes = addLeadingZeros(absOffset % 60, 2);
3393
- return sign + hours + delimiter + minutes;
3394
- }
3395
-
3396
- // ../../node_modules/date-fns/_lib/format/longFormatters.js
3397
- var dateLongFormatter = (pattern, formatLong2) => {
3398
- switch (pattern) {
3399
- case "P":
3400
- return formatLong2.date({ width: "short" });
3401
- case "PP":
3402
- return formatLong2.date({ width: "medium" });
3403
- case "PPP":
3404
- return formatLong2.date({ width: "long" });
3405
- case "PPPP":
3406
- default:
3407
- return formatLong2.date({ width: "full" });
3408
- }
3409
- };
3410
- var timeLongFormatter = (pattern, formatLong2) => {
3411
- switch (pattern) {
3412
- case "p":
3413
- return formatLong2.time({ width: "short" });
3414
- case "pp":
3415
- return formatLong2.time({ width: "medium" });
3416
- case "ppp":
3417
- return formatLong2.time({ width: "long" });
3418
- case "pppp":
3419
- default:
3420
- return formatLong2.time({ width: "full" });
3421
- }
3422
- };
3423
- var dateTimeLongFormatter = (pattern, formatLong2) => {
3424
- const matchResult = pattern.match(/(P+)(p+)?/) || [];
3425
- const datePattern = matchResult[1];
3426
- const timePattern = matchResult[2];
3427
- if (!timePattern) {
3428
- return dateLongFormatter(pattern, formatLong2);
3429
- }
3430
- let dateTimeFormat;
3431
- switch (datePattern) {
3432
- case "P":
3433
- dateTimeFormat = formatLong2.dateTime({ width: "short" });
3434
- break;
3435
- case "PP":
3436
- dateTimeFormat = formatLong2.dateTime({ width: "medium" });
3437
- break;
3438
- case "PPP":
3439
- dateTimeFormat = formatLong2.dateTime({ width: "long" });
3440
- break;
3441
- case "PPPP":
3442
- default:
3443
- dateTimeFormat = formatLong2.dateTime({ width: "full" });
3444
- break;
3445
- }
3446
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
3447
- };
3448
- var longFormatters = {
3449
- p: timeLongFormatter,
3450
- P: dateTimeLongFormatter
3451
- };
3452
-
3453
- // ../../node_modules/date-fns/_lib/protectedTokens.js
3454
- var dayOfYearTokenRE = /^D+$/;
3455
- var weekYearTokenRE = /^Y+$/;
3456
- var throwTokens = ["D", "DD", "YY", "YYYY"];
3457
- function isProtectedDayOfYearToken(token) {
3458
- return dayOfYearTokenRE.test(token);
3459
- }
3460
- function isProtectedWeekYearToken(token) {
3461
- return weekYearTokenRE.test(token);
3462
- }
3463
- function warnOrThrowProtectedError(token, format2, input) {
3464
- const _message = message(token, format2, input);
3465
- console.warn(_message);
3466
- if (throwTokens.includes(token)) throw new RangeError(_message);
3467
- }
3468
- function message(token, format2, input) {
3469
- const subject = token[0] === "Y" ? "years" : "days of the month";
3470
- return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
3471
- }
3472
-
3473
- // ../../node_modules/date-fns/format.js
3474
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
3475
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
3476
- var escapedStringRegExp = /^'([^]*?)'?$/;
3477
- var doubleQuoteRegExp = /''/g;
3478
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
3479
- function format(date, formatStr, options) {
3480
- const defaultOptions2 = getDefaultOptions();
3481
- const locale = options?.locale ?? defaultOptions2.locale ?? enUS;
3482
- const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1;
3483
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0;
3484
- const originalDate = toDate(date, options?.in);
3485
- if (!isValid(originalDate)) {
3486
- throw new RangeError("Invalid time value");
3487
- }
3488
- let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
3489
- const firstCharacter = substring[0];
3490
- if (firstCharacter === "p" || firstCharacter === "P") {
3491
- const longFormatter = longFormatters[firstCharacter];
3492
- return longFormatter(substring, locale.formatLong);
3493
- }
3494
- return substring;
3495
- }).join("").match(formattingTokensRegExp).map((substring) => {
3496
- if (substring === "''") {
3497
- return { isToken: false, value: "'" };
3498
- }
3499
- const firstCharacter = substring[0];
3500
- if (firstCharacter === "'") {
3501
- return { isToken: false, value: cleanEscapedString(substring) };
3502
- }
3503
- if (formatters[firstCharacter]) {
3504
- return { isToken: true, value: substring };
3505
- }
3506
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
3507
- throw new RangeError(
3508
- "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
3509
- );
3510
- }
3511
- return { isToken: false, value: substring };
3512
- });
3513
- if (locale.localize.preprocessor) {
3514
- parts = locale.localize.preprocessor(originalDate, parts);
3515
- }
3516
- const formatterOptions = {
3517
- firstWeekContainsDate,
3518
- weekStartsOn,
3519
- locale
3520
- };
3521
- return parts.map((part) => {
3522
- if (!part.isToken) return part.value;
3523
- const token = part.value;
3524
- if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
3525
- warnOrThrowProtectedError(token, formatStr, String(date));
3526
- }
3527
- const formatter = formatters[token[0]];
3528
- return formatter(originalDate, token, locale.localize, formatterOptions);
3529
- }).join("");
3530
- }
3531
- function cleanEscapedString(input) {
3532
- const matched = input.match(escapedStringRegExp);
3533
- if (!matched) {
3534
- return input;
3535
- }
3536
- return matched[1].replace(doubleQuoteRegExp, "'");
3537
- }
3538
-
3539
1970
  // components/customer/chat-message.tsx
1971
+ import { format } from "date-fns";
3540
1972
  import {
3541
1973
  AlertCircle as AlertCircle2,
3542
1974
  Bot as Bot2,
@@ -3595,7 +2027,7 @@ function MarkdownRenderer({ content }) {
3595
2027
  // components/customer/chat-message.tsx
3596
2028
  import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
3597
2029
  var Message = ({
3598
- message: message2,
2030
+ message,
3599
2031
  isConsecutive,
3600
2032
  onRetry
3601
2033
  }) => {
@@ -3624,34 +2056,34 @@ var Message = ({
3624
2056
  "div",
3625
2057
  {
3626
2058
  className: "flex justify-start gap-2",
3627
- "data-message-id": message2.id,
2059
+ "data-message-id": message.id,
3628
2060
  role: "article",
3629
- "aria-label": `Message from ${message2.senderId}`,
2061
+ "aria-label": `Message from ${message.senderId}`,
3630
2062
  children: [
3631
2063
  /* @__PURE__ */ jsx11("div", { className: "flex pt-10 w-10", children: /* @__PURE__ */ jsxs8("div", { className: "w-8 h-8 rounded-full flex justify-center", children: [
3632
- message2.role === "user" && /* @__PURE__ */ jsx11(User, {}),
3633
- message2.role === "ai" && /* @__PURE__ */ jsx11(Bot2, {}),
3634
- message2.role === "humanAgent" && /* @__PURE__ */ jsx11(UserCog, {})
2064
+ message.role === "user" && /* @__PURE__ */ jsx11(User, {}),
2065
+ message.role === "ai" && /* @__PURE__ */ jsx11(Bot2, {}),
2066
+ message.role === "humanAgent" && /* @__PURE__ */ jsx11(UserCog, {})
3635
2067
  ] }) }),
3636
2068
  /* @__PURE__ */ jsxs8(
3637
2069
  "div",
3638
2070
  {
3639
2071
  className: `p-3 rounded-lg max-w-[80%] bg-gray-100 text-primary-900 ${isConsecutive ? "mt-1" : "mt-4"}`,
3640
2072
  children: [
3641
- /* @__PURE__ */ jsx11("div", { className: "break-words", children: /* @__PURE__ */ jsx11(MarkdownRenderer, { content: message2.content }) }),
3642
- message2.attachments?.map(
2073
+ /* @__PURE__ */ jsx11("div", { className: "break-words", children: /* @__PURE__ */ jsx11(MarkdownRenderer, { content: message.content }) }),
2074
+ message.attachments?.map(
3643
2075
  (attachment, i) => renderAttachment(attachment, i)
3644
2076
  ),
3645
2077
  /* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-end space-x-1 mt-1", children: [
3646
- /* @__PURE__ */ jsx11("span", { className: "text-xs opacity-70", children: format(message2.time, "HH:mm") }),
3647
- message2.role === "user" && /* @__PURE__ */ jsxs8(Fragment, { children: [
3648
- message2.status === "sending" && /* @__PURE__ */ jsx11("span", { className: "w-4 h-4 animate-spin rounded-full border-2 border-gray-300 border-t-white" }),
3649
- message2.status === "sent" && /* @__PURE__ */ jsx11(Check, { className: "w-4 h-4" }),
3650
- message2.status === "delivered" && /* @__PURE__ */ jsx11(CheckCheck, { className: "w-4 h-4" }),
3651
- message2.status === "failed" && /* @__PURE__ */ jsx11(
2078
+ /* @__PURE__ */ jsx11("span", { className: "text-xs opacity-70", children: format(message.time, "HH:mm") }),
2079
+ message.role === "user" && /* @__PURE__ */ jsxs8(Fragment, { children: [
2080
+ message.status === "sending" && /* @__PURE__ */ jsx11("span", { className: "w-4 h-4 animate-spin rounded-full border-2 border-gray-300 border-t-white" }),
2081
+ message.status === "sent" && /* @__PURE__ */ jsx11(Check, { className: "w-4 h-4" }),
2082
+ message.status === "delivered" && /* @__PURE__ */ jsx11(CheckCheck, { className: "w-4 h-4" }),
2083
+ message.status === "failed" && /* @__PURE__ */ jsx11(
3652
2084
  "button",
3653
2085
  {
3654
- onClick: () => onRetry(message2.id),
2086
+ onClick: () => onRetry(message.id),
3655
2087
  className: "text-red-300 hover:text-red-400",
3656
2088
  "aria-label": "Retry sending message",
3657
2089
  children: /* @__PURE__ */ jsx11(AlertCircle2, { className: "w-4 h-4" })