import { r as n, h as e, H as t, a } from "./p-9b9ccd0c.js";

import { g as i } from "./p-d42e842b.js";

import "./p-6534555e.js";

import "lit";

import "lit/directives/when.js";

import "lit/directives/if-defined.js";

import { L as o } from "./p-311eedf3.js";

import { f as r } from "./p-4d330836.js";

/**
 * @module constants
 * @summary Useful constants
 * @description
 * Collection of useful date constants.
 *
 * The constants could be imported from `date-fns/constants`:
 *
 * ```ts
 * import { maxTime, minTime } from "./constants/date-fns/constants";
 *
 * function isAllowedTime(time) {
 *   return time <= maxTime && time >= minTime;
 * }
 * ```
 */
/**
 * @constant
 * @name minutesInMonth
 * @summary Minutes in 1 month.
 */ const s = 43200;

/**
 * @constant
 * @name minutesInDay
 * @summary Minutes in 1 day.
 */ const c = 1440;

/**
 * @constant
 * @name constructFromSymbol
 * @summary Symbol enabling Date extensions to inherit properties from the reference date.
 *
 * The symbol is used to enable the `constructFrom` function to construct a date
 * using a reference date and a value. It allows to transfer extra properties
 * from the reference date to the new date. It's useful for extensions like
 * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as
 * a constructor argument.
 */ const d = Symbol.for("constructDateFrom");

/**
 * @name constructFrom
 * @category Generic Helpers
 * @summary Constructs a date using the reference date and the value
 *
 * @description
 * The function constructs a new date using the constructor from the reference
 * date and the given value. It helps to build generic functions that accept
 * date extensions.
 *
 * It defaults to `Date` if the passed reference date is a number or a string.
 *
 * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]`
 * enabling to transfer extra properties from the reference date to the new date.
 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
 * that accept a time zone as a constructor argument.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 *
 * @param date - The reference date to take constructor from
 * @param value - The value to create the date
 *
 * @returns Date initialized using the given date and value
 *
 * @example
 * import { constructFrom } from "./constructFrom/date-fns";
 *
 * // A function that clones a date preserving the original type
 * function cloneDate<DateType extends Date>(date: DateType): DateType {
 *   return constructFrom(
 *     date, // Use constructor from the given date
 *     date.getTime() // Use the date value to create a new date
 *   );
 * }
 */ function constructFrom(n, e) {
  if (typeof n === "function") return n(e);
  if (n && typeof n === "object" && d in n) return n[d](e);
  if (n instanceof Date) return new n.constructor(e);
  return new Date(e);
}

/**
 * @name toDate
 * @category Common Helpers
 * @summary Convert the given argument to an instance of Date.
 *
 * @description
 * Convert the given argument to an instance of Date.
 *
 * If the argument is an instance of Date, the function returns its clone.
 *
 * If the argument is a number, it is treated as a timestamp.
 *
 * If the argument is none of the above, the function returns Invalid Date.
 *
 * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]`
 * enabling to transfer extra properties from the reference date to the new date.
 * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz)
 * that accept a time zone as a constructor argument.
 *
 * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param argument - The value to convert
 *
 * @returns The parsed date in the local time zone
 *
 * @example
 * // Clone the date:
 * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
 * //=> Tue Feb 11 2014 11:30:30
 *
 * @example
 * // Convert the timestamp to date:
 * const result = toDate(1392098430000)
 * //=> Tue Feb 11 2014 11:30:30
 */ function toDate(n, e) {
  // [TODO] Get rid of `toDate` or `constructFrom`?
  return constructFrom(e || n, n);
}

let l = {};

function getDefaultOptions() {
  return l;
}

/**
 * The {@link startOfWeek} function options.
 */
/**
 * @name startOfWeek
 * @category Week Helpers
 * @summary Return the start of a week for the given date.
 *
 * @description
 * Return the start of a week for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The start of a week
 *
 * @example
 * // The start of a week for 2 September 2014 11:55:00:
 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Sun Aug 31 2014 00:00:00
 *
 * @example
 * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
 * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
 * //=> Mon Sep 01 2014 00:00:00
 */ function startOfWeek(n, e) {
  const t = getDefaultOptions();
  const a = e?.weekStartsOn ?? e?.locale?.options?.weekStartsOn ?? t.weekStartsOn ?? t.locale?.options?.weekStartsOn ?? 0;
  const i = toDate(n, e?.in);
  const o = i.getDay();
  const r = (o < a ? 7 : 0) + o - a;
  i.setDate(i.getDate() - r);
  i.setHours(0, 0, 0, 0);
  return i;
}

/**
 * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
 * They usually appear for dates that denote time before the timezones were introduced
 * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
 * and GMT+01:00:00 after that date)
 *
 * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
 * which would lead to incorrect calculations.
 *
 * This function returns the timezone offset in milliseconds that takes seconds in account.
 */ function getTimezoneOffsetInMilliseconds(n) {
  const e = toDate(n);
  const t = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds()));
  t.setUTCFullYear(e.getFullYear());
  return +n - +t;
}

function normalizeDates(n, ...e) {
  const t = constructFrom.bind(null, n || e.find((n => typeof n === "object")));
  return e.map(t);
}

/**
 * @name compareAsc
 * @category Common Helpers
 * @summary Compare the two dates and return -1, 0 or 1.
 *
 * @description
 * Compare the two dates and return 1 if the first date is after the second,
 * -1 if the first date is before the second or 0 if dates are equal.
 *
 * @param dateLeft - The first date to compare
 * @param dateRight - The second date to compare
 *
 * @returns The result of the comparison
 *
 * @example
 * // Compare 11 February 1987 and 10 July 1989:
 * const result = compareAsc(new Date(1987, 1, 11), new Date(1989, 6, 10))
 * //=> -1
 *
 * @example
 * // Sort the array of dates:
 * const result = [
 *   new Date(1995, 6, 2),
 *   new Date(1987, 1, 11),
 *   new Date(1989, 6, 10)
 * ].sort(compareAsc)
 * //=> [
 * //   Wed Feb 11 1987 00:00:00,
 * //   Mon Jul 10 1989 00:00:00,
 * //   Sun Jul 02 1995 00:00:00
 * // ]
 */ function compareAsc(n, e) {
  const t = +toDate(n) - +toDate(e);
  if (t < 0) return -1; else if (t > 0) return 1;
  // Return 0 if diff is 0; return NaN if diff is NaN
    return t;
}

/**
 * @name constructNow
 * @category Generic Helpers
 * @summary Constructs a new current date using the passed value constructor.
 * @pure false
 *
 * @description
 * The function constructs a new current date using the constructor from
 * the reference date. It helps to build generic functions that accept date
 * extensions and use the current date.
 *
 * It defaults to `Date` if the passed reference date is a number or a string.
 *
 * @param date - The reference date to take constructor from
 *
 * @returns Current date initialized using the given date constructor
 *
 * @example
 * import { constructNow, isSameDay } from 'date-fns'
 *
 * function isToday<DateType extends Date>(
 *   date: DateArg<DateType>,
 * ): boolean {
 *   // If we were to use `new Date()` directly, the function would  behave
 *   // differently in different timezones and return false for the same date.
 *   return isSameDay(date, constructNow(date));
 * }
 */ function constructNow(n) {
  return constructFrom(n, Date.now());
}

/**
 * The {@link differenceInCalendarMonths} function options.
 */
/**
 * @name differenceInCalendarMonths
 * @category Month Helpers
 * @summary Get the number of calendar months between the given dates.
 *
 * @description
 * Get the number of calendar months between the given dates.
 *
 * @param laterDate - The later date
 * @param earlierDate - The earlier date
 * @param options - An object with options
 *
 * @returns The number of calendar months
 *
 * @example
 * // How many calendar months are between 31 January 2014 and 1 September 2014?
 * const result = differenceInCalendarMonths(
 *   new Date(2014, 8, 1),
 *   new Date(2014, 0, 31)
 * )
 * //=> 8
 */ function differenceInCalendarMonths(n, e, t) {
  const [a, i] = normalizeDates(t?.in, n, e);
  const o = a.getFullYear() - i.getFullYear();
  const r = a.getMonth() - i.getMonth();
  return o * 12 + r;
}

function getRoundingMethod(n) {
  return e => {
    const t = n ? Math[n] : Math.trunc;
    const a = t(e);
    // Prevent negative zero
        return a === 0 ? 0 : a;
  };
}

/**
 * @name differenceInMilliseconds
 * @category Millisecond Helpers
 * @summary Get the number of milliseconds between the given dates.
 *
 * @description
 * Get the number of milliseconds between the given dates.
 *
 * @param laterDate - The later date
 * @param earlierDate - The earlier date
 *
 * @returns The number of milliseconds
 *
 * @example
 * // How many milliseconds are between
 * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
 * const result = differenceInMilliseconds(
 *   new Date(2014, 6, 2, 12, 30, 21, 700),
 *   new Date(2014, 6, 2, 12, 30, 20, 600)
 * )
 * //=> 1100
 */ function differenceInMilliseconds(n, e) {
  return +toDate(n) - +toDate(e);
}

/**
 * The {@link endOfDay} function options.
 */
/**
 * @name endOfDay
 * @category Day Helpers
 * @summary Return the end of a day for the given date.
 *
 * @description
 * Return the end of a day for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The end of a day
 *
 * @example
 * // The end of a day for 2 September 2014 11:55:00:
 * const result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Tue Sep 02 2014 23:59:59.999
 */ function endOfDay(n, e) {
  const t = toDate(n, e?.in);
  t.setHours(23, 59, 59, 999);
  return t;
}

/**
 * The {@link endOfMonth} function options.
 */
/**
 * @name endOfMonth
 * @category Month Helpers
 * @summary Return the end of a month for the given date.
 *
 * @description
 * Return the end of a month for the given date.
 * The result will be in the local timezone.
 *
 * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
 * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
 *
 * @param date - The original date
 * @param options - An object with options
 *
 * @returns The end of a month
 *
 * @example
 * // The end of a month for 2 September 2014 11:55:00:
 * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
 * //=> Tue Sep 30 2014 23:59:59.999
 */ function endOfMonth(n, e) {
  const t = toDate(n, e?.in);
  const a = t.getMonth();
  t.setFullYear(t.getFullYear(), a + 1, 0);
  t.setHours(23, 59, 59, 999);
  return t;
}

/**
 * @name isLastDayOfMonth
 * @category Month Helpers
 * @summary Is the given date the last day of a month?
 *
 * @description
 * Is the given date the last day of a month?
 *
 * @param date - The date to check
 * @param options - An object with options
 *
 * @returns The date is the last day of a month
 *
 * @example
 * // Is 28 February 2014 the last day of a month?
 * const result = isLastDayOfMonth(new Date(2014, 1, 28))
 * //=> true
 */ function isLastDayOfMonth(n, e) {
  const t = toDate(n, e?.in);
  return +endOfDay(t, e) === +endOfMonth(t, e);
}

/**
 * The {@link differenceInMonths} function options.
 */
/**
 * @name differenceInMonths
 * @category Month Helpers
 * @summary Get the number of full months between the given dates.
 *
 * @param laterDate - The later date
 * @param earlierDate - The earlier date
 * @param options - An object with options
 *
 * @returns The number of full months
 *
 * @example
 * // How many full months are between 31 January 2014 and 1 September 2014?
 * const result = differenceInMonths(new Date(2014, 8, 1), new Date(2014, 0, 31))
 * //=> 7
 */ function differenceInMonths(n, e, t) {
  const [a, i, o] = normalizeDates(t?.in, n, n, e);
  const r = compareAsc(i, o);
  const s = Math.abs(differenceInCalendarMonths(i, o));
  if (s < 1) return 0;
  if (i.getMonth() === 1 && i.getDate() > 27) i.setDate(30);
  i.setMonth(i.getMonth() - r * s);
  let c = compareAsc(i, o) === -r;
  if (isLastDayOfMonth(a) && s === 1 && compareAsc(a, o) === 1) {
    c = false;
  }
  const d = r * (s - +c);
  return d === 0 ? 0 : d;
}

/**
 * The {@link differenceInSeconds} function options.
 */
/**
 * @name differenceInSeconds
 * @category Second Helpers
 * @summary Get the number of seconds between the given dates.
 *
 * @description
 * Get the number of seconds between the given dates.
 *
 * @param laterDate - The later date
 * @param earlierDate - The earlier date
 * @param options - An object with options.
 *
 * @returns The number of seconds
 *
 * @example
 * // How many seconds are between
 * // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
 * const result = differenceInSeconds(
 *   new Date(2014, 6, 2, 12, 30, 20, 0),
 *   new Date(2014, 6, 2, 12, 30, 7, 999)
 * )
 * //=> 12
 */ function differenceInSeconds(n, e, t) {
  const a = differenceInMilliseconds(n, e) / 1e3;
  return getRoundingMethod(t?.roundingMethod)(a);
}

const u = {
  lessThanXSeconds: {
    one: "less than a second",
    other: "less than {{count}} seconds"
  },
  xSeconds: {
    one: "1 second",
    other: "{{count}} seconds"
  },
  halfAMinute: "half a minute",
  lessThanXMinutes: {
    one: "less than a minute",
    other: "less than {{count}} minutes"
  },
  xMinutes: {
    one: "1 minute",
    other: "{{count}} minutes"
  },
  aboutXHours: {
    one: "about 1 hour",
    other: "about {{count}} hours"
  },
  xHours: {
    one: "1 hour",
    other: "{{count}} hours"
  },
  xDays: {
    one: "1 day",
    other: "{{count}} days"
  },
  aboutXWeeks: {
    one: "about 1 week",
    other: "about {{count}} weeks"
  },
  xWeeks: {
    one: "1 week",
    other: "{{count}} weeks"
  },
  aboutXMonths: {
    one: "about 1 month",
    other: "about {{count}} months"
  },
  xMonths: {
    one: "1 month",
    other: "{{count}} months"
  },
  aboutXYears: {
    one: "about 1 year",
    other: "about {{count}} years"
  },
  xYears: {
    one: "1 year",
    other: "{{count}} years"
  },
  overXYears: {
    one: "over 1 year",
    other: "over {{count}} years"
  },
  almostXYears: {
    one: "almost 1 year",
    other: "almost {{count}} years"
  }
};

const formatDistance$3 = (n, e, t) => {
  let a;
  const i = u[n];
  if (typeof i === "string") {
    a = i;
  } else if (e === 1) {
    a = i.one;
  } else {
    a = i.other.replace("{{count}}", e.toString());
  }
  if (t?.addSuffix) {
    if (t.comparison && t.comparison > 0) {
      return "in " + a;
    } else {
      return a + " ago";
    }
  }
  return a;
};

function buildFormatLongFn(n) {
  return (e = {}) => {
    // TODO: Remove String()
    const t = e.width ? String(e.width) : n.defaultWidth;
    const a = n.formats[t] || n.formats[n.defaultWidth];
    return a;
  };
}

const h = {
  full: "EEEE, MMMM do, y",
  long: "MMMM do, y",
  medium: "MMM d, y",
  short: "MM/dd/yyyy"
};

const m = {
  full: "h:mm:ss a zzzz",
  long: "h:mm:ss a z",
  medium: "h:mm:ss a",
  short: "h:mm a"
};

const f = {
  full: "{{date}} 'at' {{time}}",
  long: "{{date}} 'at' {{time}}",
  medium: "{{date}}, {{time}}",
  short: "{{date}}, {{time}}"
};

const g = {
  date: buildFormatLongFn({
    formats: h,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: m,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: f,
    defaultWidth: "full"
  })
};

const p = {
  lastWeek: "'last' eeee 'at' p",
  yesterday: "'yesterday at' p",
  today: "'today at' p",
  tomorrow: "'tomorrow at' p",
  nextWeek: "eeee 'at' p",
  other: "P"
};

const formatRelative$2 = (n, e, t, a) => p[n]
/**
 * The localize function argument callback which allows to convert raw value to
 * the actual type.
 *
 * @param value - The value to convert
 *
 * @returns The converted value
 */
/**
 * The map of localized values for each width.
 */
/**
 * The index type of the locale unit value. It types conversion of units of
 * values that don't start at 0 (i.e. quarters).
 */
/**
 * Converts the unit value to the tuple of values.
 */
/**
 * The tuple of localized era values. The first element represents BC,
 * the second element represents AD.
 */
/**
 * The tuple of localized quarter values. The first element represents Q1.
 */
/**
 * The tuple of localized day values. The first element represents Sunday.
 */
/**
 * The tuple of localized month values. The first element represents January.
 */;

function buildLocalizeFn(n) {
  return (e, t) => {
    const a = t?.context ? String(t.context) : "standalone";
    let i;
    if (a === "formatting" && n.formattingValues) {
      const e = n.defaultFormattingWidth || n.defaultWidth;
      const a = t?.width ? String(t.width) : e;
      i = n.formattingValues[a] || n.formattingValues[e];
    } else {
      const e = n.defaultWidth;
      const a = t?.width ? String(t.width) : n.defaultWidth;
      i = n.values[a] || n.values[e];
    }
    const o = n.argumentCallback ? n.argumentCallback(e) : e;
    // @ts-expect-error - For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
        return i[o];
  };
}

const b = {
  narrow: [ "B", "A" ],
  abbreviated: [ "BC", "AD" ],
  wide: [ "Before Christ", "Anno Domini" ]
};

const y = {
  narrow: [ "1", "2", "3", "4" ],
  abbreviated: [ "Q1", "Q2", "Q3", "Q4" ],
  wide: [ "1st quarter", "2nd quarter", "3rd quarter", "4th quarter" ]
};

// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
const w = {
  narrow: [ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D" ],
  abbreviated: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ],
  wide: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]
};

const v = {
  narrow: [ "S", "M", "T", "W", "T", "F", "S" ],
  short: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ],
  abbreviated: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
  wide: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]
};

const _ = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "morning",
    afternoon: "afternoon",
    evening: "evening",
    night: "night"
  }
};

const k = {
  narrow: {
    am: "a",
    pm: "p",
    midnight: "mi",
    noon: "n",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  },
  abbreviated: {
    am: "AM",
    pm: "PM",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  },
  wide: {
    am: "a.m.",
    pm: "p.m.",
    midnight: "midnight",
    noon: "noon",
    morning: "in the morning",
    afternoon: "in the afternoon",
    evening: "in the evening",
    night: "at night"
  }
};

const ordinalNumber$2 = (n, e) => {
  const t = Number(n);
  // If ordinal numbers depend on context, for example,
  // if they are different for different grammatical genders,
  // use `options.unit`.
  
  // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
  // 'day', 'hour', 'minute', 'second'.
    const a = t % 100;
  if (a > 20 || a < 10) {
    switch (a % 10) {
     case 1:
      return t + "st";

     case 2:
      return t + "nd";

     case 3:
      return t + "rd";
    }
  }
  return t + "th";
};

const M = {
  ordinalNumber: ordinalNumber$2,
  era: buildLocalizeFn({
    values: b,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: y,
    defaultWidth: "wide",
    argumentCallback: n => n - 1
  }),
  month: buildLocalizeFn({
    values: w,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: v,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: _,
    defaultWidth: "wide",
    formattingValues: k,
    defaultFormattingWidth: "wide"
  })
};

function buildMatchFn(n) {
  return (e, t = {}) => {
    const a = t.width;
    const i = a && n.matchPatterns[a] || n.matchPatterns[n.defaultMatchWidth];
    const o = e.match(i);
    if (!o) {
      return null;
    }
    const r = o[0];
    const s = a && n.parsePatterns[a] || n.parsePatterns[n.defaultParseWidth];
    const c = Array.isArray(s) ? findIndex(s, (n => n.test(r))) : // [TODO] -- I challenge you to fix the type
    findKey(s, (n => n.test(r)));
    let d;
    d = n.valueCallback ? n.valueCallback(c) : c;
    d = t.valueCallback ? // [TODO] -- I challenge you to fix the type
    t.valueCallback(d) : d;
    const l = e.slice(r.length);
    return {
      value: d,
      rest: l
    };
  };
}

function findKey(n, e) {
  for (const t in n) {
    if (Object.prototype.hasOwnProperty.call(n, t) && e(n[t])) {
      return t;
    }
  }
  return undefined;
}

function findIndex(n, e) {
  for (let t = 0; t < n.length; t++) {
    if (e(n[t])) {
      return t;
    }
  }
  return undefined;
}

function buildMatchPatternFn(n) {
  return (e, t = {}) => {
    const a = e.match(n.matchPattern);
    if (!a) return null;
    const i = a[0];
    const o = e.match(n.parsePattern);
    if (!o) return null;
    let r = n.valueCallback ? n.valueCallback(o[0]) : o[0];
    // [TODO] I challenge you to fix the type
        r = t.valueCallback ? t.valueCallback(r) : r;
    const s = e.slice(i.length);
    return {
      value: r,
      rest: s
    };
  };
}

const x = /^(\d+)(th|st|nd|rd)?/i;

const W = /\d+/i;

const F = {
  narrow: /^(b|a)/i,
  abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  wide: /^(before christ|before common era|anno domini|common era)/i
};

const P = {
  any: [ /^b/i, /^(a|c)/i ]
};

const z = {
  narrow: /^[1234]/i,
  abbreviated: /^q[1234]/i,
  wide: /^[1234](th|st|nd|rd)? quarter/i
};

const D = {
  any: [ /1/i, /2/i, /3/i, /4/i ]
};

const S = {
  narrow: /^[jfmasond]/i,
  abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
};

const T = {
  narrow: [ /^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i ],
  any: [ /^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i ]
};

const C = {
  narrow: /^[smtwf]/i,
  short: /^(su|mo|tu|we|th|fr|sa)/i,
  abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
};

const X = {
  narrow: [ /^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i ],
  any: [ /^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i ]
};

const L = {
  narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
};

const j = {
  any: {
    am: /^a/i,
    pm: /^p/i,
    midnight: /^mi/i,
    noon: /^no/i,
    morning: /morning/i,
    afternoon: /afternoon/i,
    evening: /evening/i,
    night: /night/i
  }
};

const A = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: x,
    parsePattern: W,
    valueCallback: n => parseInt(n, 10)
  }),
  era: buildMatchFn({
    matchPatterns: F,
    defaultMatchWidth: "wide",
    parsePatterns: P,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: z,
    defaultMatchWidth: "wide",
    parsePatterns: D,
    defaultParseWidth: "any",
    valueCallback: n => n + 1
  }),
  month: buildMatchFn({
    matchPatterns: S,
    defaultMatchWidth: "wide",
    parsePatterns: T,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: C,
    defaultMatchWidth: "wide",
    parsePatterns: X,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: L,
    defaultMatchWidth: "any",
    parsePatterns: j,
    defaultParseWidth: "any"
  })
};

/**
 * @category Locales
 * @summary English locale (United States).
 * @language English
 * @iso-639-2 eng
 * @author Sasha Koss [@kossnocorp](https://github.com/kossnocorp)
 * @author Lesha Koss [@leshakoss](https://github.com/leshakoss)
 */ const I = {
  code: "en-US",
  formatDistance: formatDistance$3,
  formatLong: g,
  formatRelative: formatRelative$2,
  localize: M,
  match: A,
  options: {
    weekStartsOn: 0 /* Sunday */ ,
    firstWeekContainsDate: 1
  }
};

/**
 * The {@link formatDistance} function options.
 */
/**
 * @name formatDistance
 * @category Common Helpers
 * @summary Return the distance between the given dates in words.
 *
 * @description
 * Return the distance between the given dates in words.
 *
 * | Distance between dates                                            | Result              |
 * |-------------------------------------------------------------------|---------------------|
 * | 0 ... 30 secs                                                     | less than a minute  |
 * | 30 secs ... 1 min 30 secs                                         | 1 minute            |
 * | 1 min 30 secs ... 44 mins 30 secs                                 | [2..44] minutes     |
 * | 44 mins ... 30 secs ... 89 mins 30 secs                           | about 1 hour        |
 * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs                        | about [2..24] hours |
 * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs                 | 1 day               |
 * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs         | [2..30] days        |
 * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month       |
 * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months      |
 * | 59 days 23 hrs 59 mins 30 secs ... 1 yr                           | [2..12] months      |
 * | 1 yr ... 1 yr 3 months                                            | about 1 year        |
 * | 1 yr 3 months ... 1 yr 9 month s                                  | over 1 year         |
 * | 1 yr 9 months ... 2 yrs                                           | almost 2 years      |
 * | N yrs ... N yrs 3 months                                          | about N years       |
 * | N yrs 3 months ... N yrs 9 months                                 | over N years        |
 * | N yrs 9 months ... N+1 yrs                                        | almost N+1 years    |
 *
 * With `options.includeSeconds == true`:
 * | Distance between dates | Result               |
 * |------------------------|----------------------|
 * | 0 secs ... 5 secs      | less than 5 seconds  |
 * | 5 secs ... 10 secs     | less than 10 seconds |
 * | 10 secs ... 20 secs    | less than 20 seconds |
 * | 20 secs ... 40 secs    | half a minute        |
 * | 40 secs ... 60 secs    | less than a minute   |
 * | 60 secs ... 90 secs    | 1 minute             |
 *
 * @param laterDate - The date
 * @param earlierDate - The date to compare with
 * @param options - An object with options
 *
 * @returns The distance in words
 *
 * @throws `date` must not be Invalid Date
 * @throws `baseDate` must not be Invalid Date
 * @throws `options.locale` must contain `formatDistance` property
 *
 * @example
 * // What is the distance between 2 July 2014 and 1 January 2015?
 * const result = formatDistance(new Date(2014, 6, 2), new Date(2015, 0, 1))
 * //=> '6 months'
 *
 * @example
 * // What is the distance between 1 January 2015 00:00:15
 * // and 1 January 2015 00:00:00, including seconds?
 * const result = formatDistance(
 *   new Date(2015, 0, 1, 0, 0, 15),
 *   new Date(2015, 0, 1, 0, 0, 0),
 *   { includeSeconds: true }
 * )
 * //=> 'less than 20 seconds'
 *
 * @example
 * // What is the distance from 1 January 2016
 * // to 1 January 2015, with a suffix?
 * const result = formatDistance(new Date(2015, 0, 1), new Date(2016, 0, 1), {
 *   addSuffix: true
 * })
 * //=> 'about 1 year ago'
 *
 * @example
 * // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
 * import { eoLocale } from 'date-fns/locale/eo'
 * const result = formatDistance(new Date(2016, 7, 1), new Date(2015, 0, 1), {
 *   locale: eoLocale
 * })
 * //=> 'pli ol 1 jaro'
 */ function formatDistance$2(n, e, t) {
  const a = getDefaultOptions();
  const i = t?.locale ?? a.locale ?? I;
  const o = 2520;
  const r = compareAsc(n, e);
  if (isNaN(r)) throw new RangeError("Invalid time value");
  const d = Object.assign({}, t, {
    addSuffix: t?.addSuffix,
    comparison: r
  });
  const [l, u] = normalizeDates(t?.in, ...r > 0 ? [ e, n ] : [ n, e ]);
  const h = differenceInSeconds(u, l);
  const m = (getTimezoneOffsetInMilliseconds(u) - getTimezoneOffsetInMilliseconds(l)) / 1e3;
  const f = Math.round((h - m) / 60);
  let g;
  // 0 up to 2 mins
    if (f < 2) {
    if (t?.includeSeconds) {
      if (h < 5) {
        return i.formatDistance("lessThanXSeconds", 5, d);
      } else if (h < 10) {
        return i.formatDistance("lessThanXSeconds", 10, d);
      } else if (h < 20) {
        return i.formatDistance("lessThanXSeconds", 20, d);
      } else if (h < 40) {
        return i.formatDistance("halfAMinute", 0, d);
      } else if (h < 60) {
        return i.formatDistance("lessThanXMinutes", 1, d);
      } else {
        return i.formatDistance("xMinutes", 1, d);
      }
    } else {
      if (f === 0) {
        return i.formatDistance("lessThanXMinutes", 1, d);
      } else {
        return i.formatDistance("xMinutes", f, d);
      }
    }
    // 2 mins up to 0.75 hrs
    } else if (f < 45) {
    return i.formatDistance("xMinutes", f, d);
    // 0.75 hrs up to 1.5 hrs
    } else if (f < 90) {
    return i.formatDistance("aboutXHours", 1, d);
    // 1.5 hrs up to 24 hrs
    } else if (f < c) {
    const n = Math.round(f / 60);
    return i.formatDistance("aboutXHours", n, d);
    // 1 day up to 1.75 days
    } else if (f < o) {
    return i.formatDistance("xDays", 1, d);
    // 1.75 days up to 30 days
    } else if (f < s) {
    const n = Math.round(f / c);
    return i.formatDistance("xDays", n, d);
    // 1 month up to 2 months
    } else if (f < s * 2) {
    g = Math.round(f / s);
    return i.formatDistance("aboutXMonths", g, d);
  }
  g = differenceInMonths(u, l);
  // 2 months up to 12 months
    if (g < 12) {
    const n = Math.round(f / s);
    return i.formatDistance("xMonths", n, d);
    // 1 year up to max Date
    } else {
    const n = g % 12;
    const e = Math.trunc(g / 12);
    // N years up to 1 years 3 months
        if (n < 3) {
      return i.formatDistance("aboutXYears", e, d);
      // N years 3 months up to N years 9 months
        } else if (n < 9) {
      return i.formatDistance("overXYears", e, d);
      // N years 9 months up to N year 12 months
        } else {
      return i.formatDistance("almostXYears", e + 1, d);
    }
  }
}

/**
 * The {@link formatDistanceToNow} function options.
 */
/**
 * @name formatDistanceToNow
 * @category Common Helpers
 * @summary Return the distance between the given date and now in words.
 * @pure false
 *
 * @description
 * Return the distance between the given date and now in words.
 *
 * | Distance to now                                                   | Result              |
 * |-------------------------------------------------------------------|---------------------|
 * | 0 ... 30 secs                                                     | less than a minute  |
 * | 30 secs ... 1 min 30 secs                                         | 1 minute            |
 * | 1 min 30 secs ... 44 mins 30 secs                                 | [2..44] minutes     |
 * | 44 mins ... 30 secs ... 89 mins 30 secs                           | about 1 hour        |
 * | 89 mins 30 secs ... 23 hrs 59 mins 30 secs                        | about [2..24] hours |
 * | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs                 | 1 day               |
 * | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs         | [2..30] days        |
 * | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month       |
 * | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months      |
 * | 59 days 23 hrs 59 mins 30 secs ... 1 yr                           | [2..12] months      |
 * | 1 yr ... 1 yr 3 months                                            | about 1 year        |
 * | 1 yr 3 months ... 1 yr 9 month s                                  | over 1 year         |
 * | 1 yr 9 months ... 2 yrs                                           | almost 2 years      |
 * | N yrs ... N yrs 3 months                                          | about N years       |
 * | N yrs 3 months ... N yrs 9 months                                 | over N years        |
 * | N yrs 9 months ... N+1 yrs                                        | almost N+1 years    |
 *
 * With `options.includeSeconds == true`:
 * | Distance to now     | Result               |
 * |---------------------|----------------------|
 * | 0 secs ... 5 secs   | less than 5 seconds  |
 * | 5 secs ... 10 secs  | less than 10 seconds |
 * | 10 secs ... 20 secs | less than 20 seconds |
 * | 20 secs ... 40 secs | half a minute        |
 * | 40 secs ... 60 secs | less than a minute   |
 * | 60 secs ... 90 secs | 1 minute             |
 *
 * @param date - The given date
 * @param options - The object with options
 *
 * @returns The distance in words
 *
 * @throws `date` must not be Invalid Date
 * @throws `options.locale` must contain `formatDistance` property
 *
 * @example
 * // If today is 1 January 2015, what is the distance to 2 July 2014?
 * const result = formatDistanceToNow(
 *   new Date(2014, 6, 2)
 * )
 * //=> '6 months'
 *
 * @example
 * // If now is 1 January 2015 00:00:00,
 * // what is the distance to 1 January 2015 00:00:15, including seconds?
 * const result = formatDistanceToNow(
 *   new Date(2015, 0, 1, 0, 0, 15),
 *   {includeSeconds: true}
 * )
 * //=> 'less than 20 seconds'
 *
 * @example
 * // If today is 1 January 2015,
 * // what is the distance to 1 January 2016, with a suffix?
 * const result = formatDistanceToNow(
 *   new Date(2016, 0, 1),
 *   {addSuffix: true}
 * )
 * //=> 'in about 1 year'
 *
 * @example
 * // If today is 1 January 2015,
 * // what is the distance to 1 August 2016 in Esperanto?
 * const eoLocale = require('date-fns/locale/eo')
 * const result = formatDistanceToNow(
 *   new Date(2016, 7, 1),
 *   {locale: eoLocale}
 * )
 * //=> 'pli ol 1 jaro'
 */ function formatDistanceToNow(n, e) {
  return formatDistance$2(n, constructNow(n), e);
}

/**
 * The {@link isSameWeek} function options.
 */
/**
 * @name isSameWeek
 * @category Week Helpers
 * @summary Are the given dates in the same week (and month and year)?
 *
 * @description
 * Are the given dates in the same week (and month and year)?
 *
 * @param laterDate - The first date to check
 * @param earlierDate - The second date to check
 * @param options - An object with options
 *
 * @returns The dates are in the same week (and month and year)
 *
 * @example
 * // Are 31 August 2014 and 4 September 2014 in the same week?
 * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4))
 * //=> true
 *
 * @example
 * // If week starts with Monday,
 * // are 31 August 2014 and 4 September 2014 in the same week?
 * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), {
 *   weekStartsOn: 1
 * })
 * //=> false
 *
 * @example
 * // Are 1 January 2014 and 1 January 2015 in the same week?
 * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1))
 * //=> false
 */ function isSameWeek(n, e, t) {
  const [a, i] = normalizeDates(t?.in, n, e);
  return +startOfWeek(a, t) === +startOfWeek(i, t);
}

const O = {
  lessThanXSeconds: {
    one: "1秒未満",
    other: "{{count}}秒未満",
    oneWithSuffix: "約1秒",
    otherWithSuffix: "約{{count}}秒"
  },
  xSeconds: {
    one: "1秒",
    other: "{{count}}秒"
  },
  halfAMinute: "30秒",
  lessThanXMinutes: {
    one: "1分未満",
    other: "{{count}}分未満",
    oneWithSuffix: "約1分",
    otherWithSuffix: "約{{count}}分"
  },
  xMinutes: {
    one: "1分",
    other: "{{count}}分"
  },
  aboutXHours: {
    one: "約1時間",
    other: "約{{count}}時間"
  },
  xHours: {
    one: "1時間",
    other: "{{count}}時間"
  },
  xDays: {
    one: "1日",
    other: "{{count}}日"
  },
  aboutXWeeks: {
    one: "約1週間",
    other: "約{{count}}週間"
  },
  xWeeks: {
    one: "1週間",
    other: "{{count}}週間"
  },
  aboutXMonths: {
    one: "約1か月",
    other: "約{{count}}か月"
  },
  xMonths: {
    one: "1か月",
    other: "{{count}}か月"
  },
  aboutXYears: {
    one: "約1年",
    other: "約{{count}}年"
  },
  xYears: {
    one: "1年",
    other: "{{count}}年"
  },
  overXYears: {
    one: "1年以上",
    other: "{{count}}年以上"
  },
  almostXYears: {
    one: "1年近く",
    other: "{{count}}年近く"
  }
};

const formatDistance$1 = (n, e, t) => {
  t = t || {};
  let a;
  const i = O[n];
  if (typeof i === "string") {
    a = i;
  } else if (e === 1) {
    if (t.addSuffix && i.oneWithSuffix) {
      a = i.oneWithSuffix;
    } else {
      a = i.one;
    }
  } else {
    if (t.addSuffix && i.otherWithSuffix) {
      a = i.otherWithSuffix.replace("{{count}}", String(e));
    } else {
      a = i.other.replace("{{count}}", String(e));
    }
  }
  if (t.addSuffix) {
    if (t.comparison && t.comparison > 0) {
      return a + "後";
    } else {
      return a + "前";
    }
  }
  return a;
};

const N = {
  full: "y年M月d日EEEE",
  long: "y年M月d日",
  medium: "y/MM/dd",
  short: "y/MM/dd"
};

const E = {
  full: "H時mm分ss秒 zzzz",
  long: "H:mm:ss z",
  medium: "H:mm:ss",
  short: "H:mm"
};

const Y = {
  full: "{{date}} {{time}}",
  long: "{{date}} {{time}}",
  medium: "{{date}} {{time}}",
  short: "{{date}} {{time}}"
};

const q = {
  date: buildFormatLongFn({
    formats: N,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: E,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: Y,
    defaultWidth: "full"
  })
};

const H = {
  lastWeek: "先週のeeeeのp",
  yesterday: "昨日のp",
  today: "今日のp",
  tomorrow: "明日のp",
  nextWeek: "翌週のeeeeのp",
  other: "P"
};

const formatRelative$1 = (n, e, t, a) => H[n];

const $ = {
  narrow: [ "BC", "AC" ],
  abbreviated: [ "紀元前", "西暦" ],
  wide: [ "紀元前", "西暦" ]
};

const J = {
  narrow: [ "1", "2", "3", "4" ],
  abbreviated: [ "Q1", "Q2", "Q3", "Q4" ],
  wide: [ "第1四半期", "第2四半期", "第3四半期", "第4四半期" ]
};

const Q = {
  narrow: [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ],
  abbreviated: [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" ],
  wide: [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" ]
};

const R = {
  narrow: [ "日", "月", "火", "水", "木", "金", "土" ],
  short: [ "日", "月", "火", "水", "木", "金", "土" ],
  abbreviated: [ "日", "月", "火", "水", "木", "金", "土" ],
  wide: [ "日曜日", "月曜日", "火曜日", "水曜日", "木曜日", "金曜日", "土曜日" ]
};

const B = {
  narrow: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  },
  abbreviated: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  },
  wide: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  }
};

const V = {
  narrow: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  },
  abbreviated: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  },
  wide: {
    am: "午前",
    pm: "午後",
    midnight: "深夜",
    noon: "正午",
    morning: "朝",
    afternoon: "午後",
    evening: "夜",
    night: "深夜"
  }
};

const ordinalNumber$1 = (n, e) => {
  const t = Number(n);
  const a = String(e?.unit);
  switch (a) {
   case "year":
    return `${t}年`;

   case "quarter":
    return `第${t}四半期`;

   case "month":
    return `${t}月`;

   case "week":
    return `第${t}週`;

   case "date":
    return `${t}日`;

   case "hour":
    return `${t}時`;

   case "minute":
    return `${t}分`;

   case "second":
    return `${t}秒`;

   default:
    return `${t}`;
  }
};

const K = {
  ordinalNumber: ordinalNumber$1,
  era: buildLocalizeFn({
    values: $,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: J,
    defaultWidth: "wide",
    argumentCallback: n => Number(n) - 1
  }),
  month: buildLocalizeFn({
    values: Q,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: R,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: B,
    defaultWidth: "wide",
    formattingValues: V,
    defaultFormattingWidth: "wide"
  })
};

const G = /^第?\d+(年|四半期|月|週|日|時|分|秒)?/i;

const U = /\d+/i;

const Z = {
  narrow: /^(B\.?C\.?|A\.?D\.?)/i,
  abbreviated: /^(紀元[前後]|西暦)/i,
  wide: /^(紀元[前後]|西暦)/i
};

const nn = {
  narrow: [ /^B/i, /^A/i ],
  any: [ /^(紀元前)/i, /^(西暦|紀元後)/i ]
};

const en = {
  narrow: /^[1234]/i,
  abbreviated: /^Q[1234]/i,
  wide: /^第[1234一二三四１２３４]四半期/i
};

const tn = {
  any: [ /(1|一|１)/i, /(2|二|２)/i, /(3|三|３)/i, /(4|四|４)/i ]
};

const an = {
  narrow: /^([123456789]|1[012])/,
  abbreviated: /^([123456789]|1[012])月/i,
  wide: /^([123456789]|1[012])月/i
};

const on = {
  any: [ /^1\D/, /^2/, /^3/, /^4/, /^5/, /^6/, /^7/, /^8/, /^9/, /^10/, /^11/, /^12/ ]
};

const rn = {
  narrow: /^[日月火水木金土]/,
  short: /^[日月火水木金土]/,
  abbreviated: /^[日月火水木金土]/,
  wide: /^[日月火水木金土]曜日/
};

const sn = {
  any: [ /^日/, /^月/, /^火/, /^水/, /^木/, /^金/, /^土/ ]
};

const cn = {
  any: /^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i
};

const dn = {
  any: {
    am: /^(A|午前)/i,
    pm: /^(P|午後)/i,
    midnight: /^深夜|真夜中/i,
    noon: /^正午/i,
    morning: /^朝/i,
    afternoon: /^午後/i,
    evening: /^夜/i,
    night: /^深夜/i
  }
};

const ln = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: G,
    parsePattern: U,
    valueCallback: function(n) {
      return parseInt(n, 10);
    }
  }),
  era: buildMatchFn({
    matchPatterns: Z,
    defaultMatchWidth: "wide",
    parsePatterns: nn,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: en,
    defaultMatchWidth: "wide",
    parsePatterns: tn,
    defaultParseWidth: "any",
    valueCallback: n => n + 1
  }),
  month: buildMatchFn({
    matchPatterns: an,
    defaultMatchWidth: "wide",
    parsePatterns: on,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: rn,
    defaultMatchWidth: "wide",
    parsePatterns: sn,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: cn,
    defaultMatchWidth: "any",
    parsePatterns: dn,
    defaultParseWidth: "any"
  })
};

/**
 * @category Locales
 * @summary Japanese locale.
 * @language Japanese
 * @iso-639-2 jpn
 * @author Thomas Eilmsteiner [@DeMuu](https://github.com/DeMuu)
 * @author Yamagishi Kazutoshi [@ykzts](https://github.com/ykzts)
 * @author Luca Ban [@mesqueeb](https://github.com/mesqueeb)
 * @author Terrence Lam [@skyuplam](https://github.com/skyuplam)
 * @author Taiki IKeda [@so99ynoodles](https://github.com/so99ynoodles)
 */ const un = {
  code: "ja",
  formatDistance: formatDistance$1,
  formatLong: q,
  formatRelative: formatRelative$1,
  localize: K,
  match: ln,
  options: {
    weekStartsOn: 0 /* Sunday */ ,
    firstWeekContainsDate: 1
  }
};

const hn = {
  lessThanXSeconds: {
    one: "不到 1 秒",
    other: "不到 {{count}} 秒"
  },
  xSeconds: {
    one: "1 秒",
    other: "{{count}} 秒"
  },
  halfAMinute: "半分钟",
  lessThanXMinutes: {
    one: "不到 1 分钟",
    other: "不到 {{count}} 分钟"
  },
  xMinutes: {
    one: "1 分钟",
    other: "{{count}} 分钟"
  },
  xHours: {
    one: "1 小时",
    other: "{{count}} 小时"
  },
  aboutXHours: {
    one: "大约 1 小时",
    other: "大约 {{count}} 小时"
  },
  xDays: {
    one: "1 天",
    other: "{{count}} 天"
  },
  aboutXWeeks: {
    one: "大约 1 个星期",
    other: "大约 {{count}} 个星期"
  },
  xWeeks: {
    one: "1 个星期",
    other: "{{count}} 个星期"
  },
  aboutXMonths: {
    one: "大约 1 个月",
    other: "大约 {{count}} 个月"
  },
  xMonths: {
    one: "1 个月",
    other: "{{count}} 个月"
  },
  aboutXYears: {
    one: "大约 1 年",
    other: "大约 {{count}} 年"
  },
  xYears: {
    one: "1 年",
    other: "{{count}} 年"
  },
  overXYears: {
    one: "超过 1 年",
    other: "超过 {{count}} 年"
  },
  almostXYears: {
    one: "将近 1 年",
    other: "将近 {{count}} 年"
  }
};

const formatDistance = (n, e, t) => {
  let a;
  const i = hn[n];
  if (typeof i === "string") {
    a = i;
  } else if (e === 1) {
    a = i.one;
  } else {
    a = i.other.replace("{{count}}", String(e));
  }
  if (t?.addSuffix) {
    if (t.comparison && t.comparison > 0) {
      return a + "内";
    } else {
      return a + "前";
    }
  }
  return a;
};

const mn = {
  full: "y'年'M'月'd'日' EEEE",
  long: "y'年'M'月'd'日'",
  medium: "yyyy-MM-dd",
  short: "yy-MM-dd"
};

const fn = {
  full: "zzzz a h:mm:ss",
  long: "z a h:mm:ss",
  medium: "a h:mm:ss",
  short: "a h:mm"
};

const gn = {
  full: "{{date}} {{time}}",
  long: "{{date}} {{time}}",
  medium: "{{date}} {{time}}",
  short: "{{date}} {{time}}"
};

const pn = {
  date: buildFormatLongFn({
    formats: mn,
    defaultWidth: "full"
  }),
  time: buildFormatLongFn({
    formats: fn,
    defaultWidth: "full"
  }),
  dateTime: buildFormatLongFn({
    formats: gn,
    defaultWidth: "full"
  })
};

function checkWeek(n, e, t) {
  const a = "eeee p";
  if (isSameWeek(n, e, t)) {
    return a;
 // in same week
    } else if (n.getTime() > e.getTime()) {
    return "'下个'" + a;
 // in next week
    }
  return "'上个'" + a;
 // in last week
}

const bn = {
  lastWeek: checkWeek,
  // days before yesterday, maybe in this week or last week
  yesterday: "'昨天' p",
  today: "'今天' p",
  tomorrow: "'明天' p",
  nextWeek: checkWeek,
  // days after tomorrow, maybe in this week or next week
  other: "PP p"
};

const formatRelative = (n, e, t, a) => {
  const i = bn[n];
  if (typeof i === "function") {
    return i(e, t, a);
  }
  return i;
};

const yn = {
  narrow: [ "前", "公元" ],
  abbreviated: [ "前", "公元" ],
  wide: [ "公元前", "公元" ]
};

const wn = {
  narrow: [ "1", "2", "3", "4" ],
  abbreviated: [ "第一季", "第二季", "第三季", "第四季" ],
  wide: [ "第一季度", "第二季度", "第三季度", "第四季度" ]
};

const vn = {
  narrow: [ "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二" ],
  abbreviated: [ "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" ],
  wide: [ "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" ]
};

const _n = {
  narrow: [ "日", "一", "二", "三", "四", "五", "六" ],
  short: [ "日", "一", "二", "三", "四", "五", "六" ],
  abbreviated: [ "周日", "周一", "周二", "周三", "周四", "周五", "周六" ],
  wide: [ "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" ]
};

const kn = {
  narrow: {
    am: "上",
    pm: "下",
    midnight: "凌晨",
    noon: "午",
    morning: "早",
    afternoon: "下午",
    evening: "晚",
    night: "夜"
  },
  abbreviated: {
    am: "上午",
    pm: "下午",
    midnight: "凌晨",
    noon: "中午",
    morning: "早晨",
    afternoon: "中午",
    evening: "晚上",
    night: "夜间"
  },
  wide: {
    am: "上午",
    pm: "下午",
    midnight: "凌晨",
    noon: "中午",
    morning: "早晨",
    afternoon: "中午",
    evening: "晚上",
    night: "夜间"
  }
};

const Mn = {
  narrow: {
    am: "上",
    pm: "下",
    midnight: "凌晨",
    noon: "午",
    morning: "早",
    afternoon: "下午",
    evening: "晚",
    night: "夜"
  },
  abbreviated: {
    am: "上午",
    pm: "下午",
    midnight: "凌晨",
    noon: "中午",
    morning: "早晨",
    afternoon: "中午",
    evening: "晚上",
    night: "夜间"
  },
  wide: {
    am: "上午",
    pm: "下午",
    midnight: "凌晨",
    noon: "中午",
    morning: "早晨",
    afternoon: "中午",
    evening: "晚上",
    night: "夜间"
  }
};

const ordinalNumber = (n, e) => {
  const t = Number(n);
  switch (e?.unit) {
   case "date":
    return t.toString() + "日";

   case "hour":
    return t.toString() + "时";

   case "minute":
    return t.toString() + "分";

   case "second":
    return t.toString() + "秒";

   default:
    return "第 " + t.toString();
  }
};

const xn = {
  ordinalNumber,
  era: buildLocalizeFn({
    values: yn,
    defaultWidth: "wide"
  }),
  quarter: buildLocalizeFn({
    values: wn,
    defaultWidth: "wide",
    argumentCallback: n => n - 1
  }),
  month: buildLocalizeFn({
    values: vn,
    defaultWidth: "wide"
  }),
  day: buildLocalizeFn({
    values: _n,
    defaultWidth: "wide"
  }),
  dayPeriod: buildLocalizeFn({
    values: kn,
    defaultWidth: "wide",
    formattingValues: Mn,
    defaultFormattingWidth: "wide"
  })
};

const Wn = /^(第\s*)?\d+(日|时|分|秒)?/i;

const Fn = /\d+/i;

const Pn = {
  narrow: /^(前)/i,
  abbreviated: /^(前)/i,
  wide: /^(公元前|公元)/i
};

const zn = {
  any: [ /^(前)/i, /^(公元)/i ]
};

const Dn = {
  narrow: /^[1234]/i,
  abbreviated: /^第[一二三四]刻/i,
  wide: /^第[一二三四]刻钟/i
};

const Sn = {
  any: [ /(1|一)/i, /(2|二)/i, /(3|三)/i, /(4|四)/i ]
};

const Tn = {
  narrow: /^(一|二|三|四|五|六|七|八|九|十[二一])/i,
  abbreviated: /^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,
  wide: /^(一|二|三|四|五|六|七|八|九|十[二一])月/i
};

const Cn = {
  narrow: [ /^一/i, /^二/i, /^三/i, /^四/i, /^五/i, /^六/i, /^七/i, /^八/i, /^九/i, /^十(?!(一|二))/i, /^十一/i, /^十二/i ],
  any: [ /^一|1/i, /^二|2/i, /^三|3/i, /^四|4/i, /^五|5/i, /^六|6/i, /^七|7/i, /^八|8/i, /^九|9/i, /^十(?!(一|二))|10/i, /^十一|11/i, /^十二|12/i ]
};

const Xn = {
  narrow: /^[一二三四五六日]/i,
  short: /^[一二三四五六日]/i,
  abbreviated: /^周[一二三四五六日]/i,
  wide: /^星期[一二三四五六日]/i
};

const Ln = {
  any: [ /日/i, /一/i, /二/i, /三/i, /四/i, /五/i, /六/i ]
};

const jn = {
  any: /^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i
};

const An = {
  any: {
    am: /^上午?/i,
    pm: /^下午?/i,
    midnight: /^午夜/i,
    noon: /^[中正]午/i,
    morning: /^早上/i,
    afternoon: /^下午/i,
    evening: /^晚上?/i,
    night: /^凌晨/i
  }
};

const In = {
  ordinalNumber: buildMatchPatternFn({
    matchPattern: Wn,
    parsePattern: Fn,
    valueCallback: n => parseInt(n, 10)
  }),
  era: buildMatchFn({
    matchPatterns: Pn,
    defaultMatchWidth: "wide",
    parsePatterns: zn,
    defaultParseWidth: "any"
  }),
  quarter: buildMatchFn({
    matchPatterns: Dn,
    defaultMatchWidth: "wide",
    parsePatterns: Sn,
    defaultParseWidth: "any",
    valueCallback: n => n + 1
  }),
  month: buildMatchFn({
    matchPatterns: Tn,
    defaultMatchWidth: "wide",
    parsePatterns: Cn,
    defaultParseWidth: "any"
  }),
  day: buildMatchFn({
    matchPatterns: Xn,
    defaultMatchWidth: "wide",
    parsePatterns: Ln,
    defaultParseWidth: "any"
  }),
  dayPeriod: buildMatchFn({
    matchPatterns: jn,
    defaultMatchWidth: "any",
    parsePatterns: An,
    defaultParseWidth: "any"
  })
};

/**
 * @category Locales
 * @summary Chinese Simplified locale.
 * @language Chinese Simplified
 * @iso-639-2 zho
 * @author Changyu Geng [@KingMario](https://github.com/KingMario)
 * @author Song Shuoyun [@fnlctrl](https://github.com/fnlctrl)
 * @author sabrinaM [@sabrinamiao](https://github.com/sabrinamiao)
 * @author Carney Wu [@cubicwork](https://github.com/cubicwork)
 * @author Terrence Lam [@skyuplam](https://github.com/skyuplam)
 */ const On = {
  code: "zh-CN",
  formatDistance,
  formatLong: pn,
  formatRelative,
  localize: xn,
  match: In,
  options: {
    weekStartsOn: 1 /* Monday */ ,
    firstWeekContainsDate: 4
  }
};

const Nn = '/*@container queries*/\n/* hiChar styles\nFound on /common/helpers.tsx hiChar function is used to add a span/class to every character that matches a search value. It is used to help the user see why the filter results are filtered. The span/class on the characters are useless without proper styling.\n*/\nbutton.button-secondary {\n  border-color: var(--color-border-neutral-default);\n}\n\n:host {\n  --common-spacing: var(--spacing-padding-xxl);\n  --spacing-body-block-start: var(--common-spacing);\n  --spacing-body-block-end: var(--common-spacing);\n  --spacing-body-inline-start: var(--common-spacing);\n  --spacing-body-inline-end: 0;\n  --spacing-body-inline-start: 0;\n  display: grid;\n  block-size: 100%;\n  overflow: auto;\n}\n\n:host(.spacing-body) .section-secondary,\n:host(.spacing-body) .section-create-new-kb__header,\n:host(.spacing-body) .section-create-new-kb__actions,\n:host(.spacing-body-inline) .section-secondary,\n:host(.spacing-body-inline) .section-create-new-kb__header,\n:host(.spacing-body-inline) .section-create-new-kb__actions {\n  padding-inline-start: var(--common-spacing);\n  padding-inline-end: var(--common-spacing);\n}\n\n:host(.spacing-body-inline-start) .section-secondary,\n:host(.spacing-body-inline-start) .section-create-new-kb__actions {\n  padding-inline-start: var(--common-spacing);\n}\n\n:host(.spacing-body-inline-end) .section-secondary,\n:host(.spacing-body-inline-end) .section-create-new-kb__actions {\n  padding-inline-end: var(--common-spacing);\n}\n\n.main {\n  animation: fadeIn var(--timing-fast) forwards;\n  display: grid;\n  block-size: 100%;\n  overflow: auto;\n  opacity: 0;\n  grid-template-rows: max-content 1fr;\n  gap: var(--spacing-gap-xxl);\n}\n\n@keyframes bounce {\n  0% {\n    transform: translateY(0);\n  }\n  100% {\n    transform: translateY(calc(-1 * 32px));\n  }\n}\n@keyframes fadeIn {\n  from {\n    opacity: 0;\n  }\n  to {\n    opacity: 1;\n  }\n}\n.section-create-new-kb__actions,\n.section-secondary__actions {\n  display: grid;\n  grid-auto-flow: column;\n  gap: var(--spacing-gap-xl);\n  overflow-x: auto;\n  padding-block-end: var(--spacing-padding-m);\n}\n\n.card-filled,\n.card-outlined {\n  display: grid;\n  gap: var(--spacing-gap-xl);\n  align-content: space-between;\n  border-radius: 8px;\n}\n\n.card-filled {\n  background-color: var(--color-accent-surface-elevation-1);\n  padding: var(--spacing-padding-xl);\n}\n\n.card-outlined {\n  border: 1px solid var(--color-border-surface-on-surface);\n  grid-template-columns: max-content 1fr;\n  align-items: center;\n  padding: var(--spacing-padding-xl) var(--spacing-padding-xl) var(--spacing-padding-m) var(--spacing-padding-xl);\n}\n\n.icon-capsule {\n  pointer-events: none;\n  display: inline-flex;\n  block-size: 40px;\n  inline-size: 40px;\n  justify-content: center;\n  align-items: center;\n  border-radius: 50%;\n  border: 1px dashed var(--color-border-surface-on-elevation-2);\n}\n\n.card__header {\n  display: grid;\n  gap: var(--spacing-gap-l);\n  justify-items: self-start;\n}\n\n.card__header-description {\n  display: grid;\n  gap: var(--spacing-gap-m);\n}\n\n.section-create-new-kb {\n  display: grid;\n  grid-auto-rows: max-content;\n  gap: var(--spacing-gap-xxl);\n}\n.section-create-new-kb__header {\n  display: grid;\n  gap: var(--spacing-gap-m);\n}\n.section-create-new-kb__title {\n  color: var(--color-text-neutral-default);\n}\n.section-create-new-kb__actions {\n  display: grid;\n  gap: var(--spacing-gap-xl);\n  overflow-x: auto;\n  grid-auto-flow: column;\n  grid-auto-columns: 330px;\n}\n\n.samples-buttons-container {\n  flex-wrap: wrap;\n}\n\n.section-secondary {\n  display: grid;\n  block-size: 100%;\n  position: relative;\n  overflow: auto;\n}\n.section-secondary__title {\n  display: grid;\n  grid-template-columns: 1fr max-content 1fr;\n  gap: var(--spacing-gap-xl);\n  align-items: center;\n}\n.section-secondary__title::before, .section-secondary__title::after {\n  content: "";\n  block-size: 1px;\n  background-color: var(--color-border-surface-on-elevation-1);\n}\n.section-secondary__actions {\n  display: grid;\n}\n.section-secondary__actions--two-cards {\n  grid-template-columns: repeat(2, minmax(430px, 1fr));\n}\n.section-secondary__actions--multiple-cards {\n  grid-auto-columns: 670px;\n}\n\n.section-no-kbs {\n  display: grid;\n  block-size: 100%;\n  position: relative;\n  overflow: auto;\n  grid-template-rows: max-content max-content;\n  gap: var(--spacing-gap-xl);\n}\n\n.section-kbs {\n  background-color: var(--color-accent-surface-elevation-1);\n  border-radius: 4px;\n  padding: var(--spacing-padding-l);\n  display: grid;\n  container-type: inline-size;\n  grid-template-rows: auto 1fr;\n  overflow: hidden;\n}\n.section-kbs__header {\n  display: grid;\n  grid-template-columns: max-content 230px;\n  align-items: center;\n  gap: var(--spacing-gap-xxxl);\n  border-block-end: 1px solid var(--color-border-surface-on-elevation-1);\n  padding-block-end: var(--spacing-padding-l);\n}\n.section-kbs__header--no-border {\n  border-block-end-color: transparent !important;\n}\n.section-kbs__title {\n  align-items: center;\n  display: flex;\n  min-block-size: calc(32px - 1px);\n}\n.section-kbs__filter--hidden {\n  opacity: 0;\n}\n.section-kbs__list {\n  display: grid;\n  grid-auto-rows: max-content;\n  grid-template-columns: 1fr 1fr;\n  row-gap: var(--spacing-gap-m);\n  column-gap: var(--spacing-gap-xl);\n  overflow: auto;\n  position: relative;\n  padding-block-start: var(--spacing-padding-l);\n}\n.section-kbs__list--empty {\n  grid-template-columns: 1fr;\n  grid-auto-rows: 1fr;\n  overflow: hidden;\n}\n@container (max-width: 768px) {\n  .section-kbs__list {\n    grid-template-columns: 1fr;\n  }\n}\n\n.kb__item {\n  background-color: var(--color-accent-surface-elevation-2);\n  padding: var(--spacing-padding-l);\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) max-content;\n  align-items: center;\n  column-gap: 48px;\n}\n.kb__details {\n  display: grid;\n  grid-template-columns: max-content minmax(0, 1fr);\n  align-items: center;\n  gap: var(--spacing-gap-l);\n  overflow: hidden;\n}\n.kb__info {\n  display: grid;\n  gap: var(--spacing-gap-xs);\n  overflow: hidden;\n}\n.kb__name {\n  overflow: hidden;\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  text-decoration: underline;\n  cursor: pointer;\n  display: inline-block;\n}\n.kb__name:hover {\n  color: var(--color-text-neutral-default);\n}\n.kb__modified {\n  overflow: hidden;\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  text-align: end;\n  font-variant-numeric: tabular-nums;\n  color: var(--color-text-neutral-disabled);\n}\n.kb__path {\n  overflow: hidden;\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  color: var(--color-text-neutral-disabled);\n}\n\n.hiChar {\n  color: var(--color-text-primary-default);\n  filter: brightness(1.3);\n}\n\n.loader {\n  border: 1px solid var(--color-border-surface-on-surface);\n}\n\n.heading-2,\n.heading-3 {\n  margin: 0;\n  color: #ffffff !important;\n}\n\n.card-filled .heading-3 {\n  color: var(--color-text-neutral-strawberry) !important;\n}\n\n.card__header-title {\n  color: var(--color-text-neutral-default);\n}\n\n.button-tertiary-no-padding-inline-start.button-tertiary {\n  padding-inline-start: 0;\n}';

var En = undefined && undefined.__classPrivateFieldGet || function(n, e, t, a) {
  if (t === "a" && !a) throw new TypeError("Private accessor was defined without a getter");
  if (typeof e === "function" ? n !== e || !a : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return t === "m" ? a : t === "a" ? a.call(n) : a ? a.value : e.get(n);
};

var Yn = undefined && undefined.__classPrivateFieldSet || function(n, e, t, a, i) {
  if (a === "m") throw new TypeError("Private method is not writable");
  if (a === "a" && !i) throw new TypeError("Private accessor was defined without a setter");
  if (typeof e === "function" ? n !== e || !i : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return a === "a" ? i.call(n, t) : i ? i.value = t : e.set(n, t), t;
};

var qn, Hn, $n, Jn, Qn, Rn, Bn, Vn, Kn, Gn;

const Un = {
  en: I,
  ja: un,
  "zh-CN": On,
  "zh-TW": On,
  "zh-HK": On
};

const Zn = i({
  category: "system",
  name: "detail",
  colorType: "primary"
});

const ne = i({
  category: "window-tools",
  name: "filter",
  colorType: "on-surface"
});

const ee = i({
  category: "objects",
  name: "knowledge-base"
});

const te = i({
  category: "system",
  name: "search",
  colorType: "on-surface"
});

const ae = "[projectName]";

const ie = [ "resets/box-sizing", "utils/typography", "utils/layout", "components/edit", "components/icon", "components/button", "chameleon/scrollbar", "utils/typography" ];

const oe = class {
  constructor(t) {
    n(this, t);
    qn.add(this);
    /**
         * The component hard-coded strings translations.
         */
    // eslint-disable-next-line @stencil-community/own-props-must-be-private
        Hn.set(this, void 0);
    $n.set(this, void 0);
    Jn.set(this, (n => e => {
      e.stopPropagation();
      this.createKBCallback(n);
    }));
    Qn.set(this, (n => {
      this.kbFilterValue = n.detail;
    }));
    Rn.set(this, (n => e => {
      e.stopPropagation();
      this.openKbCallback(n);
    }));
    Vn.set(this, (() => {
      const n = this.kbs.length < this.kbsFilterThreshold;
      const t = this.filteredKbs.length === 0;
      let a;
      // Evaluate what is the content to display.
            if (this.filteredKbs.length > 0) {
        a = En(this, Kn, "f").call(this);
      } else {
        // No kb has pass the filter. Display an empty-state.
        a = e("gx-ide-empty-state", {
          isAnimated: true,
          stateIconSrc: ne,
          stateTitle: En(this, Hn, "f").recentKBs.noMatches
        });
      }
      return e("section", {
        class: "section-kbs"
      }, e("header", {
        class: {
          "section-kbs__header": true
        }
      }, e("label", {
        class: "subtitle-regular-s section-kbs__title",
        htmlFor: "filter-kbs"
      }, En(this, Hn, "f").recentKBs.title), e("ch-edit", {
        // Render always, and display or hide, ro prevent FOUC, and also prevent
        // the header block-size from growing a little bit when the input renders.
        id: "filter-kbs",
        value: this.kbFilterValue,
        class: {
          input: true,
          "section-kbs__filter--hidden": n
        },
        startImgSrc: te,
        placeholder: En(this, Hn, "f").recentKBs.filterKbsPlaceholder,
        onInput: !n && En(this, Qn, "f"),
        disabled: n
      })), e("div", {
        class: {
          "section-kbs__list": true,
          "section-kbs__list--empty": t,
          scrollable: true
        }
      }, this.filteredKbs.length > 0 ? En(this, Kn, "f").call(this) : a));
    }));
    Kn.set(this, (() => {
      var n;
      return (n = this.filteredKbs) === null || n === void 0 ? void 0 : n.map(((n, t) => {
        // relative time ago
        var a;
        const i = n.lastOpenedDate ? formatDistanceToNow(new Date(n.lastOpenedDate), {
          addSuffix: true,
          locale: En(this, $n, "f")
        }) : undefined;
        // convert date to date format, since toISOString() requires date as Date.
                const o = n.lastOpenedDate ? new Date(n.lastOpenedDate) : undefined;
        let s = r(o, "date-time-short");
        // icon
                const c = (a = n.icon) !== null && a !== void 0 ? a : ee;
        return e("article", {
          class: "kb__item",
          key: t
        }, e("div", {
          class: "kb__details"
        }, e("ch-image", {
          class: "icon-m",
          src: c
        }), e("div", {
          class: "kb__info"
        }, e("button", {
          class: "body-regular-m kb__name",
          onClick: En(this, Rn, "f").call(this, n.id)
        }, n.name), n.path && e("p", {
          class: "body-regular-xs kb__path"
        }, n.path))), i && e("p", {
          class: "body-regular-s kb__modified"
        }, `${En(this, Hn, "f").recentKBs.opened}`, " ", e("time", {
          dateTime: s
        }, s)));
      }));
    }));
    Gn.set(this, (() => {
      if (!this.secondarySection) {
        return null;
      }
      const n = this.secondarySection.cards.length > 2;
      return e("section", {
        // Recent Knowledge Bases
        class: "section-no-kbs"
      }, e("header", null, e("h2", {
        class: "body-regular-s section-secondary__title"
      }, this.secondarySection.title)), e("section", {
        class: {
          "section-secondary__actions": true,
          "section-secondary__actions--two-cards": !n,
          "section-secondary__actions--multiple-cards": n,
          scrollable: true
        }
      }, this.secondarySection.cards.map(((n, t) => e("article", {
        class: "card card-outlined",
        key: t
      }, e("span", {
        class: "icon-capsule"
      }, e("ch-image", {
        class: "icon-l icon-circular",
        src: n.icon.src,
        "aria-label": n.icon.ariaLabel
      })), e("header", {
        class: "card__header"
      }, e("h2", {
        class: "subtitle-semi-bold-xs card__header-title"
      }, n.title), n.description.map((n => e("p", {
        class: "body-regular-s card__header-description"
      }, n))), n.action && e("button", {
        class: "button-tertiary button-icon-and-text button-tertiary-no-padding-inline-start",
        onClick: n.action.callback && n.action.callback
      }, e("ch-image", {
        class: "icon-m",
        src: Zn
      }), n.action.caption)))))));
    }));
    this.filteredKbs = undefined;
    this.kbFilterValue = "";
    this.loading = true;
    this.createKBCallback = undefined;
    this.hideOpenExistingProject = false;
    this.kbs = undefined;
    this.kbsFilterThreshold = undefined;
    this.openKbCallback = undefined;
    this.openSampleCallback = undefined;
    this.samples = undefined;
    this.secondarySection = undefined;
  }
  kbFilterValueChanged(n) {
    this.filteredKbs = this.kbs.filter((e => e.name.toLowerCase().includes(n.toLocaleLowerCase())));
  }
  kbsChanged(n) {
    this.filteredKbs = n;
    this.kbFilterValue = "";
 // clear filter
    }
  async componentWillLoad() {
    Yn(this, Hn, await o.getComponentStrings(this.el), "f");
    // initialize filteredKbs
        this.kbsChanged(this.kbs);
    // get user language to display the kb "last opened" value in the appropriate language.
        const n = document.documentElement.lang;
    Yn(this, $n, Un[n], "f");
  }
  render() {
    var n, a;
    this.loading = (!this.kbs || ((n = this.kbs) === null || n === void 0 ? void 0 : n.length) === 0) && !this.secondarySection;
    const i = ((a = this.samples) === null || a === void 0 ? void 0 : a.length) && this.openSampleCallback;
    return e(t, {
      class: "scrollable"
    }, e("ch-theme", {
      model: ie
    }), e("main", {
      class: "main scrollable"
    }, e("section", {
      // Create a new Knowledge Base
      class: "section-create-new-kb"
    }, e("header", {
      // main header
      class: "section-create-new-kb__header"
    }, e("h1", {
      class: "heading-5 section-create-new-kb__title"
    }, En(this, Hn, "f").createKB.title), e("p", {
      class: "body-regular-m"
    }, En(this, Hn, "f").createKB.description)), e("section", {
      class: "section-create-new-kb__actions scrollable"
    }, e("article", {
      // create project
      class: "card card-filled"
    }, e("header", {
      class: "card__header"
    }, e("div", {
      class: "card__header-description"
    }, e("h2", {
      class: "subtitle-semi-bold-xs card__header-title"
    }, En(this, Hn, "f").createProject.title), e("p", {
      class: "body-regular-s"
    }, En(this, Hn, "f").createProject.description))), e("footer", {
      class: "card__footer"
    }, e("button", {
      class: "button-primary",
      onClick: En(this, Jn, "f").call(this, false)
    }, En(this, Hn, "f").createProject.buttonCaption))), !this.hideOpenExistingProject ? e("article", {
      // open existing project
      class: "card-filled"
    }, e("header", {
      class: "card__header"
    }, e("div", {
      class: "card__header-description"
    }, e("h2", {
      class: "subtitle-semi-bold-xs"
    }, En(this, Hn, "f").openExistingProject.title), e("p", {
      class: "body-regular-s"
    }, En(this, Hn, "f").openExistingProject.description))), e("footer", {
      class: "card__footer"
    }, e("button", {
      class: "button-secondary cancel-btn",
      onClick: En(this, Jn, "f").call(this, true)
    }, En(this, Hn, "f").openExistingProject.buttonCaption))) : null, i ? e("article", {
      // view samples
      class: "card-filled"
    }, e("header", {
      class: "card__header"
    }, e("div", {
      class: "card__header-description"
    }, e("h2", {
      class: "subtitle-semi-bold-xs"
    }, En(this, Hn, "f").viewSamples.title), e("p", {
      class: "body-regular-s"
    }, En(this, Hn, "f").viewSamples.description))), e("footer", {
      class: "card__footer"
    }, e("div", {
      class: "buttons-spacer samples-buttons-container"
    }, this.samples.map((n => e("button", {
      class: "button-secondary",
      onClick: () => this.openSampleCallback(n.id)
    }, En(this, Hn, "f").viewSamples.open.replace(ae, n.name))))))) : null)), e("section", {
      class: "section-secondary scrollable"
    }, this.loading ? e("gx-ide-loader", {
      class: "loader",
      loaderTitle: En(this, Hn, "f").recentKBs.loaderTitle,
      description: En(this, Hn, "f").recentKBs.loaderDescription,
      show: true
    }) : En(this, qn, "m", Bn).call(this))));
  }
  static get assetsDirs() {
    return [ "gx-ide-assets/start-page" ];
  }
  get el() {
    return a(this);
  }
  static get watchers() {
    return {
      kbFilterValue: [ "kbFilterValueChanged" ],
      kbs: [ "kbsChanged" ]
    };
  }
};

Hn = new WeakMap, $n = new WeakMap, Jn = new WeakMap, Qn = new WeakMap, Rn = new WeakMap, 
Vn = new WeakMap, Kn = new WeakMap, Gn = new WeakMap, qn = new WeakSet, Bn = function _GxIdeStartPage_evaluateContentToRender() {
  return this.kbs && this.kbs.length > 0 ? En(this, Vn, "f").call(this) : En(this, Gn, "f").call(this);
};

oe.style = Nn;

export { oe as gx_ide_start_page };
//# sourceMappingURL=p-0680b762.entry.js.map