UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

7,657 lines 265 kB
import { a as T, f as Ui, y as Dt, j as Ct, g as uo, h as ee, x as fe, e as Be, R as Kn, b as J, c as Fi, M as Bi, n as Vi } from "./index-DqTIeHVj-CeLMF2B2.js";
import * as y from "react";
import K, { useState as Go, useEffect as qi, createElement as Br, useDebugValue as ko, useRef as ji, useContext as $i } from "react";
import { o as Zn, i as Yi, r as Hi, I as po, s as zi, c as Wi } from "./index-VIo8j85K-Gso9ejBr.js";
import { C as Xi, i as Qi, w as Ki, m as Zi } from "./index-Br4MVOGV-BTDQ_Wwy.js";
import { m as ne } from "./utils-B6fNqzRf-B1_jG1K7.js";
import { j as Jn, u as Ji } from "./button-Bp2lHjov-BTlHPcva.js";
import * as es from "react-dom";
import { a as el, n as ts, X as tl, t as rl, b as rs, S as ol, g as nl } from "./circle-COtEidYe-DaI8pjYh.js";
import { k as os, M as sl, R as al, C as il, d as ll, S as cl } from "./createLucideIcon-B950nf2d-C2YhAyqE.js";
import { s as ul } from "./index-CYIFqWxx-6SIsOs0F.js";
function Uo(e, [t, r]) {
  return Math.min(r, Math.max(t, e));
}
/**
 * @license lucide-react v0.511.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const dl = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]], ns = os("chevron-down", dl);
/**
 * @license lucide-react v0.511.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */
const pl = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], fl = os("chevron-up", pl);
function or(e) {
  const t = y.useRef({ value: e, previous: e });
  return y.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
}
var nr = "Checkbox", [ml, gh] = Ct(nr), [hl, fo] = ml(nr);
function El(e) {
  const {
    __scopeCheckbox: t,
    checked: r,
    children: o,
    defaultChecked: n,
    disabled: a,
    form: s,
    name: i,
    onCheckedChange: l,
    required: c,
    value: u = "on",
    // @ts-expect-error
    internal_do_not_use_render: p
  } = e, [d, h] = Dt({
    prop: r,
    defaultProp: n ?? !1,
    onChange: l,
    caller: nr
  }), [f, m] = y.useState(null), [_, g] = y.useState(null), E = y.useRef(!1), I = f ? !!s || !!f.closest("form") : (
    // We set this to true by default so that events bubble to forms without JS (SSR)
    !0
  ), O = {
    checked: d,
    disabled: a,
    setChecked: h,
    control: f,
    setControl: m,
    name: i,
    form: s,
    value: u,
    hasConsumerStoppedPropagationRef: E,
    required: c,
    defaultChecked: Ue(n) ? !1 : n,
    isFormControl: I,
    bubbleInput: _,
    setBubbleInput: g
  };
  return /* @__PURE__ */ T.jsx(
    hl,
    {
      scope: t,
      ...O,
      children: gl(p) ? p(O) : o
    }
  );
}
var ss = "CheckboxTrigger", as = y.forwardRef(
  ({ __scopeCheckbox: e, onKeyDown: t, onClick: r, ...o }, n) => {
    const {
      control: a,
      value: s,
      disabled: i,
      checked: l,
      required: c,
      setControl: u,
      setChecked: p,
      hasConsumerStoppedPropagationRef: d,
      isFormControl: h,
      bubbleInput: f
    } = fo(ss, e), m = fe(n, u), _ = y.useRef(l);
    return y.useEffect(() => {
      const g = a == null ? void 0 : a.form;
      if (g) {
        const E = () => p(_.current);
        return g.addEventListener("reset", E), () => g.removeEventListener("reset", E);
      }
    }, [a, p]), /* @__PURE__ */ T.jsx(
      ee.button,
      {
        type: "button",
        role: "checkbox",
        "aria-checked": Ue(l) ? "mixed" : l,
        "aria-required": c,
        "data-state": ds(l),
        "data-disabled": i ? "" : void 0,
        disabled: i,
        value: s,
        ...o,
        ref: m,
        onKeyDown: J(t, (g) => {
          g.key === "Enter" && g.preventDefault();
        }),
        onClick: J(r, (g) => {
          p((E) => Ue(E) ? !0 : !E), f && h && (d.current = g.isPropagationStopped(), d.current || g.stopPropagation());
        })
      }
    );
  }
);
as.displayName = ss;
var mo = y.forwardRef(
  (e, t) => {
    const {
      __scopeCheckbox: r,
      name: o,
      checked: n,
      defaultChecked: a,
      required: s,
      disabled: i,
      value: l,
      onCheckedChange: c,
      form: u,
      ...p
    } = e;
    return /* @__PURE__ */ T.jsx(
      El,
      {
        __scopeCheckbox: r,
        checked: n,
        defaultChecked: a,
        disabled: i,
        required: s,
        onCheckedChange: c,
        name: o,
        form: u,
        value: l,
        internal_do_not_use_render: ({ isFormControl: d }) => /* @__PURE__ */ T.jsxs(T.Fragment, { children: [
          /* @__PURE__ */ T.jsx(
            as,
            {
              ...p,
              ref: t,
              __scopeCheckbox: r
            }
          ),
          d && /* @__PURE__ */ T.jsx(
            us,
            {
              __scopeCheckbox: r
            }
          )
        ] })
      }
    );
  }
);
mo.displayName = nr;
var is = "CheckboxIndicator", ls = y.forwardRef(
  (e, t) => {
    const { __scopeCheckbox: r, forceMount: o, ...n } = e, a = fo(is, r);
    return /* @__PURE__ */ T.jsx(
      Kn,
      {
        present: o || Ue(a.checked) || a.checked === !0,
        children: /* @__PURE__ */ T.jsx(
          ee.span,
          {
            "data-state": ds(a.checked),
            "data-disabled": a.disabled ? "" : void 0,
            ...n,
            ref: t,
            style: { pointerEvents: "none", ...e.style }
          }
        )
      }
    );
  }
);
ls.displayName = is;
var cs = "CheckboxBubbleInput", us = y.forwardRef(
  ({ __scopeCheckbox: e, ...t }, r) => {
    const {
      control: o,
      hasConsumerStoppedPropagationRef: n,
      checked: a,
      defaultChecked: s,
      required: i,
      disabled: l,
      name: c,
      value: u,
      form: p,
      bubbleInput: d,
      setBubbleInput: h
    } = fo(cs, e), f = fe(r, h), m = or(a), _ = po(o);
    y.useEffect(() => {
      const E = d;
      if (!E) return;
      const I = window.HTMLInputElement.prototype, O = Object.getOwnPropertyDescriptor(
        I,
        "checked"
      ).set, S = !n.current;
      if (m !== a && O) {
        const C = new Event("click", { bubbles: S });
        E.indeterminate = Ue(a), O.call(E, Ue(a) ? !1 : a), E.dispatchEvent(C);
      }
    }, [d, m, a, n]);
    const g = y.useRef(Ue(a) ? !1 : a);
    return /* @__PURE__ */ T.jsx(
      ee.input,
      {
        type: "checkbox",
        "aria-hidden": !0,
        defaultChecked: s ?? g.current,
        required: i,
        disabled: l,
        name: c,
        value: u,
        form: p,
        ...t,
        tabIndex: -1,
        ref: f,
        style: {
          ...t.style,
          ..._,
          position: "absolute",
          pointerEvents: "none",
          opacity: 0,
          margin: 0,
          // We transform because the input is absolutely positioned but we have
          // rendered it **after** the button. This pulls it back to sit on top
          // of the button.
          transform: "translateX(-100%)"
        }
      }
    );
  }
);
us.displayName = cs;
function gl(e) {
  return typeof e == "function";
}
function Ue(e) {
  return e === "indeterminate";
}
function ds(e) {
  return Ue(e) ? "indeterminate" : e ? "checked" : "unchecked";
}
const _l = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  mo,
  {
    ref: r,
    className: ne(
      "peer border-primary ring-offset-background focus-visible:ring-ring data-[state=checked]:text-primary size-4 shrink-0 rounded-sm border focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
      e
    ),
    ...t,
    children: /* @__PURE__ */ T.jsx(
      ls,
      {
        className: ne("flex size-4 items-center justify-center text-current"),
        children: t.checked === "indeterminate" ? /* @__PURE__ */ T.jsx(Xi, { className: "text-primary mr-0.5 mb-0.5 size-3.5" }) : /* @__PURE__ */ T.jsx(Qi, { className: "text-primary mr-0.5 mb-0.5 size-3.5" })
      }
    )
  }
));
_l.displayName = mo.displayName;
const ps = Jn(
  "flex h-10 w-full rounded-lg border border-border-alpha-strong px-3 py-2 dark:bg-transparent file:border-0 placeholder:text-secondary placeholder:text-body-sm-regular focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-bg focus-visible:ring-offset-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
  {
    variants: {
      variant: {
        default: "focus-visible:ring-item-primary",
        failure: "focus-visible:ring-item-destructive bg-item-destructive-focus placeholder:text-item-destructive border-item-destructive text-destructive",
        success: "focus-visible:ring-success bg-success/20 placeholder:text-success/80 border-success text-success"
      }
    },
    defaultVariants: {
      variant: "default"
    }
  }
), yl = y.forwardRef(
  ({ className: e, type: t, variant: r, ...o }, n) => {
    const [a, s] = Go(!1), [i, l] = Go(!1);
    return qi(() => {
      s(t === "password");
    }, [t]), /* @__PURE__ */ T.jsxs("div", { className: "relative", children: [
      /* @__PURE__ */ T.jsx(
        "input",
        {
          type: i ? "text" : t,
          className: ne(
            ps({ variant: r }),
            e,
            a && "pr-10"
          ),
          ref: n,
          ...o
        }
      ),
      a && /* @__PURE__ */ T.jsx(
        Ji,
        {
          type: "button",
          size: "icon",
          variant: "tertiary",
          className: "absolute top-1 right-1 size-8 cursor-pointer rounded-md p-2 !ring-0 !ring-offset-0",
          onClick: () => {
            l(!i);
          },
          children: i ? /* @__PURE__ */ T.jsx(Ki, {}) : /* @__PURE__ */ T.jsx(Zi, {})
        }
      )
    ] });
  }
);
yl.displayName = "Input";
var ye = function() {
  return ye = Object.assign || function(e) {
    for (var t, r = 1, o = arguments.length; r < o; r++) {
      t = arguments[r];
      for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
    }
    return e;
  }, ye.apply(this, arguments);
};
function ut(e, t, r) {
  if (r || arguments.length === 2) for (var o = 0, n = t.length, a; o < n; o++)
    (a || !(o in t)) && (a || (a = Array.prototype.slice.call(t, 0, o)), a[o] = t[o]);
  return e.concat(a || Array.prototype.slice.call(t));
}
function Il(e) {
  var t = /* @__PURE__ */ Object.create(null);
  return function(r) {
    return t[r] === void 0 && (t[r] = e(r)), t[r];
  };
}
var Tl = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/, vl = /* @__PURE__ */ Il(
  function(e) {
    return Tl.test(e) || e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) < 91;
  }
  /* Z+1 */
), Z = "-ms-", Ot = "-moz-", W = "-webkit-", fs = "comm", sr = "rule", ho = "decl", Rl = "@import", ms = "@keyframes", bl = "@layer", hs = Math.abs, Eo = String.fromCharCode, Vr = Object.assign;
function Sl(e, t) {
  return de(e, 0) ^ 45 ? (((t << 2 ^ de(e, 0)) << 2 ^ de(e, 1)) << 2 ^ de(e, 2)) << 2 ^ de(e, 3) : 0;
}
function Es(e) {
  return e.trim();
}
function Le(e, t) {
  return (e = t.exec(e)) ? e[0] : e;
}
function V(e, t, r) {
  return e.replace(t, r);
}
function qt(e, t, r) {
  return e.indexOf(t, r);
}
function de(e, t) {
  return e.charCodeAt(t) | 0;
}
function dt(e, t, r) {
  return e.slice(t, r);
}
function Pe(e) {
  return e.length;
}
function gs(e) {
  return e.length;
}
function bt(e, t) {
  return t.push(e), e;
}
function Ol(e, t) {
  return e.map(t).join("");
}
function Fo(e, t) {
  return e.filter(function(r) {
    return !Le(r, t);
  });
}
var ar = 1, pt = 1, _s = 0, be = 0, ae = 0, gt = "";
function ir(e, t, r, o, n, a, s, i) {
  return { value: e, root: t, parent: r, type: o, props: n, children: a, line: ar, column: pt, length: s, return: "", siblings: i };
}
function ke(e, t) {
  return Vr(ir("", null, null, "", null, null, 0, e.siblings), e, { length: -e.length }, t);
}
function at(e) {
  for (; e.root; )
    e = ke(e.root, { children: [e] });
  bt(e, e.siblings);
}
function wl() {
  return ae;
}
function Dl() {
  return ae = be > 0 ? de(gt, --be) : 0, pt--, ae === 10 && (pt = 1, ar--), ae;
}
function Ae() {
  return ae = be < _s ? de(gt, be++) : 0, pt++, ae === 10 && (pt = 1, ar++), ae;
}
function Xe() {
  return de(gt, be);
}
function jt() {
  return be;
}
function lr(e, t) {
  return dt(gt, e, t);
}
function qr(e) {
  switch (e) {
    // \0 \t \n \r \s whitespace token
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    // ! + , / > @ ~ isolate token
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    // ; { } breakpoint token
    case 59:
    case 123:
    case 125:
      return 4;
    // : accompanied token
    case 58:
      return 3;
    // " ' ( [ opening delimit token
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    // ) ] closing delimit token
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function Cl(e) {
  return ar = pt = 1, _s = Pe(gt = e), be = 0, [];
}
function Al(e) {
  return gt = "", e;
}
function Dr(e) {
  return Es(lr(be - 1, jr(e === 91 ? e + 2 : e === 40 ? e + 1 : e)));
}
function Nl(e) {
  for (; (ae = Xe()) && ae < 33; )
    Ae();
  return qr(e) > 2 || qr(ae) > 3 ? "" : " ";
}
function Pl(e, t) {
  for (; --t && Ae() && !(ae < 48 || ae > 102 || ae > 57 && ae < 65 || ae > 70 && ae < 97); )
    ;
  return lr(e, jt() + (t < 6 && Xe() == 32 && Ae() == 32));
}
function jr(e) {
  for (; Ae(); )
    switch (ae) {
      // ] ) " '
      case e:
        return be;
      // " '
      case 34:
      case 39:
        e !== 34 && e !== 39 && jr(ae);
        break;
      // (
      case 40:
        e === 41 && jr(e);
        break;
      // \
      case 92:
        Ae();
        break;
    }
  return be;
}
function Ll(e, t) {
  for (; Ae() && e + ae !== 57 && !(e + ae === 84 && Xe() === 47); )
    ;
  return "/*" + lr(t, be - 1) + "*" + Eo(e === 47 ? e : Ae());
}
function Ml(e) {
  for (; !qr(Xe()); )
    Ae();
  return lr(e, be);
}
function xl(e) {
  return Al($t("", null, null, null, [""], e = Cl(e), 0, [0], e));
}
function $t(e, t, r, o, n, a, s, i, l) {
  for (var c = 0, u = 0, p = s, d = 0, h = 0, f = 0, m = 1, _ = 1, g = 1, E = 0, I = "", O = n, S = a, C = o, v = I; _; )
    switch (f = E, E = Ae()) {
      // (
      case 40:
        if (f != 108 && de(v, p - 1) == 58) {
          qt(v += V(Dr(E), "&", "&\f"), "&\f", hs(c ? i[c - 1] : 0)) != -1 && (g = -1);
          break;
        }
      // " ' [
      case 34:
      case 39:
      case 91:
        v += Dr(E);
        break;
      // \t \n \r \s
      case 9:
      case 10:
      case 13:
      case 32:
        v += Nl(f);
        break;
      // \
      case 92:
        v += Pl(jt() - 1, 7);
        continue;
      // /
      case 47:
        switch (Xe()) {
          case 42:
          case 47:
            bt(Gl(Ll(Ae(), jt()), t, r, l), l);
            break;
          default:
            v += "/";
        }
        break;
      // {
      case 123 * m:
        i[c++] = Pe(v) * g;
      // } ; \0
      case 125 * m:
      case 59:
      case 0:
        switch (E) {
          // \0 }
          case 0:
          case 125:
            _ = 0;
          // ;
          case 59 + u:
            g == -1 && (v = V(v, /\f/g, "")), h > 0 && Pe(v) - p && bt(h > 32 ? Vo(v + ";", o, r, p - 1, l) : Vo(V(v, " ", "") + ";", o, r, p - 2, l), l);
            break;
          // @ ;
          case 59:
            v += ";";
          // { rule/at-rule
          default:
            if (bt(C = Bo(v, t, r, c, u, n, i, I, O = [], S = [], p, a), a), E === 123)
              if (u === 0)
                $t(v, t, C, C, O, a, p, i, S);
              else
                switch (d === 99 && de(v, 3) === 110 ? 100 : d) {
                  // d l m s
                  case 100:
                  case 108:
                  case 109:
                  case 115:
                    $t(e, C, C, o && bt(Bo(e, C, C, 0, 0, n, i, I, n, O = [], p, S), S), n, S, p, i, o ? O : S);
                    break;
                  default:
                    $t(v, C, C, C, [""], S, 0, i, S);
                }
        }
        c = u = h = 0, m = g = 1, I = v = "", p = s;
        break;
      // :
      case 58:
        p = 1 + Pe(v), h = f;
      default:
        if (m < 1) {
          if (E == 123)
            --m;
          else if (E == 125 && m++ == 0 && Dl() == 125)
            continue;
        }
        switch (v += Eo(E), E * m) {
          // &
          case 38:
            g = u > 0 ? 1 : (v += "\f", -1);
            break;
          // ,
          case 44:
            i[c++] = (Pe(v) - 1) * g, g = 1;
            break;
          // @
          case 64:
            Xe() === 45 && (v += Dr(Ae())), d = Xe(), u = p = Pe(I = v += Ml(jt())), E++;
            break;
          // -
          case 45:
            f === 45 && Pe(v) == 2 && (m = 0);
        }
    }
  return a;
}
function Bo(e, t, r, o, n, a, s, i, l, c, u, p) {
  for (var d = n - 1, h = n === 0 ? a : [""], f = gs(h), m = 0, _ = 0, g = 0; m < o; ++m)
    for (var E = 0, I = dt(e, d + 1, d = hs(_ = s[m])), O = e; E < f; ++E)
      (O = Es(_ > 0 ? h[E] + " " + I : V(I, /&\f/g, h[E]))) && (l[g++] = O);
  return ir(e, t, r, n === 0 ? sr : i, l, c, u, p);
}
function Gl(e, t, r, o) {
  return ir(e, t, r, fs, Eo(wl()), dt(e, 2, -2), 0, o);
}
function Vo(e, t, r, o, n) {
  return ir(e, t, r, ho, dt(e, 0, o), dt(e, o + 1, -1), o, n);
}
function ys(e, t, r) {
  switch (Sl(e, t)) {
    // color-adjust
    case 5103:
      return W + "print-" + e + e;
    // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
    case 5737:
    case 4201:
    case 3177:
    case 3433:
    case 1641:
    case 4457:
    case 2921:
    // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
    case 5572:
    case 6356:
    case 5844:
    case 3191:
    case 6645:
    case 3005:
    // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
    case 6391:
    case 5879:
    case 5623:
    case 6135:
    case 4599:
    case 4855:
    // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
    case 4215:
    case 6389:
    case 5109:
    case 5365:
    case 5621:
    case 3829:
      return W + e + e;
    // tab-size
    case 4789:
      return Ot + e + e;
    // appearance, user-select, transform, hyphens, text-size-adjust
    case 5349:
    case 4246:
    case 4810:
    case 6968:
    case 2756:
      return W + e + Ot + e + Z + e + e;
    // writing-mode
    case 5936:
      switch (de(e, t + 11)) {
        // vertical-l(r)
        case 114:
          return W + e + Z + V(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
        // vertical-r(l)
        case 108:
          return W + e + Z + V(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
        // horizontal(-)tb
        case 45:
          return W + e + Z + V(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
      }
    // flex, flex-direction, scroll-snap-type, writing-mode
    case 6828:
    case 4268:
    case 2903:
      return W + e + Z + e + e;
    // order
    case 6165:
      return W + e + Z + "flex-" + e + e;
    // align-items
    case 5187:
      return W + e + V(e, /(\w+).+(:[^]+)/, W + "box-$1$2" + Z + "flex-$1$2") + e;
    // align-self
    case 5443:
      return W + e + Z + "flex-item-" + V(e, /flex-|-self/g, "") + (Le(e, /flex-|baseline/) ? "" : Z + "grid-row-" + V(e, /flex-|-self/g, "")) + e;
    // align-content
    case 4675:
      return W + e + Z + "flex-line-pack" + V(e, /align-content|flex-|-self/g, "") + e;
    // flex-shrink
    case 5548:
      return W + e + Z + V(e, "shrink", "negative") + e;
    // flex-basis
    case 5292:
      return W + e + Z + V(e, "basis", "preferred-size") + e;
    // flex-grow
    case 6060:
      return W + "box-" + V(e, "-grow", "") + W + e + Z + V(e, "grow", "positive") + e;
    // transition
    case 4554:
      return W + V(e, /([^-])(transform)/g, "$1" + W + "$2") + e;
    // cursor
    case 6187:
      return V(V(V(e, /(zoom-|grab)/, W + "$1"), /(image-set)/, W + "$1"), e, "") + e;
    // background, background-image
    case 5495:
    case 3959:
      return V(e, /(image-set\([^]*)/, W + "$1$`$1");
    // justify-content
    case 4968:
      return V(V(e, /(.+:)(flex-)?(.*)/, W + "box-pack:$3" + Z + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + W + e + e;
    // justify-self
    case 4200:
      if (!Le(e, /flex-|baseline/)) return Z + "grid-column-align" + dt(e, t) + e;
      break;
    // grid-template-(columns|rows)
    case 2592:
    case 3360:
      return Z + V(e, "template-", "") + e;
    // grid-(row|column)-start
    case 4384:
    case 3616:
      return r && r.some(function(o, n) {
        return t = n, Le(o.props, /grid-\w+-end/);
      }) ? ~qt(e + (r = r[t].value), "span", 0) ? e : Z + V(e, "-start", "") + e + Z + "grid-row-span:" + (~qt(r, "span", 0) ? Le(r, /\d+/) : +Le(r, /\d+/) - +Le(e, /\d+/)) + ";" : Z + V(e, "-start", "") + e;
    // grid-(row|column)-end
    case 4896:
    case 4128:
      return r && r.some(function(o) {
        return Le(o.props, /grid-\w+-start/);
      }) ? e : Z + V(V(e, "-end", "-span"), "span ", "") + e;
    // (margin|padding)-inline-(start|end)
    case 4095:
    case 3583:
    case 4068:
    case 2532:
      return V(e, /(.+)-inline(.+)/, W + "$1$2") + e;
    // (min|max)?(width|height|inline-size|block-size)
    case 8116:
    case 7059:
    case 5753:
    case 5535:
    case 5445:
    case 5701:
    case 4933:
    case 4677:
    case 5533:
    case 5789:
    case 5021:
    case 4765:
      if (Pe(e) - 1 - t > 6)
        switch (de(e, t + 1)) {
          // (m)ax-content, (m)in-content
          case 109:
            if (de(e, t + 4) !== 45)
              break;
          // (f)ill-available, (f)it-content
          case 102:
            return V(e, /(.+:)(.+)-([^]+)/, "$1" + W + "$2-$3$1" + Ot + (de(e, t + 3) == 108 ? "$3" : "$2-$3")) + e;
          // (s)tretch
          case 115:
            return ~qt(e, "stretch", 0) ? ys(V(e, "stretch", "fill-available"), t, r) + e : e;
        }
      break;
    // grid-(column|row)
    case 5152:
    case 5920:
      return V(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(o, n, a, s, i, l, c) {
        return Z + n + ":" + a + c + (s ? Z + n + "-span:" + (i ? l : +l - +a) + c : "") + e;
      });
    // position: sticky
    case 4949:
      if (de(e, t + 6) === 121)
        return V(e, ":", ":" + W) + e;
      break;
    // display: (flex|inline-flex|grid|inline-grid)
    case 6444:
      switch (de(e, de(e, 14) === 45 ? 18 : 11)) {
        // (inline-)?fle(x)
        case 120:
          return V(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + W + (de(e, 14) === 45 ? "inline-" : "") + "box$3$1" + W + "$2$3$1" + Z + "$2box$3") + e;
        // (inline-)?gri(d)
        case 100:
          return V(e, ":", ":" + Z) + e;
      }
      break;
    // scroll-margin, scroll-margin-(top|right|bottom|left)
    case 5719:
    case 2647:
    case 2135:
    case 3927:
    case 2391:
      return V(e, "scroll-", "scroll-snap-") + e;
  }
  return e;
}
function Xt(e, t) {
  for (var r = "", o = 0; o < e.length; o++)
    r += t(e[o], o, e, t) || "";
  return r;
}
function kl(e, t, r, o) {
  switch (e.type) {
    case bl:
      if (e.children.length) break;
    case Rl:
    case ho:
      return e.return = e.return || e.value;
    case fs:
      return "";
    case ms:
      return e.return = e.value + "{" + Xt(e.children, o) + "}";
    case sr:
      if (!Pe(e.value = e.props.join(","))) return "";
  }
  return Pe(r = Xt(e.children, o)) ? e.return = e.value + "{" + r + "}" : "";
}
function Ul(e) {
  var t = gs(e);
  return function(r, o, n, a) {
    for (var s = "", i = 0; i < t; i++)
      s += e[i](r, o, n, a) || "";
    return s;
  };
}
function Fl(e) {
  return function(t) {
    t.root || (t = t.return) && e(t);
  };
}
function Bl(e, t, r, o) {
  if (e.length > -1 && !e.return)
    switch (e.type) {
      case ho:
        e.return = ys(e.value, e.length, r);
        return;
      case ms:
        return Xt([ke(e, { value: V(e.value, "@", "@" + W) })], o);
      case sr:
        if (e.length)
          return Ol(r = e.props, function(n) {
            switch (Le(n, o = /(::plac\w+|:read-\w+)/)) {
              // :read-(only|write)
              case ":read-only":
              case ":read-write":
                at(ke(e, { props: [V(n, /:(read-\w+)/, ":" + Ot + "$1")] })), at(ke(e, { props: [n] })), Vr(e, { props: Fo(r, o) });
                break;
              // :placeholder
              case "::placeholder":
                at(ke(e, { props: [V(n, /:(plac\w+)/, ":" + W + "input-$1")] })), at(ke(e, { props: [V(n, /:(plac\w+)/, ":" + Ot + "$1")] })), at(ke(e, { props: [V(n, /:(plac\w+)/, Z + "input-$1")] })), at(ke(e, { props: [n] })), Vr(e, { props: Fo(r, o) });
                break;
            }
            return "";
          });
    }
}
var Vl = {
  animationIterationCount: 1,
  aspectRatio: 1,
  borderImageOutset: 1,
  borderImageSlice: 1,
  borderImageWidth: 1,
  boxFlex: 1,
  boxFlexGroup: 1,
  boxOrdinalGroup: 1,
  columnCount: 1,
  columns: 1,
  flex: 1,
  flexGrow: 1,
  flexPositive: 1,
  flexShrink: 1,
  flexNegative: 1,
  flexOrder: 1,
  gridRow: 1,
  gridRowEnd: 1,
  gridRowSpan: 1,
  gridRowStart: 1,
  gridColumn: 1,
  gridColumnEnd: 1,
  gridColumnSpan: 1,
  gridColumnStart: 1,
  msGridRow: 1,
  msGridRowSpan: 1,
  msGridColumn: 1,
  msGridColumnSpan: 1,
  fontWeight: 1,
  lineHeight: 1,
  opacity: 1,
  order: 1,
  orphans: 1,
  tabSize: 1,
  widows: 1,
  zIndex: 1,
  zoom: 1,
  WebkitLineClamp: 1,
  // SVG-related properties
  fillOpacity: 1,
  floodOpacity: 1,
  stopOpacity: 1,
  strokeDasharray: 1,
  strokeDashoffset: 1,
  strokeMiterlimit: 1,
  strokeOpacity: 1,
  strokeWidth: 1
}, tt = typeof process < "u" && process.env !== void 0 && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", Is = "active", Ts = "data-styled-version", cr = "6.1.19", go = `/*!sc*/
`, Qt = typeof window < "u" && typeof document < "u", ql = !!(typeof SC_DISABLE_SPEEDY == "boolean" ? SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== void 0 && process.env.REACT_APP_SC_DISABLE_SPEEDY !== "" ? process.env.REACT_APP_SC_DISABLE_SPEEDY !== "false" && process.env.REACT_APP_SC_DISABLE_SPEEDY : typeof process < "u" && process.env !== void 0 && process.env.SC_DISABLE_SPEEDY !== void 0 && process.env.SC_DISABLE_SPEEDY !== "" ? process.env.SC_DISABLE_SPEEDY !== "false" && process.env.SC_DISABLE_SPEEDY : process.env.NODE_ENV !== "production"), qo = /invalid hook call/i, Pt = /* @__PURE__ */ new Set(), jl = function(e, t) {
  if (process.env.NODE_ENV !== "production") {
    var r = t ? ' with the id of "'.concat(t, '"') : "", o = "The component ".concat(e).concat(r, ` has been created dynamically.
`) + `You may see this warning because you've called styled inside another component.
To resolve this only create new StyledComponents outside of any render method and function component.
See https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.
`, n = console.error;
    try {
      var a = !0;
      console.error = function(s) {
        for (var i = [], l = 1; l < arguments.length; l++) i[l - 1] = arguments[l];
        qo.test(s) ? (a = !1, Pt.delete(o)) : n.apply(void 0, ut([s], i, !1));
      }, ji(), a && !Pt.has(o) && (console.warn(o), Pt.add(o));
    } catch (s) {
      qo.test(s.message) && Pt.delete(o);
    } finally {
      console.error = n;
    }
  }
}, ur = Object.freeze([]), ft = Object.freeze({});
function $l(e, t, r) {
  return r === void 0 && (r = ft), e.theme !== r.theme && e.theme || t || r.theme;
}
var $r = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]), Yl = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g, Hl = /(^-|-$)/g;
function jo(e) {
  return e.replace(Yl, "-").replace(Hl, "");
}
var zl = /(a)(d)/gi, Lt = 52, $o = function(e) {
  return String.fromCharCode(e + (e > 25 ? 39 : 97));
};
function Yr(e) {
  var t, r = "";
  for (t = Math.abs(e); t > Lt; t = t / Lt | 0) r = $o(t % Lt) + r;
  return ($o(t % Lt) + r).replace(zl, "$1-$2");
}
var Cr, vs = 5381, $e = function(e, t) {
  for (var r = t.length; r; ) e = 33 * e ^ t.charCodeAt(--r);
  return e;
}, Rs = function(e) {
  return $e(vs, e);
};
function Wl(e) {
  return Yr(Rs(e) >>> 0);
}
function bs(e) {
  return process.env.NODE_ENV !== "production" && typeof e == "string" && e || e.displayName || e.name || "Component";
}
function Ar(e) {
  return typeof e == "string" && (process.env.NODE_ENV === "production" || e.charAt(0) === e.charAt(0).toLowerCase());
}
var Ss = typeof Symbol == "function" && Symbol.for, Os = Ss ? Symbol.for("react.memo") : 60115, Xl = Ss ? Symbol.for("react.forward_ref") : 60112, Ql = { childContextTypes: !0, contextType: !0, contextTypes: !0, defaultProps: !0, displayName: !0, getDefaultProps: !0, getDerivedStateFromError: !0, getDerivedStateFromProps: !0, mixins: !0, propTypes: !0, type: !0 }, Kl = { name: !0, length: !0, prototype: !0, caller: !0, callee: !0, arguments: !0, arity: !0 }, ws = { $$typeof: !0, compare: !0, defaultProps: !0, displayName: !0, propTypes: !0, type: !0 }, Zl = ((Cr = {})[Xl] = { $$typeof: !0, render: !0, defaultProps: !0, displayName: !0, propTypes: !0 }, Cr[Os] = ws, Cr);
function Yo(e) {
  return ("type" in (t = e) && t.type.$$typeof) === Os ? ws : "$$typeof" in e ? Zl[e.$$typeof] : Ql;
  var t;
}
var Jl = Object.defineProperty, ec = Object.getOwnPropertyNames, Ho = Object.getOwnPropertySymbols, tc = Object.getOwnPropertyDescriptor, rc = Object.getPrototypeOf, zo = Object.prototype;
function Ds(e, t, r) {
  if (typeof t != "string") {
    if (zo) {
      var o = rc(t);
      o && o !== zo && Ds(e, o, r);
    }
    var n = ec(t);
    Ho && (n = n.concat(Ho(t)));
    for (var a = Yo(e), s = Yo(t), i = 0; i < n.length; ++i) {
      var l = n[i];
      if (!(l in Kl || r && r[l] || s && l in s || a && l in a)) {
        var c = tc(t, l);
        try {
          Jl(e, l, c);
        } catch {
        }
      }
    }
  }
  return e;
}
function mt(e) {
  return typeof e == "function";
}
function _o(e) {
  return typeof e == "object" && "styledComponentId" in e;
}
function Ye(e, t) {
  return e && t ? "".concat(e, " ").concat(t) : e || t || "";
}
function Wo(e, t) {
  if (e.length === 0) return "";
  for (var r = e[0], o = 1; o < e.length; o++) r += e[o];
  return r;
}
function ht(e) {
  return e !== null && typeof e == "object" && e.constructor.name === Object.name && !("props" in e && e.$$typeof);
}
function Hr(e, t, r) {
  if (r === void 0 && (r = !1), !r && !ht(e) && !Array.isArray(e)) return t;
  if (Array.isArray(t)) for (var o = 0; o < t.length; o++) e[o] = Hr(e[o], t[o]);
  else if (ht(t)) for (var o in t) e[o] = Hr(e[o], t[o]);
  return e;
}
function yo(e, t) {
  Object.defineProperty(e, "toString", { value: t });
}
var oc = process.env.NODE_ENV !== "production" ? { 1: `Cannot create styled-component for component: %s.

`, 2: `Can't collect styles once you've consumed a \`ServerStyleSheet\`'s styles! \`ServerStyleSheet\` is a one off instance for each server-side render cycle.

- Are you trying to reuse it across renders?
- Are you accidentally calling collectStyles twice?

`, 3: `Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.

`, 4: `The \`StyleSheetManager\` expects a valid target or sheet prop!

- Does this error occur on the client and is your target falsy?
- Does this error occur on the server and is the sheet falsy?

`, 5: `The clone method cannot be used on the client!

- Are you running in a client-like environment on the server?
- Are you trying to run SSR on the client?

`, 6: `Trying to insert a new style tag, but the given Node is unmounted!

- Are you using a custom target that isn't mounted?
- Does your document not have a valid head element?
- Have you accidentally removed a style tag manually?

`, 7: 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n', 8: `ThemeProvider: Please make your "theme" prop an object.

`, 9: "Missing document `<head>`\n\n", 10: `Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021

`, 11: `_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.

`, 12: "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n", 13: `%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.

`, 14: `ThemeProvider: "theme" prop is required.

`, 15: "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n", 16: `Reached the limit of how many styled components may be created at group %s.
You may only create up to 1,073,741,824 components. If you're creating components dynamically,
as for instance in your render method then you may be running into this limitation.

`, 17: `CSSStyleSheet could not be found on HTMLStyleElement.
Has styled-components' style tag been unmounted or altered by another script?
`, 18: "ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`" } : {};
function nc() {
  for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
  for (var r = e[0], o = [], n = 1, a = e.length; n < a; n += 1) o.push(e[n]);
  return o.forEach(function(s) {
    r = r.replace(/%[a-z]/, s);
  }), r;
}
function _t(e) {
  for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
  return process.env.NODE_ENV === "production" ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e, " for more information.").concat(t.length > 0 ? " Args: ".concat(t.join(", ")) : "")) : new Error(nc.apply(void 0, ut([oc[e]], t, !1)).trim());
}
var sc = function() {
  function e(t) {
    this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = t;
  }
  return e.prototype.indexOfGroup = function(t) {
    for (var r = 0, o = 0; o < t; o++) r += this.groupSizes[o];
    return r;
  }, e.prototype.insertRules = function(t, r) {
    if (t >= this.groupSizes.length) {
      for (var o = this.groupSizes, n = o.length, a = n; t >= a; ) if ((a <<= 1) < 0) throw _t(16, "".concat(t));
      this.groupSizes = new Uint32Array(a), this.groupSizes.set(o), this.length = a;
      for (var s = n; s < a; s++) this.groupSizes[s] = 0;
    }
    for (var i = this.indexOfGroup(t + 1), l = (s = 0, r.length); s < l; s++) this.tag.insertRule(i, r[s]) && (this.groupSizes[t]++, i++);
  }, e.prototype.clearGroup = function(t) {
    if (t < this.length) {
      var r = this.groupSizes[t], o = this.indexOfGroup(t), n = o + r;
      this.groupSizes[t] = 0;
      for (var a = o; a < n; a++) this.tag.deleteRule(o);
    }
  }, e.prototype.getGroup = function(t) {
    var r = "";
    if (t >= this.length || this.groupSizes[t] === 0) return r;
    for (var o = this.groupSizes[t], n = this.indexOfGroup(t), a = n + o, s = n; s < a; s++) r += "".concat(this.tag.getRule(s)).concat(go);
    return r;
  }, e;
}(), ac = 1 << 30, Yt = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ new Map(), Ht = 1, Mt = function(e) {
  if (Yt.has(e)) return Yt.get(e);
  for (; Kt.has(Ht); ) Ht++;
  var t = Ht++;
  if (process.env.NODE_ENV !== "production" && ((0 | t) < 0 || t > ac)) throw _t(16, "".concat(t));
  return Yt.set(e, t), Kt.set(t, e), t;
}, ic = function(e, t) {
  Ht = t + 1, Yt.set(e, t), Kt.set(t, e);
}, lc = "style[".concat(tt, "][").concat(Ts, '="').concat(cr, '"]'), cc = new RegExp("^".concat(tt, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), uc = function(e, t, r) {
  for (var o, n = r.split(","), a = 0, s = n.length; a < s; a++) (o = n[a]) && e.registerName(t, o);
}, dc = function(e, t) {
  for (var r, o = ((r = t.textContent) !== null && r !== void 0 ? r : "").split(go), n = [], a = 0, s = o.length; a < s; a++) {
    var i = o[a].trim();
    if (i) {
      var l = i.match(cc);
      if (l) {
        var c = 0 | parseInt(l[1], 10), u = l[2];
        c !== 0 && (ic(u, c), uc(e, u, l[3]), e.getTag().insertRules(c, n)), n.length = 0;
      } else n.push(i);
    }
  }
}, Xo = function(e) {
  for (var t = document.querySelectorAll(lc), r = 0, o = t.length; r < o; r++) {
    var n = t[r];
    n && n.getAttribute(tt) !== Is && (dc(e, n), n.parentNode && n.parentNode.removeChild(n));
  }
};
function pc() {
  return typeof __webpack_nonce__ < "u" ? __webpack_nonce__ : null;
}
var Cs = function(e) {
  var t = document.head, r = e || t, o = document.createElement("style"), n = function(i) {
    var l = Array.from(i.querySelectorAll("style[".concat(tt, "]")));
    return l[l.length - 1];
  }(r), a = n !== void 0 ? n.nextSibling : null;
  o.setAttribute(tt, Is), o.setAttribute(Ts, cr);
  var s = pc();
  return s && o.setAttribute("nonce", s), r.insertBefore(o, a), o;
}, fc = function() {
  function e(t) {
    this.element = Cs(t), this.element.appendChild(document.createTextNode("")), this.sheet = function(r) {
      if (r.sheet) return r.sheet;
      for (var o = document.styleSheets, n = 0, a = o.length; n < a; n++) {
        var s = o[n];
        if (s.ownerNode === r) return s;
      }
      throw _t(17);
    }(this.element), this.length = 0;
  }
  return e.prototype.insertRule = function(t, r) {
    try {
      return this.sheet.insertRule(r, t), this.length++, !0;
    } catch {
      return !1;
    }
  }, e.prototype.deleteRule = function(t) {
    this.sheet.deleteRule(t), this.length--;
  }, e.prototype.getRule = function(t) {
    var r = this.sheet.cssRules[t];
    return r && r.cssText ? r.cssText : "";
  }, e;
}(), mc = function() {
  function e(t) {
    this.element = Cs(t), this.nodes = this.element.childNodes, this.length = 0;
  }
  return e.prototype.insertRule = function(t, r) {
    if (t <= this.length && t >= 0) {
      var o = document.createTextNode(r);
      return this.element.insertBefore(o, this.nodes[t] || null), this.length++, !0;
    }
    return !1;
  }, e.prototype.deleteRule = function(t) {
    this.element.removeChild(this.nodes[t]), this.length--;
  }, e.prototype.getRule = function(t) {
    return t < this.length ? this.nodes[t].textContent : "";
  }, e;
}(), hc = function() {
  function e(t) {
    this.rules = [], this.length = 0;
  }
  return e.prototype.insertRule = function(t, r) {
    return t <= this.length && (this.rules.splice(t, 0, r), this.length++, !0);
  }, e.prototype.deleteRule = function(t) {
    this.rules.splice(t, 1), this.length--;
  }, e.prototype.getRule = function(t) {
    return t < this.length ? this.rules[t] : "";
  }, e;
}(), Qo = Qt, Ec = { isServer: !Qt, useCSSOMInjection: !ql }, As = function() {
  function e(t, r, o) {
    t === void 0 && (t = ft), r === void 0 && (r = {});
    var n = this;
    this.options = ye(ye({}, Ec), t), this.gs = r, this.names = new Map(o), this.server = !!t.isServer, !this.server && Qt && Qo && (Qo = !1, Xo(this)), yo(this, function() {
      return function(a) {
        for (var s = a.getTag(), i = s.length, l = "", c = function(p) {
          var d = function(g) {
            return Kt.get(g);
          }(p);
          if (d === void 0) return "continue";
          var h = a.names.get(d), f = s.getGroup(p);
          if (h === void 0 || !h.size || f.length === 0) return "continue";
          var m = "".concat(tt, ".g").concat(p, '[id="').concat(d, '"]'), _ = "";
          h !== void 0 && h.forEach(function(g) {
            g.length > 0 && (_ += "".concat(g, ","));
          }), l += "".concat(f).concat(m, '{content:"').concat(_, '"}').concat(go);
        }, u = 0; u < i; u++) c(u);
        return l;
      }(n);
    });
  }
  return e.registerId = function(t) {
    return Mt(t);
  }, e.prototype.rehydrate = function() {
    !this.server && Qt && Xo(this);
  }, e.prototype.reconstructWithOptions = function(t, r) {
    return r === void 0 && (r = !0), new e(ye(ye({}, this.options), t), this.gs, r && this.names || void 0);
  }, e.prototype.allocateGSInstance = function(t) {
    return this.gs[t] = (this.gs[t] || 0) + 1;
  }, e.prototype.getTag = function() {
    return this.tag || (this.tag = (t = function(r) {
      var o = r.useCSSOMInjection, n = r.target;
      return r.isServer ? new hc(n) : o ? new fc(n) : new mc(n);
    }(this.options), new sc(t)));
    var t;
  }, e.prototype.hasNameForId = function(t, r) {
    return this.names.has(t) && this.names.get(t).has(r);
  }, e.prototype.registerName = function(t, r) {
    if (Mt(t), this.names.has(t)) this.names.get(t).add(r);
    else {
      var o = /* @__PURE__ */ new Set();
      o.add(r), this.names.set(t, o);
    }
  }, e.prototype.insertRules = function(t, r, o) {
    this.registerName(t, r), this.getTag().insertRules(Mt(t), o);
  }, e.prototype.clearNames = function(t) {
    this.names.has(t) && this.names.get(t).clear();
  }, e.prototype.clearRules = function(t) {
    this.getTag().clearGroup(Mt(t)), this.clearNames(t);
  }, e.prototype.clearTag = function() {
    this.tag = void 0;
  }, e;
}(), gc = /&/g, _c = /^\s*\/\/.*$/gm;
function Ns(e, t) {
  return e.map(function(r) {
    return r.type === "rule" && (r.value = "".concat(t, " ").concat(r.value), r.value = r.value.replaceAll(",", ",".concat(t, " ")), r.props = r.props.map(function(o) {
      return "".concat(t, " ").concat(o);
    })), Array.isArray(r.children) && r.type !== "@keyframes" && (r.children = Ns(r.children, t)), r;
  });
}
function yc(e) {
  var t, r, o, n = ft, a = n.options, s = a === void 0 ? ft : a, i = n.plugins, l = i === void 0 ? ur : i, c = function(d, h, f) {
    return f.startsWith(r) && f.endsWith(r) && f.replaceAll(r, "").length > 0 ? ".".concat(t) : d;
  }, u = l.slice();
  u.push(function(d) {
    d.type === sr && d.value.includes("&") && (d.props[0] = d.props[0].replace(gc, r).replace(o, c));
  }), s.prefix && u.push(Bl), u.push(kl);
  var p = function(d, h, f, m) {
    h === void 0 && (h = ""), f === void 0 && (f = ""), m === void 0 && (m = "&"), t = m, r = h, o = new RegExp("\\".concat(r, "\\b"), "g");
    var _ = d.replace(_c, ""), g = xl(f || h ? "".concat(f, " ").concat(h, " { ").concat(_, " }") : _);
    s.namespace && (g = Ns(g, s.namespace));
    var E = [];
    return Xt(g, Ul(u.concat(Fl(function(I) {
      return E.push(I);
    })))), E;
  };
  return p.hash = l.length ? l.reduce(function(d, h) {
    return h.name || _t(15), $e(d, h.name);
  }, vs).toString() : "", p;
}
var Ic = new As(), zr = yc(), Ps = K.createContext({ shouldForwardProp: void 0, styleSheet: Ic, stylis: zr });
Ps.Consumer;
K.createContext(void 0);
function Ko() {
  return $i(Ps);
}
var Zo = function() {
  function e(t, r) {
    var o = this;
    this.inject = function(n, a) {
      a === void 0 && (a = zr);
      var s = o.name + a.hash;
      n.hasNameForId(o.id, s) || n.insertRules(o.id, s, a(o.rules, s, "@keyframes"));
    }, this.name = t, this.id = "sc-keyframes-".concat(t), this.rules = r, yo(this, function() {
      throw _t(12, String(o.name));
    });
  }
  return e.prototype.getName = function(t) {
    return t === void 0 && (t = zr), this.name + t.hash;
  }, e;
}(), Tc = function(e) {
  return e >= "A" && e <= "Z";
};
function Jo(e) {
  for (var t = "", r = 0; r < e.length; r++) {
    var o = e[r];
    if (r === 1 && o === "-" && e[0] === "-") return e;
    Tc(o) ? t += "-" + o.toLowerCase() : t += o;
  }
  return t.startsWith("ms-") ? "-" + t : t;
}
var Ls = function(e) {
  return e == null || e === !1 || e === "";
}, Ms = function(e) {
  var t, r, o = [];
  for (var n in e) {
    var a = e[n];
    e.hasOwnProperty(n) && !Ls(a) && (Array.isArray(a) && a.isCss || mt(a) ? o.push("".concat(Jo(n), ":"), a, ";") : ht(a) ? o.push.apply(o, ut(ut(["".concat(n, " {")], Ms(a), !1), ["}"], !1)) : o.push("".concat(Jo(n), ": ").concat((t = n, (r = a) == null || typeof r == "boolean" || r === "" ? "" : typeof r != "number" || r === 0 || t in Vl || t.startsWith("--") ? String(r).trim() : "".concat(r, "px")), ";")));
  }
  return o;
};
function Qe(e, t, r, o) {
  if (Ls(e)) return [];
  if (_o(e)) return [".".concat(e.styledComponentId)];
  if (mt(e)) {
    if (!mt(a = e) || a.prototype && a.prototype.isReactComponent || !t) return [e];
    var n = e(t);
    return process.env.NODE_ENV === "production" || typeof n != "object" || Array.isArray(n) || n instanceof Zo || ht(n) || n === null || console.error("".concat(bs(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Qe(n, t, r, o);
  }
  var a;
  return e instanceof Zo ? r ? (e.inject(r, o), [e.getName(o)]) : [e] : ht(e) ? Ms(e) : Array.isArray(e) ? Array.prototype.concat.apply(ur, e.map(function(s) {
    return Qe(s, t, r, o);
  })) : [e.toString()];
}
function vc(e) {
  for (var t = 0; t < e.length; t += 1) {
    var r = e[t];
    if (mt(r) && !_o(r)) return !1;
  }
  return !0;
}
var Rc = Rs(cr), bc = function() {
  function e(t, r, o) {
    this.rules = t, this.staticRulesId = "", this.isStatic = process.env.NODE_ENV === "production" && (o === void 0 || o.isStatic) && vc(t), this.componentId = r, this.baseHash = $e(Rc, r), this.baseStyle = o, As.registerId(r);
  }
  return e.prototype.generateAndInjectStyles = function(t, r, o) {
    var n = this.baseStyle ? this.baseStyle.generateAndInjectStyles(t, r, o) : "";
    if (this.isStatic && !o.hash) if (this.staticRulesId && r.hasNameForId(this.componentId, this.staticRulesId)) n = Ye(n, this.staticRulesId);
    else {
      var a = Wo(Qe(this.rules, t, r, o)), s = Yr($e(this.baseHash, a) >>> 0);
      if (!r.hasNameForId(this.componentId, s)) {
        var i = o(a, ".".concat(s), void 0, this.componentId);
        r.insertRules(this.componentId, s, i);
      }
      n = Ye(n, s), this.staticRulesId = s;
    }
    else {
      for (var l = $e(this.baseHash, o.hash), c = "", u = 0; u < this.rules.length; u++) {
        var p = this.rules[u];
        if (typeof p == "string") c += p, process.env.NODE_ENV !== "production" && (l = $e(l, p));
        else if (p) {
          var d = Wo(Qe(p, t, r, o));
          l = $e(l, d + u), c += d;
        }
      }
      if (c) {
        var h = Yr(l >>> 0);
        r.hasNameForId(this.componentId, h) || r.insertRules(this.componentId, h, o(c, ".".concat(h), void 0, this.componentId)), n = Ye(n, h);
      }
    }
    return n;
  }, e;
}(), xs = K.createContext(void 0);
xs.Consumer;
var Nr = {}, en = /* @__PURE__ */ new Set();
function Sc(e, t, r) {
  var o = _o(e), n = e, a = !Ar(e), s = t.attrs, i = s === void 0 ? ur : s, l = t.componentId, c = l === void 0 ? function(O, S) {
    var C = typeof O != "string" ? "sc" : jo(O);
    Nr[C] = (Nr[C] || 0) + 1;
    var v = "".concat(C, "-").concat(Wl(cr + C + Nr[C]));
    return S ? "".concat(S, "-").concat(v) : v;
  }(t.displayName, t.parentComponentId) : l, u = t.displayName, p = u === void 0 ? function(O) {
    return Ar(O) ? "styled.".concat(O) : "Styled(".concat(bs(O), ")");
  }(e) : u, d = t.displayName && t.componentId ? "".concat(jo(t.displayName), "-").concat(t.componentId) : t.componentId || c, h = o && n.attrs ? n.attrs.concat(i).filter(Boolean) : i, f = t.shouldForwardProp;
  if (o && n.shouldForwardProp) {
    var m = n.shouldForwardProp;
    if (t.shouldForwardProp) {
      var _ = t.shouldForwardProp;
      f = function(O, S) {
        return m(O, S) && _(O, S);
      };
    } else f = m;
  }
  var g = new bc(r, d, o ? n.componentStyle : void 0);
  function E(O, S) {
    return function(C, v, A) {
      var U = C.attrs, L = C.componentStyle, x = C.defaultProps, z = C.foldedComponentIds, H = C.styledComponentId, D = C.target, B = K.useContext(xs), R = Ko(), w = C.shouldForwardProp || R.shouldForwardProp;
      process.env.NODE_ENV !== "production" && ko(H);
      var N = $l(v, B, x) || ft, M = function(Se, k, P) {
        for (var $, Y = ye(ye({}, k), { className: void 0, theme: P }), G = 0; G < Se.length; G += 1) {
          var X = mt($ = Se[G]) ? $(Y) : $;
          for (var Q in X) Y[Q] = Q === "className" ? Ye(Y[Q], X[Q]) : Q === "style" ? ye(ye({}, Y[Q]), X[Q]) : X[Q];
        }
        return k.className && (Y.className = Ye(Y.className, k.className)), Y;
      }(U, v, N), q = M.as || D, j = {};
      for (var re in M) M[re] === void 0 || re[0] === "$" || re === "as" || re === "theme" && M.theme === N || (re === "forwardedAs" ? j.as = M.forwardedAs : w && !w(re, q) || (j[re] = M[re], w || process.env.NODE_ENV !== "development" || vl(re) || en.has(re) || !$r.has(q) || (en.add(re), console.warn('styled-components: it looks like an unknown prop "'.concat(re, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
      var Ne = function(Se, k) {
        var P = Ko(), $ = Se.generateAndInjectStyles(k, P.styleSheet, P.stylis);
        return process.env.NODE_ENV !== "production" && ko($), $;
      }(L, M);
      process.env.NODE_ENV !== "production" && C.warnTooManyClasses && C.warnTooManyClasses(Ne);
      var le = Ye(z, H);
      return Ne && (le += " " + Ne), M.className && (le += " " + M.className), j[Ar(q) && !$r.has(q) ? "class" : "className"] = le, A && (j.ref = A), Br(q, j);
    }(I, O, S);
  }
  E.displayName = p;
  var I = K.forwardRef(E);
  return I.attrs = h, I.componentStyle = g, I.displayName = p, I.shouldForwardProp = f, I.foldedComponentIds = o ? Ye(n.foldedComponentIds, n.styledComponentId) : "", I.styledComponentId = d, I.target = o ? n.target : e, Object.defineProperty(I, "defaultProps", { get: function() {
    return this._foldedDefaultProps;
  }, set: function(O) {
    this._foldedDefaultProps = o ? function(S) {
      for (var C = [], v = 1; v < arguments.length; v++) C[v - 1] = arguments[v];
      for (var A = 0, U = C; A < U.length; A++) Hr(S, U[A], !0);
      return S;
    }({}, n.defaultProps, O) : O;
  } }), process.env.NODE_ENV !== "production" && (jl(p, d), I.warnTooManyClasses = /* @__PURE__ */ function(O, S) {
    var C = {}, v = !1;
    return function(A) {
      if (!v && (C[A] = !0, Object.keys(C).length >= 200)) {
        var U = S ? ' with the id of "'.concat(S, '"') : "";
        console.warn("Over ".concat(200, " classes were generated for component ").concat(O).concat(U, `.
`) + `Consider using the attrs method, together with a style object for frequently changed styles.
Example:
  const Component = styled.div.attrs(props => ({
    style: {
      background: props.background,
    },
  }))\`width: 100%;\`

  <Component />`), v = !0, C = {};
      }
    };
  }(p, d)), yo(I, function() {
    return ".".concat(I.styledComponentId);
  }), a && Ds(I, e, { attrs: !0, componentStyle: !0, displayName: !0, foldedComponentIds: !0, shouldForwardProp: !0, styledComponentId: !0, target: !0 }), I;
}
function tn(e, t) {
  for (var r = [e[0]], o = 0, n = t.length; o < n; o += 1) r.push(t[o], e[o + 1]);
  return r;
}
var rn = function(e) {
  return Object.assign(e, { isCss: !0 });
};
function Oc(e) {
  for (var t = [], r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
  if (mt(e) || ht(e)) return rn(Qe(tn(ur, ut([e], t, !0))));
  var o = e;
  return t.length === 0 && o.length === 1 && typeof o[0] == "string" ? Qe(o) : rn(Qe(tn(o, t)));
}
function Wr(e, t, r) {
  if (r === void 0 && (r = ft), !t) throw _t(1, t);
  var o = function(n) {
    for (var a = [], s = 1; s < arguments.length; s++) a[s - 1] = arguments[s];
    return e(t, r, Oc.apply(void 0, ut([n], a, !1)));
  };
  return o.attrs = function(n) {
    return Wr(e, t, ye(ye({}, r), { attrs: Array.prototype.concat(r.attrs, n).filter(Boolean) }));
  }, o.withConfig = function(n) {
    return Wr(e, t, ye(ye({}, r), n));
  }, o;
}
var Gs = function(e) {
  return Wr(Sc, e);
}, ks = Gs;
$r.forEach(function(e) {
  ks[e] = Gs(e);
});
process.env.NODE_ENV !== "production" && typeof navigator < "u" && navigator.product === "ReactNative" && console.warn(`It looks like you've imported 'styled-components' on React Native.
Perhaps you're looking to import 'styled-components/native'?
Read more about this at https://www.styled-components.com/docs/basics#react-native`);
var xt = "__sc-".concat(tt, "__");
process.env.NODE_ENV !== "production" && process.env.NODE_ENV !== "test" && typeof window < "u" && (window[xt] || (window[xt] = 0), window[xt] === 1 && console.warn(`It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.

See https://s-c.sh/2BAXzed for more info.`), window[xt] += 1);
/*!
 * FilePond 4.32.8
 * Licensed under MIT, https://opensource.org/licenses/MIT/
 * Please visit https://pqina.nl/filepond/ for details.
 */
const wc = (e) => e instanceof HTMLElement, Dc = (e, t = [], r = []) => {
  const o = {
    ...e
  }, n = [], a = [], s = () => ({ ...o }), i = () => {
    const f = [...n];
    return n.length = 0, f;
  }, l = () => {
    const f = [...a];
    a.length = 0, f.forEach(({ type: m, data: _ }) => {
      c(m, _);
    });
  }, c = (f, m, _) => {
    if (_ && !document.hidden) {
      a.push({ type: f, data: m });
      return;
    }
    h[f] && h[f](m), n.push({
      type: f,
      data: m
    });
  }, u = (f, ...m) => d[f] ? d[f](...m) : null, p = {
    getState: s,
    processActionQueue: i,
    processDispatchQueue: l,
    dispatch: c,
    query: u
  };
  let d = {};
  t.forEach((f) => {
    d = {
      ...f(o),
      ...d
    };
  });
  let h = {};
  return r.forEach((f) => {
    h = {
      ...f(c, u, o),
      ...h
    };
  }), p;
}, Cc = (e, t, r) => {
  if (typeof r == "function") {
    e[t] = r;
    return;
  }
  Object.defineProperty(e, t, { ...r });
}, te = (e, t) => {
  for (const r in e)
    e.hasOwnProperty(r) && t(r, e[r]);
}, Fe = (e) => {
  const t = {};
  return te(e, (r) => {
    Cc(t, r, e[r]);
  }), t;
}, ce = (e, t, r = null) => {
  if (r === null)
    return e.getAttribute(t) || e.hasAttribute(t);
  e.setAttribute(t, r);
}, Ac = "http://www.w3.org/2000/svg", Nc = ["svg", "path"], on = (e) => Nc.includes(e), Zt = (e, t, r = {}) => {
  typeof t == "object" && (r = t, t = null);
  const o = on(e) ? document.createElementNS(Ac, e) : document.createElement(e);
  return t && (on(e) ? ce(o, "class", t) : o.className = t), te(r, (n, a) => {
    ce(o, n, a);
  }), o;
}, Pc = (e) => (t, r) => {
  typeof r < "u" && e.children[r] ? e.insertBefore(t, e.children[r]) : e.appendChild(t);
}, Lc = (e, t) => (r, o) => (typeof o < "u" ? t.splice(o, 0, r) : t.push(r), r), Mc = (e, t) => (r) => (t.splice(t.indexOf(r), 1), r.element.parentNode && e.removeChild(r.element), r), xc = typeof window < "u" && typeof window.document < "u", Us = () => xc, Gc = Us() ? Zt("svg") : {}, kc = "children" in Gc ? (e) => e.children.length : (e) => e.childNodes.length, Fs = (e, t, r, o) => {
  const n = r[0] || e.left, a = r[1] || e.top, s = n + e.width, i = a + e.height * (o[1] || 1), l = {
    // the rectangle of the element itself
    element: {
      ...e
    },
    // the rectangle of the element expanded to contain its children, does not include any margins
    inner: {
      left: e.left,
      top: e.top,
      right: e.right,
      bottom: e.bottom
    },
    // the rectangle of the element expanded to contain its children including own margin and child margins
    // margins will be added after we've recalculated the size
    outer: {
      left: n,
      top: a,
      right: s,
      bottom: i
    }
  };
  return t.filter((c) => !c.isRectIgnored()).map((c) => c.rect).forEach((c) => {
    nn(l.inner, { ...c.inner }), nn(l.outer, { ...c.outer });
  }), sn(l.inner), l.outer.bottom += l.element.marginBottom, l.outer.right += l.element.marginRight, sn(l.outer), l;
}, nn = (e, t) => {
  t.top += e.top, t.right += e.left, t.bottom += e.top, t.left += e.left, t.bottom > e.bottom && (e.bottom = t.bottom), t.right > e.right && (e.right = t.right);
}, sn = (e) => {
  e.width = e.right - e.left, e.height = e.bottom - e.top;
}, He = (e) => typeof e == "number", Uc = (e, t, r, o = 1e-3) => Math.abs(e - t) < o && Math.abs(r) < o, Fc = (
  // default options
  ({ stiffness: e = 0.5, damping: t = 0.75, mass: r = 10 } = {}) => {
    let o = null, n = null, a = 0, s = !1;
    const i = Fe({
      interpolate: (l, c) => {
        if (s) return;
        if (!(He(o) && He(n))) {
          s = !0, a = 0;
          return;
        }
        const u = -(n - o) * e;
        a += u / r, n += a, a *= t, Uc(n, o, a) || c ? (n = o, a = 0, s = !0, i.onupdate(n), i.oncomplete(n)) : i.onupdate(n);
      },
      target: {
        set: (l) => {
          if (He(l) && !He(n) && (n = l), o === null && (o = l, n = l), o = l, n === o || typeof o > "u") {
            s = !0, a = 0, i.onupdate(n), i.oncomplete(n);
            return;
          }
          s = !1;
        },
        get: () => o
      },
      resting: {
        get: () => s
      },
      onupdate: (l) => {
      },
      oncomplete: (l) => {
      }
    });
    return i;
  }
), Bc = (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e, Vc = (
  // default values
  ({ duration: e = 500, easing: t = Bc, delay: r = 0 } = {}) => {
    let o = null, n, a, s = !0, i = !1, l = null;
    const c = Fe({
      interpolate: (u, p) => {
        s || l === null || (o === null && (o = u), !(u - o < r) && (n = u - o - r, n >= e || p ? (n = 1, a = i ? 0 : 1, c.onupdate(a * l), c.oncomplete(a * l), s = !0) : (a = n / e, c.onupdate((n >= 0 ? t(i ? 1 - a : a) : 0) * l))));
      },
      target: {
        get: () => i ? 0 : l,
        set: (u) => {
          if (l === null) {
            l = u, c.onupdate(u), c.oncomplete(u);
            return;
          }
          u < l ? (l = 1, i = !0) : (i = !1, l = u), s = !1, o = null;
        }
      },
      resting: {
        get: () => s
      },
      onupdate: (u) => {
      },
      oncomplete: (u) => {
      }
    });
    return c;
  }
), an = {
  spring: Fc,
  tween: Vc
}, qc = (e, t, r) => {
  const o = e[t] && typeof e[t][r] == "object" ? e[t][r] : e[t] || e, n = typeof o == "string" ? o : o.type, a = typeof o == "object" ? { ...o } : {};
  return an[n] ? an[n](a) : null;
}, Io = (e, t, r, o = !1) => {
  t = Array.isArray(t) ? t : [t], t.forEach((n) => {
    e.forEach((a) => {
      let s = a, i = () => r[a], l = (c) => r[a] = c;
      typeof a == "object" && (s = a.key, i = a.getter || i, l = a.setter || l), !(n[s] && !o) && (n[s] = {
        get: i,
        set: l
      });
    });
  });
}, jc = ({ mixinConfig: e, viewProps: t, viewInternalAPI: r, viewExternalAPI: o }) => {
  const n = { ...t }, a = [];
  return te(e, (s, i) => {
    const l = qc(i);
    l && (l.onupdate = (c) => {
      t[s] = c;
    }, l.target = n[s], Io([{
      key: s,
      setter: (c) => {
        l.target !== c && (l.target = c);
      },
      getter: () => t[s]
    }], [r, o], t, !0), a.push(l));
  }), {
    write: (s) => {
      let i = document.hidden, l = !0;
      return a.forEach((c) => {
        c.resting || (l = !1), c.interpolate(s, i);
      }), l;
    },
    destroy: () => {
    }
  };
}, $c = (e) => (t, r) => {
  e.addEventListener(t, r);
}, Yc = (e) => (t, r) => {
  e.removeEventListener(t, r);
}, Hc = ({
  mixinConfig: e,
  viewProps: t,
  viewInternalAPI: r,
  viewExternalAPI: o,
  viewState: n,
  view: a
}) => {
  const s = [], i = $c(a.element), l = Yc(a.element);
  return o.on = (c, u) => {
    s.push({
      type: c,
      fn: u
    }), i(c, u);
  }, o.off = (c, u) => {
    s.splice(s.findIndex((p) => p.type === c && p.fn === u), 1), l(c, u);
  }, {
    write: () => !0,
    destroy: () => {
      s.forEach((c) => {
        l(c.type, c.fn);
      });
    }
  };
}, zc = ({ mixinConfig: e, viewProps: t, viewExternalAPI: r }) => {
  Io(e, r, t);
}, me = (e) => e != null, Wc = {
  opacity: 1,
  scaleX: 1,
  scaleY: 1,
  translateX: 0,
  translateY: 0,
  rotateX: 0,
  rotateY: 0,
  rotateZ: 0,
  originX: 0,
  originY: 0
}, Xc = ({ mixinConfig: e, viewProps: t, viewInternalAPI: r, viewExternalAPI: o, view: n }) => {
  const a = { ...t }, s = {};
  Io(e, [r, o], t);
  const i = () => [t.translateX || 0, t.translateY || 0], l = () => [t.scaleX || 0, t.scaleY || 0], c = () => n.rect ? Fs(n.rect, n.childViews, i(), l()) : null;
  return r.rect = { get: c }, o.rect = { get: c }, e.forEach((u) => {
    t[u] = typeof a[u] > "u" ? Wc[u] : a[u];
  }), {
    write: () => {
      if (Qc(s, t))
        return Kc(n.element, t), Object.assign(s, { ...t }), !0;
    },
    destroy: () => {
    }
  };
}, Qc = (e, t) => {
  if (Object.keys(e).length !== Object.keys(t).length)
    return !0;
  for (const r in t)
    if (t[r] !== e[r])
      return !0;
  return !1;
}, Kc = (e, {
  opacity: t,
  perspective: r,
  translateX: o,
  translateY: n,
  scaleX: a,
  scaleY: s,
  rotateX: i,
  rotateY: l,
  rotateZ: c,
  originX: u,
  originY: p,
  width: d,
  height: h
}) => {
  let f = "", m = "";
  (me(u) || me(p)) && (m += `transform-origin: ${u || 0}px ${p || 0}px;`), me(r) && (f += `perspective(${r}px) `), (me(o) || me(n)) && (f += `translate3d(${o || 0}px, ${n || 0}px, 0) `), (me(a) || me(s)) && (f += `scale3d(${me(a) ? a : 1}, ${me(s) ? s : 1}, 1) `), me(c) && (f += `rotateZ(${c}rad) `), me(i) && (f += `rotateX(${i}rad) `), me(l) && (f += `rotateY(${l}rad) `), f.length && (m += `transform:${f};`), me(t) && (m += `opacity:${t};`, t === 0 && (m += "visibility:hidden;"), t < 1 && (m += "pointer-events:none;")), me(h) && (m += `height:${h}px;`), me(d) && (m += `width:${d}px;`);
  const _ = e.elementCurrentStyle || "";
  (m.length !== _.length || m !== _) && (e.style.cssText = m, e.elementCurrentStyle = m);
}, Zc = {
  styles: Xc,
  listeners: Hc,
  animations: jc,
  apis: zc
}, ln = (e = {}, t = {}, r = {}) => (t.layoutCalculated || (e.paddingTop = parseInt(r.paddingTop, 10) || 0, e.marginTop = parseInt(r.marginTop, 10) || 0, e.marginRight = parseInt(r.marginRight, 10) || 0, e.marginBottom = parseInt(r.marginBottom, 10) || 0, e.marginLeft = parseInt(r.marginLeft, 10) || 0, t.layoutCalculated = !0), e.left = t.offsetLeft || 0, e.top = t.offsetTop || 0, e.width = t.offsetWidth || 0, e.height = t.offsetHeight || 0, e.right = e.left + e.width, e.bottom = e.top + e.height, e.scrollTop = t.scrollTop, e.hidden = t.offsetParent === null, e), ie = (
  // default view definition
  ({
    // element definition
    tag: e = "div",
    name: t = null,
    attributes: r = {},
    // view interaction
    read: o = () => {
    },
    write: n = () => {
    },
    create: a = () => {
    },
    destroy: s = () => {
    },
    // hooks
    filterFrameActionsForChild: i = (h, f) => f,
    didCreateView: l = () => {
    },
    didWriteView: c = () => {
    },
    // rect related
    ignoreRect: u = !1,
    ignoreRectUpdate: p = !1,
    // mixins
    mixins: d = []
  } = {}) => (h, f = {}) => {
    const m = Zt(e, `filepond--${t}`, r), _ = window.getComputedStyle(m, null), g = ln();
    let E = null, I = !1;
    const O = [], S = [], C = {}, v = {}, A = [
      n
      // default writer
    ], U = [
      o
      // default reader
    ], L = [
      s
      // default destroy
    ], x = () => m, z = () => O.concat(), H = () => C, D = (k) => (P, $) => P(k, $), B = () => E || (E = Fs(g, O, [0, 0], [1, 1]), E), R = () => _, w = () => {
      E = null, O.forEach((P) => P._read()), !(p && g.width && g.height) && ln(g, m, _);
      const k = { root: le, props: f, rect: g };
      U.forEach((P) => P(k));
    }, N = (k, P, $) => {
      let Y = P.length === 0;
      return A.forEach((G) => {
        G({
          props: f,
          root: le,
          actions: P,
          timestamp: k,
          shouldOptimize: $
        }) === !1 && (Y = !1);
      }), S.forEach((G) => {
        G.write(k) === !1 && (Y = !1);
      }), O.filter((G) => !!G.element.parentNode).forEach((G) => {
        G._write(
          k,
          i(G, P),
          $
        ) || (Y = !1);
      }), O.forEach((G, X) => {
        G.element.parentNode || (le.appendChild(G.element, X), G._read(), G._write(
          k,
          i(G, P),
          $
        ), Y = !1);
      }), I = Y, c({
        props: f,
        root: le,
        actions: P,
        timestamp: k
      }), Y;
    }, M = () => {
      S.forEach((k) => k.destroy()), L.forEach((k) => {
        k({ root: le, props: f });
      }), O.forEach((k) => k._destroy());
    }, q = {
      element: {
        get: x
      },
      style: {
        get: R
      },
      childViews: {
        get: z
      }
    }, j = {
      ...q,
      rect: {
        get: B
      },
      // access to custom children references
      ref: {
        get: H
      },
      // dom modifiers
      is: (k) => t === k,
      appendChild: Pc(m),
      createChildView: D(h),
      linkView: (k) => (O.push(k), k),
      unlinkView: (k) => {
        O.splice(O.indexOf(k), 1);
      },
      appendChildView: Lc(m, O),
      removeChildView: Mc(m, O),
      registerWriter: (k) => A.push(k),
      registerReader: (k) => U.push(k),
      registerDestroyer: (k) => L.push(k),
      invalidateLayout: () => m.layoutCalculated = !1,
      // access to data store
      dispatch: h.dispatch,
      query: h.query
    }, re = {
      element: {
        get: x
      },
      childViews: {
        get: z
      },
      rect: {
        get: B
      },
      resting: {
        get: () => I
      },
      isRectIgnored: () => u,
      _read: w,
      _write: N,
      _destroy: M
    }, Ne = {
      ...q,
      rect: {
        get: () => g
      }
    };
    Object.keys(d).sort((k, P) => k === "styles" ? 1 : P === "styles" ? -1 : 0).forEach((k) => {
      const P = Zc[k]({
        mixinConfig: d[k],
        viewProps: f,
        viewState: v,
        viewInternalAPI: j,
        viewExternalAPI: re,
        view: Fe(Ne)
      });
      P && S.push(P);
    });
    const le = Fe(j);
    a({
      root: le,
      props: f
    });
    const Se = kc(m);
    return O.forEach((k, P) => {
      le.appendChild(k.element, Se + P);
    }), l(le), Fe(re);
  }
), Jc = (e, t, r = 60) => {
  const o = "__framePainter";
  if (window[o]) {
    window[o].readers.push(e), window[o].writers.push(t);
    return;
  }
  window[o] = {
    readers: [e],
    writers: [t]
  };
  const n = window[o], a = 1e3 / r;
  let s = null, i = null, l = null, c = null;
  const u = () => {
    document.hidden ? (l = () => window.setTimeout(() => p(performance.now()), a), c = () => window.clearTimeout(i)) : (l = () => window.requestAnimationFrame(p), c = () => window.cancelAnimationFrame(i));
  };
  document.addEventListener("visibilitychange", () => {
    c && c(), u(), p(performance.now());
  });
  const p = (d) => {
    i = l(p), s || (s = d);
    const h = d - s;
    h <= a || (s = d - h % a, n.readers.forEach((f) => f()), n.writers.forEach((f) => f(d)));
  };
  return u(), p(performance.now()), {
    pause: () => {
      c(i);
    }
  };
}, Ee = (e, t) => ({ root: r, props: o, actions: n = [], timestamp: a, shouldOptimize: s }) => {
  n.filter((i) => e[i.type]).forEach(
    (i) => e[i.type]({ root: r, props: o, action: i.data, timestamp: a, shouldOptimize: s })
  ), t && t({ root: r, props: o, actions: n, timestamp: a, shouldOptimize: s });
}, cn = (e, t) => t.parentNode.insertBefore(e, t), un = (e, t) => t.parentNode.insertBefore(e, t.nextSibling), dr = (e) => Array.isArray(e), Me = (e) => e == null, eu = (e) => e.trim(), pr = (e) => "" + e, tu = (e, t = ",") => Me(e) ? [] : dr(e) ? e : pr(e).split(t).map(eu).filter((r) => r.length), Bs = (e) => typeof e == "boolean", Vs = (e) => Bs(e) ? e : e === "true", he = (e) => typeof e == "string", qs = (e) => He(e) ? e : he(e) ? pr(e).replace(/[a-z]+/gi, "") : 0, zt = (e) => parseInt(qs(e), 10), dn = (e) => parseFloat(qs(e)), yt = (e) => He(e) && isFinite(e) && Math.floor(e) === e, pn = (e, t = 1e3) => {
  if (yt(e))
    return e;
  let r = pr(e).trim();
  return /MB$/i.test(r) ? (r = r.replace(/MB$i/, "").trim(), zt(r) * t * t) : /KB/i.test(r) ? (r = r.replace(/KB$i/, "").trim(), zt(r) * t) : zt(r);
}, ze = (e) => typeof e == "function", ru = (e) => {
  let t = self, r = e.split("."), o = null;
  for (; o = r.shift(); )
    if (t = t[o], !t)
      return null;
  return t;
}, fn = {
  process: "POST",
  patch: "PATCH",
  revert: "DELETE",
  fetch: "GET",
  restore: "GET",
  load: "GET"
}, ou = (e) => {
  const t = {};
  return t.url = he(e) ? e : e.url || "", t.timeout = e.timeout ? parseInt(e.timeout, 10) : 0, t.headers = e.headers ? e.headers : {}, te(fn, (r) => {
    t[r] = nu(r, e[r], fn[r], t.timeout, t.headers);
  }), t.process = e.process || he(e) || e.url ? t.process : null, t.remove = e.remove || null, delete t.headers, t;
}, nu = (e, t, r, o, n) => {
  if (t === null)
    return null;
  if (typeof t == "function")
    return t;
  const a = {
    url: r === "GET" || r === "PATCH" ? `?${e}=` : "",
    method: r,
    headers: n,
    withCredentials: !1,
    timeout: o,
    onload: null,
    ondata: null,
    onerror: null
  };
  if (he(t))
    return a.url = t, a;
  if (Object.assign(a, t), he(a.headers)) {
    const s = a.headers.split(/:(.+)/);
    a.headers = {
      header: s[0],
      value: s[1]
    };
  }
  return a.withCredentials = Vs(a.withCredentials), a;
}, su = (e) => ou(e), au = (e) => e === null, pe = (e) => typeof e == "object" && e !== null, iu = (e) => pe(e) && he(e.url) && pe(e.process) && pe(e.revert) && pe(e.restore) && pe(e.fetch), Xr = (e) => dr(e) ? "array" : au(e) ? "null" : yt(e) ? "int" : /^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e) ? "bytes" : iu(e) ? "api" : typeof e, lu = (e) => e.replace(/{\s*'/g, '{"').replace(/'\s*}/g, '"}').replace(/'\s*:/g, '":').replace(/:\s*'/g, ':"').replace(/,\s*'/g, ',"').replace(/'\s*,/g, '",'), cu = {
  array: tu,
  boolean: Vs,
  int: (e) => Xr(e) === "bytes" ? pn(e) : zt(e),
  number: dn,
  float: dn,
  bytes: pn,
  string: (e) => ze(e) ? e : pr(e),
  function: (e) => ru(e),
  serverapi: su,
  object: (e) => {
    try {
      return JSON.parse(lu(e));
    } catch {
      return null;
    }
  }
}, uu = (e, t) => cu[t](e), js = (e, t, r) => {
  if (e === t)
    return e;
  let o = Xr(e);
  if (o !== r) {
    const n = uu(e, r);
    if (o = Xr(n), n === null)
      throw `Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;
    e = n;
  }
  return e;
}, du = (e, t) => {
  let r = e;
  return {
    enumerable: !0,
    get: () => r,
    set: (o) => {
      r = js(o, e, t);
    }
  };
}, pu = (e) => {
  const t = {};
  return te(e, (r) => {
    const o = e[r];
    t[r] = du(o[0], o[1]);
  }), Fe(t);
}, fu = (e) => ({
  // model
  items: [],
  // timeout used for calling update items
  listUpdateTimeout: null,
  // timeout used for stacking metadata updates
  itemUpdateTimeout: null,
  // queue of items waiting to be processed
  processingQueue: [],
  // options
  options: pu(e)
}), fr = (e, t = "-") => e.split(/(?=[A-Z])/).map((r) => r.toLowerCase()).join(t), mu = (e, t) => {
  const r = {};
  return te(t, (o) => {
    r[o] = {
      get: () => e.getState().options[o],
      set: (n) => {
        e.dispatch(`SET_${fr(o, "_").toUpperCase()}`, {
          value: n
        });
      }
    };
  }), r;
}, hu = (e) => (t, r, o) => {
  const n = {};
  return te(e, (a) => {
    const s = fr(a, "_").toUpperCase();
    n[`SET_${s}`] = (i) => {
      try {
        o.options[a] = i.value;
      } catch {
      }
      t(`DID_SET_${s}`, { value: o.options[a] });
    };
  }), n;
}, Eu = (e) => (t) => {
  const r = {};
  return te(e, (o) => {
    r[`GET_${fr(o, "_").toUpperCase()}`] = (n) => t.options[o];
  }), r;
}, Re = {
  API: 1,
  DROP: 2,
  BROWSE: 3,
  PASTE: 4,
  NONE: 5
}, To = () => Math.random().toString(36).substring(2, 11), vo = (e, t) => e.splice(t, 1), gu = (e, t) => {
  t ? e() : document.hidden ? Promise.resolve(1).then(e) : setTimeout(e, 0);
}, mr = () => {
  const e = [], t = (o, n) => {
    vo(
      e,
      e.findIndex((a) => a.event === o && (a.cb === n || !n))
    );
  }, r = (o, n, a) => {
    e.filter((s) => s.event === o).map((s) => s.cb).forEach((s) => gu(() => s(...n), a));
  };
  return {
    fireSync: (o, ...n) => {
      r(o, n, !0);
    },
    fire: (o, ...n) => {
      r(o, n, !1);
    },
    on: (o, n) => {
      e.push({ event: o, cb: n });
    },
    onOnce: (o, n) => {
      e.push({
        event: o,
        cb: (...a) => {
          t(o, n), n(...a);
        }
      });
    },
    off: t
  };
}, $s = (e, t, r) => {
  Object.getOwnPropertyNames(e).filter((o) => !r.includes(o)).forEach(
    (o) => Object.defineProperty(t, o, Object.getOwnPropertyDescriptor(e, o))
  );
}, _u = [
  "fire",
  "process",
  "revert",
  "load",
  "on",
  "off",
  "onOnce",
  "retryLoad",
  "extend",
  "archive",
  "archived",
  "release",
  "released",
  "requestProcessing",
  "freeze"
], _e = (e) => {
  const t = {};
  return $s(e, t, _u), t;
}, yu = (e) => {
  e.forEach((t, r) => {
    t.released && vo(e, r);
  });
}, F = {
  INIT: 1,
  IDLE: 2,
  PROCESSING_QUEUED: 9,
  PROCESSING: 3,
  PROCESSING_COMPLETE: 5,
  PROCESSING_ERROR: 6,
  PROCESSING_REVERT_ERROR: 10,
  LOADING: 7,
  LOAD_ERROR: 8
}, ue = {
  INPUT: 1,
  LIMBO: 2,
  LOCAL: 3
}, Ys = (e) => /[^0-9]+/.exec(e), Hs = () => Ys(1.1.toLocaleString())[0], Iu = () => {
  const e = Hs(), t = 1e3.toLocaleString();
  return t !== "1000" ? Ys(t)[0] : e === "." ? "," : ".";
}, b = {
  BOOLEAN: "boolean",
  INT: "int",
  NUMBER: "number",
  STRING: "string",
  ARRAY: "array",
  OBJECT: "object",
  FUNCTION: "function",
  ACTION: "action",
  SERVER_API: "serverapi",
  REGEX: "regex"
}, Ro = [], we = (e, t, r) => new Promise((o, n) => {
  const a = Ro.filter((i) => i.key === e).map((i) => i.cb);
  if (a.length === 0) {
    o(t);
    return;
  }
  const s = a.shift();
  a.reduce(
    // loop over promises passing value to next promise
    (i, l) => i.then((c) => l(c, r)),
    // call initial filter, will return a promise
    s(t, r)
    // all executed
  ).then((i) => o(i)).catch((i) => n(i));
}), nt = (e, t, r) => Ro.filter((o) => o.key === e).map((o) => o.cb(t, r)), Tu = (e, t) => Ro.push({ key: e, cb: t }), vu = (e) => Object.assign(it, e), Jt = () => ({ ...it }), Ru = (e) => {
  te(e, (t, r) => {
    it[t] && (it[t][0] = js(
      r,
      it[t][0],
      it[t][1]
    ));
  });
}, it = {
  // the id to add to the root element
  id: [null, b.STRING],
  // input field name to use
  name: ["filepond", b.STRING],
  // disable the field
  disabled: [!1, b.BOOLEAN],
  // classname to put on wrapper
  className: [null, b.STRING],
  // is the field required
  required: [!1, b.BOOLEAN],
  // Allow media capture when value is set
  captureMethod: [null, b.STRING],
  // - "camera", "microphone" or "camcorder",
  // - Does not work with multiple on apple devices
  // - If set, acceptedFileTypes must be made to match with media wildcard "image/*", "audio/*" or "video/*"
  // sync `acceptedFileTypes` property with `accept` attribute
  allowSyncAcceptAttribute: [!0, b.BOOLEAN],
  // Feature toggles
  allowDrop: [!0, b.BOOLEAN],
  // Allow dropping of files
  allowBrowse: [!0, b.BOOLEAN],
  // Allow browsing the file system
  allowPaste: [!0, b.BOOLEAN],
  // Allow pasting files
  allowMultiple: [!1, b.BOOLEAN],
  // Allow multiple files (disabled by default, as multiple attribute is also required on input to allow multiple)
  allowReplace: [!0, b.BOOLEAN],
  // Allow dropping a file on other file to replace it (only works when multiple is set to false)
  allowRevert: [!0, b.BOOLEAN],
  // Allows user to revert file upload
  allowRemove: [!0, b.BOOLEAN],
  // Allow user to remove a file
  allowProcess: [!0, b.BOOLEAN],
  // Allows user to process a file, when set to false, this removes the file upload button
  allowReorder: [!1, b.BOOLEAN],
  // Allow reordering of files
  allowDirectoriesOnly: [!1, b.BOOLEAN],
  // Allow only selecting directories with browse (no support for filtering dnd at this point)
  // Try store file if `server` not set
  storeAsFile: [!1, b.BOOLEAN],
  // Revert mode
  forceRevert: [!1, b.BOOLEAN],
  // Set to 'force' to require the file to be reverted before removal
  // Input requirements
  maxFiles: [null, b.INT],
  // Max number of files
  checkValidity: [!1, b.BOOLEAN],
  // Enables custom validity messages
  // Where to put file
  itemInsertLocationFreedom: [!0, b.BOOLEAN],
  // Set to false to always add items to begin or end of list
  itemInsertLocation: ["before", b.STRING],
  // Default index in list to add items that have been dropped at the top of the list
  itemInsertInterval: [75, b.INT],
  // Drag 'n Drop related
  dropOnPage: [!1, b.BOOLEAN],
  // Allow dropping of files anywhere on page (prevents browser from opening file if dropped outside of Up)
  dropOnElement: [!0, b.BOOLEAN],
  // Drop needs to happen on element (set to false to also load drops outside of Up)
  dropValidation: [!1, b.BOOLEAN],
  // Enable or disable validating files on drop
  ignoredFiles: [[".ds_store", "thumbs.db", "desktop.ini"], b.ARRAY],
  // Upload related
  instantUpload: [!0, b.BOOLEAN],
  // Should upload files immediately on drop
  maxParallelUploads: [2, b.INT],
  // Maximum files to upload in parallel
  allowMinimumUploadDuration: [!0, b.BOOLEAN],
  // if true uploads take at least 750 ms, this ensures the user sees the upload progress giving trust the upload actually happened
  // Chunks
  chunkUploads: [!1, b.BOOLEAN],
  // Enable chunked uploads
  chunkForce: [!1, b.BOOLEAN],
  // Force use of chunk uploads even for files smaller than chunk size
  chunkSize: [5e6, b.INT],
  // Size of chunks (5MB default)
  chunkRetryDelays: [[500, 1e3, 3e3], b.ARRAY],
  // Amount of times to retry upload of a chunk when it fails
  // The server api end points to use for uploading (see docs)
  server: [null, b.SERVER_API],
  // File size calculations, can set to 1024, this is only used for display, properties use file size base 1000
  fileSizeBase: [1e3, b.INT],
  // Labels and status messages
  labelFileSizeBytes: ["bytes", b.STRING],
  labelFileSizeKilobytes: ["KB", b.STRING],
  labelFileSizeMegabytes: ["MB", b.STRING],
  labelFileSizeGigabytes: ["GB", b.STRING],
  labelDecimalSeparator: [Hs(), b.STRING],
  // Default is locale separator
  labelThousandsSeparator: [Iu(), b.STRING],
  // Default is locale separator
  labelIdle: [
    'Drag & Drop your files or <span class="filepond--label-action">Browse</span>',
    b.STRING
  ],
  labelInvalidField: ["Field contains invalid files", b.STRING],
  labelFileWaitingForSize: ["Waiting for size", b.STRING],
  labelFileSizeNotAvailable: ["Size not available", b.STRING],
  labelFileCountSingular: ["file in list", b.STRING],
  labelFileCountPlural: ["files in list", b.STRING],
  labelFileLoading: ["Loading", b.STRING],
  labelFileAdded: ["Added", b.STRING],
  // assistive only
  labelFileLoadError: ["Error during load", b.STRING],
  labelFileRemoved: ["Removed", b.STRING],
  // assistive only
  labelFileRemoveError: ["Error during remove", b.STRING],
  labelFileProcessing: ["Uploading", b.STRING],
  labelFileProcessingComplete: ["Upload complete", b.STRING],
  labelFileProcessingAborted: ["Upload cancelled", b.STRING],
  labelFileProcessingError: ["Error during upload", b.STRING],
  labelFileProcessingRevertError: ["Error during revert", b.STRING],
  labelTapToCancel: ["tap to cancel", b.STRING],
  labelTapToRetry: ["tap to retry", b.STRING],
  labelTapToUndo: ["tap to undo", b.STRING],
  labelButtonRemoveItem: ["Remove", b.STRING],
  labelButtonAbortItemLoad: ["Abort", b.STRING],
  labelButtonRetryItemLoad: ["Retry", b.STRING],
  labelButtonAbortItemProcessing: ["Cancel", b.STRING],
  labelButtonUndoItemProcessing: ["Undo", b.STRING],
  labelButtonRetryItemProcessing: ["Retry", b.STRING],
  labelButtonProcessItem: ["Upload", b.STRING],
  // make sure width and height plus viewpox are even numbers so icons are nicely centered
  iconRemove: [
    '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',
    b.STRING
  ],
  iconProcess: [
    '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',
    b.STRING
  ],
  iconRetry: [
    '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',
    b.STRING
  ],
  iconUndo: [
    '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',
    b.STRING
  ],
  iconDone: [
    '<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',
    b.STRING
  ],
  // event handlers
  oninit: [null, b.FUNCTION],
  onwarning: [null, b.FUNCTION],
  onerror: [null, b.FUNCTION],
  onactivatefile: [null, b.FUNCTION],
  oninitfile: [null, b.FUNCTION],
  onaddfilestart: [null, b.FUNCTION],
  onaddfileprogress: [null, b.FUNCTION],
  onaddfile: [null, b.FUNCTION],
  onprocessfilestart: [null, b.FUNCTION],
  onprocessfileprogress: [null, b.FUNCTION],
  onprocessfileabort: [null, b.FUNCTION],
  onprocessfilerevert: [null, b.FUNCTION],
  onprocessfile: [null, b.FUNCTION],
  onprocessfiles: [null, b.FUNCTION],
  onremovefile: [null, b.FUNCTION],
  onpreparefile: [null, b.FUNCTION],
  onupdatefiles: [null, b.FUNCTION],
  onreorderfiles: [null, b.FUNCTION],
  // hooks
  beforeDropFile: [null, b.FUNCTION],
  beforeAddFile: [null, b.FUNCTION],
  beforeRemoveFile: [null, b.FUNCTION],
  beforePrepareFile: [null, b.FUNCTION],
  // styles
  stylePanelLayout: [null, b.STRING],
  // null 'integrated', 'compact', 'circle'
  stylePanelAspectRatio: [null, b.STRING],
  // null or '3:2' or 1
  styleItemPanelAspectRatio: [null, b.STRING],
  styleButtonRemoveItemPosition: ["left", b.STRING],
  styleButtonProcessItemPosition: ["right", b.STRING],
  styleLoadIndicatorPosition: ["right", b.STRING],
  styleProgressIndicatorPosition: ["right", b.STRING],
  styleButtonRemoveItemAlign: [!1, b.BOOLEAN],
  // custom initial files array
  files: [[], b.ARRAY],
  // show support by displaying credits
  credits: [["https://pqina.nl/", "Powered by PQINA"], b.ARRAY]
}, We = (e, t) => Me(t) ? e[0] || null : yt(t) ? e[t] || null : (typeof t == "object" && (t = t.id), e.find((r) => r.id === t) || null), zs = (e) => {
  if (Me(e))
    return e;
  if (/:/.test(e)) {
    const t = e.split(":");
    return t[1] / t[0];
  }
  return parseFloat(e);
}, De = (e) => e.filter((t) => !t.archived), bu = {
  EMPTY: 0,
  IDLE: 1,
  // waiting
  ERROR: 2,
  // a file is in error state
  BUSY: 3,
  // busy processing or loading
  READY: 4
  // all files uploaded
};
let Gt = null;
const Su = () => {
  if (Gt === null)
    try {
      const e = new DataTransfer();
      e.items.add(new File(["hello world"], "This_Works.txt"));
      const t = document.createElement("input");
      t.setAttribute("type", "file"), t.files = e.files, Gt = t.files.length === 1;
    } catch {
      Gt = !1;
    }
  return Gt;
}, Ou = [
  F.LOAD_ERROR,
  F.PROCESSING_ERROR,
  F.PROCESSING_REVERT_ERROR
], wu = [
  F.LOADING,
  F.PROCESSING,
  F.PROCESSING_QUEUED,
  F.INIT
], Du = [F.PROCESSING_COMPLETE], Cu = (e) => Ou.includes(e.status), Au = (e) => wu.includes(e.status), Nu = (e) => Du.includes(e.status), mn = (e) => pe(e.options.server) && (pe(e.options.server.process) || ze(e.options.server.process)), Pu = (e) => ({
  GET_STATUS: () => {
    const t = De(e.items), { EMPTY: r, ERROR: o, BUSY: n, IDLE: a, READY: s } = bu;
    return t.length === 0 ? r : t.some(Cu) ? o : t.some(Au) ? n : t.some(Nu) ? s : a;
  },
  GET_ITEM: (t) => We(e.items, t),
  GET_ACTIVE_ITEM: (t) => We(De(e.items), t),
  GET_ACTIVE_ITEMS: () => De(e.items),
  GET_ITEMS: () => e.items,
  GET_ITEM_NAME: (t) => {
    const r = We(e.items, t);
    return r ? r.filename : null;
  },
  GET_ITEM_SIZE: (t) => {
    const r = We(e.items, t);
    return r ? r.fileSize : null;
  },
  GET_STYLES: () => Object.keys(e.options).filter((t) => /^style/.test(t)).map((t) => ({
    name: t,
    value: e.options[t]
  })),
  GET_PANEL_ASPECT_RATIO: () => /circle/.test(e.options.stylePanelLayout) ? 1 : zs(e.options.stylePanelAspectRatio),
  GET_ITEM_PANEL_ASPECT_RATIO: () => e.options.styleItemPanelAspectRatio,
  GET_ITEMS_BY_STATUS: (t) => De(e.items).filter((r) => r.status === t),
  GET_TOTAL_ITEMS: () => De(e.items).length,
  SHOULD_UPDATE_FILE_INPUT: () => e.options.storeAsFile && Su() && !mn(e),
  IS_ASYNC: () => mn(e),
  GET_FILE_SIZE_LABELS: (t) => ({
    labelBytes: t("GET_LABEL_FILE_SIZE_BYTES") || void 0,
    labelKilobytes: t("GET_LABEL_FILE_SIZE_KILOBYTES") || void 0,
    labelMegabytes: t("GET_LABEL_FILE_SIZE_MEGABYTES") || void 0,
    labelGigabytes: t("GET_LABEL_FILE_SIZE_GIGABYTES") || void 0
  })
}), Lu = (e) => {
  const t = De(e.items).length;
  if (!e.options.allowMultiple)
    return t === 0;
  const r = e.options.maxFiles;
  return r === null || t < r;
}, Ws = (e, t, r) => Math.max(Math.min(r, e), t), Mu = (e, t, r) => e.splice(t, 0, r), xu = (e, t, r) => Me(t) ? null : typeof r > "u" ? (e.push(t), t) : (r = Ws(r, 0, e.length), Mu(e, r, t), t), Qr = (e) => /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(
  e
), At = (e) => `${e}`.split("/").pop().split("?").shift(), hr = (e) => e.split(".").pop(), Gu = (e) => {
  if (typeof e != "string")
    return "";
  const t = e.split("/").pop();
  return /svg/.test(t) ? "svg" : /zip|compressed/.test(t) ? "zip" : /plain/.test(t) ? "txt" : /msword/.test(t) ? "doc" : /[a-z]+/.test(t) ? t === "jpeg" ? "jpg" : t : "";
}, Tt = (e, t = "") => (t + e).slice(-t.length), Xs = (e = /* @__PURE__ */ new Date()) => `${e.getFullYear()}-${Tt(e.getMonth() + 1, "00")}-${Tt(
  e.getDate(),
  "00"
)}_${Tt(e.getHours(), "00")}-${Tt(e.getMinutes(), "00")}-${Tt(
  e.getSeconds(),
  "00"
)}`, Et = (e, t, r = null, o = null) => {
  const n = typeof r == "string" ? e.slice(0, e.size, r) : e.slice(0, e.size, e.type);
  return n.lastModifiedDate = /* @__PURE__ */ new Date(), e._relativePath && (n._relativePath = e._relativePath), he(t) || (t = Xs()), t && o === null && hr(t) ? n.name = t : (o = o || Gu(n.type), n.name = t + (o ? "." + o : "")), n;
}, ku = () => window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, Qs = (e, t) => {
  const r = ku();
  if (r) {
    const o = new r();
    return o.append(e), o.getBlob(t);
  }
  return new Blob([e], {
    type: t
  });
}, Uu = (e, t) => {
  const r = new ArrayBuffer(e.length), o = new Uint8Array(r);
  for (let n = 0; n < e.length; n++)
    o[n] = e.charCodeAt(n);
  return Qs(r, t);
}, Ks = (e) => (/^data:(.+);/.exec(e) || [])[1] || null, Fu = (e) => e.split(",")[1].replace(/\s/g, ""), Bu = (e) => atob(Fu(e)), Vu = (e) => {
  const t = Ks(e), r = Bu(e);
  return Uu(r, t);
}, qu = (e, t, r) => Et(Vu(e), t, null, r), ju = (e) => {
  if (!/^content-disposition:/i.test(e)) return null;
  const t = e.split(/filename=|filename\*=.+''/).splice(1).map((r) => r.trim().replace(/^["']|[;"']{0,2}$/g, "")).filter((r) => r.length);
  return t.length ? decodeURI(t[t.length - 1]) : null;
}, $u = (e) => {
  if (/content-length:/i.test(e)) {
    const t = e.match(/[0-9]+/)[0];
    return t ? parseInt(t, 10) : null;
  }
  return null;
}, Yu = (e) => /x-content-transfer-id:/i.test(e) && (e.split(":")[1] || "").trim() || null, bo = (e) => {
  const t = {
    source: null,
    name: null,
    size: null
  }, r = e.split(`
`);
  for (let o of r) {
    const n = ju(o);
    if (n) {
      t.name = n;
      continue;
    }
    const a = $u(o);
    if (a) {
      t.size = a;
      continue;
    }
    const s = Yu(o);
    if (s) {
      t.source = s;
      continue;
    }
  }
  return t;
}, Hu = (e) => {
  const t = {
    source: null,
    complete: !1,
    progress: 0,
    size: null,
    timestamp: null,
    duration: 0,
    request: null
  }, r = () => t.progress, o = () => {
    t.request && t.request.abort && t.request.abort();
  }, n = () => {
    const i = t.source;
    s.fire("init", i), i instanceof File ? s.fire("load", i) : i instanceof Blob ? s.fire("load", Et(i, i.name)) : Qr(i) ? s.fire("load", qu(i)) : a(i);
  }, a = (i) => {
    if (!e) {
      s.fire("error", {
        type: "error",
        body: "Can't load URL",
        code: 400
      });
      return;
    }
    t.timestamp = Date.now(), t.request = e(
      i,
      (l) => {
        t.duration = Date.now() - t.timestamp, t.complete = !0, l instanceof Blob && (l = Et(l, l.name || At(i))), s.fire(
          "load",
          // if has received blob, we go with blob, if no response, we return null
          l instanceof Blob ? l : l ? l.body : null
        );
      },
      (l) => {
        s.fire(
          "error",
          typeof l == "string" ? {
            type: "error",
            code: 0,
            body: l
          } : l
        );
      },
      (l, c, u) => {
        if (u && (t.size = u), t.duration = Date.now() - t.timestamp, !l) {
          t.progress = null;
          return;
        }
        t.progress = c / u, s.fire("progress", t.progress);
      },
      () => {
        s.fire("abort");
      },
      (l) => {
        const c = bo(
          typeof l == "string" ? l : l.headers
        );
        s.fire("meta", {
          size: t.size || c.size,
          filename: c.name,
          source: c.source
        });
      }
    );
  }, s = {
    ...mr(),
    setSource: (i) => t.source = i,
    getProgress: r,
    // file load progress
    abort: o,
    // abort file load
    load: n
    // start load
  };
  return s;
}, hn = (e) => /GET|HEAD/.test(e), Ke = (e, t, r) => {
  const o = {
    onheaders: () => {
    },
    onprogress: () => {
    },
    onload: () => {
    },
    ontimeout: () => {
    },
    onerror: () => {
    },
    onabort: () => {
    },
    abort: () => {
      n = !0, s.abort();
    }
  };
  let n = !1, a = !1;
  r = {
    method: "POST",
    headers: {},
    withCredentials: !1,
    ...r
  }, t = encodeURI(t), hn(r.method) && e && (t = `${t}${encodeURIComponent(typeof e == "string" ? e : JSON.stringify(e))}`);
  const s = new XMLHttpRequest(), i = hn(r.method) ? s : s.upload;
  return i.onprogress = (l) => {
    n || o.onprogress(l.lengthComputable, l.loaded, l.total);
  }, s.onreadystatechange = () => {
    s.readyState < 2 || s.readyState === 4 && s.status === 0 || a || (a = !0, o.onheaders(s));
  }, s.onload = () => {
    s.status >= 200 && s.status < 300 ? o.onload(s) : o.onerror(s);
  }, s.onerror = () => o.onerror(s), s.onabort = () => {
    n = !0, o.onabort();
  }, s.ontimeout = () => o.ontimeout(s), s.open(r.method, t, !0), yt(r.timeout) && (s.timeout = r.timeout), Object.keys(r.headers).forEach((l) => {
    const c = unescape(encodeURIComponent(r.headers[l]));
    s.setRequestHeader(l, c);
  }), r.responseType && (s.responseType = r.responseType), r.withCredentials && (s.withCredentials = !0), s.send(e), o;
}, oe = (e, t, r, o) => ({
  type: e,
  code: t,
  body: r,
  headers: o
}), Ze = (e) => (t) => {
  e(oe("error", 0, "Timeout", t.getAllResponseHeaders()));
}, En = (e) => /\?/.test(e), wt = (...e) => {
  let t = "";
  return e.forEach((r) => {
    t += En(t) && En(r) ? r.replace(/\?/, "&") : r;
  }), t;
}, Pr = (e = "", t) => {
  if (typeof t == "function")
    return t;
  if (!t || !he(t.url))
    return null;
  const r = t.onload || ((n) => n), o = t.onerror || ((n) => null);
  return (n, a, s, i, l, c) => {
    const u = Ke(n, wt(e, t.url), {
      ...t,
      responseType: "blob"
    });
    return u.onload = (p) => {
      const d = p.getAllResponseHeaders(), h = bo(d).name || At(n);
      a(
        oe(
          "load",
          p.status,
          t.method === "HEAD" ? null : Et(r(p.response), h),
          d
        )
      );
    }, u.onerror = (p) => {
      s(
        oe(
          "error",
          p.status,
          o(p.response) || p.statusText,
          p.getAllResponseHeaders()
        )
      );
    }, u.onheaders = (p) => {
      c(oe("headers", p.status, null, p.getAllResponseHeaders()));
    }, u.ontimeout = Ze(s), u.onprogress = i, u.onabort = l, u;
  };
}, Te = {
  QUEUED: 0,
  COMPLETE: 1,
  PROCESSING: 2,
  ERROR: 3,
  WAITING: 4
}, zu = (e, t, r, o, n, a, s, i, l, c, u) => {
  const p = [], { chunkTransferId: d, chunkServer: h, chunkSize: f, chunkRetryDelays: m } = u, _ = {
    serverId: d,
    aborted: !1
  }, g = t.ondata || ((D) => D), E = t.onload || ((D, B) => B === "HEAD" ? D.getResponseHeader("Upload-Offset") : D.response), I = t.onerror || ((D) => null), O = (D) => {
    const B = new FormData();
    pe(n) && B.append(r, JSON.stringify(n));
    const R = typeof t.headers == "function" ? t.headers(o, n) : {
      ...t.headers,
      "Upload-Length": o.size
    }, w = {
      ...t,
      headers: R
    }, N = Ke(g(B), wt(e, t.url), w);
    N.onload = (M) => D(E(M, w.method)), N.onerror = (M) => s(
      oe(
        "error",
        M.status,
        I(M.response) || M.statusText,
        M.getAllResponseHeaders()
      )
    ), N.ontimeout = Ze(s);
  }, S = (D) => {
    const B = wt(e, h.url, _.serverId), R = {
      headers: typeof t.headers == "function" ? t.headers(_.serverId) : {
        ...t.headers
      },
      method: "HEAD"
    }, w = Ke(null, B, R);
    w.onload = (N) => D(E(N, R.method)), w.onerror = (N) => s(
      oe(
        "error",
        N.status,
        I(N.response) || N.statusText,
        N.getAllResponseHeaders()
      )
    ), w.ontimeout = Ze(s);
  }, C = Math.floor(o.size / f);
  for (let D = 0; D <= C; D++) {
    const B = D * f, R = o.slice(B, B + f, "application/offset+octet-stream");
    p[D] = {
      index: D,
      size: R.size,
      offset: B,
      data: R,
      file: o,
      progress: 0,
      retries: [...m],
      status: Te.QUEUED,
      error: null,
      request: null,
      timeout: null
    };
  }
  const v = () => a(_.serverId), A = (D) => D.status === Te.QUEUED || D.status === Te.ERROR, U = (D) => {
    if (_.aborted) return;
    if (D = D || p.find(A), !D) {
      p.every((j) => j.status === Te.COMPLETE) && v();
      return;
    }
    D.status = Te.PROCESSING, D.progress = null;
    const B = h.ondata || ((j) => j), R = h.onerror || ((j) => null), w = h.onload || (() => {
    }), N = wt(e, h.url, _.serverId), M = typeof h.headers == "function" ? h.headers(D) : {
      ...h.headers,
      "Content-Type": "application/offset+octet-stream",
      "Upload-Offset": D.offset,
      "Upload-Length": o.size,
      "Upload-Name": o.name
    }, q = D.request = Ke(B(D.data), N, {
      ...h,
      headers: M
    });
    q.onload = (j) => {
      w(j, D.index, p.length), D.status = Te.COMPLETE, D.request = null, z();
    }, q.onprogress = (j, re, Ne) => {
      D.progress = j ? re : null, x();
    }, q.onerror = (j) => {
      D.status = Te.ERROR, D.request = null, D.error = R(j.response) || j.statusText, L(D) || s(
        oe(
          "error",
          j.status,
          R(j.response) || j.statusText,
          j.getAllResponseHeaders()
        )
      );
    }, q.ontimeout = (j) => {
      D.status = Te.ERROR, D.request = null, L(D) || Ze(s)(j);
    }, q.onabort = () => {
      D.status = Te.QUEUED, D.request = null, l();
    };
  }, L = (D) => D.retries.length === 0 ? !1 : (D.status = Te.WAITING, clearTimeout(D.timeout), D.timeout = setTimeout(() => {
    U(D);
  }, D.retries.shift()), !0), x = () => {
    const D = p.reduce((R, w) => R === null || w.progress === null ? null : R + w.progress, 0);
    if (D === null) return i(!1, 0, 0);
    const B = p.reduce((R, w) => R + w.size, 0);
    i(!0, D, B);
  }, z = () => {
    p.filter((D) => D.status === Te.PROCESSING).length >= 1 || U();
  }, H = () => {
    p.forEach((D) => {
      clearTimeout(D.timeout), D.request && D.request.abort();
    });
  };
  return _.serverId ? S((D) => {
    _.aborted || (p.filter((B) => B.offset < D).forEach((B) => {
      B.status = Te.COMPLETE, B.progress = B.size;
    }), z());
  }) : O((D) => {
    _.aborted || (c(D), _.serverId = D, z());
  }), {
    abort: () => {
      _.aborted = !0, H();
    }
  };
}, Wu = (e, t, r, o) => (n, a, s, i, l, c, u) => {
  if (!n) return;
  const p = o.chunkUploads, d = p && n.size > o.chunkSize, h = p && (d || o.chunkForce);
  if (n instanceof Blob && h)
    return zu(
      e,
      t,
      r,
      n,
      a,
      s,
      i,
      l,
      c,
      u,
      o
    );
  const f = t.ondata || ((S) => S), m = t.onload || ((S) => S), _ = t.onerror || ((S) => null), g = typeof t.headers == "function" ? t.headers(n, a) || {} : {
    ...t.headers
  }, E = {
    ...t,
    headers: g
  };
  var I = new FormData();
  pe(a) && I.append(r, JSON.stringify(a)), (n instanceof Blob ? [{ name: null, file: n }] : n).forEach((S) => {
    I.append(
      r,
      S.file,
      S.name === null ? S.file.name : `${S.name}${S.file.name}`
    );
  });
  const O = Ke(f(I), wt(e, t.url), E);
  return O.onload = (S) => {
    s(oe("load", S.status, m(S.response), S.getAllResponseHeaders()));
  }, O.onerror = (S) => {
    i(
      oe(
        "error",
        S.status,
        _(S.response) || S.statusText,
        S.getAllResponseHeaders()
      )
    );
  }, O.ontimeout = Ze(i), O.onprogress = l, O.onabort = c, O;
}, Xu = (e = "", t, r, o) => typeof t == "function" ? (...n) => t(r, ...n, o) : !t || !he(t.url) ? null : Wu(e, t, r, o), vt = (e = "", t) => {
  if (typeof t == "function")
    return t;
  if (!t || !he(t.url))
    return (n, a) => a();
  const r = t.onload || ((n) => n), o = t.onerror || ((n) => null);
  return (n, a, s) => {
    const i = Ke(
      n,
      e + t.url,
      t
      // contains method, headers and withCredentials properties
    );
    return i.onload = (l) => {
      a(
        oe(
          "load",
          l.status,
          r(l.response),
          l.getAllResponseHeaders()
        )
      );
    }, i.onerror = (l) => {
      s(
        oe(
          "error",
          l.status,
          o(l.response) || l.statusText,
          l.getAllResponseHeaders()
        )
      );
    }, i.ontimeout = Ze(s), i;
  };
}, Zs = (e = 0, t = 1) => e + Math.random() * (t - e), Qu = (e, t = 1e3, r = 0, o = 25, n = 250) => {
  let a = null;
  const s = Date.now(), i = () => {
    let l = Date.now() - s, c = Zs(o, n);
    l + c > t && (c = l + c - t);
    let u = l / t;
    if (u >= 1 || document.hidden) {
      e(1);
      return;
    }
    e(u), a = setTimeout(i, c);
  };
  return t > 0 && i(), {
    clear: () => {
      clearTimeout(a);
    }
  };
}, Ku = (e, t) => {
  const r = {
    complete: !1,
    perceivedProgress: 0,
    perceivedPerformanceUpdater: null,
    progress: null,
    timestamp: null,
    perceivedDuration: 0,
    duration: 0,
    request: null,
    response: null
  }, { allowMinimumUploadDuration: o } = t, n = (u, p) => {
    const d = () => {
      r.duration === 0 || r.progress === null || c.fire("progress", c.getProgress());
    }, h = () => {
      r.complete = !0, c.fire("load-perceived", r.response.body);
    };
    c.fire("start"), r.timestamp = Date.now(), r.perceivedPerformanceUpdater = Qu(
      (f) => {
        r.perceivedProgress = f, r.perceivedDuration = Date.now() - r.timestamp, d(), r.response && r.perceivedProgress === 1 && !r.complete && h();
      },
      // random delay as in a list of files you start noticing
      // files uploading at the exact same speed
      o ? Zs(750, 1500) : 0
    ), r.request = e(
      // the file to process
      u,
      // the metadata to send along
      p,
      // callbacks (load, error, progress, abort, transfer)
      // load expects the body to be a server id if
      // you want to make use of revert
      (f) => {
        r.response = pe(f) ? f : {
          type: "load",
          code: 200,
          body: `${f}`,
          headers: {}
        }, r.duration = Date.now() - r.timestamp, r.progress = 1, c.fire("load", r.response.body), (!o || o && r.perceivedProgress === 1) && h();
      },
      // error is expected to be an object with type, code, body
      (f) => {
        r.perceivedPerformanceUpdater.clear(), c.fire(
          "error",
          pe(f) ? f : {
            type: "error",
            code: 0,
            body: `${f}`
          }
        );
      },
      // actual processing progress
      (f, m, _) => {
        r.duration = Date.now() - r.timestamp, r.progress = f ? m / _ : null, d();
      },
      // abort does not expect a value
      () => {
        r.perceivedPerformanceUpdater.clear(), c.fire("abort", r.response ? r.response.body : null);
      },
      // register the id for this transfer
      (f) => {
        c.fire("transfer", f);
      }
    );
  }, a = () => {
    r.request && (r.perceivedPerformanceUpdater.clear(), r.request.abort && r.request.abort(), r.complete = !0);
  }, s = () => {
    a(), r.complete = !1, r.perceivedProgress = 0, r.progress = 0, r.timestamp = null, r.perceivedDuration = 0, r.duration = 0, r.request = null, r.response = null;
  }, i = o ? () => r.progress ? Math.min(r.progress, r.perceivedProgress) : null : () => r.progress || null, l = o ? () => Math.min(r.duration, r.perceivedDuration) : () => r.duration, c = {
    ...mr(),
    process: n,
    // start processing file
    abort: a,
    // abort active process request
    getProgress: i,
    getDuration: l,
    reset: s
  };
  return c;
}, Js = (e) => e.substring(0, e.lastIndexOf(".")) || e, Zu = (e) => {
  let t = [e.name, e.size, e.type];
  return e instanceof Blob || Qr(e) ? t[0] = e.name || Xs() : Qr(e) ? (t[1] = e.length, t[2] = Ks(e)) : he(e) && (t[0] = At(e), t[1] = 0, t[2] = "application/octet-stream"), {
    name: t[0],
    size: t[1],
    type: t[2]
  };
}, Je = (e) => !!(e instanceof File || e instanceof Blob && e.name), ea = (e) => {
  if (!pe(e)) return e;
  const t = dr(e) ? [] : {};
  for (const r in e) {
    if (!e.hasOwnProperty(r)) continue;
    const o = e[r];
    t[r] = o && pe(o) ? ea(o) : o;
  }
  return t;
}, Ju = (e = null, t = null, r = null) => {
  const o = To(), n = {
    // is archived
    archived: !1,
    // if is frozen, no longer fires events
    frozen: !1,
    // removed from view
    released: !1,
    // original source
    source: null,
    // file model reference
    file: r,
    // id of file on server
    serverFileReference: t,
    // id of file transfer on server
    transferId: null,
    // is aborted
    processingAborted: !1,
    // current item status
    status: t ? F.PROCESSING_COMPLETE : F.INIT,
    // active processes
    activeLoader: null,
    activeProcessor: null
  };
  let a = null;
  const s = {}, i = (v) => n.status = v, l = (v, ...A) => {
    n.released || n.frozen || S.fire(v, ...A);
  }, c = () => hr(n.file.name), u = () => n.file.type, p = () => n.file.size, d = () => n.file, h = (v, A, U) => {
    if (n.source = v, S.fireSync("init"), n.file) {
      S.fireSync("load-skip");
      return;
    }
    n.file = Zu(v), A.on("init", () => {
      l("load-init");
    }), A.on("meta", (L) => {
      n.file.size = L.size, n.file.filename = L.filename, L.source && (e = ue.LIMBO, n.serverFileReference = L.source, n.status = F.PROCESSING_COMPLETE), l("load-meta");
    }), A.on("progress", (L) => {
      i(F.LOADING), l("load-progress", L);
    }), A.on("error", (L) => {
      i(F.LOAD_ERROR), l("load-request-error", L);
    }), A.on("abort", () => {
      i(F.INIT), l("load-abort");
    }), A.on("load", (L) => {
      n.activeLoader = null;
      const x = (H) => {
        n.file = Je(H) ? H : n.file, e === ue.LIMBO && n.serverFileReference ? i(F.PROCESSING_COMPLETE) : i(F.IDLE), l("load");
      }, z = (H) => {
        n.file = L, l("load-meta"), i(F.LOAD_ERROR), l("load-file-error", H);
      };
      if (n.serverFileReference) {
        x(L);
        return;
      }
      U(L, x, z);
    }), A.setSource(v), n.activeLoader = A, A.load();
  }, f = () => {
    n.activeLoader && n.activeLoader.load();
  }, m = () => {
    if (n.activeLoader) {
      n.activeLoader.abort();
      return;
    }
    i(F.INIT), l("load-abort");
  }, _ = (v, A) => {
    if (n.processingAborted) {
      n.processingAborted = !1;
      return;
    }
    if (i(F.PROCESSING), a = null, !(n.file instanceof Blob)) {
      S.on("load", () => {
        _(v, A);
      });
      return;
    }
    v.on("load", (x) => {
      n.transferId = null, n.serverFileReference = x;
    }), v.on("transfer", (x) => {
      n.transferId = x;
    }), v.on("load-perceived", (x) => {
      n.activeProcessor = null, n.transferId = null, n.serverFileReference = x, i(F.PROCESSING_COMPLETE), l("process-complete", x);
    }), v.on("start", () => {
      l("process-start");
    }), v.on("error", (x) => {
      n.activeProcessor = null, i(F.PROCESSING_ERROR), l("process-error", x);
    }), v.on("abort", (x) => {
      n.activeProcessor = null, n.serverFileReference = x, i(F.IDLE), l("process-abort"), a && a();
    }), v.on("progress", (x) => {
      l("process-progress", x);
    });
    const U = (x) => {
      n.archived || v.process(x, { ...s });
    }, L = console.error;
    A(n.file, U, L), n.activeProcessor = v;
  }, g = () => {
    n.processingAborted = !1, i(F.PROCESSING_QUEUED);
  }, E = () => new Promise((v) => {
    if (!n.activeProcessor) {
      n.processingAborted = !0, i(F.IDLE), l("process-abort"), v();
      return;
    }
    a = () => {
      v();
    }, n.activeProcessor.abort();
  }), I = (v, A) => new Promise((U, L) => {
    const x = n.serverFileReference !== null ? n.serverFileReference : n.transferId;
    if (x === null) {
      U();
      return;
    }
    v(
      x,
      () => {
        n.serverFileReference = null, n.transferId = null, U();
      },
      (z) => {
        if (!A) {
          U();
          return;
        }
        i(F.PROCESSING_REVERT_ERROR), l("process-revert-error"), L(z);
      }
    ), i(F.IDLE), l("process-revert");
  }), O = (v, A, U) => {
    const L = v.split("."), x = L[0], z = L.pop();
    let H = s;
    L.forEach((D) => H = H[D]), JSON.stringify(H[z]) !== JSON.stringify(A) && (H[z] = A, l("metadata-update", {
      key: x,
      value: s[x],
      silent: U
    }));
  }, S = {
    id: { get: () => o },
    origin: { get: () => e, set: (v) => e = v },
    serverId: { get: () => n.serverFileReference },
    transferId: { get: () => n.transferId },
    status: { get: () => n.status },
    filename: { get: () => n.file.name },
    filenameWithoutExtension: { get: () => Js(n.file.name) },
    fileExtension: { get: c },
    fileType: { get: u },
    fileSize: { get: p },
    file: { get: d },
    relativePath: { get: () => n.file._relativePath },
    source: { get: () => n.source },
    getMetadata: (v) => ea(v ? s[v] : s),
    setMetadata: (v, A, U) => {
      if (pe(v)) {
        const L = v;
        return Object.keys(L).forEach((x) => {
          O(x, L[x], A);
        }), v;
      }
      return O(v, A, U), A;
    },
    extend: (v, A) => C[v] = A,
    abortLoad: m,
    retryLoad: f,
    requestProcessing: g,
    abortProcessing: E,
    load: h,
    process: _,
    revert: I,
    ...mr(),
    freeze: () => n.frozen = !0,
    release: () => n.released = !0,
    released: { get: () => n.released },
    archive: () => n.archived = !0,
    archived: { get: () => n.archived },
    // replace source and file object
    setFile: (v) => n.file = v
  }, C = Fe(S);
  return C;
}, ed = (e, t) => Me(t) ? 0 : he(t) ? e.findIndex((r) => r.id === t) : -1, gn = (e, t) => {
  const r = ed(e, t);
  if (!(r < 0))
    return e[r] || null;
}, td = (e, t, r, o, n, a) => {
  const s = Ke(null, e, {
    method: "GET",
    responseType: "blob"
  });
  return s.onload = (i) => {
    const l = i.getAllResponseHeaders(), c = bo(l).name || At(e);
    t(oe("load", i.status, Et(i.response, c), l));
  }, s.onerror = (i) => {
    r(oe("error", i.status, i.statusText, i.getAllResponseHeaders()));
  }, s.onheaders = (i) => {
    a(oe("headers", i.status, null, i.getAllResponseHeaders()));
  }, s.ontimeout = Ze(r), s.onprogress = o, s.onabort = n, s;
}, _n = (e) => (e.indexOf("//") === 0 && (e = location.protocol + e), e.toLowerCase().replace("blob:", "").replace(/([a-z])?:\/\//, "$1").split("/")[0]), rd = (e) => (e.indexOf(":") > -1 || e.indexOf("//") > -1) && _n(location.href) !== _n(e), kt = (e) => (...t) => ze(e) ? e(...t) : e, od = (e) => !Je(e.file), Lr = (e, t) => {
  clearTimeout(t.listUpdateTimeout), t.listUpdateTimeout = setTimeout(() => {
    e("DID_UPDATE_ITEMS", { items: De(t.items) });
  }, 0);
}, yn = (e, ...t) => new Promise((r) => {
  if (!e)
    return r(!0);
  const o = e(...t);
  if (o == null)
    return r(!0);
  if (typeof o == "boolean")
    return r(o);
  typeof o.then == "function" && o.then(r);
}), Mr = (e, t) => {
  e.items.sort((r, o) => t(_e(r), _e(o)));
}, ve = (e, t) => ({
  query: r,
  success: o = () => {
  },
  failure: n = () => {
  },
  ...a
} = {}) => {
  const s = We(e.items, r);
  if (!s) {
    n({
      error: oe("error", 0, "Item not found"),
      file: null
    });
    return;
  }
  t(s, o, n, a || {});
}, nd = (e, t, r) => ({
  /**
   * Aborts all ongoing processes
   */
  ABORT_ALL: () => {
    De(r.items).forEach((o) => {
      o.freeze(), o.abortLoad(), o.abortProcessing();
    });
  },
  /**
   * Sets initial files
   */
  DID_SET_FILES: ({ value: o = [] }) => {
    const n = o.map((s) => ({
      source: s.source ? s.source : s,
      options: s.options
    }));
    let a = De(r.items);
    a.forEach((s) => {
      n.find((i) => i.source === s.source || i.source === s.file) || e("REMOVE_ITEM", { query: s, remove: !1 });
    }), a = De(r.items), n.forEach((s, i) => {
      a.find((l) => l.source === s.source || l.file === s.source) || e("ADD_ITEM", {
        ...s,
        interactionMethod: Re.NONE,
        index: i
      });
    });
  },
  DID_UPDATE_ITEM_METADATA: ({ id: o, action: n, change: a }) => {
    a.silent || (clearTimeout(r.itemUpdateTimeout), r.itemUpdateTimeout = setTimeout(() => {
      const s = gn(r.items, o);
      if (!t("IS_ASYNC")) {
        we("SHOULD_PREPARE_OUTPUT", !1, {
          item: s,
          query: t,
          action: n,
          change: a
        }).then((u) => {
          const p = t("GET_BEFORE_PREPARE_FILE");
          p && (u = p(s, u)), u && e(
            "REQUEST_PREPARE_OUTPUT",
            {
              query: o,
              item: s,
              success: (d) => {
                e("DID_PREPARE_OUTPUT", { id: o, file: d });
              }
            },
            !0
          );
        });
        return;
      }
      s.origin === ue.LOCAL && e("DID_LOAD_ITEM", {
        id: s.id,
        error: null,
        serverFileReference: s.source
      });
      const i = () => {
        setTimeout(() => {
          e("REQUEST_ITEM_PROCESSING", { query: o });
        }, 32);
      }, l = (u) => {
        s.revert(
          vt(r.options.server.url, r.options.server.revert),
          t("GET_FORCE_REVERT")
        ).then(u ? i : () => {
        }).catch(() => {
        });
      }, c = (u) => {
        s.abortProcessing().then(u ? i : () => {
        });
      };
      if (s.status === F.PROCESSING_COMPLETE)
        return l(r.options.instantUpload);
      if (s.status === F.PROCESSING)
        return c(r.options.instantUpload);
      r.options.instantUpload && i();
    }, 0));
  },
  MOVE_ITEM: ({ query: o, index: n }) => {
    const a = We(r.items, o);
    if (!a) return;
    const s = r.items.indexOf(a);
    n = Ws(n, 0, r.items.length - 1), s !== n && r.items.splice(n, 0, r.items.splice(s, 1)[0]);
  },
  SORT: ({ compare: o }) => {
    Mr(r, o), e("DID_SORT_ITEMS", {
      items: t("GET_ACTIVE_ITEMS")
    });
  },
  ADD_ITEMS: ({ items: o, index: n, interactionMethod: a, success: s = () => {
  }, failure: i = () => {
  } }) => {
    let l = n;
    if (n === -1 || typeof n > "u") {
      const d = t("GET_ITEM_INSERT_LOCATION"), h = t("GET_TOTAL_ITEMS");
      l = d === "before" ? 0 : h;
    }
    const c = t("GET_IGNORED_FILES"), u = (d) => Je(d) ? !c.includes(d.name.toLowerCase()) : !Me(d), p = o.filter(u).map(
      (d) => new Promise((h, f) => {
        e("ADD_ITEM", {
          interactionMethod: a,
          source: d.source || d,
          success: h,
          failure: f,
          index: l++,
          options: d.options || {}
        });
      })
    );
    Promise.all(p).then(s).catch(i);
  },
  /**
   * @param source
   * @param index
   * @param interactionMethod
   */
  ADD_ITEM: ({
    source: o,
    index: n = -1,
    interactionMethod: a,
    success: s = () => {
    },
    failure: i = () => {
    },
    options: l = {}
  }) => {
    if (Me(o)) {
      i({
        error: oe("error", 0, "No source"),
        file: null
      });
      return;
    }
    if (Je(o) && r.options.ignoredFiles.includes(o.name.toLowerCase()))
      return;
    if (!Lu(r)) {
      if (r.options.allowMultiple || !r.options.allowMultiple && !r.options.allowReplace) {
        const E = oe("warning", 0, "Max files");
        e("DID_THROW_MAX_FILES", {
          source: o,
          error: E
        }), i({ error: E, file: null });
        return;
      }
      const g = De(r.items)[0];
      if (g.status === F.PROCESSING_COMPLETE || g.status === F.PROCESSING_REVERT_ERROR) {
        const E = t("GET_FORCE_REVERT");
        if (g.revert(
          vt(r.options.server.url, r.options.server.revert),
          E
        ).then(() => {
          E && e("ADD_ITEM", {
            source: o,
            index: n,
            interactionMethod: a,
            success: s,
            failure: i,
            options: l
          });
        }).catch(() => {
        }), E) return;
      }
      e("REMOVE_ITEM", { query: g.id });
    }
    const c = l.type === "local" ? ue.LOCAL : l.type === "limbo" ? ue.LIMBO : ue.INPUT, u = Ju(
      // where did this file come from
      c,
      // an input file never has a server file reference
      c === ue.INPUT ? null : o,
      // file mock data, if defined
      l.file
    );
    Object.keys(l.metadata || {}).forEach((g) => {
      u.setMetadata(g, l.metadata[g]);
    }), nt("DID_CREATE_ITEM", u, { query: t, dispatch: e });
    const p = t("GET_ITEM_INSERT_LOCATION");
    r.options.itemInsertLocationFreedom || (n = p === "before" ? -1 : r.items.length), xu(r.items, u, n), ze(p) && o && Mr(r, p);
    const d = u.id;
    u.on("init", () => {
      e("DID_INIT_ITEM", { id: d });
    }), u.on("load-init", () => {
      e("DID_START_ITEM_LOAD", { id: d });
    }), u.on("load-meta", () => {
      e("DID_UPDATE_ITEM_META", { id: d });
    }), u.on("load-progress", (g) => {
      e("DID_UPDATE_ITEM_LOAD_PROGRESS", { id: d, progress: g });
    }), u.on("load-request-error", (g) => {
      const E = kt(r.options.labelFileLoadError)(g);
      if (g.code >= 400 && g.code < 500) {
        e("DID_THROW_ITEM_INVALID", {
          id: d,
          error: g,
          status: {
            main: E,
            sub: `${g.code} (${g.body})`
          }
        }), i({ error: g, file: _e(u) });
        return;
      }
      e("DID_THROW_ITEM_LOAD_ERROR", {
        id: d,
        error: g,
        status: {
          main: E,
          sub: r.options.labelTapToRetry
        }
      });
    }), u.on("load-file-error", (g) => {
      e("DID_THROW_ITEM_INVALID", {
        id: d,
        error: g.status,
        status: g.status
      }), i({ error: g.status, file: _e(u) });
    }), u.on("load-abort", () => {
      e("REMOVE_ITEM", { query: d });
    }), u.on("load-skip", () => {
      u.on("metadata-update", (g) => {
        Je(u.file) && e("DID_UPDATE_ITEM_METADATA", { id: d, change: g });
      }), e("COMPLETE_LOAD_ITEM", {
        query: d,
        item: u,
        data: {
          source: o,
          success: s
        }
      });
    }), u.on("load", () => {
      const g = (E) => {
        if (!E) {
          e("REMOVE_ITEM", {
            query: d
          });
          return;
        }
        u.on("metadata-update", (I) => {
          e("DID_UPDATE_ITEM_METADATA", { id: d, change: I });
        }), we("SHOULD_PREPARE_OUTPUT", !1, { item: u, query: t }).then(
          (I) => {
            const O = t("GET_BEFORE_PREPARE_FILE");
            O && (I = O(u, I));
            const S = () => {
              e("COMPLETE_LOAD_ITEM", {
                query: d,
                item: u,
                data: {
                  source: o,
                  success: s
                }
              }), Lr(e, r);
            };
            if (I) {
              e(
                "REQUEST_PREPARE_OUTPUT",
                {
                  query: d,
                  item: u,
                  success: (C) => {
                    e("DID_PREPARE_OUTPUT", { id: d, file: C }), S();
                  }
                },
                !0
              );
              return;
            }
            S();
          }
        );
      };
      we("DID_LOAD_ITEM", u, { query: t, dispatch: e }).then(() => {
        yn(t("GET_BEFORE_ADD_FILE"), _e(u)).then(
          g
        );
      }).catch((E) => {
        if (!E || !E.error || !E.status) return g(!1);
        e("DID_THROW_ITEM_INVALID", {
          id: d,
          error: E.error,
          status: E.status
        });
      });
    }), u.on("process-start", () => {
      e("DID_START_ITEM_PROCESSING", { id: d });
    }), u.on("process-progress", (g) => {
      e("DID_UPDATE_ITEM_PROCESS_PROGRESS", { id: d, progress: g });
    }), u.on("process-error", (g) => {
      e("DID_THROW_ITEM_PROCESSING_ERROR", {
        id: d,
        error: g,
        status: {
          main: kt(r.options.labelFileProcessingError)(g),
          sub: r.options.labelTapToRetry
        }
      });
    }), u.on("process-revert-error", (g) => {
      e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR", {
        id: d,
        error: g,
        status: {
          main: kt(r.options.labelFileProcessingRevertError)(g),
          sub: r.options.labelTapToRetry
        }
      });
    }), u.on("process-complete", (g) => {
      e("DID_COMPLETE_ITEM_PROCESSING", {
        id: d,
        error: null,
        serverFileReference: g
      }), e("DID_DEFINE_VALUE", { id: d, value: g });
    }), u.on("process-abort", () => {
      e("DID_ABORT_ITEM_PROCESSING", { id: d });
    }), u.on("process-revert", () => {
      e("DID_REVERT_ITEM_PROCESSING", { id: d }), e("DID_DEFINE_VALUE", { id: d, value: null });
    }), e("DID_ADD_ITEM", { id: d, index: n, interactionMethod: a }), Lr(e, r);
    const { url: h, load: f, restore: m, fetch: _ } = r.options.server || {};
    u.load(
      o,
      // this creates a function that loads the file based on the type of file (string, base64, blob, file) and location of file (local, remote, limbo)
      Hu(
        c === ue.INPUT ? (
          // input, if is remote, see if should use custom fetch, else use default fetchBlob
          he(o) && rd(o) && _ ? Pr(h, _) : td
        ) : (
          // limbo or local
          c === ue.LIMBO ? Pr(h, m) : Pr(h, f)
        )
        // local
      ),
      // called when the file is loaded so it can be piped through the filters
      (g, E, I) => {
        we("LOAD_FILE", g, { query: t }).then(E).catch(I);
      }
    );
  },
  REQUEST_PREPARE_OUTPUT: ({ item: o, success: n, failure: a = () => {
  } }) => {
    const s = {
      error: oe("error", 0, "Item not found"),
      file: null
    };
    if (o.archived) return a(s);
    we("PREPARE_OUTPUT", o.file, { query: t, item: o }).then((i) => {
      we("COMPLETE_PREPARE_OUTPUT", i, { query: t, item: o }).then((l) => {
        if (o.archived) return a(s);
        n(l);
      });
    });
  },
  COMPLETE_LOAD_ITEM: ({ item: o, data: n }) => {
    const { success: a, source: s } = n, i = t("GET_ITEM_INSERT_LOCATION");
    if (ze(i) && s && Mr(r, i), e("DID_LOAD_ITEM", {
      id: o.id,
      error: null,
      serverFileReference: o.origin === ue.INPUT ? null : s
    }), a(_e(o)), o.origin === ue.LOCAL) {
      e("DID_LOAD_LOCAL_ITEM", { id: o.id });
      return;
    }
    if (o.origin === ue.LIMBO) {
      e("DID_COMPLETE_ITEM_PROCESSING", {
        id: o.id,
        error: null,
        serverFileReference: s
      }), e("DID_DEFINE_VALUE", {
        id: o.id,
        value: o.serverId || s
      });
      return;
    }
    t("IS_ASYNC") && r.options.instantUpload && e("REQUEST_ITEM_PROCESSING", { query: o.id });
  },
  RETRY_ITEM_LOAD: ve(r, (o) => {
    o.retryLoad();
  }),
  REQUEST_ITEM_PREPARE: ve(r, (o, n, a) => {
    e(
      "REQUEST_PREPARE_OUTPUT",
      {
        query: o.id,
        item: o,
        success: (s) => {
          e("DID_PREPARE_OUTPUT", { id: o.id, file: s }), n({
            file: o,
            output: s
          });
        },
        failure: a
      },
      !0
    );
  }),
  REQUEST_ITEM_PROCESSING: ve(r, (o, n, a) => {
    if (!// waiting for something
    (o.status === F.IDLE || // processing went wrong earlier
    o.status === F.PROCESSING_ERROR)) {
      const s = () => e("REQUEST_ITEM_PROCESSING", { query: o, success: n, failure: a }), i = () => document.hidden ? s() : setTimeout(s, 32);
      o.status === F.PROCESSING_COMPLETE || o.status === F.PROCESSING_REVERT_ERROR ? o.revert(
        vt(r.options.server.url, r.options.server.revert),
        t("GET_FORCE_REVERT")
      ).then(i).catch(() => {
      }) : o.status === F.PROCESSING && o.abortProcessing().then(i);
      return;
    }
    o.status !== F.PROCESSING_QUEUED && (o.requestProcessing(), e("DID_REQUEST_ITEM_PROCESSING", { id: o.id }), e("PROCESS_ITEM", { query: o, success: n, failure: a }, !0));
  }),
  PROCESS_ITEM: ve(r, (o, n, a) => {
    const s = t("GET_MAX_PARALLEL_UPLOADS");
    if (t("GET_ITEMS_BY_STATUS", F.PROCESSING).length === s) {
      r.processingQueue.push({
        id: o.id,
        success: n,
        failure: a
      });
      return;
    }
    if (o.status === F.PROCESSING) return;
    const i = () => {
      const c = r.processingQueue.shift();
      if (!c) return;
      const { id: u, success: p, failure: d } = c, h = We(r.items, u);
      if (!h || h.archived) {
        i();
        return;
      }
      e("PROCESS_ITEM", { query: u, success: p, failure: d }, !0);
    };
    o.onOnce("process-complete", () => {
      n(_e(o)), i();
      const c = r.options.server;
      if (r.options.instantUpload && o.origin === ue.LOCAL && ze(c.remove)) {
        const u = () => {
        };
        o.origin = ue.LIMBO, r.options.server.remove(o.source, u, u);
      }
      t("GET_ITEMS_BY_STATUS", F.PROCESSING_COMPLETE).length === r.items.length && e("DID_COMPLETE_ITEM_PROCESSING_ALL");
    }), o.onOnce("process-error", (c) => {
      a({ error: c, file: _e(o) }), i();
    });
    const l = r.options;
    o.process(
      Ku(
        Xu(l.server.url, l.server.process, l.name, {
          chunkTransferId: o.transferId,
          chunkServer: l.server.patch,
          chunkUploads: l.chunkUploads,
          chunkForce: l.chunkForce,
          chunkSize: l.chunkSize,
          chunkRetryDelays: l.chunkRetryDelays
        }),
        {
          allowMinimumUploadDuration: t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")
        }
      ),
      // called when the file is about to be processed so it can be piped through the transform filters
      (c, u, p) => {
        we("PREPARE_OUTPUT", c, { query: t, item: o }).then((d) => {
          e("DID_PREPARE_OUTPUT", { id: o.id, file: d }), u(d);
        }).catch(p);
      }
    );
  }),
  RETRY_ITEM_PROCESSING: ve(r, (o) => {
    e("REQUEST_ITEM_PROCESSING", { query: o });
  }),
  REQUEST_REMOVE_ITEM: ve(r, (o) => {
    yn(t("GET_BEFORE_REMOVE_FILE"), _e(o)).then((n) => {
      n && e("REMOVE_ITEM", { query: o });
    });
  }),
  RELEASE_ITEM: ve(r, (o) => {
    o.release();
  }),
  REMOVE_ITEM: ve(r, (o, n, a, s) => {
    const i = () => {
      const c = o.id;
      gn(r.items, c).archive(), e("DID_REMOVE_ITEM", { error: null, id: c, item: o }), Lr(e, r), n(_e(o));
    }, l = r.options.server;
    o.origin === ue.LOCAL && l && ze(l.remove) && s.remove !== !1 ? (e("DID_START_ITEM_REMOVE", { id: o.id }), l.remove(
      o.source,
      () => i(),
      (c) => {
        e("DID_THROW_ITEM_REMOVE_ERROR", {
          id: o.id,
          error: oe("error", 0, c, null),
          status: {
            main: kt(r.options.labelFileRemoveError)(c),
            sub: r.options.labelTapToRetry
          }
        });
      }
    )) : ((s.revert && o.origin !== ue.LOCAL && o.serverId !== null || // if chunked uploads are enabled and we're uploading in chunks for this specific file
    // or if the file isn't big enough for chunked uploads but chunkForce is set then call
    // revert before removing from the view...
    r.options.chunkUploads && o.file.size > r.options.chunkSize || r.options.chunkUploads && r.options.chunkForce) && o.revert(
      vt(r.options.server.url, r.options.server.revert),
      t("GET_FORCE_REVERT")
    ), i());
  }),
  ABORT_ITEM_LOAD: ve(r, (o) => {
    o.abortLoad();
  }),
  ABORT_ITEM_PROCESSING: ve(r, (o) => {
    if (o.serverId) {
      e("REVERT_ITEM_PROCESSING", { id: o.id });
      return;
    }
    o.abortProcessing().then(() => {
      r.options.instantUpload && e("REMOVE_ITEM", { query: o.id });
    });
  }),
  REQUEST_REVERT_ITEM_PROCESSING: ve(r, (o) => {
    if (!r.options.instantUpload) {
      e("REVERT_ITEM_PROCESSING", { query: o });
      return;
    }
    const n = (i) => {
      i && e("REVERT_ITEM_PROCESSING", { query: o });
    }, a = t("GET_BEFORE_REMOVE_FILE");
    if (!a)
      return n(!0);
    const s = a(_e(o));
    if (s == null)
      return n(!0);
    if (typeof s == "boolean")
      return n(s);
    typeof s.then == "function" && s.then(n);
  }),
  REVERT_ITEM_PROCESSING: ve(r, (o) => {
    o.revert(
      vt(r.options.server.url, r.options.server.revert),
      t("GET_FORCE_REVERT")
    ).then(() => {
      (r.options.instantUpload || od(o)) && e("REMOVE_ITEM", { query: o.id });
    }).catch(() => {
    });
  }),
  SET_OPTIONS: ({ options: o }) => {
    const n = Object.keys(o), a = sd.filter((s) => n.includes(s));
    [
      // add prioritized first if passed to options, else remove
      ...a,
      // prevent duplicate keys
      ...Object.keys(o).filter((s) => !a.includes(s))
    ].forEach((s) => {
      e(`SET_${fr(s, "_").toUpperCase()}`, {
        value: o[s]
      });
    });
  }
}), sd = [
  "server"
  // must be processed before "files"
], So = (e) => e, xe = (e) => document.createElement(e), se = (e, t) => {
  let r = e.childNodes[0];
  r ? t !== r.nodeValue && (r.nodeValue = t) : (r = document.createTextNode(t), e.appendChild(r));
}, In = (e, t, r, o) => {
  const n = (o % 360 - 90) * Math.PI / 180;
  return {
    x: e + r * Math.cos(n),
    y: t + r * Math.sin(n)
  };
}, ad = (e, t, r, o, n, a) => {
  const s = In(e, t, r, n), i = In(e, t, r, o);
  return ["M", s.x, s.y, "A", r, r, 0, a, 0, i.x, i.y].join(" ");
}, id = (e, t, r, o, n) => {
  let a = 1;
  return n > o && n - o <= 0.5 && (a = 0), o > n && o - n >= 0.5 && (a = 0), ad(
    e,
    t,
    r,
    Math.min(0.9999, o) * 360,
    Math.min(0.9999, n) * 360,
    a
  );
}, ld = ({ root: e, props: t }) => {
  t.spin = !1, t.progress = 0, t.opacity = 0;
  const r = Zt("svg");
  e.ref.path = Zt("path", {
    "stroke-width": 2,
    "stroke-linecap": "round"
  }), r.appendChild(e.ref.path), e.ref.svg = r, e.appendChild(r);
}, cd = ({ root: e, props: t }) => {
  if (t.opacity === 0)
    return;
  t.align && (e.element.dataset.align = t.align);
  const r = parseInt(ce(e.ref.path, "stroke-width"), 10), o = e.rect.element.width * 0.5;
  let n = 0, a = 0;
  t.spin ? (n = 0, a = 0.5) : (n = 0, a = t.progress);
  const s = id(o, o, o - r, n, a);
  ce(e.ref.path, "d", s), ce(e.ref.path, "stroke-opacity", t.spin || t.progress > 0 ? 1 : 0);
}, Tn = ie({
  tag: "div",
  name: "progress-indicator",
  ignoreRectUpdate: !0,
  ignoreRect: !0,
  create: ld,
  write: cd,
  mixins: {
    apis: ["progress", "spin", "align"],
    styles: ["opacity"],
    animations: {
      opacity: { type: "tween", duration: 500 },
      progress: {
        type: "spring",
        stiffness: 0.95,
        damping: 0.65,
        mass: 10
      }
    }
  }
}), ud = ({ root: e, props: t }) => {
  e.element.innerHTML = (t.icon || "") + `<span>${t.label}</span>`, t.isDisabled = !1;
}, dd = ({ root: e, props: t }) => {
  const { isDisabled: r } = t, o = e.query("GET_DISABLED") || t.opacity === 0;
  o && !r ? (t.isDisabled = !0, ce(e.element, "disabled", "disabled")) : !o && r && (t.isDisabled = !1, e.element.removeAttribute("disabled"));
}, ta = ie({
  tag: "button",
  attributes: {
    type: "button"
  },
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  name: "file-action-button",
  mixins: {
    apis: ["label"],
    styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity"],
    animations: {
      scaleX: "spring",
      scaleY: "spring",
      translateX: "spring",
      translateY: "spring",
      opacity: { type: "tween", duration: 250 }
    },
    listeners: !0
  },
  create: ud,
  write: dd
}), ra = (e, t = ".", r = 1e3, o = {}) => {
  const {
    labelBytes: n = "bytes",
    labelKilobytes: a = "KB",
    labelMegabytes: s = "MB",
    labelGigabytes: i = "GB"
  } = o;
  e = Math.round(Math.abs(e));
  const l = r, c = r * r, u = r * r * r;
  return e < l ? `${e} ${n}` : e < c ? `${Math.floor(e / l)} ${a}` : e < u ? `${vn(e / c, 1, t)} ${s}` : `${vn(e / u, 2, t)} ${i}`;
}, vn = (e, t, r) => e.toFixed(t).split(".").filter((o) => o !== "0").join(r), pd = ({ root: e, props: t }) => {
  const r = xe("span");
  r.className = "filepond--file-info-main", ce(r, "aria-hidden", "true"), e.appendChild(r), e.ref.fileName = r;
  const o = xe("span");
  o.className = "filepond--file-info-sub", e.appendChild(o), e.ref.fileSize = o, se(o, e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")), se(r, So(e.query("GET_ITEM_NAME", t.id)));
}, Kr = ({ root: e, props: t }) => {
  se(
    e.ref.fileSize,
    ra(
      e.query("GET_ITEM_SIZE", t.id),
      ".",
      e.query("GET_FILE_SIZE_BASE"),
      e.query("GET_FILE_SIZE_LABELS", e.query)
    )
  ), se(e.ref.fileName, So(e.query("GET_ITEM_NAME", t.id)));
}, Rn = ({ root: e, props: t }) => {
  if (yt(e.query("GET_ITEM_SIZE", t.id))) {
    Kr({ root: e, props: t });
    return;
  }
  se(e.ref.fileSize, e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"));
}, fd = ie({
  name: "file-info",
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  write: Ee({
    DID_LOAD_ITEM: Kr,
    DID_UPDATE_ITEM_META: Kr,
    DID_THROW_ITEM_LOAD_ERROR: Rn,
    DID_THROW_ITEM_INVALID: Rn
  }),
  didCreateView: (e) => {
    nt("CREATE_VIEW", { ...e, view: e });
  },
  create: pd,
  mixins: {
    styles: ["translateX", "translateY"],
    animations: {
      translateX: "spring",
      translateY: "spring"
    }
  }
}), oa = (e) => Math.round(e * 100), md = ({ root: e }) => {
  const t = xe("span");
  t.className = "filepond--file-status-main", e.appendChild(t), e.ref.main = t;
  const r = xe("span");
  r.className = "filepond--file-status-sub", e.appendChild(r), e.ref.sub = r, na({ root: e, action: { progress: null } });
}, na = ({ root: e, action: t }) => {
  const r = t.progress === null ? e.query("GET_LABEL_FILE_LOADING") : `${e.query("GET_LABEL_FILE_LOADING")} ${oa(t.progress)}%`;
  se(e.ref.main, r), se(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, hd = ({ root: e, action: t }) => {
  const r = t.progress === null ? e.query("GET_LABEL_FILE_PROCESSING") : `${e.query("GET_LABEL_FILE_PROCESSING")} ${oa(t.progress)}%`;
  se(e.ref.main, r), se(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, Ed = ({ root: e }) => {
  se(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING")), se(e.ref.sub, e.query("GET_LABEL_TAP_TO_CANCEL"));
}, gd = ({ root: e }) => {
  se(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING_ABORTED")), se(e.ref.sub, e.query("GET_LABEL_TAP_TO_RETRY"));
}, _d = ({ root: e }) => {
  se(e.ref.main, e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")), se(e.ref.sub, e.query("GET_LABEL_TAP_TO_UNDO"));
}, bn = ({ root: e }) => {
  se(e.ref.main, ""), se(e.ref.sub, "");
}, Rt = ({ root: e, action: t }) => {
  se(e.ref.main, t.status.main), se(e.ref.sub, t.status.sub);
}, yd = ie({
  name: "file-status",
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  write: Ee({
    DID_LOAD_ITEM: bn,
    DID_REVERT_ITEM_PROCESSING: bn,
    DID_REQUEST_ITEM_PROCESSING: Ed,
    DID_ABORT_ITEM_PROCESSING: gd,
    DID_COMPLETE_ITEM_PROCESSING: _d,
    DID_UPDATE_ITEM_PROCESS_PROGRESS: hd,
    DID_UPDATE_ITEM_LOAD_PROGRESS: na,
    DID_THROW_ITEM_LOAD_ERROR: Rt,
    DID_THROW_ITEM_INVALID: Rt,
    DID_THROW_ITEM_PROCESSING_ERROR: Rt,
    DID_THROW_ITEM_PROCESSING_REVERT_ERROR: Rt,
    DID_THROW_ITEM_REMOVE_ERROR: Rt
  }),
  didCreateView: (e) => {
    nt("CREATE_VIEW", { ...e, view: e });
  },
  create: md,
  mixins: {
    styles: ["translateX", "translateY", "opacity"],
    animations: {
      opacity: { type: "tween", duration: 250 },
      translateX: "spring",
      translateY: "spring"
    }
  }
}), Zr = {
  AbortItemLoad: {
    label: "GET_LABEL_BUTTON_ABORT_ITEM_LOAD",
    action: "ABORT_ITEM_LOAD",
    className: "filepond--action-abort-item-load",
    align: "LOAD_INDICATOR_POSITION"
    // right
  },
  RetryItemLoad: {
    label: "GET_LABEL_BUTTON_RETRY_ITEM_LOAD",
    action: "RETRY_ITEM_LOAD",
    icon: "GET_ICON_RETRY",
    className: "filepond--action-retry-item-load",
    align: "BUTTON_PROCESS_ITEM_POSITION"
    // right
  },
  RemoveItem: {
    label: "GET_LABEL_BUTTON_REMOVE_ITEM",
    action: "REQUEST_REMOVE_ITEM",
    icon: "GET_ICON_REMOVE",
    className: "filepond--action-remove-item",
    align: "BUTTON_REMOVE_ITEM_POSITION"
    // left
  },
  ProcessItem: {
    label: "GET_LABEL_BUTTON_PROCESS_ITEM",
    action: "REQUEST_ITEM_PROCESSING",
    icon: "GET_ICON_PROCESS",
    className: "filepond--action-process-item",
    align: "BUTTON_PROCESS_ITEM_POSITION"
    // right
  },
  AbortItemProcessing: {
    label: "GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",
    action: "ABORT_ITEM_PROCESSING",
    className: "filepond--action-abort-item-processing",
    align: "BUTTON_PROCESS_ITEM_POSITION"
    // right
  },
  RetryItemProcessing: {
    label: "GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",
    action: "RETRY_ITEM_PROCESSING",
    icon: "GET_ICON_RETRY",
    className: "filepond--action-retry-item-processing",
    align: "BUTTON_PROCESS_ITEM_POSITION"
    // right
  },
  RevertItemProcessing: {
    label: "GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",
    action: "REQUEST_REVERT_ITEM_PROCESSING",
    icon: "GET_ICON_UNDO",
    className: "filepond--action-revert-item-processing",
    align: "BUTTON_PROCESS_ITEM_POSITION"
    // right
  }
}, Jr = [];
te(Zr, (e) => {
  Jr.push(e);
});
const Ie = (e) => {
  if (eo(e) === "right") return 0;
  const t = e.ref.buttonRemoveItem.rect.element;
  return t.hidden ? null : t.width + t.left;
}, Id = (e) => e.ref.buttonAbortItemLoad.rect.element.width, Ut = (e) => Math.floor(e.ref.buttonRemoveItem.rect.element.height / 4), Td = (e) => Math.floor(e.ref.buttonRemoveItem.rect.element.left / 2), vd = (e) => e.query("GET_STYLE_LOAD_INDICATOR_POSITION"), Rd = (e) => e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION"), eo = (e) => e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"), bd = {
  buttonAbortItemLoad: { opacity: 0 },
  buttonRetryItemLoad: { opacity: 0 },
  buttonRemoveItem: { opacity: 0 },
  buttonProcessItem: { opacity: 0 },
  buttonAbortItemProcessing: { opacity: 0 },
  buttonRetryItemProcessing: { opacity: 0 },
  buttonRevertItemProcessing: { opacity: 0 },
  loadProgressIndicator: { opacity: 0, align: vd },
  processProgressIndicator: { opacity: 0, align: Rd },
  processingCompleteIndicator: { opacity: 0, scaleX: 0.75, scaleY: 0.75 },
  info: { translateX: 0, translateY: 0, opacity: 0 },
  status: { translateX: 0, translateY: 0, opacity: 0 }
}, Sn = {
  buttonRemoveItem: { opacity: 1 },
  buttonProcessItem: { opacity: 1 },
  info: { translateX: Ie },
  status: { translateX: Ie }
}, xr = {
  buttonAbortItemProcessing: { opacity: 1 },
  processProgressIndicator: { opacity: 1 },
  status: { opacity: 1 }
}, lt = {
  DID_THROW_ITEM_INVALID: {
    buttonRemoveItem: { opacity: 1 },
    info: { translateX: Ie },
    status: { translateX: Ie, opacity: 1 }
  },
  DID_START_ITEM_LOAD: {
    buttonAbortItemLoad: { opacity: 1 },
    loadProgressIndicator: { opacity: 1 },
    status: { opacity: 1 }
  },
  DID_THROW_ITEM_LOAD_ERROR: {
    buttonRetryItemLoad: { opacity: 1 },
    buttonRemoveItem: { opacity: 1 },
    info: { translateX: Ie },
    status: { opacity: 1 }
  },
  DID_START_ITEM_REMOVE: {
    processProgressIndicator: { opacity: 1, align: eo },
    info: { translateX: Ie },
    status: { opacity: 0 }
  },
  DID_THROW_ITEM_REMOVE_ERROR: {
    processProgressIndicator: { opacity: 0, align: eo },
    buttonRemoveItem: { opacity: 1 },
    info: { translateX: Ie },
    status: { opacity: 1, translateX: Ie }
  },
  DID_LOAD_ITEM: Sn,
  DID_LOAD_LOCAL_ITEM: {
    buttonRemoveItem: { opacity: 1 },
    info: { translateX: Ie },
    status: { translateX: Ie }
  },
  DID_START_ITEM_PROCESSING: xr,
  DID_REQUEST_ITEM_PROCESSING: xr,
  DID_UPDATE_ITEM_PROCESS_PROGRESS: xr,
  DID_COMPLETE_ITEM_PROCESSING: {
    buttonRevertItemProcessing: { opacity: 1 },
    info: { opacity: 1 },
    status: { opacity: 1 }
  },
  DID_THROW_ITEM_PROCESSING_ERROR: {
    buttonRemoveItem: { opacity: 1 },
    buttonRetryItemProcessing: { opacity: 1 },
    status: { opacity: 1 },
    info: { translateX: Ie }
  },
  DID_THROW_ITEM_PROCESSING_REVERT_ERROR: {
    buttonRevertItemProcessing: { opacity: 1 },
    status: { opacity: 1 },
    info: { opacity: 1 }
  },
  DID_ABORT_ITEM_PROCESSING: {
    buttonRemoveItem: { opacity: 1 },
    buttonProcessItem: { opacity: 1 },
    info: { translateX: Ie },
    status: { opacity: 1 }
  },
  DID_REVERT_ITEM_PROCESSING: Sn
}, Sd = ie({
  create: ({ root: e }) => {
    e.element.innerHTML = e.query("GET_ICON_DONE");
  },
  name: "processing-complete-indicator",
  ignoreRect: !0,
  mixins: {
    styles: ["scaleX", "scaleY", "opacity"],
    animations: {
      scaleX: "spring",
      scaleY: "spring",
      opacity: { type: "tween", duration: 250 }
    }
  }
}), Od = ({ root: e, props: t }) => {
  const r = Object.keys(Zr).reduce((f, m) => (f[m] = { ...Zr[m] }, f), {}), { id: o } = t, n = e.query("GET_ALLOW_REVERT"), a = e.query("GET_ALLOW_REMOVE"), s = e.query("GET_ALLOW_PROCESS"), i = e.query("GET_INSTANT_UPLOAD"), l = e.query("IS_ASYNC"), c = e.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN");
  let u;
  l ? s && !n ? u = (f) => !/RevertItemProcessing/.test(f) : !s && n ? u = (f) => !/ProcessItem|RetryItemProcessing|AbortItemProcessing/.test(f) : !s && !n && (u = (f) => !/Process/.test(f)) : u = (f) => !/Process/.test(f);
  const p = u ? Jr.filter(u) : Jr.concat();
  if (i && n && (r.RevertItemProcessing.label = "GET_LABEL_BUTTON_REMOVE_ITEM", r.RevertItemProcessing.icon = "GET_ICON_REMOVE"), l && !n) {
    const f = lt.DID_COMPLETE_ITEM_PROCESSING;
    f.info.translateX = Td, f.info.translateY = Ut, f.status.translateY = Ut, f.processingCompleteIndicator = { opacity: 1, scaleX: 1, scaleY: 1 };
  }
  if (l && !s && ([
    "DID_START_ITEM_PROCESSING",
    "DID_REQUEST_ITEM_PROCESSING",
    "DID_UPDATE_ITEM_PROCESS_PROGRESS",
    "DID_THROW_ITEM_PROCESSING_ERROR"
  ].forEach((f) => {
    lt[f].status.translateY = Ut;
  }), lt.DID_THROW_ITEM_PROCESSING_ERROR.status.translateX = Id), c && n) {
    r.RevertItemProcessing.align = "BUTTON_REMOVE_ITEM_POSITION";
    const f = lt.DID_COMPLETE_ITEM_PROCESSING;
    f.info.translateX = Ie, f.status.translateY = Ut, f.processingCompleteIndicator = { opacity: 1, scaleX: 1, scaleY: 1 };
  }
  a || (r.RemoveItem.disabled = !0), te(r, (f, m) => {
    const _ = e.createChildView(ta, {
      label: e.query(m.label),
      icon: e.query(m.icon),
      opacity: 0
    });
    p.includes(f) && e.appendChildView(_), m.disabled && (_.element.setAttribute("disabled", "disabled"), _.element.setAttribute("hidden", "hidden")), _.element.dataset.align = e.query(`GET_STYLE_${m.align}`), _.element.classList.add(m.className), _.on("click", (g) => {
      g.stopPropagation(), !m.disabled && e.dispatch(m.action, { query: o });
    }), e.ref[`button${f}`] = _;
  }), e.ref.processingCompleteIndicator = e.appendChildView(
    e.createChildView(Sd)
  ), e.ref.processingCompleteIndicator.element.dataset.align = e.query(
    "GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"
  ), e.ref.info = e.appendChildView(e.createChildView(fd, { id: o })), e.ref.status = e.appendChildView(e.createChildView(yd, { id: o }));
  const d = e.appendChildView(
    e.createChildView(Tn, {
      opacity: 0,
      align: e.query("GET_STYLE_LOAD_INDICATOR_POSITION")
    })
  );
  d.element.classList.add("filepond--load-indicator"), e.ref.loadProgressIndicator = d;
  const h = e.appendChildView(
    e.createChildView(Tn, {
      opacity: 0,
      align: e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")
    })
  );
  h.element.classList.add("filepond--process-indicator"), e.ref.processProgressIndicator = h, e.ref.activeStyles = [];
}, wd = ({ root: e, actions: t, props: r }) => {
  Dd({ root: e, actions: t, props: r });
  let o = t.concat().filter((n) => /^DID_/.test(n.type)).reverse().find((n) => lt[n.type]);
  if (o) {
    e.ref.activeStyles = [];
    const n = lt[o.type];
    te(bd, (a, s) => {
      const i = e.ref[a];
      te(s, (l, c) => {
        const u = n[a] && typeof n[a][l] < "u" ? n[a][l] : c;
        e.ref.activeStyles.push({ control: i, key: l, value: u });
      });
    });
  }
  e.ref.activeStyles.forEach(({ control: n, key: a, value: s }) => {
    n[a] = typeof s == "function" ? s(e) : s;
  });
}, Dd = Ee({
  DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING: ({ root: e, action: t }) => {
    e.ref.buttonAbortItemProcessing.label = t.value;
  },
  DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD: ({ root: e, action: t }) => {
    e.ref.buttonAbortItemLoad.label = t.value;
  },
  DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL: ({ root: e, action: t }) => {
    e.ref.buttonAbortItemRemoval.label = t.value;
  },
  DID_REQUEST_ITEM_PROCESSING: ({ root: e }) => {
    e.ref.processProgressIndicator.spin = !0, e.ref.processProgressIndicator.progress = 0;
  },
  DID_START_ITEM_LOAD: ({ root: e }) => {
    e.ref.loadProgressIndicator.spin = !0, e.ref.loadProgressIndicator.progress = 0;
  },
  DID_START_ITEM_REMOVE: ({ root: e }) => {
    e.ref.processProgressIndicator.spin = !0, e.ref.processProgressIndicator.progress = 0;
  },
  DID_UPDATE_ITEM_LOAD_PROGRESS: ({ root: e, action: t }) => {
    e.ref.loadProgressIndicator.spin = !1, e.ref.loadProgressIndicator.progress = t.progress;
  },
  DID_UPDATE_ITEM_PROCESS_PROGRESS: ({ root: e, action: t }) => {
    e.ref.processProgressIndicator.spin = !1, e.ref.processProgressIndicator.progress = t.progress;
  }
}), Cd = ie({
  create: Od,
  write: wd,
  didCreateView: (e) => {
    nt("CREATE_VIEW", { ...e, view: e });
  },
  name: "file"
}), Ad = ({ root: e, props: t }) => {
  e.ref.fileName = xe("legend"), e.appendChild(e.ref.fileName), e.ref.file = e.appendChildView(e.createChildView(Cd, { id: t.id })), e.ref.data = !1;
}, Nd = ({ root: e, props: t }) => {
  se(e.ref.fileName, So(e.query("GET_ITEM_NAME", t.id)));
}, Pd = ie({
  create: Ad,
  ignoreRect: !0,
  write: Ee({
    DID_LOAD_ITEM: Nd
  }),
  didCreateView: (e) => {
    nt("CREATE_VIEW", { ...e, view: e });
  },
  tag: "fieldset",
  name: "file-wrapper"
}), On = { type: "spring", damping: 0.6, mass: 7 }, Ld = ({ root: e, props: t }) => {
  [
    {
      name: "top"
    },
    {
      name: "center",
      props: {
        translateY: null,
        scaleY: null
      },
      mixins: {
        animations: {
          scaleY: On
        },
        styles: ["translateY", "scaleY"]
      }
    },
    {
      name: "bottom",
      props: {
        translateY: null
      },
      mixins: {
        animations: {
          translateY: On
        },
        styles: ["translateY"]
      }
    }
  ].forEach((r) => {
    Md(e, r, t.name);
  }), e.element.classList.add(`filepond--${t.name}`), e.ref.scalable = null;
}, Md = (e, t, r) => {
  const o = ie({
    name: `panel-${t.name} filepond--${r}`,
    mixins: t.mixins,
    ignoreRectUpdate: !0
  }), n = e.createChildView(o, t.props);
  e.ref[t.name] = e.appendChildView(n);
}, xd = ({ root: e, props: t }) => {
  if ((e.ref.scalable === null || t.scalable !== e.ref.scalable) && (e.ref.scalable = Bs(t.scalable) ? t.scalable : !0, e.element.dataset.scalable = e.ref.scalable), !t.height) return;
  const r = e.ref.top.rect.element, o = e.ref.bottom.rect.element, n = Math.max(r.height + o.height, t.height);
  e.ref.center.translateY = r.height, e.ref.center.scaleY = (n - r.height - o.height) / 100, e.ref.bottom.translateY = n - o.height;
}, sa = ie({
  name: "panel",
  read: ({ root: e, props: t }) => t.heightCurrent = e.ref.bottom.translateY,
  write: xd,
  create: Ld,
  ignoreRect: !0,
  mixins: {
    apis: ["height", "heightCurrent", "scalable"]
  }
}), Gd = (e) => {
  const t = e.map((o) => o.id);
  let r;
  return {
    setIndex: (o) => {
      r = o;
    },
    getIndex: () => r,
    getItemIndex: (o) => t.indexOf(o.id)
  };
}, wn = {
  type: "spring",
  stiffness: 0.75,
  damping: 0.45,
  mass: 10
}, Dn = "spring", Cn = {
  DID_START_ITEM_LOAD: "busy",
  DID_UPDATE_ITEM_LOAD_PROGRESS: "loading",
  DID_THROW_ITEM_INVALID: "load-invalid",
  DID_THROW_ITEM_LOAD_ERROR: "load-error",
  DID_LOAD_ITEM: "idle",
  DID_THROW_ITEM_REMOVE_ERROR: "remove-error",
  DID_START_ITEM_REMOVE: "busy",
  DID_START_ITEM_PROCESSING: "busy processing",
  DID_REQUEST_ITEM_PROCESSING: "busy processing",
  DID_UPDATE_ITEM_PROCESS_PROGRESS: "processing",
  DID_COMPLETE_ITEM_PROCESSING: "processing-complete",
  DID_THROW_ITEM_PROCESSING_ERROR: "processing-error",
  DID_THROW_ITEM_PROCESSING_REVERT_ERROR: "processing-revert-error",
  DID_ABORT_ITEM_PROCESSING: "cancelled",
  DID_REVERT_ITEM_PROCESSING: "idle"
}, kd = ({ root: e, props: t }) => {
  if (e.ref.handleClick = (o) => e.dispatch("DID_ACTIVATE_ITEM", { id: t.id }), e.element.id = `filepond--item-${t.id}`, e.element.addEventListener("click", e.ref.handleClick), e.ref.container = e.appendChildView(e.createChildView(Pd, { id: t.id })), e.ref.panel = e.appendChildView(e.createChildView(sa, { name: "item-panel" })), e.ref.panel.height = null, t.markedForRemoval = !1, !e.query("GET_ALLOW_REORDER")) return;
  e.element.dataset.dragState = "idle";
  const r = (o) => {
    if (!o.isPrimary) return;
    let n = !1;
    const a = {
      x: o.pageX,
      y: o.pageY
    };
    t.dragOrigin = {
      x: e.translateX,
      y: e.translateY
    }, t.dragCenter = {
      x: o.offsetX,
      y: o.offsetY
    };
    const s = Gd(e.query("GET_ACTIVE_ITEMS"));
    e.dispatch("DID_GRAB_ITEM", { id: t.id, dragState: s });
    const i = (p) => {
      p.isPrimary && (p.stopPropagation(), p.preventDefault(), t.dragOffset = {
        x: p.pageX - a.x,
        y: p.pageY - a.y
      }, t.dragOffset.x * t.dragOffset.x + t.dragOffset.y * t.dragOffset.y > 16 && !n && (n = !0, e.element.removeEventListener("click", e.ref.handleClick)), e.dispatch("DID_DRAG_ITEM", { id: t.id, dragState: s }));
    }, l = (p) => {
      p.isPrimary && (t.dragOffset = {
        x: p.pageX - a.x,
        y: p.pageY - a.y
      }, u());
    }, c = () => {
      u();
    }, u = () => {
      document.removeEventListener("pointercancel", c), document.removeEventListener("pointermove", i), document.removeEventListener("pointerup", l), e.dispatch("DID_DROP_ITEM", { id: t.id, dragState: s }), n && setTimeout(() => e.element.addEventListener("click", e.ref.handleClick), 0);
    };
    document.addEventListener("pointercancel", c), document.addEventListener("pointermove", i), document.addEventListener("pointerup", l);
  };
  e.element.addEventListener("pointerdown", r);
}, Ud = Ee({
  DID_UPDATE_PANEL_HEIGHT: ({ root: e, action: t }) => {
    e.height = t.height;
  }
}), Fd = Ee(
  {
    DID_GRAB_ITEM: ({ root: e, props: t }) => {
      t.dragOrigin = {
        x: e.translateX,
        y: e.translateY
      };
    },
    DID_DRAG_ITEM: ({ root: e }) => {
      e.element.dataset.dragState = "drag";
    },
    DID_DROP_ITEM: ({ root: e, props: t }) => {
      t.dragOffset = null, t.dragOrigin = null, e.element.dataset.dragState = "drop";
    }
  },
  ({ root: e, actions: t, props: r, shouldOptimize: o }) => {
    e.element.dataset.dragState === "drop" && e.scaleX <= 1 && (e.element.dataset.dragState = "idle");
    let n = t.concat().filter((s) => /^DID_/.test(s.type)).reverse().find((s) => Cn[s.type]);
    n && n.type !== r.currentState && (r.currentState = n.type, e.element.dataset.filepondItemState = Cn[r.currentState] || "");
    const a = e.query("GET_ITEM_PANEL_ASPECT_RATIO") || e.query("GET_PANEL_ASPECT_RATIO");
    a ? o || (e.height = e.rect.element.width * a) : (Ud({ root: e, actions: t, props: r }), !e.height && e.ref.container.rect.element.height > 0 && (e.height = e.ref.container.rect.element.height)), o && (e.ref.panel.height = null), e.ref.panel.height = e.height;
  }
), Bd = ie({
  create: kd,
  write: Fd,
  destroy: ({ root: e, props: t }) => {
    e.element.removeEventListener("click", e.ref.handleClick), e.dispatch("RELEASE_ITEM", { query: t.id });
  },
  tag: "li",
  name: "item",
  mixins: {
    apis: [
      "id",
      "interactionMethod",
      "markedForRemoval",
      "spawnDate",
      "dragCenter",
      "dragOrigin",
      "dragOffset"
    ],
    styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity", "height"],
    animations: {
      scaleX: Dn,
      scaleY: Dn,
      translateX: wn,
      translateY: wn,
      opacity: { type: "tween", duration: 150 }
    }
  }
});
var Oo = (e, t) => Math.max(1, Math.floor((e + 1) / t));
const wo = (e, t, r) => {
  if (!r) return;
  const o = e.rect.element.width, n = t.length;
  let a = null;
  if (n === 0 || r.top < t[0].rect.element.top) return -1;
  const s = t[0].rect.element, i = s.marginLeft + s.marginRight, l = s.width + i, c = Oo(o, l);
  if (c === 1) {
    for (let d = 0; d < n; d++) {
      const h = t[d], f = h.rect.outer.top + h.rect.element.height * 0.5;
      if (r.top < f)
        return d;
    }
    return n;
  }
  const u = s.marginTop + s.marginBottom, p = s.height + u;
  for (let d = 0; d < n; d++) {
    const h = d % c, f = Math.floor(d / c), m = h * l, _ = f * p, g = _ - s.marginTop, E = m + l, I = _ + p + s.marginBottom;
    if (r.top < I && r.top > g) {
      if (r.left < E)
        return d;
      d !== n - 1 ? a = d : a = null;
    }
  }
  return a !== null ? a : n;
}, Ft = {
  height: 0,
  width: 0,
  get getHeight() {
    return this.height;
  },
  set setHeight(e) {
    (this.height === 0 || e === 0) && (this.height = e);
  },
  get getWidth() {
    return this.width;
  },
  set setWidth(e) {
    (this.width === 0 || e === 0) && (this.width = e);
  }
}, Vd = ({ root: e }) => {
  ce(e.element, "role", "list"), e.ref.lastItemSpanwDate = Date.now();
}, qd = ({ root: e, action: t }) => {
  const { id: r, index: o, interactionMethod: n } = t;
  e.ref.addIndex = o;
  const a = Date.now();
  let s = a, i = 1;
  if (n !== Re.NONE) {
    i = 0;
    const l = e.query("GET_ITEM_INSERT_INTERVAL"), c = a - e.ref.lastItemSpanwDate;
    s = c < l ? a + (l - c) : a;
  }
  e.ref.lastItemSpanwDate = s, e.appendChildView(
    e.createChildView(
      // view type
      Bd,
      // props
      {
        spawnDate: s,
        id: r,
        opacity: i,
        interactionMethod: n
      }
    ),
    o
  );
}, An = (e, t, r, o = 0, n = 1) => {
  e.dragOffset ? (e.translateX = null, e.translateY = null, e.translateX = e.dragOrigin.x + e.dragOffset.x, e.translateY = e.dragOrigin.y + e.dragOffset.y, e.scaleX = 1.025, e.scaleY = 1.025) : (e.translateX = t, e.translateY = r, Date.now() > e.spawnDate && (e.opacity === 0 && jd(e, t, r, o, n), e.scaleX = 1, e.scaleY = 1, e.opacity = 1));
}, jd = (e, t, r, o, n) => {
  e.interactionMethod === Re.NONE ? (e.translateX = null, e.translateX = t, e.translateY = null, e.translateY = r) : e.interactionMethod === Re.DROP ? (e.translateX = null, e.translateX = t - o * 20, e.translateY = null, e.translateY = r - n * 10, e.scaleX = 0.8, e.scaleY = 0.8) : e.interactionMethod === Re.BROWSE ? (e.translateY = null, e.translateY = r - 30) : e.interactionMethod === Re.API && (e.translateX = null, e.translateX = t - 30, e.translateY = null);
}, $d = ({ root: e, action: t }) => {
  const { id: r } = t, o = e.childViews.find((n) => n.id === r);
  o && (o.scaleX = 0.9, o.scaleY = 0.9, o.opacity = 0, o.markedForRemoval = !0);
}, Gr = (e) => e.rect.element.height + e.rect.element.marginBottom * 0.5 + e.rect.element.marginTop * 0.5, Yd = (e) => e.rect.element.width + e.rect.element.marginLeft * 0.5 + e.rect.element.marginRight * 0.5, Hd = ({ root: e, action: t }) => {
  const { id: r, dragState: o } = t, n = e.query("GET_ITEM", { id: r }), a = e.childViews.find((_) => _.id === r), s = e.childViews.length, i = o.getItemIndex(n);
  if (!a) return;
  const l = {
    x: a.dragOrigin.x + a.dragOffset.x + a.dragCenter.x,
    y: a.dragOrigin.y + a.dragOffset.y + a.dragCenter.y
  }, c = Gr(a), u = Yd(a);
  let p = Math.floor(e.rect.outer.width / u);
  p > s && (p = s);
  const d = Math.floor(s / p + 1);
  Ft.setHeight = c * d, Ft.setWidth = u * p;
  var h = {
    y: Math.floor(l.y / c),
    x: Math.floor(l.x / u),
    getGridIndex: function() {
      return l.y > Ft.getHeight || l.y < 0 || l.x > Ft.getWidth || l.x < 0 ? i : this.y * p + this.x;
    },
    getColIndex: function() {
      const _ = e.query("GET_ACTIVE_ITEMS"), g = e.childViews.filter((L) => L.rect.element.height), E = _.map(
        (L) => g.find((x) => x.id === L.id)
      ), I = E.findIndex((L) => L === a), O = Gr(a), S = E.length;
      let C = S, v = 0, A = 0, U = 0;
      for (let L = 0; L < S; L++)
        if (v = Gr(E[L]), U = A, A = U + v, l.y < A) {
          if (I > L) {
            if (l.y < U + O) {
              C = L;
              break;
            }
            continue;
          }
          C = L;
          break;
        }
      return C;
    }
  };
  const f = p > 1 ? h.getGridIndex() : h.getColIndex();
  e.dispatch("MOVE_ITEM", { query: a, index: f });
  const m = o.getIndex();
  if (m === void 0 || m !== f) {
    if (o.setIndex(f), m === void 0) return;
    e.dispatch("DID_REORDER_ITEMS", {
      items: e.query("GET_ACTIVE_ITEMS"),
      origin: i,
      target: f
    });
  }
}, zd = Ee({
  DID_ADD_ITEM: qd,
  DID_REMOVE_ITEM: $d,
  DID_DRAG_ITEM: Hd
}), Wd = ({ root: e, props: t, actions: r, shouldOptimize: o }) => {
  zd({ root: e, props: t, actions: r });
  const { dragCoordinates: n } = t, a = e.rect.element.width, s = e.childViews.filter((I) => I.rect.element.height), i = e.query("GET_ACTIVE_ITEMS").map((I) => s.find((O) => O.id === I.id)).filter((I) => I), l = n ? wo(e, i, n) : null, c = e.ref.addIndex || null;
  e.ref.addIndex = null;
  let u = 0, p = 0, d = 0;
  if (i.length === 0) return;
  const h = i[0].rect.element, f = h.marginTop + h.marginBottom, m = h.marginLeft + h.marginRight, _ = h.width + m, g = h.height + f, E = Oo(a, _);
  if (E === 1) {
    let I = 0, O = 0;
    i.forEach((S, C) => {
      if (l) {
        let A = C - l;
        A === -2 ? O = -f * 0.25 : A === -1 ? O = -f * 0.75 : A === 0 ? O = f * 0.75 : A === 1 ? O = f * 0.25 : O = 0;
      }
      o && (S.translateX = null, S.translateY = null), S.markedForRemoval || An(S, 0, I + O);
      let v = (S.rect.element.height + f) * (S.markedForRemoval ? S.opacity : 1);
      I += v;
    });
  } else {
    let I = 0, O = 0;
    i.forEach((S, C) => {
      C === l && (u = 1), C === c && (d += 1), S.markedForRemoval && S.opacity < 0.5 && (p -= 1);
      const v = C + d + u + p, A = v % E, U = Math.floor(v / E), L = A * _, x = U * g, z = Math.sign(L - I), H = Math.sign(x - O);
      I = L, O = x, !S.markedForRemoval && (o && (S.translateX = null, S.translateY = null), An(S, L, x, z, H));
    });
  }
}, Xd = (e, t) => t.filter((r) => r.data && r.data.id ? e.id === r.data.id : !0), Qd = ie({
  create: Vd,
  write: Wd,
  tag: "ul",
  name: "list",
  didWriteView: ({ root: e }) => {
    e.childViews.filter((t) => t.markedForRemoval && t.opacity === 0 && t.resting).forEach((t) => {
      t._destroy(), e.removeChildView(t);
    });
  },
  filterFrameActionsForChild: Xd,
  mixins: {
    apis: ["dragCoordinates"]
  }
}), Kd = ({ root: e, props: t }) => {
  e.ref.list = e.appendChildView(e.createChildView(Qd)), t.dragCoordinates = null, t.overflowing = !1;
}, Zd = ({ root: e, props: t, action: r }) => {
  e.query("GET_ITEM_INSERT_LOCATION_FREEDOM") && (t.dragCoordinates = {
    left: r.position.scopeLeft - e.ref.list.rect.element.left,
    top: r.position.scopeTop - (e.rect.outer.top + e.rect.element.marginTop + e.rect.element.scrollTop)
  });
}, Jd = ({ props: e }) => {
  e.dragCoordinates = null;
}, ep = Ee({
  DID_DRAG: Zd,
  DID_END_DRAG: Jd
}), tp = ({ root: e, props: t, actions: r }) => {
  if (ep({ root: e, props: t, actions: r }), e.ref.list.dragCoordinates = t.dragCoordinates, t.overflowing && !t.overflow && (t.overflowing = !1, e.element.dataset.state = "", e.height = null), t.overflow) {
    const o = Math.round(t.overflow);
    o !== e.height && (t.overflowing = !0, e.element.dataset.state = "overflow", e.height = o);
  }
}, rp = ie({
  create: Kd,
  write: tp,
  name: "list-scroller",
  mixins: {
    apis: ["overflow", "dragCoordinates"],
    styles: ["height", "translateY"],
    animations: {
      translateY: "spring"
    }
  }
}), Ce = (e, t, r, o = "") => {
  r ? ce(e, t, o) : e.removeAttribute(t);
}, op = (e) => {
  if (!(!e || e.value === "")) {
    try {
      e.value = "";
    } catch {
    }
    if (e.value) {
      const t = xe("form"), r = e.parentNode, o = e.nextSibling;
      t.appendChild(e), t.reset(), o ? r.insertBefore(e, o) : r.appendChild(e);
    }
  }
}, np = ({ root: e, props: t }) => {
  e.element.id = `filepond--browser-${t.id}`, ce(e.element, "name", e.query("GET_NAME")), ce(e.element, "aria-controls", `filepond--assistant-${t.id}`), ce(e.element, "aria-labelledby", `filepond--drop-label-${t.id}`), aa({ root: e, action: { value: e.query("GET_ACCEPTED_FILE_TYPES") } }), ia({ root: e, action: { value: e.query("GET_ALLOW_MULTIPLE") } }), la({ root: e, action: { value: e.query("GET_ALLOW_DIRECTORIES_ONLY") } }), to({ root: e }), ca({ root: e, action: { value: e.query("GET_REQUIRED") } }), ua({ root: e, action: { value: e.query("GET_CAPTURE_METHOD") } }), e.ref.handleChange = (r) => {
    if (!e.element.value)
      return;
    const o = Array.from(e.element.files).map((n) => (n._relativePath = n.webkitRelativePath, n));
    setTimeout(() => {
      t.onload(o), op(e.element);
    }, 250);
  }, e.element.addEventListener("change", e.ref.handleChange);
}, aa = ({ root: e, action: t }) => {
  e.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE") && Ce(e.element, "accept", !!t.value, t.value ? t.value.join(",") : "");
}, ia = ({ root: e, action: t }) => {
  Ce(e.element, "multiple", t.value);
}, la = ({ root: e, action: t }) => {
  Ce(e.element, "webkitdirectory", t.value);
}, to = ({ root: e }) => {
  const t = e.query("GET_DISABLED"), r = e.query("GET_ALLOW_BROWSE"), o = t || !r;
  Ce(e.element, "disabled", o);
}, ca = ({ root: e, action: t }) => {
  t.value ? e.query("GET_TOTAL_ITEMS") === 0 && Ce(e.element, "required", !0) : Ce(e.element, "required", !1);
}, ua = ({ root: e, action: t }) => {
  Ce(e.element, "capture", !!t.value, t.value === !0 ? "" : t.value);
}, Nn = ({ root: e }) => {
  const { element: t } = e;
  if (e.query("GET_TOTAL_ITEMS") > 0) {
    Ce(t, "required", !1), Ce(t, "name", !1);
    const r = e.query("GET_ACTIVE_ITEMS");
    let o = !1;
    for (let n = 0; n < r.length; n++)
      r[n].status === F.LOAD_ERROR && (o = !0);
    e.element.setCustomValidity(
      o ? e.query("GET_LABEL_INVALID_FIELD") : ""
    );
  } else
    Ce(t, "name", !0, e.query("GET_NAME")), e.query("GET_CHECK_VALIDITY") && t.setCustomValidity(""), e.query("GET_REQUIRED") && Ce(t, "required", !0);
}, sp = ({ root: e }) => {
  e.query("GET_CHECK_VALIDITY") && e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"));
}, ap = ie({
  tag: "input",
  name: "browser",
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  attributes: {
    type: "file"
  },
  create: np,
  destroy: ({ root: e }) => {
    e.element.removeEventListener("change", e.ref.handleChange);
  },
  write: Ee({
    DID_LOAD_ITEM: Nn,
    DID_REMOVE_ITEM: Nn,
    DID_THROW_ITEM_INVALID: sp,
    DID_SET_DISABLED: to,
    DID_SET_ALLOW_BROWSE: to,
    DID_SET_ALLOW_DIRECTORIES_ONLY: la,
    DID_SET_ALLOW_MULTIPLE: ia,
    DID_SET_ACCEPTED_FILE_TYPES: aa,
    DID_SET_CAPTURE_METHOD: ua,
    DID_SET_REQUIRED: ca
  })
}), Pn = {
  ENTER: 13,
  SPACE: 32
}, ip = ({ root: e, props: t }) => {
  const r = xe("label");
  ce(r, "for", `filepond--browser-${t.id}`), ce(r, "id", `filepond--drop-label-${t.id}`), e.ref.handleKeyDown = (o) => {
    (o.keyCode === Pn.ENTER || o.keyCode === Pn.SPACE) && (o.preventDefault(), e.ref.label.click());
  }, e.ref.handleClick = (o) => {
    o.target === r || r.contains(o.target) || e.ref.label.click();
  }, r.addEventListener("keydown", e.ref.handleKeyDown), e.element.addEventListener("click", e.ref.handleClick), da(r, t.caption), e.appendChild(r), e.ref.label = r;
}, da = (e, t) => {
  e.innerHTML = t;
  const r = e.querySelector(".filepond--label-action");
  return r && ce(r, "tabindex", "0"), t;
}, lp = ie({
  name: "drop-label",
  ignoreRect: !0,
  create: ip,
  destroy: ({ root: e }) => {
    e.ref.label.addEventListener("keydown", e.ref.handleKeyDown), e.element.removeEventListener("click", e.ref.handleClick);
  },
  write: Ee({
    DID_SET_LABEL_IDLE: ({ root: e, action: t }) => {
      da(e.ref.label, t.value);
    }
  }),
  mixins: {
    styles: ["opacity", "translateX", "translateY"],
    animations: {
      opacity: { type: "tween", duration: 150 },
      translateX: "spring",
      translateY: "spring"
    }
  }
}), cp = ie({
  name: "drip-blob",
  ignoreRect: !0,
  mixins: {
    styles: ["translateX", "translateY", "scaleX", "scaleY", "opacity"],
    animations: {
      scaleX: "spring",
      scaleY: "spring",
      translateX: "spring",
      translateY: "spring",
      opacity: { type: "tween", duration: 250 }
    }
  }
}), up = ({ root: e }) => {
  const t = e.rect.element.width * 0.5, r = e.rect.element.height * 0.5;
  e.ref.blob = e.appendChildView(
    e.createChildView(cp, {
      opacity: 0,
      scaleX: 2.5,
      scaleY: 2.5,
      translateX: t,
      translateY: r
    })
  );
}, dp = ({ root: e, action: t }) => {
  if (!e.ref.blob) {
    up({ root: e });
    return;
  }
  e.ref.blob.translateX = t.position.scopeLeft, e.ref.blob.translateY = t.position.scopeTop, e.ref.blob.scaleX = 1, e.ref.blob.scaleY = 1, e.ref.blob.opacity = 1;
}, pp = ({ root: e }) => {
  e.ref.blob && (e.ref.blob.opacity = 0);
}, fp = ({ root: e }) => {
  e.ref.blob && (e.ref.blob.scaleX = 2.5, e.ref.blob.scaleY = 2.5, e.ref.blob.opacity = 0);
}, mp = ({ root: e, props: t, actions: r }) => {
  hp({ root: e, props: t, actions: r });
  const { blob: o } = e.ref;
  r.length === 0 && o && o.opacity === 0 && (e.removeChildView(o), e.ref.blob = null);
}, hp = Ee({
  DID_DRAG: dp,
  DID_DROP: fp,
  DID_END_DRAG: pp
}), Ep = ie({
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  name: "drip",
  write: mp
}), pa = (e, t) => {
  try {
    const r = new DataTransfer();
    t.forEach((o) => {
      o instanceof File ? r.items.add(o) : r.items.add(
        new File([o], o.name, {
          type: o.type
        })
      );
    }), e.files = r.files;
  } catch {
    return !1;
  }
  return !0;
}, gp = ({ root: e }) => {
  e.ref.fields = {};
  const t = document.createElement("legend");
  t.textContent = "Files", e.element.appendChild(t);
}, Er = (e, t) => e.ref.fields[t], Do = (e) => {
  e.query("GET_ACTIVE_ITEMS").forEach((t) => {
    e.ref.fields[t.id] && e.element.appendChild(e.ref.fields[t.id]);
  });
}, Ln = ({ root: e }) => Do(e), _p = ({ root: e, action: t }) => {
  const r = e.query("GET_ITEM", t.id).origin !== ue.LOCAL && e.query("SHOULD_UPDATE_FILE_INPUT"), o = xe("input");
  o.type = r ? "file" : "hidden", o.name = e.query("GET_NAME"), e.ref.fields[t.id] = o, Do(e);
}, yp = ({ root: e, action: t }) => {
  const r = Er(e, t.id);
  if (!r || (t.serverFileReference !== null && (r.value = t.serverFileReference), !e.query("SHOULD_UPDATE_FILE_INPUT"))) return;
  const o = e.query("GET_ITEM", t.id);
  pa(r, [o.file]);
}, Ip = ({ root: e, action: t }) => {
  e.query("SHOULD_UPDATE_FILE_INPUT") && setTimeout(() => {
    const r = Er(e, t.id);
    r && pa(r, [t.file]);
  }, 0);
}, Tp = ({ root: e }) => {
  e.element.disabled = e.query("GET_DISABLED");
}, vp = ({ root: e, action: t }) => {
  const r = Er(e, t.id);
  r && (r.parentNode && r.parentNode.removeChild(r), delete e.ref.fields[t.id]);
}, Rp = ({ root: e, action: t }) => {
  const r = Er(e, t.id);
  r && (t.value === null ? r.removeAttribute("value") : r.type != "file" && (r.value = t.value), Do(e));
}, bp = Ee({
  DID_SET_DISABLED: Tp,
  DID_ADD_ITEM: _p,
  DID_LOAD_ITEM: yp,
  DID_REMOVE_ITEM: vp,
  DID_DEFINE_VALUE: Rp,
  DID_PREPARE_OUTPUT: Ip,
  DID_REORDER_ITEMS: Ln,
  DID_SORT_ITEMS: Ln
}), Sp = ie({
  tag: "fieldset",
  name: "data",
  create: gp,
  write: bp,
  ignoreRect: !0
}), Op = (e) => "getRootNode" in e ? e.getRootNode() : document, wp = ["jpg", "jpeg", "png", "gif", "bmp", "webp", "svg", "tiff"], Dp = ["css", "csv", "html", "txt"], Cp = {
  zip: "zip|compressed",
  epub: "application/epub+zip"
}, fa = (e = "") => (e = e.toLowerCase(), wp.includes(e) ? "image/" + (e === "jpg" ? "jpeg" : e === "svg" ? "svg+xml" : e) : Dp.includes(e) ? "text/" + e : Cp[e] || ""), Co = (e) => new Promise((t, r) => {
  const o = kp(e);
  if (o.length && !Ap(e))
    return t(o);
  Np(e).then(t);
}), Ap = (e) => e.files ? e.files.length > 0 : !1, Np = (e) => new Promise((t, r) => {
  const o = (e.items ? Array.from(e.items) : []).filter((n) => Pp(n)).map((n) => Lp(n));
  if (!o.length) {
    t(e.files ? Array.from(e.files) : []);
    return;
  }
  Promise.all(o).then((n) => {
    const a = [];
    n.forEach((s) => {
      a.push.apply(a, s);
    }), t(
      a.filter((s) => s).map((s) => (s._relativePath || (s._relativePath = s.webkitRelativePath), s))
    );
  }).catch(console.error);
}), Pp = (e) => {
  if (ma(e)) {
    const t = Ao(e);
    if (t)
      return t.isFile || t.isDirectory;
  }
  return e.kind === "file";
}, Lp = (e) => new Promise((t, r) => {
  if (Gp(e)) {
    Mp(Ao(e)).then(t).catch(r);
    return;
  }
  t([e.getAsFile()]);
}), Mp = (e) => new Promise((t, r) => {
  const o = [];
  let n = 0, a = 0;
  const s = () => {
    a === 0 && n === 0 && t(o);
  }, i = (l) => {
    n++;
    const c = l.createReader(), u = () => {
      c.readEntries((p) => {
        if (p.length === 0) {
          n--, s();
          return;
        }
        p.forEach((d) => {
          d.isDirectory ? i(d) : (a++, d.file((h) => {
            const f = xp(h);
            d.fullPath && (f._relativePath = d.fullPath), o.push(f), a--, s();
          }));
        }), u();
      }, r);
    };
    u();
  };
  i(e);
}), xp = (e) => {
  if (e.type.length) return e;
  const t = e.lastModifiedDate, r = e.name, o = fa(hr(e.name));
  return o.length && (e = e.slice(0, e.size, o), e.name = r, e.lastModifiedDate = t), e;
}, Gp = (e) => ma(e) && (Ao(e) || {}).isDirectory, ma = (e) => "webkitGetAsEntry" in e, Ao = (e) => e.webkitGetAsEntry(), kp = (e) => {
  let t = [];
  try {
    if (t = Fp(e), t.length)
      return t;
    t = Up(e);
  } catch {
  }
  return t;
}, Up = (e) => {
  let t = e.getData("url");
  return typeof t == "string" && t.length ? [t] : [];
}, Fp = (e) => {
  let t = e.getData("text/html");
  if (typeof t == "string" && t.length) {
    const r = t.match(/src\s*=\s*"(.+?)"/);
    if (r)
      return [r[1]];
  }
  return [];
}, er = [], et = (e) => ({
  pageLeft: e.pageX,
  pageTop: e.pageY,
  scopeLeft: e.offsetX || e.layerX,
  scopeTop: e.offsetY || e.layerY
}), Bp = (e, t, r) => {
  const o = Vp(t), n = {
    element: e,
    filterElement: r,
    state: null,
    ondrop: () => {
    },
    onenter: () => {
    },
    ondrag: () => {
    },
    onexit: () => {
    },
    onload: () => {
    },
    allowdrop: () => {
    }
  };
  return n.destroy = o.addListener(n), n;
}, Vp = (e) => {
  const t = er.find((o) => o.element === e);
  if (t)
    return t;
  const r = qp(e);
  return er.push(r), r;
}, qp = (e) => {
  const t = [], r = {
    dragenter: $p,
    dragover: Yp,
    dragleave: zp,
    drop: Hp
  }, o = {};
  te(r, (a, s) => {
    o[a] = s(e, t), e.addEventListener(a, o[a], !1);
  });
  const n = {
    element: e,
    addListener: (a) => (t.push(a), () => {
      t.splice(t.indexOf(a), 1), t.length === 0 && (er.splice(er.indexOf(n), 1), te(r, (s) => {
        e.removeEventListener(s, o[s], !1);
      }));
    })
  };
  return n;
}, jp = (e, t) => ("elementFromPoint" in e || (e = document), e.elementFromPoint(t.x, t.y)), No = (e, t) => {
  const r = Op(t), o = jp(r, {
    x: e.pageX - window.pageXOffset,
    y: e.pageY - window.pageYOffset
  });
  return o === t || t.contains(o);
};
let ha = null;
const Bt = (e, t) => {
  try {
    e.dropEffect = t;
  } catch {
  }
}, $p = (e, t) => (r) => {
  r.preventDefault(), ha = r.target, t.forEach((o) => {
    const { element: n, onenter: a } = o;
    No(r, n) && (o.state = "enter", a(et(r)));
  });
}, Yp = (e, t) => (r) => {
  r.preventDefault();
  const o = r.dataTransfer;
  Co(o).then((n) => {
    let a = !1;
    t.some((s) => {
      const { filterElement: i, element: l, onenter: c, onexit: u, ondrag: p, allowdrop: d } = s;
      Bt(o, "copy");
      const h = d(n);
      if (!h) {
        Bt(o, "none");
        return;
      }
      if (No(r, l)) {
        if (a = !0, s.state === null) {
          s.state = "enter", c(et(r));
          return;
        }
        if (s.state = "over", i && !h) {
          Bt(o, "none");
          return;
        }
        p(et(r));
      } else
        i && !a && Bt(o, "none"), s.state && (s.state = null, u(et(r)));
    });
  });
}, Hp = (e, t) => (r) => {
  r.preventDefault();
  const o = r.dataTransfer;
  Co(o).then((n) => {
    t.forEach((a) => {
      const { filterElement: s, element: i, ondrop: l, onexit: c, allowdrop: u } = a;
      if (a.state = null, !(s && !No(r, i))) {
        if (!u(n)) return c(et(r));
        l(et(r), n);
      }
    });
  });
}, zp = (e, t) => (r) => {
  ha === r.target && t.forEach((o) => {
    const { onexit: n } = o;
    o.state = null, n(et(r));
  });
}, Wp = (e, t, r) => {
  e.classList.add("filepond--hopper");
  const { catchesDropsOnPage: o, requiresDropOnElement: n, filterItems: a = (u) => u } = r, s = Bp(
    e,
    o ? document.documentElement : e,
    n
  );
  let i = "", l = "";
  s.allowdrop = (u) => t(a(u)), s.ondrop = (u, p) => {
    const d = a(p);
    if (!t(d)) {
      c.ondragend(u);
      return;
    }
    l = "drag-drop", c.onload(d, u);
  }, s.ondrag = (u) => {
    c.ondrag(u);
  }, s.onenter = (u) => {
    l = "drag-over", c.ondragstart(u);
  }, s.onexit = (u) => {
    l = "drag-exit", c.ondragend(u);
  };
  const c = {
    updateHopperState: () => {
      i !== l && (e.dataset.hopperState = l, i = l);
    },
    onload: () => {
    },
    ondragstart: () => {
    },
    ondrag: () => {
    },
    ondragend: () => {
    },
    destroy: () => {
      s.destroy();
    }
  };
  return c;
};
let ro = !1;
const ct = [], Ea = (e) => {
  const t = document.activeElement;
  if (t && (/textarea|input/i.test(t.nodeName) || t.getAttribute("contenteditable") === "true" || t.getAttribute("contenteditable") === "")) {
    let r = !1, o = t;
    for (; o !== document.body; ) {
      if (o.classList.contains("filepond--root")) {
        r = !0;
        break;
      }
      o = o.parentNode;
    }
    if (!r) return;
  }
  Co(e.clipboardData).then((r) => {
    r.length && ct.forEach((o) => o(r));
  });
}, Xp = (e) => {
  ct.includes(e) || (ct.push(e), !ro && (ro = !0, document.addEventListener("paste", Ea)));
}, Qp = (e) => {
  vo(ct, ct.indexOf(e)), ct.length === 0 && (document.removeEventListener("paste", Ea), ro = !1);
}, Kp = () => {
  const e = (r) => {
    t.onload(r);
  }, t = {
    destroy: () => {
      Qp(e);
    },
    onload: () => {
    }
  };
  return Xp(e), t;
}, Zp = ({ root: e, props: t }) => {
  e.element.id = `filepond--assistant-${t.id}`, ce(e.element, "role", "alert"), ce(e.element, "aria-live", "polite"), ce(e.element, "aria-relevant", "additions");
};
let Mn = null, xn = null;
const kr = [], gr = (e, t) => {
  e.element.textContent = t;
}, Jp = (e) => {
  e.element.textContent = "";
}, ga = (e, t, r) => {
  const o = e.query("GET_TOTAL_ITEMS");
  gr(
    e,
    `${r} ${t}, ${o} ${o === 1 ? e.query("GET_LABEL_FILE_COUNT_SINGULAR") : e.query("GET_LABEL_FILE_COUNT_PLURAL")}`
  ), clearTimeout(xn), xn = setTimeout(() => {
    Jp(e);
  }, 1500);
}, _a = (e) => e.element.parentNode.contains(document.activeElement), ef = ({ root: e, action: t }) => {
  if (!_a(e))
    return;
  e.element.textContent = "";
  const r = e.query("GET_ITEM", t.id);
  kr.push(r.filename), clearTimeout(Mn), Mn = setTimeout(() => {
    ga(e, kr.join(", "), e.query("GET_LABEL_FILE_ADDED")), kr.length = 0;
  }, 750);
}, tf = ({ root: e, action: t }) => {
  if (!_a(e))
    return;
  const r = t.item;
  ga(e, r.filename, e.query("GET_LABEL_FILE_REMOVED"));
}, rf = ({ root: e, action: t }) => {
  const r = e.query("GET_ITEM", t.id).filename, o = e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");
  gr(e, `${r} ${o}`);
}, Gn = ({ root: e, action: t }) => {
  const r = e.query("GET_ITEM", t.id).filename, o = e.query("GET_LABEL_FILE_PROCESSING_ABORTED");
  gr(e, `${r} ${o}`);
}, Vt = ({ root: e, action: t }) => {
  const r = e.query("GET_ITEM", t.id).filename;
  gr(e, `${t.status.main} ${r} ${t.status.sub}`);
}, of = ie({
  create: Zp,
  ignoreRect: !0,
  ignoreRectUpdate: !0,
  write: Ee({
    DID_LOAD_ITEM: ef,
    DID_REMOVE_ITEM: tf,
    DID_COMPLETE_ITEM_PROCESSING: rf,
    DID_ABORT_ITEM_PROCESSING: Gn,
    DID_REVERT_ITEM_PROCESSING: Gn,
    DID_THROW_ITEM_REMOVE_ERROR: Vt,
    DID_THROW_ITEM_LOAD_ERROR: Vt,
    DID_THROW_ITEM_INVALID: Vt,
    DID_THROW_ITEM_PROCESSING_ERROR: Vt
  }),
  tag: "span",
  name: "assistant"
}), ya = (e, t = "-") => e.replace(new RegExp(`${t}.`, "g"), (r) => r.charAt(1).toUpperCase()), Ia = (e, t = 16, r = !0) => {
  let o = Date.now(), n = null;
  return (...a) => {
    clearTimeout(n);
    const s = Date.now() - o, i = () => {
      o = Date.now(), e(...a);
    };
    s < t ? r || (n = setTimeout(i, t - s)) : i();
  };
}, nf = 1e6, tr = (e) => e.preventDefault(), sf = ({ root: e, props: t }) => {
  const r = e.query("GET_ID");
  r && (e.element.id = r);
  const o = e.query("GET_CLASS_NAME");
  o && o.split(" ").filter((i) => i.length).forEach((i) => {
    e.element.classList.add(i);
  }), e.ref.label = e.appendChildView(
    e.createChildView(lp, {
      ...t,
      translateY: null,
      caption: e.query("GET_LABEL_IDLE")
    })
  ), e.ref.list = e.appendChildView(e.createChildView(rp, { translateY: null })), e.ref.panel = e.appendChildView(e.createChildView(sa, { name: "panel-root" })), e.ref.assistant = e.appendChildView(e.createChildView(of, { ...t })), e.ref.data = e.appendChildView(e.createChildView(Sp, { ...t })), e.ref.measure = xe("div"), e.ref.measure.style.height = "100%", e.element.appendChild(e.ref.measure), e.ref.bounds = null, e.query("GET_STYLES").filter((i) => !Me(i.value)).map(({ name: i, value: l }) => {
    e.element.dataset[i] = l;
  }), e.ref.widthPrevious = null, e.ref.widthUpdated = Ia(() => {
    e.ref.updateHistory = [], e.dispatch("DID_RESIZE_ROOT");
  }, 250), e.ref.previousAspectRatio = null, e.ref.updateHistory = [];
  const n = window.matchMedia("(pointer: fine) and (hover: hover)").matches, a = "PointerEvent" in window;
  e.query("GET_ALLOW_REORDER") && a && !n && (e.element.addEventListener("touchmove", tr, { passive: !1 }), e.element.addEventListener("gesturestart", tr));
  const s = e.query("GET_CREDITS");
  if (s.length === 2) {
    const i = document.createElement("a");
    i.className = "filepond--credits", i.href = s[0], i.tabIndex = -1, i.target = "_blank", i.rel = "noopener noreferrer nofollow", i.textContent = s[1], e.element.appendChild(i), e.ref.credits = i;
  }
}, af = ({ root: e, props: t, actions: r }) => {
  if (pf({ root: e, props: t, actions: r }), r.filter((C) => /^DID_SET_STYLE_/.test(C.type)).filter((C) => !Me(C.data.value)).map(({ type: C, data: v }) => {
    const A = ya(C.substring(8).toLowerCase(), "_");
    e.element.dataset[A] = v.value, e.invalidateLayout();
  }), e.rect.element.hidden) return;
  e.rect.element.width !== e.ref.widthPrevious && (e.ref.widthPrevious = e.rect.element.width, e.ref.widthUpdated());
  let o = e.ref.bounds;
  o || (o = e.ref.bounds = uf(e), e.element.removeChild(e.ref.measure), e.ref.measure = null);
  const { hopper: n, label: a, list: s, panel: i } = e.ref;
  n && n.updateHopperState();
  const l = e.query("GET_PANEL_ASPECT_RATIO"), c = e.query("GET_ALLOW_MULTIPLE"), u = e.query("GET_TOTAL_ITEMS"), p = c ? e.query("GET_MAX_FILES") || nf : 1, d = u === p, h = r.find((C) => C.type === "DID_ADD_ITEM");
  if (d && h) {
    const C = h.data.interactionMethod;
    a.opacity = 0, c ? a.translateY = -40 : C === Re.API ? a.translateX = 40 : C === Re.BROWSE ? a.translateY = 40 : a.translateY = 30;
  } else d || (a.opacity = 1, a.translateX = 0, a.translateY = 0);
  const f = lf(e), m = cf(e), _ = a.rect.element.height, g = !c || d ? 0 : _, E = d ? s.rect.element.marginTop : 0, I = u === 0 ? 0 : s.rect.element.marginBottom, O = g + E + m.visual + I, S = g + E + m.bounds + I;
  if (s.translateY = Math.max(0, g - s.rect.element.marginTop) - f.top, l) {
    const C = e.rect.element.width, v = C * l;
    l !== e.ref.previousAspectRatio && (e.ref.previousAspectRatio = l, e.ref.updateHistory = []);
    const A = e.ref.updateHistory;
    A.push(C);
    const U = 2;
    if (A.length > U * 2) {
      const x = A.length, z = x - 10;
      let H = 0;
      for (let D = x; D >= z; D--)
        if (A[D] === A[D - 2] && H++, H >= U)
          return;
    }
    i.scalable = !1, i.height = v;
    const L = (
      // the height of the panel minus the label height
      v - g - // the room we leave open between the end of the list and the panel bottom
      (I - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
      (d ? E : 0)
    );
    m.visual > L ? s.overflow = L : s.overflow = null, e.height = v;
  } else if (o.fixedHeight) {
    i.scalable = !1;
    const C = (
      // the height of the panel minus the label height
      o.fixedHeight - g - // the room we leave open between the end of the list and the panel bottom
      (I - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
      (d ? E : 0)
    );
    m.visual > C ? s.overflow = C : s.overflow = null;
  } else if (o.cappedHeight) {
    const C = O >= o.cappedHeight, v = Math.min(o.cappedHeight, O);
    i.scalable = !0, i.height = C ? v : v - f.top - f.bottom;
    const A = (
      // the height of the panel minus the label height
      v - g - // the room we leave open between the end of the list and the panel bottom
      (I - f.bottom) - // if we're full we need to leave some room between the top of the panel and the list
      (d ? E : 0)
    );
    O > o.cappedHeight && m.visual > A ? s.overflow = A : s.overflow = null, e.height = Math.min(
      o.cappedHeight,
      S - f.top - f.bottom
    );
  } else {
    const C = u > 0 ? f.top + f.bottom : 0;
    i.scalable = !0, i.height = Math.max(_, O - C), e.height = Math.max(_, S - C);
  }
  e.ref.credits && i.heightCurrent && (e.ref.credits.style.transform = `translateY(${i.heightCurrent}px)`);
}, lf = (e) => {
  const t = e.ref.list.childViews[0].childViews[0];
  return t ? {
    top: t.rect.element.marginTop,
    bottom: t.rect.element.marginBottom
  } : {
    top: 0,
    bottom: 0
  };
}, cf = (e) => {
  let t = 0, r = 0;
  const o = e.ref.list, n = o.childViews[0], a = n.childViews.filter((E) => E.rect.element.height), s = e.query("GET_ACTIVE_ITEMS").map((E) => a.find((I) => I.id === E.id)).filter((E) => E);
  if (s.length === 0) return { visual: t, bounds: r };
  const i = n.rect.element.width, l = wo(n, s, o.dragCoordinates), c = s[0].rect.element, u = c.marginTop + c.marginBottom, p = c.marginLeft + c.marginRight, d = c.width + p, h = c.height + u, f = typeof l < "u" && l >= 0 ? 1 : 0, m = s.find((E) => E.markedForRemoval && E.opacity < 0.45) ? -1 : 0, _ = s.length + f + m, g = Oo(i, d);
  return g === 1 ? s.forEach((E) => {
    const I = E.rect.element.height + u;
    r += I, t += I * E.opacity;
  }) : (r = Math.ceil(_ / g) * h, t = r), { visual: t, bounds: r };
}, uf = (e) => {
  const t = e.ref.measureHeight || null;
  return {
    cappedHeight: parseInt(e.style.maxHeight, 10) || null,
    fixedHeight: t === 0 ? null : t
  };
}, Po = (e, t) => {
  const r = e.query("GET_ALLOW_REPLACE"), o = e.query("GET_ALLOW_MULTIPLE"), n = e.query("GET_TOTAL_ITEMS");
  let a = e.query("GET_MAX_FILES");
  const s = t.length;
  return !o && s > 1 ? (e.dispatch("DID_THROW_MAX_FILES", {
    source: t,
    error: oe("warning", 0, "Max files")
  }), !0) : (a = o ? a : 1, !o && r ? !1 : yt(a) && n + s > a ? (e.dispatch("DID_THROW_MAX_FILES", {
    source: t,
    error: oe("warning", 0, "Max files")
  }), !0) : !1);
}, df = (e, t, r) => {
  const o = e.childViews[0];
  return wo(o, t, {
    left: r.scopeLeft - o.rect.element.left,
    top: r.scopeTop - (e.rect.outer.top + e.rect.element.marginTop + e.rect.element.scrollTop)
  });
}, kn = (e) => {
  const t = e.query("GET_ALLOW_DROP"), r = e.query("GET_DISABLED"), o = t && !r;
  if (o && !e.ref.hopper) {
    const n = Wp(
      e.element,
      (a) => {
        const s = e.query("GET_BEFORE_DROP_FILE") || (() => !0);
        return e.query("GET_DROP_VALIDATION") ? a.every(
          (i) => nt("ALLOW_HOPPER_ITEM", i, {
            query: e.query
          }).every((l) => l === !0) && s(i)
        ) : !0;
      },
      {
        filterItems: (a) => {
          const s = e.query("GET_IGNORED_FILES");
          return a.filter((i) => Je(i) ? !s.includes(i.name.toLowerCase()) : !0);
        },
        catchesDropsOnPage: e.query("GET_DROP_ON_PAGE"),
        requiresDropOnElement: e.query("GET_DROP_ON_ELEMENT")
      }
    );
    n.onload = (a, s) => {
      const i = e.ref.list.childViews[0].childViews.filter((c) => c.rect.element.height), l = e.query("GET_ACTIVE_ITEMS").map((c) => i.find((u) => u.id === c.id)).filter((c) => c);
      we("ADD_ITEMS", a, { dispatch: e.dispatch }).then((c) => {
        if (Po(e, c)) return !1;
        e.dispatch("ADD_ITEMS", {
          items: c,
          index: df(e.ref.list, l, s),
          interactionMethod: Re.DROP
        });
      }), e.dispatch("DID_DROP", { position: s }), e.dispatch("DID_END_DRAG", { position: s });
    }, n.ondragstart = (a) => {
      e.dispatch("DID_START_DRAG", { position: a });
    }, n.ondrag = Ia((a) => {
      e.dispatch("DID_DRAG", { position: a });
    }), n.ondragend = (a) => {
      e.dispatch("DID_END_DRAG", { position: a });
    }, e.ref.hopper = n, e.ref.drip = e.appendChildView(e.createChildView(Ep));
  } else !o && e.ref.hopper && (e.ref.hopper.destroy(), e.ref.hopper = null, e.removeChildView(e.ref.drip));
}, Un = (e, t) => {
  const r = e.query("GET_ALLOW_BROWSE"), o = e.query("GET_DISABLED"), n = r && !o;
  n && !e.ref.browser ? e.ref.browser = e.appendChildView(
    e.createChildView(ap, {
      ...t,
      onload: (a) => {
        we("ADD_ITEMS", a, {
          dispatch: e.dispatch
        }).then((s) => {
          if (Po(e, s)) return !1;
          e.dispatch("ADD_ITEMS", {
            items: s,
            index: -1,
            interactionMethod: Re.BROWSE
          });
        });
      }
    }),
    0
  ) : !n && e.ref.browser && (e.removeChildView(e.ref.browser), e.ref.browser = null);
}, Fn = (e) => {
  const t = e.query("GET_ALLOW_PASTE"), r = e.query("GET_DISABLED"), o = t && !r;
  o && !e.ref.paster ? (e.ref.paster = Kp(), e.ref.paster.onload = (n) => {
    we("ADD_ITEMS", n, { dispatch: e.dispatch }).then((a) => {
      if (Po(e, a)) return !1;
      e.dispatch("ADD_ITEMS", {
        items: a,
        index: -1,
        interactionMethod: Re.PASTE
      });
    });
  }) : !o && e.ref.paster && (e.ref.paster.destroy(), e.ref.paster = null);
}, pf = Ee({
  DID_SET_ALLOW_BROWSE: ({ root: e, props: t }) => {
    Un(e, t);
  },
  DID_SET_ALLOW_DROP: ({ root: e }) => {
    kn(e);
  },
  DID_SET_ALLOW_PASTE: ({ root: e }) => {
    Fn(e);
  },
  DID_SET_DISABLED: ({ root: e, props: t }) => {
    kn(e), Fn(e), Un(e, t), e.query("GET_DISABLED") ? e.element.dataset.disabled = "disabled" : e.element.removeAttribute("data-disabled");
  }
}), ff = ie({
  name: "root",
  read: ({ root: e }) => {
    e.ref.measure && (e.ref.measureHeight = e.ref.measure.offsetHeight);
  },
  create: sf,
  write: af,
  destroy: ({ root: e }) => {
    e.ref.paster && e.ref.paster.destroy(), e.ref.hopper && e.ref.hopper.destroy(), e.element.removeEventListener("touchmove", tr), e.element.removeEventListener("gesturestart", tr);
  },
  mixins: {
    styles: ["height"]
  }
}), mf = (e = {}) => {
  let t = null;
  const r = Jt(), o = Dc(
    // initial state (should be serializable)
    fu(r),
    // queries
    [Pu, Eu(r)],
    // action handlers
    [nd, hu(r)]
  );
  o.dispatch("SET_OPTIONS", { options: e });
  const n = () => {
    document.hidden || o.dispatch("KICK");
  };
  document.addEventListener("visibilitychange", n);
  let a = null, s = !1, i = !1, l = null, c = null;
  const u = () => {
    s || (s = !0), clearTimeout(a), a = setTimeout(() => {
      s = !1, l = null, c = null, i && (i = !1, o.dispatch("DID_STOP_RESIZE"));
    }, 500);
  };
  window.addEventListener("resize", u);
  const p = ff(o, { id: To() });
  let d = !1, h = !1;
  const f = {
    // necessary for update loop
    /**
     * Reads from dom (never call manually)
     * @private
     */
    _read: () => {
      s && (c = window.innerWidth, l || (l = c), !i && c !== l && (o.dispatch("DID_START_RESIZE"), i = !0)), h && d && (d = p.element.offsetParent === null), !d && (p._read(), h = p.rect.element.hidden);
    },
    /**
     * Writes to dom (never call manually)
     * @private
     */
    _write: (R) => {
      const w = o.processActionQueue().filter((N) => !/^SET_/.test(N.type));
      d && !w.length || (E(w), d = p._write(R, w, i), yu(o.query("GET_ITEMS")), d && o.processDispatchQueue());
    }
  }, m = (R) => (w) => {
    const N = {
      type: R
    };
    if (!w)
      return N;
    if (w.hasOwnProperty("error") && (N.error = w.error ? { ...w.error } : null), w.status && (N.status = { ...w.status }), w.file && (N.output = w.file), w.source)
      N.file = w.source;
    else if (w.item || w.id) {
      const M = w.item ? w.item : o.query("GET_ITEM", w.id);
      N.file = M ? _e(M) : null;
    }
    return w.items && (N.items = w.items.map(_e)), /progress/.test(R) && (N.progress = w.progress), w.hasOwnProperty("origin") && w.hasOwnProperty("target") && (N.origin = w.origin, N.target = w.target), N;
  }, _ = {
    DID_DESTROY: m("destroy"),
    DID_INIT: m("init"),
    DID_THROW_MAX_FILES: m("warning"),
    DID_INIT_ITEM: m("initfile"),
    DID_START_ITEM_LOAD: m("addfilestart"),
    DID_UPDATE_ITEM_LOAD_PROGRESS: m("addfileprogress"),
    DID_LOAD_ITEM: m("addfile"),
    DID_THROW_ITEM_INVALID: [m("error"), m("addfile")],
    DID_THROW_ITEM_LOAD_ERROR: [m("error"), m("addfile")],
    DID_THROW_ITEM_REMOVE_ERROR: [m("error"), m("removefile")],
    DID_PREPARE_OUTPUT: m("preparefile"),
    DID_START_ITEM_PROCESSING: m("processfilestart"),
    DID_UPDATE_ITEM_PROCESS_PROGRESS: m("processfileprogress"),
    DID_ABORT_ITEM_PROCESSING: m("processfileabort"),
    DID_COMPLETE_ITEM_PROCESSING: m("processfile"),
    DID_COMPLETE_ITEM_PROCESSING_ALL: m("processfiles"),
    DID_REVERT_ITEM_PROCESSING: m("processfilerevert"),
    DID_THROW_ITEM_PROCESSING_ERROR: [m("error"), m("processfile")],
    DID_REMOVE_ITEM: m("removefile"),
    DID_UPDATE_ITEMS: m("updatefiles"),
    DID_ACTIVATE_ITEM: m("activatefile"),
    DID_REORDER_ITEMS: m("reorderfiles")
  }, g = (R) => {
    const w = { pond: B, ...R };
    delete w.type, p.element.dispatchEvent(
      new CustomEvent(`FilePond:${R.type}`, {
        // event info
        detail: w,
        // event behaviour
        bubbles: !0,
        cancelable: !0,
        composed: !0
        // triggers listeners outside of shadow root
      })
    );
    const N = [];
    R.hasOwnProperty("error") && N.push(R.error), R.hasOwnProperty("file") && N.push(R.file);
    const M = ["type", "error", "file"];
    Object.keys(R).filter((j) => !M.includes(j)).forEach((j) => N.push(R[j])), B.fire(R.type, ...N);
    const q = o.query(`GET_ON${R.type.toUpperCase()}`);
    q && q(...N);
  }, E = (R) => {
    R.length && R.filter((w) => _[w.type]).forEach((w) => {
      const N = _[w.type];
      (Array.isArray(N) ? N : [N]).forEach((M) => {
        w.type === "DID_INIT_ITEM" ? g(M(w.data)) : setTimeout(() => {
          g(M(w.data));
        }, 0);
      });
    });
  }, I = (R) => o.dispatch("SET_OPTIONS", { options: R }), O = (R) => o.query("GET_ACTIVE_ITEM", R), S = (R) => new Promise((w, N) => {
    o.dispatch("REQUEST_ITEM_PREPARE", {
      query: R,
      success: (M) => {
        w(M);
      },
      failure: (M) => {
        N(M);
      }
    });
  }), C = (R, w = {}) => new Promise((N, M) => {
    U([{ source: R, options: w }], { index: w.index }).then((q) => N(q && q[0])).catch(M);
  }), v = (R) => R.file && R.id, A = (R, w) => (typeof R == "object" && !v(R) && !w && (w = R, R = void 0), o.dispatch("REMOVE_ITEM", { ...w, query: R }), o.query("GET_ACTIVE_ITEM", R) === null), U = (...R) => new Promise((w, N) => {
    const M = [], q = {};
    if (dr(R[0]))
      M.push.apply(M, R[0]), Object.assign(q, R[1] || {});
    else {
      const j = R[R.length - 1];
      typeof j == "object" && !(j instanceof Blob) && Object.assign(q, R.pop()), M.push(...R);
    }
    o.dispatch("ADD_ITEMS", {
      items: M,
      index: q.index,
      interactionMethod: Re.API,
      success: w,
      failure: N
    });
  }), L = () => o.query("GET_ACTIVE_ITEMS"), x = (R) => new Promise((w, N) => {
    o.dispatch("REQUEST_ITEM_PROCESSING", {
      query: R,
      success: (M) => {
        w(M);
      },
      failure: (M) => {
        N(M);
      }
    });
  }), z = (...R) => {
    const w = Array.isArray(R[0]) ? R[0] : R, N = w.length ? w : L();
    return Promise.all(N.map(S));
  }, H = (...R) => {
    const w = Array.isArray(R[0]) ? R[0] : R;
    if (!w.length) {
      const N = L().filter(
        (M) => !(M.status === F.IDLE && M.origin === ue.LOCAL) && M.status !== F.PROCESSING && M.status !== F.PROCESSING_COMPLETE && M.status !== F.PROCESSING_REVERT_ERROR
      );
      return Promise.all(N.map(x));
    }
    return Promise.all(w.map(x));
  }, D = (...R) => {
    const w = Array.isArray(R[0]) ? R[0] : R;
    let N;
    typeof w[w.length - 1] == "object" ? N = w.pop() : Array.isArray(R[0]) && (N = R[1]);
    const M = L();
    return w.length ? w.map((q) => He(q) ? M[q] ? M[q].id : null : q).filter((q) => q).map((q) => A(q, N)) : Promise.all(M.map((q) => A(q, N)));
  }, B = {
    // supports events
    ...mr(),
    // inject private api methods
    ...f,
    // inject all getters and setters
    ...mu(o, r),
    /**
     * Override options defined in options object
     * @param options
     */
    setOptions: I,
    /**
     * Load the given file
     * @param source - the source of the file (either a File, base64 data uri or url)
     * @param options - object, { index: 0 }
     */
    addFile: C,
    /**
     * Load the given files
     * @param sources - the sources of the files to load
     * @param options - object, { index: 0 }
     */
    addFiles: U,
    /**
     * Returns the file objects matching the given query
     * @param query { string, number, null }
     */
    getFile: O,
    /**
     * Upload file with given name
     * @param query { string, number, null  }
     */
    processFile: x,
    /**
     * Request prepare output for file with given name
     * @param query { string, number, null  }
     */
    prepareFile: S,
    /**
     * Removes a file by its name
     * @param query { string, number, null  }
     */
    removeFile: A,
    /**
     * Moves a file to a new location in the files list
     */
    moveFile: (R, w) => o.dispatch("MOVE_ITEM", { query: R, index: w }),
    /**
     * Returns all files (wrapped in public api)
     */
    getFiles: L,
    /**
     * Starts uploading all files
     */
    processFiles: H,
    /**
     * Clears all files from the files list
     */
    removeFiles: D,
    /**
     * Starts preparing output of all files
     */
    prepareFiles: z,
    /**
     * Sort list of files
     */
    sort: (R) => o.dispatch("SORT", { compare: R }),
    /**
     * Browse the file system for a file
     */
    browse: () => {
      var R = p.element.querySelector("input[type=file]");
      R && R.click();
    },
    /**
     * Destroys the app
     */
    destroy: () => {
      B.fire("destroy", p.element), o.dispatch("ABORT_ALL"), p._destroy(), window.removeEventListener("resize", u), document.removeEventListener("visibilitychange", n), o.dispatch("DID_DESTROY");
    },
    /**
     * Inserts the plugin before the target element
     */
    insertBefore: (R) => cn(p.element, R),
    /**
     * Inserts the plugin after the target element
     */
    insertAfter: (R) => un(p.element, R),
    /**
     * Appends the plugin to the target element
     */
    appendTo: (R) => R.appendChild(p.element),
    /**
     * Replaces an element with the app
     */
    replaceElement: (R) => {
      cn(p.element, R), R.parentNode.removeChild(R), t = R;
    },
    /**
     * Restores the original element
     */
    restoreElement: () => {
      t && (un(t, p.element), p.element.parentNode.removeChild(p.element), t = null);
    },
    /**
     * Returns true if the app root is attached to given element
     * @param element
     */
    isAttachedTo: (R) => p.element === R || t === R,
    /**
     * Returns the root element
     */
    element: {
      get: () => p.element
    },
    /**
     * Returns the current pond status
     */
    status: {
      get: () => o.query("GET_STATUS")
    }
  };
  return o.dispatch("DID_INIT"), Fe(B);
}, Ta = (e = {}) => {
  const t = {};
  return te(Jt(), (r, o) => {
    t[r] = o[0];
  }), mf({
    // default options
    ...t,
    // custom options
    ...e
  });
}, hf = (e) => e.charAt(0).toLowerCase() + e.slice(1), Ef = (e) => ya(e.replace(/^data-/, "")), va = (e, t) => {
  te(t, (r, o) => {
    te(e, (n, a) => {
      const s = new RegExp(r);
      if (!s.test(n) || (delete e[n], o === !1))
        return;
      if (he(o)) {
        e[o] = a;
        return;
      }
      const i = o.group;
      pe(o) && !e[i] && (e[i] = {}), e[i][hf(n.replace(s, ""))] = a;
    }), o.mapping && va(e[o.group], o.mapping);
  });
}, gf = (e, t = {}) => {
  const r = [];
  te(e.attributes, (n) => {
    r.push(e.attributes[n]);
  });
  const o = r.filter((n) => n.name).reduce((n, a) => {
    const s = ce(e, a.name);
    return n[Ef(a.name)] = s === a.name ? !0 : s, n;
  }, {});
  return va(o, t), o;
}, _f = (e, t = {}) => {
  const r = {
    // translate to other name
    "^class$": "className",
    "^multiple$": "allowMultiple",
    "^capture$": "captureMethod",
    "^webkitdirectory$": "allowDirectoriesOnly",
    // group under single property
    "^server": {
      group: "server",
      mapping: {
        "^process": {
          group: "process"
        },
        "^revert": {
          group: "revert"
        },
        "^fetch": {
          group: "fetch"
        },
        "^restore": {
          group: "restore"
        },
        "^load": {
          group: "load"
        }
      }
    },
    // don't include in object
    "^type$": !1,
    "^files$": !1
  };
  nt("SET_ATTRIBUTE_TO_OPTION_MAP", r);
  const o = {
    ...t
  }, n = gf(
    e.nodeName === "FIELDSET" ? e.querySelector("input[type=file]") : e,
    r
  );
  Object.keys(n).forEach((s) => {
    pe(n[s]) ? (pe(o[s]) || (o[s] = {}), Object.assign(o[s], n[s])) : o[s] = n[s];
  }), o.files = (t.files || []).concat(
    Array.from(e.querySelectorAll("input:not([type=file])")).map((s) => ({
      source: s.value,
      options: {
        type: s.dataset.type
      }
    }))
  );
  const a = Ta(o);
  return e.files && Array.from(e.files).forEach((s) => {
    a.addFile(s);
  }), a.replaceElement(e), a;
}, yf = (...e) => wc(e[0]) ? _f(...e) : Ta(...e), If = ["fire", "_read", "_write"], Bn = (e) => {
  const t = {};
  return $s(e, t, If), t;
}, Tf = (e, t) => e.replace(/(?:{([a-zA-Z]+)})/g, (r, o) => t[o]), vf = (e) => {
  const t = new Blob(["(", e.toString(), ")()"], {
    type: "application/javascript"
  }), r = URL.createObjectURL(t), o = new Worker(r);
  return {
    transfer: (n, a) => {
    },
    post: (n, a, s) => {
      const i = To();
      o.onmessage = (l) => {
        l.data.id === i && a(l.data.message);
      }, o.postMessage(
        {
          id: i,
          message: n
        },
        s
      );
    },
    terminate: () => {
      o.terminate(), URL.revokeObjectURL(r);
    }
  };
}, Rf = (e) => new Promise((t, r) => {
  const o = new Image();
  o.onload = () => {
    t(o);
  }, o.onerror = (n) => {
    r(n);
  }, o.src = e;
}), Ra = (e, t) => {
  const r = e.slice(0, e.size, e.type);
  return r.lastModifiedDate = e.lastModifiedDate, r.name = t, r;
}, bf = (e) => Ra(e, e.name), Vn = [], Sf = (e) => {
  if (Vn.includes(e))
    return;
  Vn.push(e);
  const t = e({
    addFilter: Tu,
    utils: {
      Type: b,
      forin: te,
      isString: he,
      isFile: Je,
      toNaturalFileSize: ra,
      replaceInString: Tf,
      getExtensionFromFilename: hr,
      getFilenameWithoutExtension: Js,
      guesstimateMimeType: fa,
      getFileFromBlob: Et,
      getFilenameFromURL: At,
      createRoute: Ee,
      createWorker: vf,
      createView: ie,
      createItemAPI: _e,
      loadImage: Rf,
      copyFile: bf,
      renameFile: Ra,
      createBlob: Qs,
      applyFilterChain: we,
      text: se,
      getNumericAspectRatioFromString: zs
    },
    views: {
      fileActionButton: ta
    }
  });
  vu(t.options);
}, Of = () => Object.prototype.toString.call(window.operamini) === "[object OperaMini]", wf = () => "Promise" in window, Df = () => "slice" in Blob.prototype, Cf = () => "URL" in window && "createObjectURL" in window.URL, Af = () => "visibilityState" in document, Nf = () => "performance" in window, Pf = () => "supports" in (window.CSS || {}), Lf = () => /MSIE|Trident/.test(window.navigator.userAgent), oo = (() => {
  const e = (
    // Has to be a browser
    Us() && // Can't run on Opera Mini due to lack of everything
    !Of() && // Require these APIs to feature detect a modern browser
    Af() && wf() && Df() && Cf() && Nf() && // doesn't need CSSSupports but is a good way to detect Safari 9+ (we do want to support IE11 though)
    (Pf() || Lf())
  );
  return () => e;
})(), Ge = {
  // active app instances, used to redraw the apps and to find the later
  apps: []
}, Mf = "filepond", st = () => {
};
let qn = {}, Wt = st, Ur = st, jn = st, $n = st, Yn = st, Hn = st, zn = st;
if (oo()) {
  Jc(
    () => {
      Ge.apps.forEach((r) => r._read());
    },
    (r) => {
      Ge.apps.forEach((o) => o._write(r));
    }
  );
  const e = () => {
    document.dispatchEvent(
      new CustomEvent("FilePond:loaded", {
        detail: {
          supported: oo,
          create: Wt,
          destroy: Ur,
          parse: jn,
          find: $n,
          registerPlugin: Yn,
          setOptions: zn
        }
      })
    ), document.removeEventListener("DOMContentLoaded", e);
  };
  document.readyState !== "loading" ? setTimeout(() => e(), 0) : document.addEventListener("DOMContentLoaded", e);
  const t = () => te(Jt(), (r, o) => {
    qn[r] = o[1];
  });
  qn = {}, t(), Wt = (...r) => {
    const o = yf(...r);
    return o.on("destroy", Ur), Ge.apps.push(o), Bn(o);
  }, Ur = (r) => {
    const o = Ge.apps.findIndex((n) => n.isAttachedTo(r));
    return o >= 0 ? (Ge.apps.splice(o, 1)[0].restoreElement(), !0) : !1;
  }, jn = (r) => Array.from(r.querySelectorAll(`.${Mf}`)).filter(
    (o) => !Ge.apps.find((n) => n.isAttachedTo(o))
  ).map((o) => Wt(o)), $n = (r) => {
    const o = Ge.apps.find((n) => n.isAttachedTo(r));
    return o ? Bn(o) : null;
  }, Yn = (...r) => {
    r.forEach(Sf), t();
  }, Hn = () => {
    const r = {};
    return te(Jt(), (o, n) => {
      r[o] = n[0];
    }), r;
  }, zn = (r) => (pe(r) && (Ge.apps.forEach((o) => {
    o.setOptions(r);
  }), Ru(r)), Hn());
}
/*!
 * react-filepond v7.1.3
 * A handy FilePond adapter component for React
 * 
 * Copyright (c) 2024 PQINA
 * https://pqina.nl/filepond
 * 
 * Licensed under the MIT license.
 */
const xf = oo(), Gf = [
  "setOptions",
  "on",
  "off",
  "onOnce",
  "appendTo",
  "insertAfter",
  "insertBefore",
  "isAttachedTo",
  "replaceElement",
  "restoreElement",
  "destroy"
];
class kf extends K.Component {
  constructor(t) {
    super(t), this.allowFilesSync = !0;
  }
  // Will setup FilePond instance when mounted
  componentDidMount() {
    if (this._input = this._element.querySelector('input[type="file"]'), this._inputClone = this._input.cloneNode(), !xf) return;
    const t = Object.assign({}, this.props);
    if (t.onupdatefiles) {
      const r = t.onupdatefiles;
      t.onupdatefiles = (o) => {
        this.allowFilesSync = !1, r(o);
      };
    }
    this._pond = Wt(this._input, t), Object.keys(this._pond).filter((r) => !Gf.includes(r)).forEach((r) => {
      this[r] = this._pond[r];
    });
  }
  // Will clean up FilePond instance when unmounted
  componentWillUnmount() {
    if (!this._pond) return;
    const t = document.createElement("div");
    t.append(this._pond.element), t.id = "foo", this._pond.destroy(), this._pond = void 0, this._element.append(this._inputClone);
  }
  shouldComponentUpdate() {
    return this.allowFilesSync ? !0 : (this.allowFilesSync = !0, !1);
  }
  // Something changed
  componentDidUpdate() {
    if (!this._pond) return;
    const t = Object.assign({}, this.props);
    delete t.onupdatefiles, this._pond.setOptions(t);
  }
  // Renders basic element hook for FilePond to attach to
  render() {
    const {
      id: t,
      name: r,
      className: o,
      allowMultiple: n,
      required: a,
      captureMethod: s,
      acceptedFileTypes: i
    } = this.props;
    return Br(
      "div",
      {
        className: "filepond--wrapper",
        ref: (l) => this._element = l
      },
      Br("input", {
        type: "file",
        name: r,
        id: t,
        accept: i,
        multiple: n,
        required: a,
        className: o,
        capture: s
      })
    );
  }
}
const Uf = ks.div`
  .filepond {
    &--drop-label {
      label {
        color: ${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "inherit"} !important;
      }
    }

    &--root {
      margin-bottom: 0.5rem;
      border-radius: 0.75rem;
    }

    &--panel {
      border-radius: 0.8rem;
      overflow: hidden;

      &-root {
        background-color: transparent;
      }
    }

    &--drip {
      border: 1px solid
        ${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "var(--color-border-alpha-strong)"};
      background-color: transparent;
      opacity: 1;
      outline-offset: 2px;
      border-radius: 0.75rem;
    }
  }

  &:focus-within {
    .filepond {
      &--drip {
        outline: 2px solid
          ${({ $invalid: e }) => e ? "var(--color-item-primary-destructive)" : "var(--color-item-primary-primary)"};
      }
    }
  }
`;
function Ff({
  variant: e = "default",
  containerClassName: t,
  ...r
}) {
  return /* @__PURE__ */ T.jsx(
    Uf,
    {
      $invalid: e === "failure",
      className: t,
      children: /* @__PURE__ */ T.jsx(kf, { credits: !1, instantUpload: !1, ...r })
    }
  );
}
Ff.displayName = "FileUpload";
var Bf = "Label", ba = y.forwardRef((e, t) => /* @__PURE__ */ T.jsx(
  ee.label,
  {
    ...e,
    ref: t,
    onMouseDown: (r) => {
      var o;
      r.target.closest("button, input, select, textarea") || ((o = e.onMouseDown) == null || o.call(e, r), !r.defaultPrevented && r.detail > 1 && r.preventDefault());
    }
  }
));
ba.displayName = Bf;
var Sa = ba, Vf = (e) => e.type === "checkbox", qf = (e) => e instanceof Date, Oa = (e) => e == null;
const jf = (e) => typeof e == "object";
var Nt = (e) => !Oa(e) && !Array.isArray(e) && jf(e) && !qf(e), $f = (e) => Nt(e) && e.target ? Vf(e.target) ? e.target.checked : e.target.value : e, Yf = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Hf = (e, t) => e.has(Yf(t)), zf = (e) => {
  const t = e.constructor && e.constructor.prototype;
  return Nt(t) && t.hasOwnProperty("isPrototypeOf");
}, Wf = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
function wa(e) {
  let t;
  const r = Array.isArray(e), o = typeof FileList < "u" ? e instanceof FileList : !1;
  if (e instanceof Date)
    t = new Date(e);
  else if (!(Wf && (e instanceof Blob || o)) && (r || Nt(e)))
    if (t = r ? [] : {}, !r && !zf(e))
      t = e;
    else
      for (const n in e)
        e.hasOwnProperty(n) && (t[n] = wa(e[n]));
  else
    return e;
  return t;
}
var Da = (e) => /^\w*$/.test(e), no = (e) => e === void 0, Xf = (e) => Array.isArray(e) ? e.filter(Boolean) : [], Ca = (e) => Xf(e.replace(/["|']|\]/g, "").split(/\.|\[/)), ge = (e, t, r) => {
  if (!t || !Nt(e))
    return r;
  const o = (Da(t) ? [t] : Ca(t)).reduce((n, a) => Oa(n) ? n : n[a], e);
  return no(o) || o === e ? no(e[t]) ? r : e[t] : o;
}, Fr = (e) => typeof e == "boolean", Wn = (e, t, r) => {
  let o = -1;
  const n = Da(t) ? [t] : Ca(t), a = n.length, s = a - 1;
  for (; ++o < a; ) {
    const i = n[o];
    let l = r;
    if (o !== s) {
      const c = e[i];
      l = Nt(c) || Array.isArray(c) ? c : isNaN(+n[o + 1]) ? {} : [];
    }
    if (i === "__proto__" || i === "constructor" || i === "prototype")
      return;
    e[i] = l, e = e[i];
  }
};
const Xn = {
  BLUR: "blur",
  CHANGE: "change"
}, Qn = {
  all: "all"
}, Lo = K.createContext(null);
Lo.displayName = "HookFormContext";
const _r = () => K.useContext(Lo), Qf = (e) => {
  const { children: t, ...r } = e;
  return K.createElement(Lo.Provider, { value: r }, t);
};
var Kf = (e, t, r, o = !0) => {
  const n = {
    defaultValues: t._defaultValues
  };
  for (const a in e)
    Object.defineProperty(n, a, {
      get: () => {
        const s = a;
        return t._proxyFormState[s] !== Qn.all && (t._proxyFormState[s] = !o || Qn.all), r && (r[s] = !0), e[s];
      }
    });
  return n;
};
const Aa = typeof window < "u" ? y.useLayoutEffect : y.useEffect;
function Zf(e) {
  const t = _r(), { control: r = t.control, disabled: o, name: n, exact: a } = e || {}, [s, i] = K.useState(r._formState), l = K.useRef({
    isDirty: !1,
    isLoading: !1,
    dirtyFields: !1,
    touchedFields: !1,
    validatingFields: !1,
    isValidating: !1,
    isValid: !1,
    errors: !1
  });
  return Aa(() => r._subscribe({
    name: n,
    formState: l.current,
    exact: a,
    callback: (c) => {
      !o && i({
        ...r._formState,
        ...c
      });
    }
  }), [n, o, a]), K.useEffect(() => {
    l.current.isValid && r._setValid(!0);
  }, [r]), K.useMemo(() => Kf(s, r, l.current, !1), [s, r]);
}
var Jf = (e) => typeof e == "string", em = (e, t, r, o, n) => Jf(e) ? ge(r, e, n) : Array.isArray(e) ? e.map((a) => ge(r, a)) : r;
function tm(e) {
  const t = _r(), { control: r = t.control, name: o, defaultValue: n, disabled: a, exact: s } = e || {}, i = K.useRef(n), [l, c] = K.useState(r._getWatch(o, i.current));
  return Aa(() => r._subscribe({
    name: o,
    formState: {
      values: !0
    },
    exact: s,
    callback: (u) => !a && c(em(o, r._names, u.values || r._formValues, !1, i.current))
  }), [o, r, a, s]), K.useEffect(() => r._removeUnmounted()), l;
}
function rm(e) {
  const t = _r(), { name: r, disabled: o, control: n = t.control, shouldUnregister: a } = e, s = Hf(n._names.array, r), i = tm({
    control: n,
    name: r,
    defaultValue: ge(n._formValues, r, ge(n._defaultValues, r, e.defaultValue)),
    exact: !0
  }), l = Zf({
    control: n,
    name: r,
    exact: !0
  }), c = K.useRef(e), u = K.useRef(n.register(r, {
    ...e.rules,
    value: i,
    ...Fr(e.disabled) ? { disabled: e.disabled } : {}
  })), p = K.useMemo(() => Object.defineProperties({}, {
    invalid: {
      enumerable: !0,
      get: () => !!ge(l.errors, r)
    },
    isDirty: {
      enumerable: !0,
      get: () => !!ge(l.dirtyFields, r)
    },
    isTouched: {
      enumerable: !0,
      get: () => !!ge(l.touchedFields, r)
    },
    isValidating: {
      enumerable: !0,
      get: () => !!ge(l.validatingFields, r)
    },
    error: {
      enumerable: !0,
      get: () => ge(l.errors, r)
    }
  }), [l, r]), d = K.useCallback((_) => u.current.onChange({
    target: {
      value: $f(_),
      name: r
    },
    type: Xn.CHANGE
  }), [r]), h = K.useCallback(() => u.current.onBlur({
    target: {
      value: ge(n._formValues, r),
      name: r
    },
    type: Xn.BLUR
  }), [r, n._formValues]), f = K.useCallback((_) => {
    const g = ge(n._fields, r);
    g && _ && (g._f.ref = {
      focus: () => _.focus && _.focus(),
      select: () => _.select && _.select(),
      setCustomValidity: (E) => _.setCustomValidity(E),
      reportValidity: () => _.reportValidity()
    });
  }, [n._fields, r]), m = K.useMemo(() => ({
    name: r,
    value: i,
    ...Fr(o) || l.disabled ? { disabled: l.disabled || o } : {},
    onChange: d,
    onBlur: h,
    ref: f
  }), [r, o, l.disabled, d, h, f, i]);
  return K.useEffect(() => {
    const _ = n._options.shouldUnregister || a;
    n.register(r, {
      ...c.current.rules,
      ...Fr(c.current.disabled) ? { disabled: c.current.disabled } : {}
    });
    const g = (E, I) => {
      const O = ge(n._fields, E);
      O && O._f && (O._f.mount = I);
    };
    if (g(r, !0), _) {
      const E = wa(ge(n._options.defaultValues, r));
      Wn(n._defaultValues, r, E), no(ge(n._formValues, r)) && Wn(n._formValues, r, E);
    }
    return !s && n.register(r), () => {
      (s ? _ && !n._state.action : _) ? n.unregister(r) : g(r, !1);
    };
  }, [r, n, s, a]), K.useEffect(() => {
    n._setDisabledField({
      disabled: o,
      name: r
    });
  }, [o, r, n]), K.useMemo(() => ({
    field: m,
    formState: l,
    fieldState: p
  }), [m, l, p]);
}
const om = (e) => e.render(rm(e)), nm = Jn(
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
), Na = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  Sa,
  {
    ref: r,
    className: ne(nm(), e),
    ...t
  }
));
Na.displayName = Sa.displayName;
const _h = Qf, Pa = y.createContext(
  {}
), yh = ({
  ...e
}) => /* @__PURE__ */ T.jsx(Pa.Provider, { value: { name: e.name }, children: /* @__PURE__ */ T.jsx(om, { ...e }) }), yr = () => {
  const e = y.useContext(Pa), t = y.useContext(La), { getFieldState: r, formState: o } = _r(), n = r(e.name, o);
  if (!e)
    throw new Error("useFormField should be used within <FormField>");
  const { id: a } = t;
  return {
    id: a,
    name: e.name,
    formItemId: `${a}-form-item`,
    formDescriptionId: `${a}-form-item-description`,
    formMessageId: `${a}-form-item-message`,
    ...n
  };
}, La = y.createContext(
  {}
), sm = y.forwardRef(({ className: e, ...t }, r) => {
  const o = y.useId();
  return /* @__PURE__ */ T.jsx(La.Provider, { value: { id: o }, children: /* @__PURE__ */ T.jsx(
    "div",
    {
      ref: r,
      className: ne("relative space-y-2", e),
      ...t
    }
  ) });
});
sm.displayName = "FormItem";
const am = y.forwardRef(({ className: e, ...t }, r) => {
  const { error: o, formItemId: n } = yr();
  return /* @__PURE__ */ T.jsx(
    Na,
    {
      ref: r,
      className: ne(
        "!text-body-xs-medium",
        e,
        o && "text-destructive"
      ),
      htmlFor: n,
      ...t
    }
  );
});
am.displayName = "FormLabel";
const im = y.forwardRef(({ ...e }, t) => {
  const { error: r, formItemId: o, formDescriptionId: n, formMessageId: a } = yr();
  return /* @__PURE__ */ T.jsx(
    Ui,
    {
      ref: t,
      id: o,
      "aria-describedby": r ? `${n} ${a}` : `${n}`,
      "aria-invalid": !!r,
      ...e
    }
  );
});
im.displayName = "FormControl";
const lm = y.forwardRef(({ className: e, ...t }, r) => {
  const { formDescriptionId: o } = yr();
  return /* @__PURE__ */ T.jsx(
    "p",
    {
      ref: r,
      id: o,
      className: ne("text-muted-foreground text-sm", e),
      ...t
    }
  );
});
lm.displayName = "FormDescription";
const cm = y.forwardRef(({ className: e, children: t, ...r }, o) => {
  const { error: n, formMessageId: a } = yr(), s = n ? String(n == null ? void 0 : n.message) : t;
  return s ? /* @__PURE__ */ T.jsx(
    "p",
    {
      ref: o,
      id: a,
      className: ne("!text-body-xs-medium text-destructive", e),
      ...r,
      children: s
    }
  ) : null;
});
cm.displayName = "FormMessage";
var Ir = "Switch", [um, Ih] = Ct(Ir), [dm, pm] = um(Ir), Ma = y.forwardRef(
  (e, t) => {
    const {
      __scopeSwitch: r,
      name: o,
      checked: n,
      defaultChecked: a,
      required: s,
      disabled: i,
      value: l = "on",
      onCheckedChange: c,
      form: u,
      ...p
    } = e, [d, h] = y.useState(null), f = fe(t, (I) => h(I)), m = y.useRef(!1), _ = d ? u || !!d.closest("form") : !0, [g, E] = Dt({
      prop: n,
      defaultProp: a ?? !1,
      onChange: c,
      caller: Ir
    });
    return /* @__PURE__ */ T.jsxs(dm, { scope: r, checked: g, disabled: i, children: [
      /* @__PURE__ */ T.jsx(
        ee.button,
        {
          type: "button",
          role: "switch",
          "aria-checked": g,
          "aria-required": s,
          "data-state": Ua(g),
          "data-disabled": i ? "" : void 0,
          disabled: i,
          value: l,
          ...p,
          ref: f,
          onClick: J(e.onClick, (I) => {
            E((O) => !O), _ && (m.current = I.isPropagationStopped(), m.current || I.stopPropagation());
          })
        }
      ),
      _ && /* @__PURE__ */ T.jsx(
        ka,
        {
          control: d,
          bubbles: !m.current,
          name: o,
          value: l,
          checked: g,
          required: s,
          disabled: i,
          form: u,
          style: { transform: "translateX(-100%)" }
        }
      )
    ] });
  }
);
Ma.displayName = Ir;
var xa = "SwitchThumb", Ga = y.forwardRef(
  (e, t) => {
    const { __scopeSwitch: r, ...o } = e, n = pm(xa, r);
    return /* @__PURE__ */ T.jsx(
      ee.span,
      {
        "data-state": Ua(n.checked),
        "data-disabled": n.disabled ? "" : void 0,
        ...o,
        ref: t
      }
    );
  }
);
Ga.displayName = xa;
var fm = "SwitchBubbleInput", ka = y.forwardRef(
  ({
    __scopeSwitch: e,
    control: t,
    checked: r,
    bubbles: o = !0,
    ...n
  }, a) => {
    const s = y.useRef(null), i = fe(s, a), l = or(r), c = po(t);
    return y.useEffect(() => {
      const u = s.current;
      if (!u) return;
      const p = window.HTMLInputElement.prototype, d = Object.getOwnPropertyDescriptor(
        p,
        "checked"
      ).set;
      if (l !== r && d) {
        const h = new Event("click", { bubbles: o });
        d.call(u, r), u.dispatchEvent(h);
      }
    }, [l, r, o]), /* @__PURE__ */ T.jsx(
      "input",
      {
        type: "checkbox",
        "aria-hidden": !0,
        defaultChecked: r,
        ...n,
        tabIndex: -1,
        ref: i,
        style: {
          ...n.style,
          ...c,
          position: "absolute",
          pointerEvents: "none",
          opacity: 0,
          margin: 0
        }
      }
    );
  }
);
ka.displayName = fm;
function Ua(e) {
  return e ? "checked" : "unchecked";
}
var Fa = Ma, mm = Ga;
const hm = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  Fa,
  {
    className: ne(
      "peer focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-item-primary data-[state=unchecked]:bg-input inline-flex h-4 w-7 shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-40",
      e
    ),
    ...t,
    ref: r,
    children: /* @__PURE__ */ T.jsx(
      mm,
      {
        className: ne(
          "bg-background pointer-events-none block size-3.5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-3 data-[state=unchecked]:translate-x-0"
        )
      }
    )
  }
));
hm.displayName = Fa.displayName;
const Em = y.forwardRef(
  ({ className: e, variant: t, ...r }, o) => /* @__PURE__ */ T.jsx(
    "textarea",
    {
      className: ne(
        "min-h-20 px-3 py-2",
        ps({ variant: t }),
        e
      ),
      ref: o,
      ...r
    }
  )
);
Em.displayName = "Textarea";
var gm = [" ", "Enter", "ArrowUp", "ArrowDown"], _m = [" ", "Enter"], rt = "Select", [Tr, vr, ym] = tl(rt), [It, Th] = Ct(rt, [
  ym,
  Zn
]), Rr = Zn(), [Im, Ve] = It(rt), [Tm, vm] = It(rt), Ba = (e) => {
  const {
    __scopeSelect: t,
    children: r,
    open: o,
    defaultOpen: n,
    onOpenChange: a,
    value: s,
    defaultValue: i,
    onValueChange: l,
    dir: c,
    name: u,
    autoComplete: p,
    disabled: d,
    required: h,
    form: f
  } = e, m = Rr(t), [_, g] = y.useState(null), [E, I] = y.useState(null), [O, S] = y.useState(!1), C = ts(c), [v, A] = Dt({
    prop: o,
    defaultProp: n ?? !1,
    onChange: a,
    caller: rt
  }), [U, L] = Dt({
    prop: s,
    defaultProp: i,
    onChange: l,
    caller: rt
  }), x = y.useRef(null), z = _ ? f || !!_.closest("form") : !0, [H, D] = y.useState(/* @__PURE__ */ new Set()), B = Array.from(H).map((R) => R.props.value).join(";");
  return /* @__PURE__ */ T.jsx(Yi, { ...m, children: /* @__PURE__ */ T.jsxs(
    Im,
    {
      required: h,
      scope: t,
      trigger: _,
      onTriggerChange: g,
      valueNode: E,
      onValueNodeChange: I,
      valueNodeHasChildren: O,
      onValueNodeHasChildrenChange: S,
      contentId: uo(),
      value: U,
      onValueChange: L,
      open: v,
      onOpenChange: A,
      dir: C,
      triggerPointerDownPosRef: x,
      disabled: d,
      children: [
        /* @__PURE__ */ T.jsx(Tr.Provider, { scope: t, children: /* @__PURE__ */ T.jsx(
          Tm,
          {
            scope: e.__scopeSelect,
            onNativeOptionAdd: y.useCallback((R) => {
              D((w) => new Set(w).add(R));
            }, []),
            onNativeOptionRemove: y.useCallback((R) => {
              D((w) => {
                const N = new Set(w);
                return N.delete(R), N;
              });
            }, []),
            children: r
          }
        ) }),
        z ? /* @__PURE__ */ T.jsxs(
          di,
          {
            "aria-hidden": !0,
            required: h,
            tabIndex: -1,
            name: u,
            autoComplete: p,
            value: U,
            onChange: (R) => L(R.target.value),
            disabled: d,
            form: f,
            children: [
              U === void 0 ? /* @__PURE__ */ T.jsx("option", { value: "" }) : null,
              Array.from(H)
            ]
          },
          B
        ) : null
      ]
    }
  ) });
};
Ba.displayName = rt;
var Va = "SelectTrigger", qa = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, disabled: o = !1, ...n } = e, a = Rr(r), s = Ve(Va, r), i = s.disabled || o, l = fe(t, s.onTriggerChange), c = vr(r), u = y.useRef("touch"), [p, d, h] = fi((m) => {
      const _ = c().filter((I) => !I.disabled), g = _.find((I) => I.value === s.value), E = mi(_, m, g);
      E !== void 0 && s.onValueChange(E.value);
    }), f = (m) => {
      i || (s.onOpenChange(!0), h()), m && (s.triggerPointerDownPosRef.current = {
        x: Math.round(m.pageX),
        y: Math.round(m.pageY)
      });
    };
    return /* @__PURE__ */ T.jsx(Hi, { asChild: !0, ...a, children: /* @__PURE__ */ T.jsx(
      ee.button,
      {
        type: "button",
        role: "combobox",
        "aria-controls": s.contentId,
        "aria-expanded": s.open,
        "aria-required": s.required,
        "aria-autocomplete": "none",
        dir: s.dir,
        "data-state": s.open ? "open" : "closed",
        disabled: i,
        "data-disabled": i ? "" : void 0,
        "data-placeholder": pi(s.value) ? "" : void 0,
        ...n,
        ref: l,
        onClick: J(n.onClick, (m) => {
          m.currentTarget.focus(), u.current !== "mouse" && f(m);
        }),
        onPointerDown: J(n.onPointerDown, (m) => {
          u.current = m.pointerType;
          const _ = m.target;
          _.hasPointerCapture(m.pointerId) && _.releasePointerCapture(m.pointerId), m.button === 0 && m.ctrlKey === !1 && m.pointerType === "mouse" && (f(m), m.preventDefault());
        }),
        onKeyDown: J(n.onKeyDown, (m) => {
          const _ = p.current !== "";
          !(m.ctrlKey || m.altKey || m.metaKey) && m.key.length === 1 && d(m.key), !(_ && m.key === " ") && gm.includes(m.key) && (f(), m.preventDefault());
        })
      }
    ) });
  }
);
qa.displayName = Va;
var ja = "SelectValue", $a = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, className: o, style: n, children: a, placeholder: s = "", ...i } = e, l = Ve(ja, r), { onValueNodeHasChildrenChange: c } = l, u = a !== void 0, p = fe(t, l.onValueNodeChange);
    return Be(() => {
      c(u);
    }, [c, u]), /* @__PURE__ */ T.jsx(
      ee.span,
      {
        ...i,
        ref: p,
        style: { pointerEvents: "none" },
        children: pi(l.value) ? /* @__PURE__ */ T.jsx(T.Fragment, { children: s }) : a
      }
    );
  }
);
$a.displayName = ja;
var Rm = "SelectIcon", Ya = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, children: o, ...n } = e;
    return /* @__PURE__ */ T.jsx(ee.span, { "aria-hidden": !0, ...n, ref: t, children: o || "▼" });
  }
);
Ya.displayName = Rm;
var bm = "SelectPortal", Ha = (e) => /* @__PURE__ */ T.jsx(sl, { asChild: !0, ...e });
Ha.displayName = bm;
var ot = "SelectContent", za = y.forwardRef(
  (e, t) => {
    const r = Ve(ot, e.__scopeSelect), [o, n] = y.useState();
    if (Be(() => {
      n(new DocumentFragment());
    }, []), !r.open) {
      const a = o;
      return a ? es.createPortal(
        /* @__PURE__ */ T.jsx(Wa, { scope: e.__scopeSelect, children: /* @__PURE__ */ T.jsx(Tr.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ T.jsx("div", { children: e.children }) }) }),
        a
      ) : null;
    }
    return /* @__PURE__ */ T.jsx(Xa, { ...e, ref: t });
  }
);
za.displayName = ot;
var Oe = 10, [Wa, qe] = It(ot), Sm = "SelectContentImpl", Om = Fi("SelectContent.RemoveScroll"), Xa = y.forwardRef(
  (e, t) => {
    const {
      __scopeSelect: r,
      position: o = "item-aligned",
      onCloseAutoFocus: n,
      onEscapeKeyDown: a,
      onPointerDownOutside: s,
      //
      // PopperContent props
      side: i,
      sideOffset: l,
      align: c,
      alignOffset: u,
      arrowPadding: p,
      collisionBoundary: d,
      collisionPadding: h,
      sticky: f,
      hideWhenDetached: m,
      avoidCollisions: _,
      //
      ...g
    } = e, E = Ve(ot, r), [I, O] = y.useState(null), [S, C] = y.useState(null), v = fe(t, (P) => O(P)), [A, U] = y.useState(null), [L, x] = y.useState(
      null
    ), z = vr(r), [H, D] = y.useState(!1), B = y.useRef(!1);
    y.useEffect(() => {
      if (I) return al(I);
    }, [I]), il();
    const R = y.useCallback(
      (P) => {
        const [$, ...Y] = z().map((Q) => Q.ref.current), [G] = Y.slice(-1), X = document.activeElement;
        for (const Q of P)
          if (Q === X || (Q == null || Q.scrollIntoView({ block: "nearest" }), Q === $ && S && (S.scrollTop = 0), Q === G && S && (S.scrollTop = S.scrollHeight), Q == null || Q.focus(), document.activeElement !== X)) return;
      },
      [z, S]
    ), w = y.useCallback(
      () => R([A, I]),
      [R, A, I]
    );
    y.useEffect(() => {
      H && w();
    }, [H, w]);
    const { onOpenChange: N, triggerPointerDownPosRef: M } = E;
    y.useEffect(() => {
      if (I) {
        let P = { x: 0, y: 0 };
        const $ = (G) => {
          var X, Q;
          P = {
            x: Math.abs(Math.round(G.pageX) - (((X = M.current) == null ? void 0 : X.x) ?? 0)),
            y: Math.abs(Math.round(G.pageY) - (((Q = M.current) == null ? void 0 : Q.y) ?? 0))
          };
        }, Y = (G) => {
          P.x <= 10 && P.y <= 10 ? G.preventDefault() : I.contains(G.target) || N(!1), document.removeEventListener("pointermove", $), M.current = null;
        };
        return M.current !== null && (document.addEventListener("pointermove", $), document.addEventListener("pointerup", Y, { capture: !0, once: !0 })), () => {
          document.removeEventListener("pointermove", $), document.removeEventListener("pointerup", Y, { capture: !0 });
        };
      }
    }, [I, N, M]), y.useEffect(() => {
      const P = () => N(!1);
      return window.addEventListener("blur", P), window.addEventListener("resize", P), () => {
        window.removeEventListener("blur", P), window.removeEventListener("resize", P);
      };
    }, [N]);
    const [q, j] = fi((P) => {
      const $ = z().filter((X) => !X.disabled), Y = $.find((X) => X.ref.current === document.activeElement), G = mi($, P, Y);
      G && setTimeout(() => G.ref.current.focus());
    }), re = y.useCallback(
      (P, $, Y) => {
        const G = !B.current && !Y;
        (E.value !== void 0 && E.value === $ || G) && (U(P), G && (B.current = !0));
      },
      [E.value]
    ), Ne = y.useCallback(() => I == null ? void 0 : I.focus(), [I]), le = y.useCallback(
      (P, $, Y) => {
        const G = !B.current && !Y;
        (E.value !== void 0 && E.value === $ || G) && x(P);
      },
      [E.value]
    ), Se = o === "popper" ? so : Qa, k = Se === so ? {
      side: i,
      sideOffset: l,
      align: c,
      alignOffset: u,
      arrowPadding: p,
      collisionBoundary: d,
      collisionPadding: h,
      sticky: f,
      hideWhenDetached: m,
      avoidCollisions: _
    } : {};
    return /* @__PURE__ */ T.jsx(
      Wa,
      {
        scope: r,
        content: I,
        viewport: S,
        onViewportChange: C,
        itemRefCallback: re,
        selectedItem: A,
        onItemLeave: Ne,
        itemTextRefCallback: le,
        focusSelectedItem: w,
        selectedItemText: L,
        position: o,
        isPositioned: H,
        searchRef: q,
        children: /* @__PURE__ */ T.jsx(ll, { as: Om, allowPinchZoom: !0, children: /* @__PURE__ */ T.jsx(
          cl,
          {
            asChild: !0,
            trapped: E.open,
            onMountAutoFocus: (P) => {
              P.preventDefault();
            },
            onUnmountAutoFocus: J(n, (P) => {
              var $;
              ($ = E.trigger) == null || $.focus({ preventScroll: !0 }), P.preventDefault();
            }),
            children: /* @__PURE__ */ T.jsx(
              Bi,
              {
                asChild: !0,
                disableOutsidePointerEvents: !0,
                onEscapeKeyDown: a,
                onPointerDownOutside: s,
                onFocusOutside: (P) => P.preventDefault(),
                onDismiss: () => E.onOpenChange(!1),
                children: /* @__PURE__ */ T.jsx(
                  Se,
                  {
                    role: "listbox",
                    id: E.contentId,
                    "data-state": E.open ? "open" : "closed",
                    dir: E.dir,
                    onContextMenu: (P) => P.preventDefault(),
                    ...g,
                    ...k,
                    onPlaced: () => D(!0),
                    ref: v,
                    style: {
                      // flex layout so we can place the scroll buttons properly
                      display: "flex",
                      flexDirection: "column",
                      // reset the outline by default as the content MAY get focused
                      outline: "none",
                      ...g.style
                    },
                    onKeyDown: J(g.onKeyDown, (P) => {
                      const $ = P.ctrlKey || P.altKey || P.metaKey;
                      if (P.key === "Tab" && P.preventDefault(), !$ && P.key.length === 1 && j(P.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(P.key)) {
                        let Y = z().filter((G) => !G.disabled).map((G) => G.ref.current);
                        if (["ArrowUp", "End"].includes(P.key) && (Y = Y.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(P.key)) {
                          const G = P.target, X = Y.indexOf(G);
                          Y = Y.slice(X + 1);
                        }
                        setTimeout(() => R(Y)), P.preventDefault();
                      }
                    })
                  }
                )
              }
            )
          }
        ) })
      }
    );
  }
);
Xa.displayName = Sm;
var wm = "SelectItemAlignedPosition", Qa = y.forwardRef((e, t) => {
  const { __scopeSelect: r, onPlaced: o, ...n } = e, a = Ve(ot, r), s = qe(ot, r), [i, l] = y.useState(null), [c, u] = y.useState(null), p = fe(t, (v) => u(v)), d = vr(r), h = y.useRef(!1), f = y.useRef(!0), { viewport: m, selectedItem: _, selectedItemText: g, focusSelectedItem: E } = s, I = y.useCallback(() => {
    if (a.trigger && a.valueNode && i && c && m && _ && g) {
      const v = a.trigger.getBoundingClientRect(), A = c.getBoundingClientRect(), U = a.valueNode.getBoundingClientRect(), L = g.getBoundingClientRect();
      if (a.dir !== "rtl") {
        const G = L.left - A.left, X = U.left - G, Q = v.left - X, je = v.width + Q, Sr = Math.max(je, A.width), Or = window.innerWidth - Oe, wr = Uo(X, [
          Oe,
          // Prevents the content from going off the starting edge of the
          // viewport. It may still go off the ending edge, but this can be
          // controlled by the user since they may want to manage overflow in a
          // specific way.
          // https://github.com/radix-ui/primitives/issues/2049
          Math.max(Oe, Or - Sr)
        ]);
        i.style.minWidth = je + "px", i.style.left = wr + "px";
      } else {
        const G = A.right - L.right, X = window.innerWidth - U.right - G, Q = window.innerWidth - v.right - X, je = v.width + Q, Sr = Math.max(je, A.width), Or = window.innerWidth - Oe, wr = Uo(X, [
          Oe,
          Math.max(Oe, Or - Sr)
        ]);
        i.style.minWidth = je + "px", i.style.right = wr + "px";
      }
      const x = d(), z = window.innerHeight - Oe * 2, H = m.scrollHeight, D = window.getComputedStyle(c), B = parseInt(D.borderTopWidth, 10), R = parseInt(D.paddingTop, 10), w = parseInt(D.borderBottomWidth, 10), N = parseInt(D.paddingBottom, 10), M = B + R + H + N + w, q = Math.min(_.offsetHeight * 5, M), j = window.getComputedStyle(m), re = parseInt(j.paddingTop, 10), Ne = parseInt(j.paddingBottom, 10), le = v.top + v.height / 2 - Oe, Se = z - le, k = _.offsetHeight / 2, P = _.offsetTop + k, $ = B + R + P, Y = M - $;
      if ($ <= le) {
        const G = x.length > 0 && _ === x[x.length - 1].ref.current;
        i.style.bottom = "0px";
        const X = c.clientHeight - m.offsetTop - m.offsetHeight, Q = Math.max(
          Se,
          k + // viewport might have padding bottom, include it to avoid a scrollable viewport
          (G ? Ne : 0) + X + w
        ), je = $ + Q;
        i.style.height = je + "px";
      } else {
        const G = x.length > 0 && _ === x[0].ref.current;
        i.style.top = "0px";
        const X = Math.max(
          le,
          B + m.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
          (G ? re : 0) + k
        ) + Y;
        i.style.height = X + "px", m.scrollTop = $ - le + m.offsetTop;
      }
      i.style.margin = `${Oe}px 0`, i.style.minHeight = q + "px", i.style.maxHeight = z + "px", o == null || o(), requestAnimationFrame(() => h.current = !0);
    }
  }, [
    d,
    a.trigger,
    a.valueNode,
    i,
    c,
    m,
    _,
    g,
    a.dir,
    o
  ]);
  Be(() => I(), [I]);
  const [O, S] = y.useState();
  Be(() => {
    c && S(window.getComputedStyle(c).zIndex);
  }, [c]);
  const C = y.useCallback(
    (v) => {
      v && f.current === !0 && (I(), E == null || E(), f.current = !1);
    },
    [I, E]
  );
  return /* @__PURE__ */ T.jsx(
    Cm,
    {
      scope: r,
      contentWrapper: i,
      shouldExpandOnScrollRef: h,
      onScrollButtonChange: C,
      children: /* @__PURE__ */ T.jsx(
        "div",
        {
          ref: l,
          style: {
            display: "flex",
            flexDirection: "column",
            position: "fixed",
            zIndex: O
          },
          children: /* @__PURE__ */ T.jsx(
            ee.div,
            {
              ...n,
              ref: p,
              style: {
                // When we get the height of the content, it includes borders. If we were to set
                // the height without having `boxSizing: 'border-box'` it would be too big.
                boxSizing: "border-box",
                // We need to ensure the content doesn't get taller than the wrapper
                maxHeight: "100%",
                ...n.style
              }
            }
          )
        }
      )
    }
  );
});
Qa.displayName = wm;
var Dm = "SelectPopperPosition", so = y.forwardRef((e, t) => {
  const {
    __scopeSelect: r,
    align: o = "start",
    collisionPadding: n = Oe,
    ...a
  } = e, s = Rr(r);
  return /* @__PURE__ */ T.jsx(
    zi,
    {
      ...s,
      ...a,
      ref: t,
      align: o,
      collisionPadding: n,
      style: {
        // Ensure border-box for floating-ui calculations
        boxSizing: "border-box",
        ...a.style,
        "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
        "--radix-select-content-available-width": "var(--radix-popper-available-width)",
        "--radix-select-content-available-height": "var(--radix-popper-available-height)",
        "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
        "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
      }
    }
  );
});
so.displayName = Dm;
var [Cm, Mo] = It(ot, {}), ao = "SelectViewport", Ka = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, nonce: o, ...n } = e, a = qe(ao, r), s = Mo(ao, r), i = fe(t, a.onViewportChange), l = y.useRef(0);
    return /* @__PURE__ */ T.jsxs(T.Fragment, { children: [
      /* @__PURE__ */ T.jsx(
        "style",
        {
          dangerouslySetInnerHTML: {
            __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
          },
          nonce: o
        }
      ),
      /* @__PURE__ */ T.jsx(Tr.Slot, { scope: r, children: /* @__PURE__ */ T.jsx(
        ee.div,
        {
          "data-radix-select-viewport": "",
          role: "presentation",
          ...n,
          ref: i,
          style: {
            // we use position: 'relative' here on the `viewport` so that when we call
            // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
            // (independent of the scrollUpButton).
            position: "relative",
            flex: 1,
            // Viewport should only be scrollable in the vertical direction.
            // This won't work in vertical writing modes, so we'll need to
            // revisit this if/when that is supported
            // https://developer.chrome.com/blog/vertical-form-controls
            overflow: "hidden auto",
            ...n.style
          },
          onScroll: J(n.onScroll, (c) => {
            const u = c.currentTarget, { contentWrapper: p, shouldExpandOnScrollRef: d } = s;
            if (d != null && d.current && p) {
              const h = Math.abs(l.current - u.scrollTop);
              if (h > 0) {
                const f = window.innerHeight - Oe * 2, m = parseFloat(p.style.minHeight), _ = parseFloat(p.style.height), g = Math.max(m, _);
                if (g < f) {
                  const E = g + h, I = Math.min(f, E), O = E - I;
                  p.style.height = I + "px", p.style.bottom === "0px" && (u.scrollTop = O > 0 ? O : 0, p.style.justifyContent = "flex-end");
                }
              }
            }
            l.current = u.scrollTop;
          })
        }
      ) })
    ] });
  }
);
Ka.displayName = ao;
var Za = "SelectGroup", [Am, Nm] = It(Za), Ja = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, ...o } = e, n = uo();
    return /* @__PURE__ */ T.jsx(Am, { scope: r, id: n, children: /* @__PURE__ */ T.jsx(ee.div, { role: "group", "aria-labelledby": n, ...o, ref: t }) });
  }
);
Ja.displayName = Za;
var ei = "SelectLabel", ti = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, ...o } = e, n = Nm(ei, r);
    return /* @__PURE__ */ T.jsx(ee.div, { id: n.id, ...o, ref: t });
  }
);
ti.displayName = ei;
var rr = "SelectItem", [Pm, ri] = It(rr), oi = y.forwardRef(
  (e, t) => {
    const {
      __scopeSelect: r,
      value: o,
      disabled: n = !1,
      textValue: a,
      ...s
    } = e, i = Ve(rr, r), l = qe(rr, r), c = i.value === o, [u, p] = y.useState(a ?? ""), [d, h] = y.useState(!1), f = fe(
      t,
      (E) => {
        var I;
        return (I = l.itemRefCallback) == null ? void 0 : I.call(l, E, o, n);
      }
    ), m = uo(), _ = y.useRef("touch"), g = () => {
      n || (i.onValueChange(o), i.onOpenChange(!1));
    };
    if (o === "")
      throw new Error(
        "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
      );
    return /* @__PURE__ */ T.jsx(
      Pm,
      {
        scope: r,
        value: o,
        disabled: n,
        textId: m,
        isSelected: c,
        onItemTextChange: y.useCallback((E) => {
          p((I) => I || ((E == null ? void 0 : E.textContent) ?? "").trim());
        }, []),
        children: /* @__PURE__ */ T.jsx(
          Tr.ItemSlot,
          {
            scope: r,
            value: o,
            disabled: n,
            textValue: u,
            children: /* @__PURE__ */ T.jsx(
              ee.div,
              {
                role: "option",
                "aria-labelledby": m,
                "data-highlighted": d ? "" : void 0,
                "aria-selected": c && d,
                "data-state": c ? "checked" : "unchecked",
                "aria-disabled": n || void 0,
                "data-disabled": n ? "" : void 0,
                tabIndex: n ? void 0 : -1,
                ...s,
                ref: f,
                onFocus: J(s.onFocus, () => h(!0)),
                onBlur: J(s.onBlur, () => h(!1)),
                onClick: J(s.onClick, () => {
                  _.current !== "mouse" && g();
                }),
                onPointerUp: J(s.onPointerUp, () => {
                  _.current === "mouse" && g();
                }),
                onPointerDown: J(s.onPointerDown, (E) => {
                  _.current = E.pointerType;
                }),
                onPointerMove: J(s.onPointerMove, (E) => {
                  var I;
                  _.current = E.pointerType, n ? (I = l.onItemLeave) == null || I.call(l) : _.current === "mouse" && E.currentTarget.focus({ preventScroll: !0 });
                }),
                onPointerLeave: J(s.onPointerLeave, (E) => {
                  var I;
                  E.currentTarget === document.activeElement && ((I = l.onItemLeave) == null || I.call(l));
                }),
                onKeyDown: J(s.onKeyDown, (E) => {
                  var I;
                  ((I = l.searchRef) == null ? void 0 : I.current) !== "" && E.key === " " || (_m.includes(E.key) && g(), E.key === " " && E.preventDefault());
                })
              }
            )
          }
        )
      }
    );
  }
);
oi.displayName = rr;
var St = "SelectItemText", ni = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, className: o, style: n, ...a } = e, s = Ve(St, r), i = qe(St, r), l = ri(St, r), c = vm(St, r), [u, p] = y.useState(null), d = fe(
      t,
      (g) => p(g),
      l.onItemTextChange,
      (g) => {
        var E;
        return (E = i.itemTextRefCallback) == null ? void 0 : E.call(i, g, l.value, l.disabled);
      }
    ), h = u == null ? void 0 : u.textContent, f = y.useMemo(
      () => /* @__PURE__ */ T.jsx("option", { value: l.value, disabled: l.disabled, children: h }, l.value),
      [l.disabled, l.value, h]
    ), { onNativeOptionAdd: m, onNativeOptionRemove: _ } = c;
    return Be(() => (m(f), () => _(f)), [m, _, f]), /* @__PURE__ */ T.jsxs(T.Fragment, { children: [
      /* @__PURE__ */ T.jsx(ee.span, { id: l.textId, ...a, ref: d }),
      l.isSelected && s.valueNode && !s.valueNodeHasChildren ? es.createPortal(a.children, s.valueNode) : null
    ] });
  }
);
ni.displayName = St;
var si = "SelectItemIndicator", ai = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, ...o } = e;
    return ri(si, r).isSelected ? /* @__PURE__ */ T.jsx(ee.span, { "aria-hidden": !0, ...o, ref: t }) : null;
  }
);
ai.displayName = si;
var io = "SelectScrollUpButton", ii = y.forwardRef((e, t) => {
  const r = qe(io, e.__scopeSelect), o = Mo(io, e.__scopeSelect), [n, a] = y.useState(!1), s = fe(t, o.onScrollButtonChange);
  return Be(() => {
    if (r.viewport && r.isPositioned) {
      let i = function() {
        const c = l.scrollTop > 0;
        a(c);
      };
      const l = r.viewport;
      return i(), l.addEventListener("scroll", i), () => l.removeEventListener("scroll", i);
    }
  }, [r.viewport, r.isPositioned]), n ? /* @__PURE__ */ T.jsx(
    ci,
    {
      ...e,
      ref: s,
      onAutoScroll: () => {
        const { viewport: i, selectedItem: l } = r;
        i && l && (i.scrollTop = i.scrollTop - l.offsetHeight);
      }
    }
  ) : null;
});
ii.displayName = io;
var lo = "SelectScrollDownButton", li = y.forwardRef((e, t) => {
  const r = qe(lo, e.__scopeSelect), o = Mo(lo, e.__scopeSelect), [n, a] = y.useState(!1), s = fe(t, o.onScrollButtonChange);
  return Be(() => {
    if (r.viewport && r.isPositioned) {
      let i = function() {
        const c = l.scrollHeight - l.clientHeight, u = Math.ceil(l.scrollTop) < c;
        a(u);
      };
      const l = r.viewport;
      return i(), l.addEventListener("scroll", i), () => l.removeEventListener("scroll", i);
    }
  }, [r.viewport, r.isPositioned]), n ? /* @__PURE__ */ T.jsx(
    ci,
    {
      ...e,
      ref: s,
      onAutoScroll: () => {
        const { viewport: i, selectedItem: l } = r;
        i && l && (i.scrollTop = i.scrollTop + l.offsetHeight);
      }
    }
  ) : null;
});
li.displayName = lo;
var ci = y.forwardRef((e, t) => {
  const { __scopeSelect: r, onAutoScroll: o, ...n } = e, a = qe("SelectScrollButton", r), s = y.useRef(null), i = vr(r), l = y.useCallback(() => {
    s.current !== null && (window.clearInterval(s.current), s.current = null);
  }, []);
  return y.useEffect(() => () => l(), [l]), Be(() => {
    var c;
    const u = i().find((p) => p.ref.current === document.activeElement);
    (c = u == null ? void 0 : u.ref.current) == null || c.scrollIntoView({ block: "nearest" });
  }, [i]), /* @__PURE__ */ T.jsx(
    ee.div,
    {
      "aria-hidden": !0,
      ...n,
      ref: t,
      style: { flexShrink: 0, ...n.style },
      onPointerDown: J(n.onPointerDown, () => {
        s.current === null && (s.current = window.setInterval(o, 50));
      }),
      onPointerMove: J(n.onPointerMove, () => {
        var c;
        (c = a.onItemLeave) == null || c.call(a), s.current === null && (s.current = window.setInterval(o, 50));
      }),
      onPointerLeave: J(n.onPointerLeave, () => {
        l();
      })
    }
  );
}), Lm = "SelectSeparator", ui = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, ...o } = e;
    return /* @__PURE__ */ T.jsx(ee.div, { "aria-hidden": !0, ...o, ref: t });
  }
);
ui.displayName = Lm;
var co = "SelectArrow", Mm = y.forwardRef(
  (e, t) => {
    const { __scopeSelect: r, ...o } = e, n = Rr(r), a = Ve(co, r), s = qe(co, r);
    return a.open && s.position === "popper" ? /* @__PURE__ */ T.jsx(Wi, { ...n, ...o, ref: t }) : null;
  }
);
Mm.displayName = co;
var xm = "SelectBubbleInput", di = y.forwardRef(
  ({ __scopeSelect: e, value: t, ...r }, o) => {
    const n = y.useRef(null), a = fe(o, n), s = or(t);
    return y.useEffect(() => {
      const i = n.current;
      if (!i) return;
      const l = window.HTMLSelectElement.prototype, c = Object.getOwnPropertyDescriptor(
        l,
        "value"
      ).set;
      if (s !== t && c) {
        const u = new Event("change", { bubbles: !0 });
        c.call(i, t), i.dispatchEvent(u);
      }
    }, [s, t]), /* @__PURE__ */ T.jsx(
      ee.select,
      {
        ...r,
        style: { ...ul, ...r.style },
        ref: a,
        defaultValue: t
      }
    );
  }
);
di.displayName = xm;
function pi(e) {
  return e === "" || e === void 0;
}
function fi(e) {
  const t = Vi(e), r = y.useRef(""), o = y.useRef(0), n = y.useCallback(
    (s) => {
      const i = r.current + s;
      t(i), function l(c) {
        r.current = c, window.clearTimeout(o.current), c !== "" && (o.current = window.setTimeout(() => l(""), 1e3));
      }(i);
    },
    [t]
  ), a = y.useCallback(() => {
    r.current = "", window.clearTimeout(o.current);
  }, []);
  return y.useEffect(() => () => window.clearTimeout(o.current), []), [r, n, a];
}
function mi(e, t, r) {
  const o = t.length > 1 && Array.from(t).every((i) => i === t[0]) ? t[0] : t, n = r ? e.indexOf(r) : -1;
  let a = Gm(e, Math.max(n, 0));
  o.length === 1 && (a = a.filter((i) => i !== r));
  const s = a.find(
    (i) => i.textValue.toLowerCase().startsWith(o.toLowerCase())
  );
  return s !== r ? s : void 0;
}
function Gm(e, t) {
  return e.map((r, o) => e[(t + o) % e.length]);
}
var km = Ba, hi = qa, Um = $a, Fm = Ya, Bm = Ha, Ei = za, Vm = Ka, qm = Ja, gi = ti, _i = oi, jm = ni, $m = ai, yi = ii, Ii = li, Ti = ui;
const vh = km, Rh = qm, bh = Um, Ym = y.forwardRef(({ className: e, children: t, variant: r = "default", ...o }, n) => /* @__PURE__ */ T.jsxs(
  hi,
  {
    ref: n,
    className: ne(
      "border-border ring-offset-background placeholder:text-muted-foreground focus:ring-offset-none focus:ring-primary flex h-10 w-full items-center justify-between rounded-md border bg-white px-3 py-2 text-sm focus:ring-2 focus:ring-offset-transparent focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 dark:bg-transparent [&>span]:line-clamp-1",
      r === "failure" && "focus:ring-destructive hover:bg-destructive/20 bg-destructive/20 border-destructive !text-destructive",
      e
    ),
    ...o,
    children: [
      t,
      /* @__PURE__ */ T.jsx(Fm, { asChild: !0, children: /* @__PURE__ */ T.jsx(ns, { className: "h-4 w-4 opacity-50" }) })
    ]
  }
));
Ym.displayName = hi.displayName;
const vi = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  yi,
  {
    ref: r,
    className: ne(
      "flex cursor-default items-center justify-center py-1",
      e
    ),
    ...t,
    children: /* @__PURE__ */ T.jsx(fl, { className: "h-4 w-4" })
  }
));
vi.displayName = yi.displayName;
const Ri = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  Ii,
  {
    ref: r,
    className: ne(
      "flex cursor-default items-center justify-center py-1",
      e
    ),
    ...t,
    children: /* @__PURE__ */ T.jsx(ns, { className: "h-4 w-4" })
  }
));
Ri.displayName = Ii.displayName;
const Hm = y.forwardRef(({ className: e, children: t, position: r = "popper", ...o }, n) => /* @__PURE__ */ T.jsx(Bm, { children: /* @__PURE__ */ T.jsxs(
  Ei,
  {
    ref: n,
    className: ne(
      "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",
      r === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
      e
    ),
    position: r,
    ...o,
    children: [
      /* @__PURE__ */ T.jsx(vi, {}),
      /* @__PURE__ */ T.jsx(
        Vm,
        {
          className: ne(
            "p-1",
            r === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
          ),
          children: t
        }
      ),
      /* @__PURE__ */ T.jsx(Ri, {})
    ]
  }
) }));
Hm.displayName = Ei.displayName;
const zm = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  gi,
  {
    ref: r,
    className: ne("py-1.5 pr-2 pl-8 text-sm font-semibold", e),
    ...t
  }
));
zm.displayName = gi.displayName;
const Wm = y.forwardRef(({ className: e, children: t, ...r }, o) => /* @__PURE__ */ T.jsxs(
  _i,
  {
    ref: o,
    className: ne(
      "focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
      e
    ),
    ...r,
    children: [
      /* @__PURE__ */ T.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ T.jsx($m, { children: /* @__PURE__ */ T.jsx(rl, { className: "h-4 w-4" }) }) }),
      /* @__PURE__ */ T.jsx(jm, { children: t })
    ]
  }
));
Wm.displayName = _i.displayName;
const Xm = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  Ti,
  {
    ref: r,
    className: ne("bg-muted -mx-1 my-1 h-px", e),
    ...t
  }
));
Xm.displayName = Ti.displayName;
var xo = "Radio", [Qm, bi] = Ct(xo), [Km, Zm] = Qm(xo), Si = y.forwardRef(
  (e, t) => {
    const {
      __scopeRadio: r,
      name: o,
      checked: n = !1,
      required: a,
      disabled: s,
      value: i = "on",
      onCheck: l,
      form: c,
      ...u
    } = e, [p, d] = y.useState(null), h = fe(t, (_) => d(_)), f = y.useRef(!1), m = p ? c || !!p.closest("form") : !0;
    return /* @__PURE__ */ T.jsxs(Km, { scope: r, checked: n, disabled: s, children: [
      /* @__PURE__ */ T.jsx(
        ee.button,
        {
          type: "button",
          role: "radio",
          "aria-checked": n,
          "data-state": Ci(n),
          "data-disabled": s ? "" : void 0,
          disabled: s,
          value: i,
          ...u,
          ref: h,
          onClick: J(e.onClick, (_) => {
            n || l == null || l(), m && (f.current = _.isPropagationStopped(), f.current || _.stopPropagation());
          })
        }
      ),
      m && /* @__PURE__ */ T.jsx(
        Di,
        {
          control: p,
          bubbles: !f.current,
          name: o,
          value: i,
          checked: n,
          required: a,
          disabled: s,
          form: c,
          style: { transform: "translateX(-100%)" }
        }
      )
    ] });
  }
);
Si.displayName = xo;
var Oi = "RadioIndicator", wi = y.forwardRef(
  (e, t) => {
    const { __scopeRadio: r, forceMount: o, ...n } = e, a = Zm(Oi, r);
    return /* @__PURE__ */ T.jsx(Kn, { present: o || a.checked, children: /* @__PURE__ */ T.jsx(
      ee.span,
      {
        "data-state": Ci(a.checked),
        "data-disabled": a.disabled ? "" : void 0,
        ...n,
        ref: t
      }
    ) });
  }
);
wi.displayName = Oi;
var Jm = "RadioBubbleInput", Di = y.forwardRef(
  ({
    __scopeRadio: e,
    control: t,
    checked: r,
    bubbles: o = !0,
    ...n
  }, a) => {
    const s = y.useRef(null), i = fe(s, a), l = or(r), c = po(t);
    return y.useEffect(() => {
      const u = s.current;
      if (!u) return;
      const p = window.HTMLInputElement.prototype, d = Object.getOwnPropertyDescriptor(
        p,
        "checked"
      ).set;
      if (l !== r && d) {
        const h = new Event("click", { bubbles: o });
        d.call(u, r), u.dispatchEvent(h);
      }
    }, [l, r, o]), /* @__PURE__ */ T.jsx(
      ee.input,
      {
        type: "radio",
        "aria-hidden": !0,
        defaultChecked: r,
        ...n,
        tabIndex: -1,
        ref: i,
        style: {
          ...n.style,
          ...c,
          position: "absolute",
          pointerEvents: "none",
          opacity: 0,
          margin: 0
        }
      }
    );
  }
);
Di.displayName = Jm;
function Ci(e) {
  return e ? "checked" : "unchecked";
}
var eh = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], br = "RadioGroup", [th, Sh] = Ct(br, [
  rs,
  bi
]), Ai = rs(), Ni = bi(), [rh, oh] = th(br), Pi = y.forwardRef(
  (e, t) => {
    const {
      __scopeRadioGroup: r,
      name: o,
      defaultValue: n,
      value: a,
      required: s = !1,
      disabled: i = !1,
      orientation: l,
      dir: c,
      loop: u = !0,
      onValueChange: p,
      ...d
    } = e, h = Ai(r), f = ts(c), [m, _] = Dt({
      prop: a,
      defaultProp: n ?? null,
      onChange: p,
      caller: br
    });
    return /* @__PURE__ */ T.jsx(
      rh,
      {
        scope: r,
        name: o,
        required: s,
        disabled: i,
        value: m,
        onValueChange: _,
        children: /* @__PURE__ */ T.jsx(
          ol,
          {
            asChild: !0,
            ...h,
            orientation: l,
            dir: f,
            loop: u,
            children: /* @__PURE__ */ T.jsx(
              ee.div,
              {
                role: "radiogroup",
                "aria-required": s,
                "aria-orientation": l,
                "data-disabled": i ? "" : void 0,
                dir: f,
                ...d,
                ref: t
              }
            )
          }
        )
      }
    );
  }
);
Pi.displayName = br;
var Li = "RadioGroupItem", Mi = y.forwardRef(
  (e, t) => {
    const { __scopeRadioGroup: r, disabled: o, ...n } = e, a = oh(Li, r), s = a.disabled || o, i = Ai(r), l = Ni(r), c = y.useRef(null), u = fe(t, c), p = a.value === n.value, d = y.useRef(!1);
    return y.useEffect(() => {
      const h = (m) => {
        eh.includes(m.key) && (d.current = !0);
      }, f = () => d.current = !1;
      return document.addEventListener("keydown", h), document.addEventListener("keyup", f), () => {
        document.removeEventListener("keydown", h), document.removeEventListener("keyup", f);
      };
    }, []), /* @__PURE__ */ T.jsx(
      nl,
      {
        asChild: !0,
        ...i,
        focusable: !s,
        active: p,
        children: /* @__PURE__ */ T.jsx(
          Si,
          {
            disabled: s,
            required: a.required,
            checked: p,
            ...l,
            ...n,
            name: a.name,
            ref: u,
            onCheck: () => a.onValueChange(n.value),
            onKeyDown: J((h) => {
              h.key === "Enter" && h.preventDefault();
            }),
            onFocus: J(n.onFocus, () => {
              var h;
              d.current && ((h = c.current) == null || h.click());
            })
          }
        )
      }
    );
  }
);
Mi.displayName = Li;
var nh = "RadioGroupIndicator", xi = y.forwardRef(
  (e, t) => {
    const { __scopeRadioGroup: r, ...o } = e, n = Ni(r);
    return /* @__PURE__ */ T.jsx(wi, { ...n, ...o, ref: t });
  }
);
xi.displayName = nh;
var Gi = Pi, ki = Mi, sh = xi;
const ah = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  Gi,
  {
    className: ne("grid gap-2", e),
    ...t,
    ref: r
  }
));
ah.displayName = Gi.displayName;
const ih = y.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ T.jsx(
  ki,
  {
    ref: r,
    className: ne(
      "border-primary text-primary ring-offset-background focus-visible:ring-ring aspect-square h-4 w-4 rounded-full border focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
      e
    ),
    ...t,
    children: /* @__PURE__ */ T.jsx(sh, { className: "flex items-center justify-center", children: /* @__PURE__ */ T.jsx(el, { className: "h-2.5 w-2.5 fill-current text-current" }) })
  }
));
ih.displayName = ki.displayName;
export {
  hm as E,
  bh as F,
  Rh as G,
  Xm as K,
  Na as L,
  yh as N,
  _h as P,
  _l as T,
  Hm as W,
  Wm as X,
  Ym as Y,
  am as a,
  ih as b,
  lm as c,
  cm as d,
  ah as e,
  Ri as f,
  Em as g,
  yr as h,
  sm as i,
  Ff as k,
  im as l,
  ps as m,
  vi as v,
  vh as x,
  yl as y,
  zm as z
};