UNPKG

dgz-ui-shared

Version:

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

1,479 lines 202 kB
import { t as lt } from "../../MyInput-CHKuq1qI.js"; import { M as vc } from "../../MyInput-CHKuq1qI.js"; import { M as xc } from "../../MySelect-B49OLiFT.js"; import { j as S } from "../../jsx-runtime-C5mzlN2N.js"; import { l as De } from "../../lodash-CYNxjS-I.js"; import { N as ge, i as he, l as Re, c as Oe, d as Xe, a as ue, T as Kt, E as Jt, k as en, g as tn, b as nn } from "../../radio-group-CqPTye2U-DGs9dBuR.js"; import { P as Bc, y as Uc, L as Vc, e as Hc, x as Yc, W as Wc, G as qc, X as jc, z as $c, f as zc, v as kc, K as Xc, Y as Zc, F as Qc, m as Kc, h as Jc } from "../../radio-group-CqPTye2U-DGs9dBuR.js"; import { O as sn, _ as rn, u as an } from "../../popover-HTqpqYpJ-CwZxzUFN.js"; import { z as td } from "../../popover-HTqpqYpJ-CwZxzUFN.js"; import { u as on } from "../../button-Bp2lHjov-BTlHPcva.js"; import { d as ln, n as cs, L as cn, D as nr, G as dn } from "../../DateRangePicker-ozP6DB6g.js"; import { m as be } from "../../utils-B6fNqzRf-B1_jG1K7.js"; import { c as sr } from "../../createLucideIcon-B950nf2d.js"; import rr, { createElement as un } from "react"; /** * @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 ir = [ ["path", { d: "M8 2v4", key: "1cmpym" }], ["path", { d: "M16 2v4", key: "4m81vk" }], ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }], ["path", { d: "M3 10h18", key: "8toen8" }] ], fn = sr("calendar", ir), Sc = ({ control: e, name: t, label: n, helperText: s, required: r, rules: a, format: i = cs, placeholder: l, floatingError: o, register: d, ...c }) => { const f = n && /* @__PURE__ */ S.jsxs(ue, { className: "text-body-xs-medium my-3", children: [ n, " ", r && /* @__PURE__ */ S.jsx("span", { className: "text-red-600", children: "*" }) ] }); return /* @__PURE__ */ S.jsx(S.Fragment, { children: t && e ? /* @__PURE__ */ S.jsx( ge, { control: e, name: t, rules: a, render: ({ field: I, formState: p }) => /* @__PURE__ */ S.jsxs(he, { className: "relative flex flex-col", children: [ f, /* @__PURE__ */ S.jsxs(sn, { children: [ /* @__PURE__ */ S.jsx(rn, { asChild: !0, children: /* @__PURE__ */ S.jsx(Re, { children: /* @__PURE__ */ S.jsxs( on, { variant: "secondary", className: be( "text-secondary !text-body-sm-regular border-alpha-strong focus:ring-item-primary mb-0 bg-transparent pl-3 text-left font-normal hover:bg-transparent", De.get(p.errors, `${t}`) && "focus:ring-item-destructive border-item-destructive bg-item-destructive-focus text-item-destructive hover:bg-item-destructive-focus dark:bg-transparent", I.value && "text-primary" ), children: [ I.value ? ln(I.value).format(i) : l || "Pick a date", /* @__PURE__ */ S.jsx(fn, { className: "ml-auto h-4 w-4" }) ] } ) }) }), /* @__PURE__ */ S.jsx(an, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ S.jsx( cn, { ...c, mode: "single", selected: I.value, onSelect: I.onChange } ) }) ] }), /* @__PURE__ */ S.jsx(Oe, { children: s }), /* @__PURE__ */ S.jsx("div", { className: "relative", children: /* @__PURE__ */ S.jsx(Xe, {}) }) ] }) } ) : /* @__PURE__ */ S.jsxs("div", { className: "relative flex flex-col", children: [ f, /* @__PURE__ */ S.jsxs(sn, { children: [ /* @__PURE__ */ S.jsx(rn, { asChild: !0, children: /* @__PURE__ */ S.jsxs( on, { variant: "secondary", className: be( "text-secondary !text-body-sm-regular border-border-alpha-strong focus:ring-item-primary mb-0 bg-transparent pl-3 text-left font-normal hover:bg-transparent", c.selected && "text-primary" ), children: [ c.selected ? ln(c.selected).format(i) : l || "Pick a date", /* @__PURE__ */ S.jsx(fn, { className: "ml-auto h-4 w-4" }) ] } ) }), /* @__PURE__ */ S.jsx(an, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ S.jsx(cn, { ...c, mode: "single" }) }) ] }) ] }) }); }, Dc = ({ control: e, name: t, label: n, helperText: s, required: r, rules: a, format: i = cs, placeholder: l, ...o }) => { const d = n && /* @__PURE__ */ S.jsxs(ue, { className: "text-body-xs-medium my-3", children: [ n, " ", r && /* @__PURE__ */ S.jsx("span", { className: "text-red-600", children: "*" }) ] }); return /* @__PURE__ */ S.jsx(S.Fragment, { children: t && e && /* @__PURE__ */ S.jsx( ge, { control: e, name: t, rules: a, render: ({ field: c, formState: f }) => /* @__PURE__ */ S.jsxs(he, { className: "relative flex flex-col", children: [ d, /* @__PURE__ */ S.jsx(Re, { children: /* @__PURE__ */ S.jsx( nr, { ...o, error: `${De.get(f.errors, t, "")}`, selected: c.value, onRangeSelected: c.onChange, format: i, placeholder: l } ) }), /* @__PURE__ */ S.jsx(Oe, { children: s }), /* @__PURE__ */ S.jsx("div", { className: "relative", children: /* @__PURE__ */ S.jsx(Xe, {}) }) ] }) } ) }); }, yc = ({ control: e, name: t, label: n, rules: s, helperText: r, ...a }) => t && e ? /* @__PURE__ */ S.jsx( ge, { control: e, name: t, rules: s, render: ({ field: i }) => /* @__PURE__ */ S.jsxs(he, { className: "flex flex-row items-start space-x-3", children: [ /* @__PURE__ */ S.jsx(Re, { children: /* @__PURE__ */ S.jsx( Kt, { checked: i.value, onCheckedChange: i.onChange, ...a } ) }), /* @__PURE__ */ S.jsxs("div", { className: "space-y-1 leading-none", children: [ n && /* @__PURE__ */ S.jsx(ue, { children: n }), /* @__PURE__ */ S.jsx(Oe, { children: r }) ] }) ] }) } ) : /* @__PURE__ */ S.jsxs("div", { className: "flex flex-row items-start space-y-0 space-x-3 rounded-md border p-4", children: [ /* @__PURE__ */ S.jsx(Kt, { ...a }), /* @__PURE__ */ S.jsx("div", { className: "space-y-1 leading-none", children: n && /* @__PURE__ */ S.jsx(ue, { children: n }) }) ] }), Ac = ({ control: e, name: t, label: n, helperText: s, rules: r, ...a }) => t && e ? /* @__PURE__ */ S.jsx( ge, { control: e, name: t, rules: r, render: ({ field: i }) => /* @__PURE__ */ S.jsxs(he, { className: "flex items-center gap-2", children: [ /* @__PURE__ */ S.jsx(Re, { children: /* @__PURE__ */ S.jsx( Jt, { className: "m-0", checked: i.value, onCheckedChange: i.onChange, ...a } ) }), /* @__PURE__ */ S.jsxs("div", { className: "mb-1 space-y-1 leading-none", children: [ n && /* @__PURE__ */ S.jsx( ue, { className: be("text-primary", a.disabled && "opacity-40"), children: n } ), /* @__PURE__ */ S.jsx(Oe, { children: s }) ] }) ] }) } ) : /* @__PURE__ */ S.jsxs("div", { className: "flex flex-row items-center space-x-3", children: [ /* @__PURE__ */ S.jsx(Jt, { ...a }), /* @__PURE__ */ S.jsx("div", { className: "mb-1 space-y-1 leading-none", children: n && /* @__PURE__ */ S.jsx( ue, { className: be("text-primary", a.disabled && "opacity-40"), children: n } ) }) ] }); /*! * FilePond 4.32.8 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ const ar = (e) => e instanceof HTMLElement, or = (e, t = [], n = []) => { const s = { ...e }, r = [], a = [], i = () => ({ ...s }), l = () => { const u = [...r]; return r.length = 0, u; }, o = () => { const u = [...a]; a.length = 0, u.forEach(({ type: _, data: T }) => { d(_, T); }); }, d = (u, _, T) => { if (T && !document.hidden) { a.push({ type: u, data: _ }); return; } p[u] && p[u](_), r.push({ type: u, data: _ }); }, c = (u, ..._) => I[u] ? I[u](..._) : null, f = { getState: i, processActionQueue: l, processDispatchQueue: o, dispatch: d, query: c }; let I = {}; t.forEach((u) => { I = { ...u(s), ...I }; }); let p = {}; return n.forEach((u) => { p = { ...u(d, c, s), ...p }; }), f; }, lr = (e, t, n) => { if (typeof n == "function") { e[t] = n; return; } Object.defineProperty(e, t, { ...n }); }, Y = (e, t) => { for (const n in e) e.hasOwnProperty(n) && t(n, e[n]); }, Te = (e) => { const t = {}; return Y(e, (n) => { lr(t, n, e[n]); }), t; }, $ = (e, t, n = null) => { if (n === null) return e.getAttribute(t) || e.hasAttribute(t); e.setAttribute(t, n); }, cr = "http://www.w3.org/2000/svg", dr = ["svg", "path"], En = (e) => dr.includes(e), ct = (e, t, n = {}) => { typeof t == "object" && (n = t, t = null); const s = En(e) ? document.createElementNS(cr, e) : document.createElement(e); return t && (En(e) ? $(s, "class", t) : s.className = t), Y(n, (r, a) => { $(s, r, a); }), s; }, ur = (e) => (t, n) => { typeof n < "u" && e.children[n] ? e.insertBefore(t, e.children[n]) : e.appendChild(t); }, fr = (e, t) => (n, s) => (typeof s < "u" ? t.splice(s, 0, n) : t.push(n), n), Er = (e, t) => (n) => (t.splice(t.indexOf(n), 1), n.element.parentNode && e.removeChild(n.element), n), pr = typeof window < "u" && typeof window.document < "u", ds = () => pr, Ir = ds() ? ct("svg") : {}, _r = "children" in Ir ? (e) => e.children.length : (e) => e.childNodes.length, us = (e, t, n, s) => { const r = n[0] || e.left, a = n[1] || e.top, i = r + e.width, l = a + e.height * (s[1] || 1), o = { // 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: r, top: a, right: i, bottom: l } }; return t.filter((d) => !d.isRectIgnored()).map((d) => d.rect).forEach((d) => { pn(o.inner, { ...d.inner }), pn(o.outer, { ...d.outer }); }), In(o.inner), o.outer.bottom += o.element.marginBottom, o.outer.right += o.element.marginRight, In(o.outer), o; }, pn = (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); }, In = (e) => { e.width = e.right - e.left, e.height = e.bottom - e.top; }, ye = (e) => typeof e == "number", mr = (e, t, n, s = 1e-3) => Math.abs(e - t) < s && Math.abs(n) < s, Tr = ( // default options ({ stiffness: e = 0.5, damping: t = 0.75, mass: n = 10 } = {}) => { let s = null, r = null, a = 0, i = !1; const d = Te({ interpolate: (c, f) => { if (i) return; if (!(ye(s) && ye(r))) { i = !0, a = 0; return; } const I = -(r - s) * e; a += I / n, r += a, a *= t, mr(r, s, a) || f ? (r = s, a = 0, i = !0, d.onupdate(r), d.oncomplete(r)) : d.onupdate(r); }, target: { set: (c) => { if (ye(c) && !ye(r) && (r = c), s === null && (s = c, r = c), s = c, r === s || typeof s > "u") { i = !0, a = 0, d.onupdate(r), d.oncomplete(r); return; } i = !1; }, get: () => s }, resting: { get: () => i }, onupdate: (c) => { }, oncomplete: (c) => { } }); return d; } ), gr = (e) => e < 0.5 ? 2 * e * e : -1 + (4 - 2 * e) * e, hr = ( // default values ({ duration: e = 500, easing: t = gr, delay: n = 0 } = {}) => { let s = null, r, a, i = !0, l = !1, o = null; const c = Te({ interpolate: (f, I) => { i || o === null || (s === null && (s = f), !(f - s < n) && (r = f - s - n, r >= e || I ? (r = 1, a = l ? 0 : 1, c.onupdate(a * o), c.oncomplete(a * o), i = !0) : (a = r / e, c.onupdate((r >= 0 ? t(l ? 1 - a : a) : 0) * o)))); }, target: { get: () => l ? 0 : o, set: (f) => { if (o === null) { o = f, c.onupdate(f), c.oncomplete(f); return; } f < o ? (o = 1, l = !0) : (l = !1, o = f), i = !1, s = null; } }, resting: { get: () => i }, onupdate: (f) => { }, oncomplete: (f) => { } }); return c; } ), _n = { spring: Tr, tween: hr }, Rr = (e, t, n) => { const s = e[t] && typeof e[t][n] == "object" ? e[t][n] : e[t] || e, r = typeof s == "string" ? s : s.type, a = typeof s == "object" ? { ...s } : {}; return _n[r] ? _n[r](a) : null; }, Ut = (e, t, n, s = !1) => { t = Array.isArray(t) ? t : [t], t.forEach((r) => { e.forEach((a) => { let i = a, l = () => n[a], o = (d) => n[a] = d; typeof a == "object" && (i = a.key, l = a.getter || l, o = a.setter || o), !(r[i] && !s) && (r[i] = { get: l, set: o }); }); }); }, Or = ({ mixinConfig: e, viewProps: t, viewInternalAPI: n, viewExternalAPI: s }) => { const r = { ...t }, a = []; return Y(e, (i, l) => { const o = Rr(l); if (!o) return; o.onupdate = (c) => { t[i] = c; }, o.target = r[i], Ut([{ key: i, setter: (c) => { o.target !== c && (o.target = c); }, getter: () => t[i] }], [n, s], t, !0), a.push(o); }), { write: (i) => { let l = document.hidden, o = !0; return a.forEach((d) => { d.resting || (o = !1), d.interpolate(i, l); }), o; }, destroy: () => { } }; }, Sr = (e) => (t, n) => { e.addEventListener(t, n); }, Dr = (e) => (t, n) => { e.removeEventListener(t, n); }, yr = ({ mixinConfig: e, viewProps: t, viewInternalAPI: n, viewExternalAPI: s, viewState: r, view: a }) => { const i = [], l = Sr(a.element), o = Dr(a.element); return s.on = (d, c) => { i.push({ type: d, fn: c }), l(d, c); }, s.off = (d, c) => { i.splice(i.findIndex((f) => f.type === d && f.fn === c), 1), o(d, c); }, { write: () => !0, destroy: () => { i.forEach((d) => { o(d.type, d.fn); }); } }; }, Ar = ({ mixinConfig: e, viewProps: t, viewExternalAPI: n }) => { Ut(e, n, t); }, Z = (e) => e != null, Mr = { opacity: 1, scaleX: 1, scaleY: 1, translateX: 0, translateY: 0, rotateX: 0, rotateY: 0, rotateZ: 0, originX: 0, originY: 0 }, Lr = ({ mixinConfig: e, viewProps: t, viewInternalAPI: n, viewExternalAPI: s, view: r }) => { const a = { ...t }, i = {}; Ut(e, [n, s], t); const l = () => [t.translateX || 0, t.translateY || 0], o = () => [t.scaleX || 0, t.scaleY || 0], d = () => r.rect ? us(r.rect, r.childViews, l(), o()) : null; return n.rect = { get: d }, s.rect = { get: d }, e.forEach((c) => { t[c] = typeof a[c] > "u" ? Mr[c] : a[c]; }), { write: () => { if (wr(i, t)) return Pr(r.element, t), Object.assign(i, { ...t }), !0; }, destroy: () => { } }; }, wr = (e, t) => { if (Object.keys(e).length !== Object.keys(t).length) return !0; for (const n in t) if (t[n] !== e[n]) return !0; return !1; }, Pr = (e, { opacity: t, perspective: n, translateX: s, translateY: r, scaleX: a, scaleY: i, rotateX: l, rotateY: o, rotateZ: d, originX: c, originY: f, width: I, height: p }) => { let u = "", _ = ""; (Z(c) || Z(f)) && (_ += `transform-origin: ${c || 0}px ${f || 0}px;`), Z(n) && (u += `perspective(${n}px) `), (Z(s) || Z(r)) && (u += `translate3d(${s || 0}px, ${r || 0}px, 0) `), (Z(a) || Z(i)) && (u += `scale3d(${Z(a) ? a : 1}, ${Z(i) ? i : 1}, 1) `), Z(d) && (u += `rotateZ(${d}rad) `), Z(l) && (u += `rotateX(${l}rad) `), Z(o) && (u += `rotateY(${o}rad) `), u.length && (_ += `transform:${u};`), Z(t) && (_ += `opacity:${t};`, t === 0 && (_ += "visibility:hidden;"), t < 1 && (_ += "pointer-events:none;")), Z(p) && (_ += `height:${p}px;`), Z(I) && (_ += `width:${I}px;`); const T = e.elementCurrentStyle || ""; (_.length !== T.length || _ !== T) && (e.style.cssText = _, e.elementCurrentStyle = _); }, Cr = { styles: Lr, listeners: yr, animations: Or, apis: Ar }, mn = (e = {}, t = {}, n = {}) => (t.layoutCalculated || (e.paddingTop = parseInt(n.paddingTop, 10) || 0, e.marginTop = parseInt(n.marginTop, 10) || 0, e.marginRight = parseInt(n.marginRight, 10) || 0, e.marginBottom = parseInt(n.marginBottom, 10) || 0, e.marginLeft = parseInt(n.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), j = ( // default view definition ({ // element definition tag: e = "div", name: t = null, attributes: n = {}, // view interaction read: s = () => { }, write: r = () => { }, create: a = () => { }, destroy: i = () => { }, // hooks filterFrameActionsForChild: l = (p, u) => u, didCreateView: o = () => { }, didWriteView: d = () => { }, // rect related ignoreRect: c = !1, ignoreRectUpdate: f = !1, // mixins mixins: I = [] } = {}) => (p, u = {}) => { const _ = ct(e, `filepond--${t}`, n), T = window.getComputedStyle(_, null), h = mn(); let E = null, m = !1; const R = [], D = [], L = {}, N = {}, y = [ r // default writer ], w = [ s // default reader ], G = [ i // default destroy ], P = () => _, C = () => R.concat(), V = () => L, M = (U) => (X, pe) => X(U, pe), B = () => E || (E = us(h, R, [0, 0], [1, 1]), E), O = () => T, A = () => { E = null, R.forEach((pe) => pe._read()), !(f && h.width && h.height) && mn(h, _, T); const X = { root: oe, props: u, rect: h }; w.forEach((pe) => pe(X)); }, b = (U, X, pe) => { let Ge = X.length === 0; return y.forEach((J) => { J({ props: u, root: oe, actions: X, timestamp: U, shouldOptimize: pe }) === !1 && (Ge = !1); }), D.forEach((J) => { J.write(U) === !1 && (Ge = !1); }), R.filter((J) => !!J.element.parentNode).forEach((J) => { J._write( U, l(J, X), pe ) || (Ge = !1); }), R.forEach((J, Qe) => { J.element.parentNode || (oe.appendChild(J.element, Qe), J._read(), J._write( U, l(J, X), pe ), Ge = !1); }), m = Ge, d({ props: u, root: oe, actions: X, timestamp: U }), Ge; }, v = () => { D.forEach((U) => U.destroy()), G.forEach((U) => { U({ root: oe, props: u }); }), R.forEach((U) => U._destroy()); }, H = { element: { get: P }, style: { get: O }, childViews: { get: C } }, F = { ...H, rect: { get: B }, // access to custom children references ref: { get: V }, // dom modifiers is: (U) => t === U, appendChild: ur(_), createChildView: M(p), linkView: (U) => (R.push(U), U), unlinkView: (U) => { R.splice(R.indexOf(U), 1); }, appendChildView: fr(_, R), removeChildView: Er(_, R), registerWriter: (U) => y.push(U), registerReader: (U) => w.push(U), registerDestroyer: (U) => G.push(U), invalidateLayout: () => _.layoutCalculated = !1, // access to data store dispatch: p.dispatch, query: p.query }, Se = { element: { get: P }, childViews: { get: C }, rect: { get: B }, resting: { get: () => m }, isRectIgnored: () => c, _read: A, _write: b, _destroy: v }, Ye = { ...H, rect: { get: () => h } }; Object.keys(I).sort((U, X) => U === "styles" ? 1 : X === "styles" ? -1 : 0).forEach((U) => { const X = Cr[U]({ mixinConfig: I[U], viewProps: u, viewState: N, viewInternalAPI: F, viewExternalAPI: Se, view: Te(Ye) }); X && D.push(X); }); const oe = Te(F); a({ root: oe, props: u }); const ht = _r(_); return R.forEach((U, X) => { oe.appendChild(U.element, ht + X); }), o(oe), Te(Se); } ), br = (e, t, n = 60) => { const s = "__framePainter"; if (window[s]) { window[s].readers.push(e), window[s].writers.push(t); return; } window[s] = { readers: [e], writers: [t] }; const r = window[s], a = 1e3 / n; let i = null, l = null, o = null, d = null; const c = () => { document.hidden ? (o = () => window.setTimeout(() => f(performance.now()), a), d = () => window.clearTimeout(l)) : (o = () => window.requestAnimationFrame(f), d = () => window.cancelAnimationFrame(l)); }; document.addEventListener("visibilitychange", () => { d && d(), c(), f(performance.now()); }); const f = (I) => { l = o(f), i || (i = I); const p = I - i; p <= a || (i = I - p % a, r.readers.forEach((u) => u()), r.writers.forEach((u) => u(I))); }; return c(), f(performance.now()), { pause: () => { d(l); } }; }, K = (e, t) => ({ root: n, props: s, actions: r = [], timestamp: a, shouldOptimize: i }) => { r.filter((l) => e[l.type]).forEach( (l) => e[l.type]({ root: n, props: s, action: l.data, timestamp: a, shouldOptimize: i }) ), t && t({ root: n, props: s, actions: r, timestamp: a, shouldOptimize: i }); }, Tn = (e, t) => t.parentNode.insertBefore(e, t), gn = (e, t) => t.parentNode.insertBefore(e, t.nextSibling), Et = (e) => Array.isArray(e), Ie = (e) => e == null, Nr = (e) => e.trim(), pt = (e) => "" + e, vr = (e, t = ",") => Ie(e) ? [] : Et(e) ? e : pt(e).split(t).map(Nr).filter((n) => n.length), fs = (e) => typeof e == "boolean", Es = (e) => fs(e) ? e : e === "true", Q = (e) => typeof e == "string", ps = (e) => ye(e) ? e : Q(e) ? pt(e).replace(/[a-z]+/gi, "") : 0, at = (e) => parseInt(ps(e), 10), hn = (e) => parseFloat(ps(e)), He = (e) => ye(e) && isFinite(e) && Math.floor(e) === e, Rn = (e, t = 1e3) => { if (He(e)) return e; let n = pt(e).trim(); return /MB$/i.test(n) ? (n = n.replace(/MB$i/, "").trim(), at(n) * t * t) : /KB/i.test(n) ? (n = n.replace(/KB$i/, "").trim(), at(n) * t) : at(n); }, Ae = (e) => typeof e == "function", Gr = (e) => { let t = self, n = e.split("."), s = null; for (; s = n.shift(); ) if (t = t[s], !t) return null; return t; }, On = { process: "POST", patch: "PATCH", revert: "DELETE", fetch: "GET", restore: "GET", load: "GET" }, xr = (e) => { const t = {}; return t.url = Q(e) ? e : e.url || "", t.timeout = e.timeout ? parseInt(e.timeout, 10) : 0, t.headers = e.headers ? e.headers : {}, Y(On, (n) => { t[n] = Fr(n, e[n], On[n], t.timeout, t.headers); }), t.process = e.process || Q(e) || e.url ? t.process : null, t.remove = e.remove || null, delete t.headers, t; }, Fr = (e, t, n, s, r) => { if (t === null) return null; if (typeof t == "function") return t; const a = { url: n === "GET" || n === "PATCH" ? `?${e}=` : "", method: n, headers: r, withCredentials: !1, timeout: s, onload: null, ondata: null, onerror: null }; if (Q(t)) return a.url = t, a; if (Object.assign(a, t), Q(a.headers)) { const i = a.headers.split(/:(.+)/); a.headers = { header: i[0], value: i[1] }; } return a.withCredentials = Es(a.withCredentials), a; }, Br = (e) => xr(e), Ur = (e) => e === null, k = (e) => typeof e == "object" && e !== null, Vr = (e) => k(e) && Q(e.url) && k(e.process) && k(e.revert) && k(e.restore) && k(e.fetch), wt = (e) => Et(e) ? "array" : Ur(e) ? "null" : He(e) ? "int" : /^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e) ? "bytes" : Vr(e) ? "api" : typeof e, Hr = (e) => e.replace(/{\s*'/g, '{"').replace(/'\s*}/g, '"}').replace(/'\s*:/g, '":').replace(/:\s*'/g, ':"').replace(/,\s*'/g, ',"').replace(/'\s*,/g, '",'), Yr = { array: vr, boolean: Es, int: (e) => wt(e) === "bytes" ? Rn(e) : at(e), number: hn, float: hn, bytes: Rn, string: (e) => Ae(e) ? e : pt(e), function: (e) => Gr(e), serverapi: Br, object: (e) => { try { return JSON.parse(Hr(e)); } catch { return null; } } }, Wr = (e, t) => Yr[t](e), Is = (e, t, n) => { if (e === t) return e; let s = wt(e); if (s !== n) { const r = Wr(e, n); if (s = wt(r), r === null) throw `Trying to assign value with incorrect type to "${option}", allowed type: "${n}"`; e = r; } return e; }, qr = (e, t) => { let n = e; return { enumerable: !0, get: () => n, set: (s) => { n = Is(s, e, t); } }; }, jr = (e) => { const t = {}; return Y(e, (n) => { const s = e[n]; t[n] = qr(s[0], s[1]); }), Te(t); }, $r = (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: jr(e) }), It = (e, t = "-") => e.split(/(?=[A-Z])/).map((n) => n.toLowerCase()).join(t), zr = (e, t) => { const n = {}; return Y(t, (s) => { n[s] = { get: () => e.getState().options[s], set: (r) => { e.dispatch(`SET_${It(s, "_").toUpperCase()}`, { value: r }); } }; }), n; }, kr = (e) => (t, n, s) => { const r = {}; return Y(e, (a) => { const i = It(a, "_").toUpperCase(); r[`SET_${i}`] = (l) => { try { s.options[a] = l.value; } catch { } t(`DID_SET_${i}`, { value: s.options[a] }); }; }), r; }, Xr = (e) => (t) => { const n = {}; return Y(e, (s) => { n[`GET_${It(s, "_").toUpperCase()}`] = (r) => t.options[s]; }), n; }, ae = { API: 1, DROP: 2, BROWSE: 3, PASTE: 4, NONE: 5 }, Vt = () => Math.random().toString(36).substring(2, 11), Ht = (e, t) => e.splice(t, 1), Zr = (e, t) => { t ? e() : document.hidden ? Promise.resolve(1).then(e) : setTimeout(e, 0); }, _t = () => { const e = [], t = (s, r) => { Ht( e, e.findIndex((a) => a.event === s && (a.cb === r || !r)) ); }, n = (s, r, a) => { e.filter((i) => i.event === s).map((i) => i.cb).forEach((i) => Zr(() => i(...r), a)); }; return { fireSync: (s, ...r) => { n(s, r, !0); }, fire: (s, ...r) => { n(s, r, !1); }, on: (s, r) => { e.push({ event: s, cb: r }); }, onOnce: (s, r) => { e.push({ event: s, cb: (...a) => { t(s, r), r(...a); } }); }, off: t }; }, _s = (e, t, n) => { Object.getOwnPropertyNames(e).filter((s) => !n.includes(s)).forEach( (s) => Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(e, s)) ); }, Qr = [ "fire", "process", "revert", "load", "on", "off", "onOnce", "retryLoad", "extend", "archive", "archived", "release", "released", "requestProcessing", "freeze" ], ee = (e) => { const t = {}; return _s(e, t, Qr), t; }, Kr = (e) => { e.forEach((t, n) => { t.released && Ht(e, n); }); }, x = { INIT: 1, IDLE: 2, PROCESSING_QUEUED: 9, PROCESSING: 3, PROCESSING_COMPLETE: 5, PROCESSING_ERROR: 6, PROCESSING_REVERT_ERROR: 10, LOADING: 7, LOAD_ERROR: 8 }, z = { INPUT: 1, LIMBO: 2, LOCAL: 3 }, ms = (e) => /[^0-9]+/.exec(e), Ts = () => ms(1.1.toLocaleString())[0], Jr = () => { const e = Ts(), t = 1e3.toLocaleString(); return t !== "1000" ? ms(t)[0] : e === "." ? "," : "."; }, g = { BOOLEAN: "boolean", INT: "int", NUMBER: "number", STRING: "string", ARRAY: "array", OBJECT: "object", FUNCTION: "function", ACTION: "action", SERVER_API: "serverapi", REGEX: "regex" }, Yt = [], le = (e, t, n) => new Promise((s, r) => { const a = Yt.filter((l) => l.key === e).map((l) => l.cb); if (a.length === 0) { s(t); return; } const i = a.shift(); a.reduce( // loop over promises passing value to next promise (l, o) => l.then((d) => o(d, n)), // call initial filter, will return a promise i(t, n) // all executed ).then((l) => s(l)).catch((l) => r(l)); }), Ne = (e, t, n) => Yt.filter((s) => s.key === e).map((s) => s.cb(t, n)), ei = (e, t) => Yt.push({ key: e, cb: t }), ti = (e) => Object.assign(xe, e), dt = () => ({ ...xe }), ni = (e) => { Y(e, (t, n) => { xe[t] && (xe[t][0] = Is( n, xe[t][0], xe[t][1] )); }); }, xe = { // the id to add to the root element id: [null, g.STRING], // input field name to use name: ["filepond", g.STRING], // disable the field disabled: [!1, g.BOOLEAN], // classname to put on wrapper className: [null, g.STRING], // is the field required required: [!1, g.BOOLEAN], // Allow media capture when value is set captureMethod: [null, g.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, g.BOOLEAN], // Feature toggles allowDrop: [!0, g.BOOLEAN], // Allow dropping of files allowBrowse: [!0, g.BOOLEAN], // Allow browsing the file system allowPaste: [!0, g.BOOLEAN], // Allow pasting files allowMultiple: [!1, g.BOOLEAN], // Allow multiple files (disabled by default, as multiple attribute is also required on input to allow multiple) allowReplace: [!0, g.BOOLEAN], // Allow dropping a file on other file to replace it (only works when multiple is set to false) allowRevert: [!0, g.BOOLEAN], // Allows user to revert file upload allowRemove: [!0, g.BOOLEAN], // Allow user to remove a file allowProcess: [!0, g.BOOLEAN], // Allows user to process a file, when set to false, this removes the file upload button allowReorder: [!1, g.BOOLEAN], // Allow reordering of files allowDirectoriesOnly: [!1, g.BOOLEAN], // Allow only selecting directories with browse (no support for filtering dnd at this point) // Try store file if `server` not set storeAsFile: [!1, g.BOOLEAN], // Revert mode forceRevert: [!1, g.BOOLEAN], // Set to 'force' to require the file to be reverted before removal // Input requirements maxFiles: [null, g.INT], // Max number of files checkValidity: [!1, g.BOOLEAN], // Enables custom validity messages // Where to put file itemInsertLocationFreedom: [!0, g.BOOLEAN], // Set to false to always add items to begin or end of list itemInsertLocation: ["before", g.STRING], // Default index in list to add items that have been dropped at the top of the list itemInsertInterval: [75, g.INT], // Drag 'n Drop related dropOnPage: [!1, g.BOOLEAN], // Allow dropping of files anywhere on page (prevents browser from opening file if dropped outside of Up) dropOnElement: [!0, g.BOOLEAN], // Drop needs to happen on element (set to false to also load drops outside of Up) dropValidation: [!1, g.BOOLEAN], // Enable or disable validating files on drop ignoredFiles: [[".ds_store", "thumbs.db", "desktop.ini"], g.ARRAY], // Upload related instantUpload: [!0, g.BOOLEAN], // Should upload files immediately on drop maxParallelUploads: [2, g.INT], // Maximum files to upload in parallel allowMinimumUploadDuration: [!0, g.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, g.BOOLEAN], // Enable chunked uploads chunkForce: [!1, g.BOOLEAN], // Force use of chunk uploads even for files smaller than chunk size chunkSize: [5e6, g.INT], // Size of chunks (5MB default) chunkRetryDelays: [[500, 1e3, 3e3], g.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, g.SERVER_API], // File size calculations, can set to 1024, this is only used for display, properties use file size base 1000 fileSizeBase: [1e3, g.INT], // Labels and status messages labelFileSizeBytes: ["bytes", g.STRING], labelFileSizeKilobytes: ["KB", g.STRING], labelFileSizeMegabytes: ["MB", g.STRING], labelFileSizeGigabytes: ["GB", g.STRING], labelDecimalSeparator: [Ts(), g.STRING], // Default is locale separator labelThousandsSeparator: [Jr(), g.STRING], // Default is locale separator labelIdle: [ 'Drag & Drop your files or <span class="filepond--label-action">Browse</span>', g.STRING ], labelInvalidField: ["Field contains invalid files", g.STRING], labelFileWaitingForSize: ["Waiting for size", g.STRING], labelFileSizeNotAvailable: ["Size not available", g.STRING], labelFileCountSingular: ["file in list", g.STRING], labelFileCountPlural: ["files in list", g.STRING], labelFileLoading: ["Loading", g.STRING], labelFileAdded: ["Added", g.STRING], // assistive only labelFileLoadError: ["Error during load", g.STRING], labelFileRemoved: ["Removed", g.STRING], // assistive only labelFileRemoveError: ["Error during remove", g.STRING], labelFileProcessing: ["Uploading", g.STRING], labelFileProcessingComplete: ["Upload complete", g.STRING], labelFileProcessingAborted: ["Upload cancelled", g.STRING], labelFileProcessingError: ["Error during upload", g.STRING], labelFileProcessingRevertError: ["Error during revert", g.STRING], labelTapToCancel: ["tap to cancel", g.STRING], labelTapToRetry: ["tap to retry", g.STRING], labelTapToUndo: ["tap to undo", g.STRING], labelButtonRemoveItem: ["Remove", g.STRING], labelButtonAbortItemLoad: ["Abort", g.STRING], labelButtonRetryItemLoad: ["Retry", g.STRING], labelButtonAbortItemProcessing: ["Cancel", g.STRING], labelButtonUndoItemProcessing: ["Undo", g.STRING], labelButtonRetryItemProcessing: ["Retry", g.STRING], labelButtonProcessItem: ["Upload", g.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>', g.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>', g.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>', g.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>', g.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>', g.STRING ], // event handlers oninit: [null, g.FUNCTION], onwarning: [null, g.FUNCTION], onerror: [null, g.FUNCTION], onactivatefile: [null, g.FUNCTION], oninitfile: [null, g.FUNCTION], onaddfilestart: [null, g.FUNCTION], onaddfileprogress: [null, g.FUNCTION], onaddfile: [null, g.FUNCTION], onprocessfilestart: [null, g.FUNCTION], onprocessfileprogress: [null, g.FUNCTION], onprocessfileabort: [null, g.FUNCTION], onprocessfilerevert: [null, g.FUNCTION], onprocessfile: [null, g.FUNCTION], onprocessfiles: [null, g.FUNCTION], onremovefile: [null, g.FUNCTION], onpreparefile: [null, g.FUNCTION], onupdatefiles: [null, g.FUNCTION], onreorderfiles: [null, g.FUNCTION], // hooks beforeDropFile: [null, g.FUNCTION], beforeAddFile: [null, g.FUNCTION], beforeRemoveFile: [null, g.FUNCTION], beforePrepareFile: [null, g.FUNCTION], // styles stylePanelLayout: [null, g.STRING], // null 'integrated', 'compact', 'circle' stylePanelAspectRatio: [null, g.STRING], // null or '3:2' or 1 styleItemPanelAspectRatio: [null, g.STRING], styleButtonRemoveItemPosition: ["left", g.STRING], styleButtonProcessItemPosition: ["right", g.STRING], styleLoadIndicatorPosition: ["right", g.STRING], styleProgressIndicatorPosition: ["right", g.STRING], styleButtonRemoveItemAlign: [!1, g.BOOLEAN], // custom initial files array files: [[], g.ARRAY], // show support by displaying credits credits: [["https://pqina.nl/", "Powered by PQINA"], g.ARRAY] }, Me = (e, t) => Ie(t) ? e[0] || null : He(t) ? e[t] || null : (typeof t == "object" && (t = t.id), e.find((n) => n.id === t) || null), gs = (e) => { if (Ie(e)) return e; if (/:/.test(e)) { const t = e.split(":"); return t[1] / t[0]; } return parseFloat(e); }, ce = (e) => e.filter((t) => !t.archived), si = { 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 Ke = null; const ri = () => { if (Ke === 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, Ke = t.files.length === 1; } catch { Ke = !1; } return Ke; }, ii = [ x.LOAD_ERROR, x.PROCESSING_ERROR, x.PROCESSING_REVERT_ERROR ], ai = [ x.LOADING, x.PROCESSING, x.PROCESSING_QUEUED, x.INIT ], oi = [x.PROCESSING_COMPLETE], li = (e) => ii.includes(e.status), ci = (e) => ai.includes(e.status), di = (e) => oi.includes(e.status), Sn = (e) => k(e.options.server) && (k(e.options.server.process) || Ae(e.options.server.process)), ui = (e) => ({ GET_STATUS: () => { const t = ce(e.items), { EMPTY: n, ERROR: s, BUSY: r, IDLE: a, READY: i } = si; return t.length === 0 ? n : t.some(li) ? s : t.some(ci) ? r : t.some(di) ? i : a; }, GET_ITEM: (t) => Me(e.items, t), GET_ACTIVE_ITEM: (t) => Me(ce(e.items), t), GET_ACTIVE_ITEMS: () => ce(e.items), GET_ITEMS: () => e.items, GET_ITEM_NAME: (t) => { const n = Me(e.items, t); return n ? n.filename : null; }, GET_ITEM_SIZE: (t) => { const n = Me(e.items, t); return n ? n.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 : gs(e.options.stylePanelAspectRatio), GET_ITEM_PANEL_ASPECT_RATIO: () => e.options.styleItemPanelAspectRatio, GET_ITEMS_BY_STATUS: (t) => ce(e.items).filter((n) => n.status === t), GET_TOTAL_ITEMS: () => ce(e.items).length, SHOULD_UPDATE_FILE_INPUT: () => e.options.storeAsFile && ri() && !Sn(e), IS_ASYNC: () => Sn(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 }) }), fi = (e) => { const t = ce(e.items).length; if (!e.options.allowMultiple) return t === 0; const n = e.options.maxFiles; return n === null || t < n; }, hs = (e, t, n) => Math.max(Math.min(n, e), t), Ei = (e, t, n) => e.splice(t, 0, n), pi = (e, t, n) => Ie(t) ? null : typeof n > "u" ? (e.push(t), t) : (n = hs(n, 0, e.length), Ei(e, n, t), t), Pt = (e) => /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test( e ), Ze = (e) => `${e}`.split("/").pop().split("?").shift(), mt = (e) => e.split(".").pop(), Ii = (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 : ""; }, We = (e, t = "") => (t + e).slice(-t.length), Rs = (e = /* @__PURE__ */ new Date()) => `${e.getFullYear()}-${We(e.getMonth() + 1, "00")}-${We( e.getDate(), "00" )}_${We(e.getHours(), "00")}-${We(e.getMinutes(), "00")}-${We( e.getSeconds(), "00" )}`, Ve = (e, t, n = null, s = null) => { const r = typeof n == "string" ? e.slice(0, e.size, n) : e.slice(0, e.size, e.type); return r.lastModifiedDate = /* @__PURE__ */ new Date(), e._relativePath && (r._relativePath = e._relativePath), Q(t) || (t = Rs()), t && s === null && mt(t) ? r.name = t : (s = s || Ii(r.type), r.name = t + (s ? "." + s : "")), r; }, _i = () => window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder, Os = (e, t) => { const n = _i(); if (n) { const s = new n(); return s.append(e), s.getBlob(t); } return new Blob([e], { type: t }); }, mi = (e, t) => { const n = new ArrayBuffer(e.length), s = new Uint8Array(n); for (let r = 0; r < e.length; r++) s[r] = e.charCodeAt(r); return Os(n, t); }, Ss = (e) => (/^data:(.+);/.exec(e) || [])[1] || null, Ti = (e) => e.split(",")[1].replace(/\s/g, ""), gi = (e) => atob(Ti(e)), hi = (e) => { const t = Ss(e), n = gi(e); return mi(n, t); }, Ri = (e, t, n) => Ve(hi(e), t, null, n), Oi = (e) => { if (!/^content-disposition:/i.test(e)) return null; const t = e.split(/filename=|filename\*=.+''/).splice(1).map((n) => n.trim().replace(/^["']|[;"']{0,2}$/g, "")).filter((n) => n.length); return t.length ? decodeURI(t[t.length - 1]) : null; }, Si = (e) => { if (/content-length:/i.test(e)) { const t = e.match(/[0-9]+/)[0]; return t ? parseInt(t, 10) : null; } return null; }, Di = (e) => /x-content-transfer-id:/i.test(e) && (e.split(":")[1] || "").trim() || null, Wt = (e) => { const t = { source: null, name: null, size: null }, n = e.split(` `); for (let s of n) { const r = Oi(s); if (r) { t.name = r; continue; } const a = Si(s); if (a) { t.size = a; continue; } const i = Di(s); if (i) { t.source = i; continue; } } return t; }, yi = (e) => { const t = { source: null, complete: !1, progress: 0, size: null, timestamp: null, duration: 0, request: null }, n = () => t.progress, s = () => { t.request && t.request.abort && t.request.abort(); }, r = () => { const l = t.source; i.fire("init", l), l instanceof File ? i.fire("load", l) : l instanceof Blob ? i.fire("load", Ve(l, l.name)) : Pt(l) ? i.fire("load", Ri(l)) : a(l); }, a = (l) => { if (!e) { i.fire("error", { type: "error", body: "Can't load URL", code: 400 }); return; } t.timestamp = Date.now(), t.request = e( l, (o) => { t.duration = Date.now() - t.timestamp, t.complete = !0, o instanceof Blob && (o = Ve(o, o.name || Ze(l))), i.fire( "load", // if has received blob, we go with blob, if no response, we return null o instanceof Blob ? o : o ? o.body : null ); }, (o) => { i.fire( "error", typeof o == "string" ? { type: "error", code: 0, body: o } : o ); }, (o, d, c) => { if (c && (t.size = c), t.duration = Date.now() - t.timestamp, !o) { t.progress = null; return; } t.progress = d / c, i.fire("progress", t.progress); }, () => { i.fire("abort"); }, (o) => { const d = Wt( typeof o == "string" ? o : o.headers ); i.fire("meta", { size: t.size || d.size, filename: d.name, source: d.source }); } ); }, i = { ..._t(), setSource: (l) => t.source = l, getProgress: n, // file load progress abort: s, // abort file load load: r // start load }; return i; }, Dn = (e) => /GET|HEAD/.test(e), Le = (e, t, n) => { const s = { onheaders: () => { }, onprogress: () => { }, onload: () => { }, ontimeout: () => { }, onerror: () => { }, onabort: () => { }, abort: () => { r = !0, i.abort(); } }; let r = !1, a = !1; n = { method: "POST", headers: {}, withCredentials: !1, ...n }, t = encodeURI(t), Dn(n.method) && e && (t = `${t}${encodeURIComponent(typeof e == "string" ? e : JSON.stringify(e))}`); const i = new XMLHttpRequest(), l = Dn(n.method) ? i : i.upload; return l.onprogress = (o) => { r || s.onprogress(o.lengthComputable, o.loaded, o.total); }, i.onreadystatechange = () => { i.readyState < 2 || i.readyState === 4 && i.status === 0 || a || (a = !0, s.onheaders(i)); }, i.onload = () => { i.status >= 200 && i.status < 300 ? s.onload(i) : s.onerror(i); }, i.onerror = () => s.onerror(i), i.onabort = () => { r = !0, s.onabort(); }, i.ontimeout = () => s.ontimeout(i), i.open(n.method, t, !0), He(n.timeout) && (i.timeout = n.timeout), Object.keys(n.headers).forEach((o) => { const d = unescape(encodeURIComponent(n.headers[o])); i.setRequestHeader(o, d); }), n.responseType && (i.responseType = n.responseType), n.withCredentials && (i.withCredentials = !0), i.send(e), s; }, W = (e, t, n, s) => ({ type: e, code: t, body: n, headers: s }), we = (e) => (t) => { e(W("error", 0, "Timeout", t.getAllResponseHeaders())); }, yn = (e) => /\?/.test(e), $e = (...e) => { let t = ""; return e.forEach((n) => { t += yn(t) && yn(n) ? n.replace(/\?/, "&") : n; }), t; }, Rt = (e = "", t) => { if (typeof t == "function") return t; if (!t || !Q(t.url)) return null; const n = t.onload || ((r) => r), s = t.onerror || ((r) => null); return (r, a, i, l, o, d) => { const c = Le(r, $e(e, t.url), { ...t, responseType: "blob" }); return c.onload = (f) => { const I = f.getAllResponseHeaders(), p = Wt(I).name || Ze(r); a( W( "load", f.status, t.method === "HEAD" ? null : Ve(n(f.response), p), I ) ); }, c.onerror = (f) => { i( W( "error", f.status, s(f.response) || f.statusText, f.getAllResponseHeaders() ) ); }, c.onheaders = (f) => { d(W("headers", f.status, null, f.getAllResponseHeaders())); }, c.ontimeout = we(i), c.onprogress = l, c.onabort = o, c; }; }, se = { QUEUED: 0, COMPLETE: 1, PROCESSING: 2, ERROR: 3, WAITING: 4 }, Ai = (e, t, n, s, r, a, i, l, o, d, c) => { const f = [], { chunkTransferId: I, chunkServer: p, chunkSize: u, chunkRetryDelays: _ } = c, T = { serverId: I, aborted: !1 }, h = t.ondata || ((M) => M), E = t.onload || ((M, B) => B === "HEAD" ? M.getResponseHeader("Upload-Offset") : M.response), m = t.onerror || ((M) => null), R = (M) => { const B = new FormData(); k(r) && B.append(n, JSON.stringify(r)); const O = typeof t.headers == "function" ? t.headers(s, r) : { ...t.headers, "Upload-Length": s.size }, A = { ...t, headers: O }, b = Le(h(B), $e(e, t.url), A); b.onload = (v) => M(E(v, A.method)), b.onerror = (v) => i( W( "error", v.status, m(v.response) || v.statusText, v.getAllResponseHeaders() ) ), b.ontimeout = we(i); }, D = (M) => { const B = $e(e, p.url, T.serverId), A = { headers: typeof t.headers == "function" ? t.headers(T.serverId) : { ...t.headers }, method: "HEAD" }, b = Le(null, B, A); b.onload = (v) => M(E(v, A.method)), b.onerror = (v) => i( W( "error", v.status, m(v.response) || v.statusText, v.getAllResponseHeaders() ) ), b.ontimeout = we(i); }, L = Math.floor(s.size / u); for (let M = 0; M <= L; M++) { const B = M * u, O = s.slice(B, B + u, "application/offset+octet-stream"); f[M] = { index: M, size: O.size, of