Files
nuhodds_fi4/public/js/filament/forms/components/select.js
T
2026-03-23 06:58:36 +01:00

4630 lines
159 KiB
JavaScript

var Ft = Math.min,
vt = Math.max,
Ht = Math.round;
var st = (n) => ({ x: n, y: n }),
ji = { left: "right", right: "left", bottom: "top", top: "bottom" },
qi = { start: "end", end: "start" };
function De(n, t, e) {
return vt(n, Ft(t, e));
}
function Vt(n, t) {
return typeof n == "function" ? n(t) : n;
}
function yt(n) {
return n.split("-")[0];
}
function Wt(n) {
return n.split("-")[1];
}
function Ae(n) {
return n === "x" ? "y" : "x";
}
function Ce(n) {
return n === "y" ? "height" : "width";
}
var Ji = new Set(["top", "bottom"]);
function ht(n) {
return Ji.has(yt(n)) ? "y" : "x";
}
function Le(n) {
return Ae(ht(n));
}
function Je(n, t, e) {
e === void 0 && (e = !1);
let i = Wt(n),
o = Le(n),
s = Ce(o),
r =
o === "x"
? i === (e ? "end" : "start")
? "right"
: "left"
: i === "start"
? "bottom"
: "top";
return (t.reference[s] > t.floating[s] && (r = Bt(r)), [r, Bt(r)]);
}
function Qe(n) {
let t = Bt(n);
return [ie(n), t, ie(t)];
}
function ie(n) {
return n.replace(/start|end/g, (t) => qi[t]);
}
var je = ["left", "right"],
qe = ["right", "left"],
Qi = ["top", "bottom"],
Zi = ["bottom", "top"];
function tn(n, t, e) {
switch (n) {
case "top":
case "bottom":
return e ? (t ? qe : je) : t ? je : qe;
case "left":
case "right":
return t ? Qi : Zi;
default:
return [];
}
}
function Ze(n, t, e, i) {
let o = Wt(n),
s = tn(yt(n), e === "start", i);
return (
o && ((s = s.map((r) => r + "-" + o)), t && (s = s.concat(s.map(ie)))),
s
);
}
function Bt(n) {
return n.replace(/left|right|bottom|top/g, (t) => ji[t]);
}
function en(n) {
return { top: 0, right: 0, bottom: 0, left: 0, ...n };
}
function ti(n) {
return typeof n != "number"
? en(n)
: { top: n, right: n, bottom: n, left: n };
}
function Ot(n) {
let { x: t, y: e, width: i, height: o } = n;
return {
width: i,
height: o,
top: e,
left: t,
right: t + i,
bottom: e + o,
x: t,
y: e,
};
}
function ei(n, t, e) {
let { reference: i, floating: o } = n,
s = ht(t),
r = Le(t),
a = Ce(r),
l = yt(t),
c = s === "y",
f = i.x + i.width / 2 - o.width / 2,
d = i.y + i.height / 2 - o.height / 2,
p = i[a] / 2 - o[a] / 2,
u;
switch (l) {
case "top":
u = { x: f, y: i.y - o.height };
break;
case "bottom":
u = { x: f, y: i.y + i.height };
break;
case "right":
u = { x: i.x + i.width, y: d };
break;
case "left":
u = { x: i.x - o.width, y: d };
break;
default:
u = { x: i.x, y: i.y };
}
switch (Wt(t)) {
case "start":
u[r] -= p * (e && c ? -1 : 1);
break;
case "end":
u[r] += p * (e && c ? -1 : 1);
break;
}
return u;
}
var ii = async (n, t, e) => {
let {
placement: i = "bottom",
strategy: o = "absolute",
middleware: s = [],
platform: r,
} = e,
a = s.filter(Boolean),
l = await (r.isRTL == null ? void 0 : r.isRTL(t)),
c = await r.getElementRects({ reference: n, floating: t, strategy: o }),
{ x: f, y: d } = ei(c, i, l),
p = i,
u = {},
g = 0;
for (let m = 0; m < a.length; m++) {
let { name: S, fn: E } = a[m],
{
x: w,
y: D,
data: A,
reset: C,
} = await E({
x: f,
y: d,
initialPlacement: i,
placement: p,
strategy: o,
middlewareData: u,
rects: c,
platform: r,
elements: { reference: n, floating: t },
});
((f = w ?? f),
(d = D ?? d),
(u = { ...u, [S]: { ...u[S], ...A } }),
C &&
g <= 50 &&
(g++,
typeof C == "object" &&
(C.placement && (p = C.placement),
C.rects &&
(c =
C.rects === !0
? await r.getElementRects({
reference: n,
floating: t,
strategy: o,
})
: C.rects),
({ x: f, y: d } = ei(c, p, l))),
(m = -1)));
}
return { x: f, y: d, placement: p, strategy: o, middlewareData: u };
};
async function Ie(n, t) {
var e;
t === void 0 && (t = {});
let { x: i, y: o, platform: s, rects: r, elements: a, strategy: l } = n,
{
boundary: c = "clippingAncestors",
rootBoundary: f = "viewport",
elementContext: d = "floating",
altBoundary: p = !1,
padding: u = 0,
} = Vt(t, n),
g = ti(u),
S = a[p ? (d === "floating" ? "reference" : "floating") : d],
E = Ot(
await s.getClippingRect({
element:
(e = await (s.isElement == null
? void 0
: s.isElement(S))) == null || e
? S
: S.contextElement ||
(await (s.getDocumentElement == null
? void 0
: s.getDocumentElement(a.floating))),
boundary: c,
rootBoundary: f,
strategy: l,
}),
),
w =
d === "floating"
? {
x: i,
y: o,
width: r.floating.width,
height: r.floating.height,
}
: r.reference,
D = await (s.getOffsetParent == null
? void 0
: s.getOffsetParent(a.floating)),
A = (await (s.isElement == null ? void 0 : s.isElement(D)))
? (await (s.getScale == null ? void 0 : s.getScale(D))) || {
x: 1,
y: 1,
}
: { x: 1, y: 1 },
C = Ot(
s.convertOffsetParentRelativeRectToViewportRelativeRect
? await s.convertOffsetParentRelativeRectToViewportRelativeRect(
{ elements: a, rect: w, offsetParent: D, strategy: l },
)
: w,
);
return {
top: (E.top - C.top + g.top) / A.y,
bottom: (C.bottom - E.bottom + g.bottom) / A.y,
left: (E.left - C.left + g.left) / A.x,
right: (C.right - E.right + g.right) / A.x,
};
}
var ni = function (n) {
return (
n === void 0 && (n = {}),
{
name: "flip",
options: n,
async fn(t) {
var e, i;
let {
placement: o,
middlewareData: s,
rects: r,
initialPlacement: a,
platform: l,
elements: c,
} = t,
{
mainAxis: f = !0,
crossAxis: d = !0,
fallbackPlacements: p,
fallbackStrategy: u = "bestFit",
fallbackAxisSideDirection: g = "none",
flipAlignment: m = !0,
...S
} = Vt(n, t);
if ((e = s.arrow) != null && e.alignmentOffset) return {};
let E = yt(o),
w = ht(a),
D = yt(a) === a,
A = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)),
C = p || (D || !m ? [Bt(a)] : Qe(a)),
F = g !== "none";
!p && F && C.push(...Ze(a, m, g, A));
let q = [a, ...C],
J = await Ie(t, S),
_ = [],
V = ((i = s.flip) == null ? void 0 : i.overflows) || [];
if ((f && _.push(J[E]), d)) {
let k = Je(o, r, A);
_.push(J[k[0]], J[k[1]]);
}
if (
((V = [...V, { placement: o, overflows: _ }]),
!_.every((k) => k <= 0))
) {
var W, tt;
let k =
(((W = s.flip) == null ? void 0 : W.index) || 0) +
1,
Y = q[k];
if (
Y &&
(!(d === "alignment" ? w !== ht(Y) : !1) ||
V.every((L) =>
ht(L.placement) === w ? L.overflows[0] > 0 : !0,
))
)
return {
data: { index: k, overflows: V },
reset: { placement: Y },
};
let B =
(tt = V.filter((X) => X.overflows[0] <= 0).sort(
(X, L) => X.overflows[1] - L.overflows[1],
)[0]) == null
? void 0
: tt.placement;
if (!B)
switch (u) {
case "bestFit": {
var z;
let X =
(z = V.filter((L) => {
if (F) {
let et = ht(L.placement);
return et === w || et === "y";
}
return !0;
})
.map((L) => [
L.placement,
L.overflows
.filter((et) => et > 0)
.reduce((et, ee) => et + ee, 0),
])
.sort((L, et) => L[1] - et[1])[0]) ==
null
? void 0
: z[0];
X && (B = X);
break;
}
case "initialPlacement":
B = a;
break;
}
if (o !== B) return { reset: { placement: B } };
}
return {};
},
}
);
};
var nn = new Set(["left", "top"]);
async function on(n, t) {
let { placement: e, platform: i, elements: o } = n,
s = await (i.isRTL == null ? void 0 : i.isRTL(o.floating)),
r = yt(e),
a = Wt(e),
l = ht(e) === "y",
c = nn.has(r) ? -1 : 1,
f = s && l ? -1 : 1,
d = Vt(t, n),
{
mainAxis: p,
crossAxis: u,
alignmentAxis: g,
} = typeof d == "number"
? { mainAxis: d, crossAxis: 0, alignmentAxis: null }
: {
mainAxis: d.mainAxis || 0,
crossAxis: d.crossAxis || 0,
alignmentAxis: d.alignmentAxis,
};
return (
a && typeof g == "number" && (u = a === "end" ? g * -1 : g),
l ? { x: u * f, y: p * c } : { x: p * c, y: u * f }
);
}
var oi = function (n) {
return (
n === void 0 && (n = 0),
{
name: "offset",
options: n,
async fn(t) {
var e, i;
let { x: o, y: s, placement: r, middlewareData: a } = t,
l = await on(t, n);
return r ===
((e = a.offset) == null ? void 0 : e.placement) &&
(i = a.arrow) != null &&
i.alignmentOffset
? {}
: {
x: o + l.x,
y: s + l.y,
data: { ...l, placement: r },
};
},
}
);
},
si = function (n) {
return (
n === void 0 && (n = {}),
{
name: "shift",
options: n,
async fn(t) {
let { x: e, y: i, placement: o } = t,
{
mainAxis: s = !0,
crossAxis: r = !1,
limiter: a = {
fn: (S) => {
let { x: E, y: w } = S;
return { x: E, y: w };
},
},
...l
} = Vt(n, t),
c = { x: e, y: i },
f = await Ie(t, l),
d = ht(yt(o)),
p = Ae(d),
u = c[p],
g = c[d];
if (s) {
let S = p === "y" ? "top" : "left",
E = p === "y" ? "bottom" : "right",
w = u + f[S],
D = u - f[E];
u = De(w, u, D);
}
if (r) {
let S = d === "y" ? "top" : "left",
E = d === "y" ? "bottom" : "right",
w = g + f[S],
D = g - f[E];
g = De(w, g, D);
}
let m = a.fn({ ...t, [p]: u, [d]: g });
return {
...m,
data: {
x: m.x - e,
y: m.y - i,
enabled: { [p]: s, [d]: r },
},
};
},
}
);
};
function oe() {
return typeof window < "u";
}
function Et(n) {
return ai(n) ? (n.nodeName || "").toLowerCase() : "#document";
}
function U(n) {
var t;
return (
(n == null || (t = n.ownerDocument) == null ? void 0 : t.defaultView) ||
window
);
}
function ct(n) {
var t;
return (t = (ai(n) ? n.ownerDocument : n.document) || window.document) ==
null
? void 0
: t.documentElement;
}
function ai(n) {
return oe() ? n instanceof Node || n instanceof U(n).Node : !1;
}
function it(n) {
return oe() ? n instanceof Element || n instanceof U(n).Element : !1;
}
function rt(n) {
return oe()
? n instanceof HTMLElement || n instanceof U(n).HTMLElement
: !1;
}
function ri(n) {
return !oe() || typeof ShadowRoot > "u"
? !1
: n instanceof ShadowRoot || n instanceof U(n).ShadowRoot;
}
var sn = new Set(["inline", "contents"]);
function It(n) {
let { overflow: t, overflowX: e, overflowY: i, display: o } = nt(n);
return /auto|scroll|overlay|hidden|clip/.test(t + i + e) && !sn.has(o);
}
var rn = new Set(["table", "td", "th"]);
function li(n) {
return rn.has(Et(n));
}
var an = [":popover-open", ":modal"];
function zt(n) {
return an.some((t) => {
try {
return n.matches(t);
} catch {
return !1;
}
});
}
var ln = ["transform", "translate", "scale", "rotate", "perspective"],
cn = ["transform", "translate", "scale", "rotate", "perspective", "filter"],
dn = ["paint", "layout", "strict", "content"];
function se(n) {
let t = re(),
e = it(n) ? nt(n) : n;
return (
ln.some((i) => (e[i] ? e[i] !== "none" : !1)) ||
(e.containerType ? e.containerType !== "normal" : !1) ||
(!t && (e.backdropFilter ? e.backdropFilter !== "none" : !1)) ||
(!t && (e.filter ? e.filter !== "none" : !1)) ||
cn.some((i) => (e.willChange || "").includes(i)) ||
dn.some((i) => (e.contain || "").includes(i))
);
}
function ci(n) {
let t = ut(n);
for (; rt(t) && !Dt(t); ) {
if (se(t)) return t;
if (zt(t)) return null;
t = ut(t);
}
return null;
}
function re() {
return typeof CSS > "u" || !CSS.supports
? !1
: CSS.supports("-webkit-backdrop-filter", "none");
}
var fn = new Set(["html", "body", "#document"]);
function Dt(n) {
return fn.has(Et(n));
}
function nt(n) {
return U(n).getComputedStyle(n);
}
function Xt(n) {
return it(n)
? { scrollLeft: n.scrollLeft, scrollTop: n.scrollTop }
: { scrollLeft: n.scrollX, scrollTop: n.scrollY };
}
function ut(n) {
if (Et(n) === "html") return n;
let t = n.assignedSlot || n.parentNode || (ri(n) && n.host) || ct(n);
return ri(t) ? t.host : t;
}
function di(n) {
let t = ut(n);
return Dt(t)
? n.ownerDocument
? n.ownerDocument.body
: n.body
: rt(t) && It(t)
? t
: di(t);
}
function ne(n, t, e) {
var i;
(t === void 0 && (t = []), e === void 0 && (e = !0));
let o = di(n),
s = o === ((i = n.ownerDocument) == null ? void 0 : i.body),
r = U(o);
if (s) {
let a = ae(r);
return t.concat(
r,
r.visualViewport || [],
It(o) ? o : [],
a && e ? ne(a) : [],
);
}
return t.concat(o, ne(o, [], e));
}
function ae(n) {
return n.parent && Object.getPrototypeOf(n.parent) ? n.frameElement : null;
}
function pi(n) {
let t = nt(n),
e = parseFloat(t.width) || 0,
i = parseFloat(t.height) || 0,
o = rt(n),
s = o ? n.offsetWidth : e,
r = o ? n.offsetHeight : i,
a = Ht(e) !== s || Ht(i) !== r;
return (a && ((e = s), (i = r)), { width: e, height: i, $: a });
}
function gi(n) {
return it(n) ? n : n.contextElement;
}
function Tt(n) {
let t = gi(n);
if (!rt(t)) return st(1);
let e = t.getBoundingClientRect(),
{ width: i, height: o, $: s } = pi(t),
r = (s ? Ht(e.width) : e.width) / i,
a = (s ? Ht(e.height) : e.height) / o;
return (
(!r || !Number.isFinite(r)) && (r = 1),
(!a || !Number.isFinite(a)) && (a = 1),
{ x: r, y: a }
);
}
var hn = st(0);
function mi(n) {
let t = U(n);
return !re() || !t.visualViewport
? hn
: { x: t.visualViewport.offsetLeft, y: t.visualViewport.offsetTop };
}
function un(n, t, e) {
return (t === void 0 && (t = !1), !e || (t && e !== U(n)) ? !1 : t);
}
function $t(n, t, e, i) {
(t === void 0 && (t = !1), e === void 0 && (e = !1));
let o = n.getBoundingClientRect(),
s = gi(n),
r = st(1);
t && (i ? it(i) && (r = Tt(i)) : (r = Tt(n)));
let a = un(s, e, i) ? mi(s) : st(0),
l = (o.left + a.x) / r.x,
c = (o.top + a.y) / r.y,
f = o.width / r.x,
d = o.height / r.y;
if (s) {
let p = U(s),
u = i && it(i) ? U(i) : i,
g = p,
m = ae(g);
for (; m && i && u !== g; ) {
let S = Tt(m),
E = m.getBoundingClientRect(),
w = nt(m),
D = E.left + (m.clientLeft + parseFloat(w.paddingLeft)) * S.x,
A = E.top + (m.clientTop + parseFloat(w.paddingTop)) * S.y;
((l *= S.x),
(c *= S.y),
(f *= S.x),
(d *= S.y),
(l += D),
(c += A),
(g = U(m)),
(m = ae(g)));
}
}
return Ot({ width: f, height: d, x: l, y: c });
}
function le(n, t) {
let e = Xt(n).scrollLeft;
return t ? t.left + e : $t(ct(n)).left + e;
}
function bi(n, t) {
let e = n.getBoundingClientRect(),
i = e.left + t.scrollLeft - le(n, e),
o = e.top + t.scrollTop;
return { x: i, y: o };
}
function pn(n) {
let { elements: t, rect: e, offsetParent: i, strategy: o } = n,
s = o === "fixed",
r = ct(i),
a = t ? zt(t.floating) : !1;
if (i === r || (a && s)) return e;
let l = { scrollLeft: 0, scrollTop: 0 },
c = st(1),
f = st(0),
d = rt(i);
if (
(d || (!d && !s)) &&
((Et(i) !== "body" || It(r)) && (l = Xt(i)), rt(i))
) {
let u = $t(i);
((c = Tt(i)), (f.x = u.x + i.clientLeft), (f.y = u.y + i.clientTop));
}
let p = r && !d && !s ? bi(r, l) : st(0);
return {
width: e.width * c.x,
height: e.height * c.y,
x: e.x * c.x - l.scrollLeft * c.x + f.x + p.x,
y: e.y * c.y - l.scrollTop * c.y + f.y + p.y,
};
}
function gn(n) {
return Array.from(n.getClientRects());
}
function mn(n) {
let t = ct(n),
e = Xt(n),
i = n.ownerDocument.body,
o = vt(t.scrollWidth, t.clientWidth, i.scrollWidth, i.clientWidth),
s = vt(t.scrollHeight, t.clientHeight, i.scrollHeight, i.clientHeight),
r = -e.scrollLeft + le(n),
a = -e.scrollTop;
return (
nt(i).direction === "rtl" &&
(r += vt(t.clientWidth, i.clientWidth) - o),
{ width: o, height: s, x: r, y: a }
);
}
var fi = 25;
function bn(n, t) {
let e = U(n),
i = ct(n),
o = e.visualViewport,
s = i.clientWidth,
r = i.clientHeight,
a = 0,
l = 0;
if (o) {
((s = o.width), (r = o.height));
let f = re();
(!f || (f && t === "fixed")) && ((a = o.offsetLeft), (l = o.offsetTop));
}
let c = le(i);
if (c <= 0) {
let f = i.ownerDocument,
d = f.body,
p = getComputedStyle(d),
u =
(f.compatMode === "CSS1Compat" &&
parseFloat(p.marginLeft) + parseFloat(p.marginRight)) ||
0,
g = Math.abs(i.clientWidth - d.clientWidth - u);
g <= fi && (s -= g);
} else c <= fi && (s += c);
return { width: s, height: r, x: a, y: l };
}
var vn = new Set(["absolute", "fixed"]);
function yn(n, t) {
let e = $t(n, !0, t === "fixed"),
i = e.top + n.clientTop,
o = e.left + n.clientLeft,
s = rt(n) ? Tt(n) : st(1),
r = n.clientWidth * s.x,
a = n.clientHeight * s.y,
l = o * s.x,
c = i * s.y;
return { width: r, height: a, x: l, y: c };
}
function hi(n, t, e) {
let i;
if (t === "viewport") i = bn(n, e);
else if (t === "document") i = mn(ct(n));
else if (it(t)) i = yn(t, e);
else {
let o = mi(n);
i = { x: t.x - o.x, y: t.y - o.y, width: t.width, height: t.height };
}
return Ot(i);
}
function vi(n, t) {
let e = ut(n);
return e === t || !it(e) || Dt(e)
? !1
: nt(e).position === "fixed" || vi(e, t);
}
function wn(n, t) {
let e = t.get(n);
if (e) return e;
let i = ne(n, [], !1).filter((a) => it(a) && Et(a) !== "body"),
o = null,
s = nt(n).position === "fixed",
r = s ? ut(n) : n;
for (; it(r) && !Dt(r); ) {
let a = nt(r),
l = se(r);
(!l && a.position === "fixed" && (o = null),
(
s
? !l && !o
: (!l &&
a.position === "static" &&
!!o &&
vn.has(o.position)) ||
(It(r) && !l && vi(n, r))
)
? (i = i.filter((f) => f !== r))
: (o = a),
(r = ut(r)));
}
return (t.set(n, i), i);
}
function Sn(n) {
let { element: t, boundary: e, rootBoundary: i, strategy: o } = n,
r = [
...(e === "clippingAncestors"
? zt(t)
? []
: wn(t, this._c)
: [].concat(e)),
i,
],
a = r[0],
l = r.reduce(
(c, f) => {
let d = hi(t, f, o);
return (
(c.top = vt(d.top, c.top)),
(c.right = Ft(d.right, c.right)),
(c.bottom = Ft(d.bottom, c.bottom)),
(c.left = vt(d.left, c.left)),
c
);
},
hi(t, a, o),
);
return {
width: l.right - l.left,
height: l.bottom - l.top,
x: l.left,
y: l.top,
};
}
function xn(n) {
let { width: t, height: e } = pi(n);
return { width: t, height: e };
}
function On(n, t, e) {
let i = rt(t),
o = ct(t),
s = e === "fixed",
r = $t(n, !0, s, t),
a = { scrollLeft: 0, scrollTop: 0 },
l = st(0);
function c() {
l.x = le(o);
}
if (i || (!i && !s))
if (((Et(t) !== "body" || It(o)) && (a = Xt(t)), i)) {
let u = $t(t, !0, s, t);
((l.x = u.x + t.clientLeft), (l.y = u.y + t.clientTop));
} else o && c();
s && !i && o && c();
let f = o && !i && !s ? bi(o, a) : st(0),
d = r.left + a.scrollLeft - l.x - f.x,
p = r.top + a.scrollTop - l.y - f.y;
return { x: d, y: p, width: r.width, height: r.height };
}
function Te(n) {
return nt(n).position === "static";
}
function ui(n, t) {
if (!rt(n) || nt(n).position === "fixed") return null;
if (t) return t(n);
let e = n.offsetParent;
return (ct(n) === e && (e = e.ownerDocument.body), e);
}
function yi(n, t) {
let e = U(n);
if (zt(n)) return e;
if (!rt(n)) {
let o = ut(n);
for (; o && !Dt(o); ) {
if (it(o) && !Te(o)) return o;
o = ut(o);
}
return e;
}
let i = ui(n, t);
for (; i && li(i) && Te(i); ) i = ui(i, t);
return i && Dt(i) && Te(i) && !se(i) ? e : i || ci(n) || e;
}
var En = async function (n) {
let t = this.getOffsetParent || yi,
e = this.getDimensions,
i = await e(n.floating);
return {
reference: On(n.reference, await t(n.floating), n.strategy),
floating: { x: 0, y: 0, width: i.width, height: i.height },
};
};
function Dn(n) {
return nt(n).direction === "rtl";
}
var An = {
convertOffsetParentRelativeRectToViewportRelativeRect: pn,
getDocumentElement: ct,
getClippingRect: Sn,
getOffsetParent: yi,
getElementRects: En,
getClientRects: gn,
getDimensions: xn,
getScale: Tt,
isElement: it,
isRTL: Dn,
};
var wi = oi;
var Si = si,
xi = ni;
var Oi = (n, t, e) => {
let i = new Map(),
o = { platform: An, ...e },
s = { ...o.platform, _c: i };
return ii(n, t, { ...o, platform: s });
};
function Ei(n, t) {
var e = Object.keys(n);
if (Object.getOwnPropertySymbols) {
var i = Object.getOwnPropertySymbols(n);
(t &&
(i = i.filter(function (o) {
return Object.getOwnPropertyDescriptor(n, o).enumerable;
})),
e.push.apply(e, i));
}
return e;
}
function ft(n) {
for (var t = 1; t < arguments.length; t++) {
var e = arguments[t] != null ? arguments[t] : {};
t % 2
? Ei(Object(e), !0).forEach(function (i) {
Cn(n, i, e[i]);
})
: Object.getOwnPropertyDescriptors
? Object.defineProperties(n, Object.getOwnPropertyDescriptors(e))
: Ei(Object(e)).forEach(function (i) {
Object.defineProperty(
n,
i,
Object.getOwnPropertyDescriptor(e, i),
);
});
}
return n;
}
function ue(n) {
"@babel/helpers - typeof";
return (
typeof Symbol == "function" && typeof Symbol.iterator == "symbol"
? (ue = function (t) {
return typeof t;
})
: (ue = function (t) {
return t &&
typeof Symbol == "function" &&
t.constructor === Symbol &&
t !== Symbol.prototype
? "symbol"
: typeof t;
}),
ue(n)
);
}
function Cn(n, t, e) {
return (
t in n
? Object.defineProperty(n, t, {
value: e,
enumerable: !0,
configurable: !0,
writable: !0,
})
: (n[t] = e),
n
);
}
function gt() {
return (
(gt =
Object.assign ||
function (n) {
for (var t = 1; t < arguments.length; t++) {
var e = arguments[t];
for (var i in e)
Object.prototype.hasOwnProperty.call(e, i) &&
(n[i] = e[i]);
}
return n;
}),
gt.apply(this, arguments)
);
}
function Ln(n, t) {
if (n == null) return {};
var e = {},
i = Object.keys(n),
o,
s;
for (s = 0; s < i.length; s++)
((o = i[s]), !(t.indexOf(o) >= 0) && (e[o] = n[o]));
return e;
}
function In(n, t) {
if (n == null) return {};
var e = Ln(n, t),
i,
o;
if (Object.getOwnPropertySymbols) {
var s = Object.getOwnPropertySymbols(n);
for (o = 0; o < s.length; o++)
((i = s[o]),
!(t.indexOf(i) >= 0) &&
Object.prototype.propertyIsEnumerable.call(n, i) &&
(e[i] = n[i]));
}
return e;
}
var Tn = "1.15.6";
function pt(n) {
if (typeof window < "u" && window.navigator)
return !!navigator.userAgent.match(n);
}
var mt = pt(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),
Zt = pt(/Edge/i),
Di = pt(/firefox/i),
Gt = pt(/safari/i) && !pt(/chrome/i) && !pt(/android/i),
$e = pt(/iP(ad|od|hone)/i),
Pi = pt(/chrome/i) && pt(/android/i),
Mi = { capture: !1, passive: !1 };
function O(n, t, e) {
n.addEventListener(t, e, !mt && Mi);
}
function x(n, t, e) {
n.removeEventListener(t, e, !mt && Mi);
}
function ve(n, t) {
if (t) {
if ((t[0] === ">" && (t = t.substring(1)), n))
try {
if (n.matches) return n.matches(t);
if (n.msMatchesSelector) return n.msMatchesSelector(t);
if (n.webkitMatchesSelector) return n.webkitMatchesSelector(t);
} catch {
return !1;
}
return !1;
}
}
function Ni(n) {
return n.host && n !== document && n.host.nodeType ? n.host : n.parentNode;
}
function lt(n, t, e, i) {
if (n) {
e = e || document;
do {
if (
(t != null &&
(t[0] === ">"
? n.parentNode === e && ve(n, t)
: ve(n, t))) ||
(i && n === e)
)
return n;
if (n === e) break;
} while ((n = Ni(n)));
}
return null;
}
var Ai = /\s+/g;
function Q(n, t, e) {
if (n && t)
if (n.classList) n.classList[e ? "add" : "remove"](t);
else {
var i = (" " + n.className + " ")
.replace(Ai, " ")
.replace(" " + t + " ", " ");
n.className = (i + (e ? " " + t : "")).replace(Ai, " ");
}
}
function b(n, t, e) {
var i = n && n.style;
if (i) {
if (e === void 0)
return (
document.defaultView && document.defaultView.getComputedStyle
? (e = document.defaultView.getComputedStyle(n, ""))
: n.currentStyle && (e = n.currentStyle),
t === void 0 ? e : e[t]
);
(!(t in i) && t.indexOf("webkit") === -1 && (t = "-webkit-" + t),
(i[t] = e + (typeof e == "string" ? "" : "px")));
}
}
function Nt(n, t) {
var e = "";
if (typeof n == "string") e = n;
else
do {
var i = b(n, "transform");
i && i !== "none" && (e = i + " " + e);
} while (!t && (n = n.parentNode));
var o =
window.DOMMatrix ||
window.WebKitCSSMatrix ||
window.CSSMatrix ||
window.MSCSSMatrix;
return o && new o(e);
}
function ki(n, t, e) {
if (n) {
var i = n.getElementsByTagName(t),
o = 0,
s = i.length;
if (e) for (; o < s; o++) e(i[o], o);
return i;
}
return [];
}
function dt() {
var n = document.scrollingElement;
return n || document.documentElement;
}
function N(n, t, e, i, o) {
if (!(!n.getBoundingClientRect && n !== window)) {
var s, r, a, l, c, f, d;
if (
(n !== window && n.parentNode && n !== dt()
? ((s = n.getBoundingClientRect()),
(r = s.top),
(a = s.left),
(l = s.bottom),
(c = s.right),
(f = s.height),
(d = s.width))
: ((r = 0),
(a = 0),
(l = window.innerHeight),
(c = window.innerWidth),
(f = window.innerHeight),
(d = window.innerWidth)),
(t || e) && n !== window && ((o = o || n.parentNode), !mt))
)
do
if (
o &&
o.getBoundingClientRect &&
(b(o, "transform") !== "none" ||
(e && b(o, "position") !== "static"))
) {
var p = o.getBoundingClientRect();
((r -= p.top + parseInt(b(o, "border-top-width"))),
(a -= p.left + parseInt(b(o, "border-left-width"))),
(l = r + s.height),
(c = a + s.width));
break;
}
while ((o = o.parentNode));
if (i && n !== window) {
var u = Nt(o || n),
g = u && u.a,
m = u && u.d;
u &&
((r /= m),
(a /= g),
(d /= g),
(f /= m),
(l = r + f),
(c = a + d));
}
return { top: r, left: a, bottom: l, right: c, width: d, height: f };
}
}
function Ci(n, t, e) {
for (var i = xt(n, !0), o = N(n)[t]; i; ) {
var s = N(i)[e],
r = void 0;
if ((e === "top" || e === "left" ? (r = o >= s) : (r = o <= s), !r))
return i;
if (i === dt()) break;
i = xt(i, !1);
}
return !1;
}
function kt(n, t, e, i) {
for (var o = 0, s = 0, r = n.children; s < r.length; ) {
if (
r[s].style.display !== "none" &&
r[s] !== v.ghost &&
(i || r[s] !== v.dragged) &&
lt(r[s], e.draggable, n, !1)
) {
if (o === t) return r[s];
o++;
}
s++;
}
return null;
}
function Ke(n, t) {
for (
var e = n.lastElementChild;
e && (e === v.ghost || b(e, "display") === "none" || (t && !ve(e, t)));
)
e = e.previousElementSibling;
return e || null;
}
function ot(n, t) {
var e = 0;
if (!n || !n.parentNode) return -1;
for (; (n = n.previousElementSibling); )
n.nodeName.toUpperCase() !== "TEMPLATE" &&
n !== v.clone &&
(!t || ve(n, t)) &&
e++;
return e;
}
function Li(n) {
var t = 0,
e = 0,
i = dt();
if (n)
do {
var o = Nt(n),
s = o.a,
r = o.d;
((t += n.scrollLeft * s), (e += n.scrollTop * r));
} while (n !== i && (n = n.parentNode));
return [t, e];
}
function _n(n, t) {
for (var e in n)
if (n.hasOwnProperty(e)) {
for (var i in t)
if (t.hasOwnProperty(i) && t[i] === n[e][i]) return Number(e);
}
return -1;
}
function xt(n, t) {
if (!n || !n.getBoundingClientRect) return dt();
var e = n,
i = !1;
do
if (e.clientWidth < e.scrollWidth || e.clientHeight < e.scrollHeight) {
var o = b(e);
if (
(e.clientWidth < e.scrollWidth &&
(o.overflowX == "auto" || o.overflowX == "scroll")) ||
(e.clientHeight < e.scrollHeight &&
(o.overflowY == "auto" || o.overflowY == "scroll"))
) {
if (!e.getBoundingClientRect || e === document.body)
return dt();
if (i || t) return e;
i = !0;
}
}
while ((e = e.parentNode));
return dt();
}
function Rn(n, t) {
if (n && t) for (var e in t) t.hasOwnProperty(e) && (n[e] = t[e]);
return n;
}
function _e(n, t) {
return (
Math.round(n.top) === Math.round(t.top) &&
Math.round(n.left) === Math.round(t.left) &&
Math.round(n.height) === Math.round(t.height) &&
Math.round(n.width) === Math.round(t.width)
);
}
var jt;
function Bi(n, t) {
return function () {
if (!jt) {
var e = arguments,
i = this;
(e.length === 1 ? n.call(i, e[0]) : n.apply(i, e),
(jt = setTimeout(function () {
jt = void 0;
}, t)));
}
};
}
function Pn() {
(clearTimeout(jt), (jt = void 0));
}
function Fi(n, t, e) {
((n.scrollLeft += t), (n.scrollTop += e));
}
function Hi(n) {
var t = window.Polymer,
e = window.jQuery || window.Zepto;
return t && t.dom
? t.dom(n).cloneNode(!0)
: e
? e(n).clone(!0)[0]
: n.cloneNode(!0);
}
function Vi(n, t, e) {
var i = {};
return (
Array.from(n.children).forEach(function (o) {
var s, r, a, l;
if (!(!lt(o, t.draggable, n, !1) || o.animated || o === e)) {
var c = N(o);
((i.left = Math.min(
(s = i.left) !== null && s !== void 0 ? s : 1 / 0,
c.left,
)),
(i.top = Math.min(
(r = i.top) !== null && r !== void 0 ? r : 1 / 0,
c.top,
)),
(i.right = Math.max(
(a = i.right) !== null && a !== void 0 ? a : -1 / 0,
c.right,
)),
(i.bottom = Math.max(
(l = i.bottom) !== null && l !== void 0 ? l : -1 / 0,
c.bottom,
)));
}
}),
(i.width = i.right - i.left),
(i.height = i.bottom - i.top),
(i.x = i.left),
(i.y = i.top),
i
);
}
var j = "Sortable" + new Date().getTime();
function Mn() {
var n = [],
t;
return {
captureAnimationState: function () {
if (((n = []), !!this.options.animation)) {
var i = [].slice.call(this.el.children);
i.forEach(function (o) {
if (!(b(o, "display") === "none" || o === v.ghost)) {
n.push({ target: o, rect: N(o) });
var s = ft({}, n[n.length - 1].rect);
if (o.thisAnimationDuration) {
var r = Nt(o, !0);
r && ((s.top -= r.f), (s.left -= r.e));
}
o.fromRect = s;
}
});
}
},
addAnimationState: function (i) {
n.push(i);
},
removeAnimationState: function (i) {
n.splice(_n(n, { target: i }), 1);
},
animateAll: function (i) {
var o = this;
if (!this.options.animation) {
(clearTimeout(t), typeof i == "function" && i());
return;
}
var s = !1,
r = 0;
(n.forEach(function (a) {
var l = 0,
c = a.target,
f = c.fromRect,
d = N(c),
p = c.prevFromRect,
u = c.prevToRect,
g = a.rect,
m = Nt(c, !0);
(m && ((d.top -= m.f), (d.left -= m.e)),
(c.toRect = d),
c.thisAnimationDuration &&
_e(p, d) &&
!_e(f, d) &&
(g.top - d.top) / (g.left - d.left) ===
(f.top - d.top) / (f.left - d.left) &&
(l = kn(g, p, u, o.options)),
_e(d, f) ||
((c.prevFromRect = f),
(c.prevToRect = d),
l || (l = o.options.animation),
o.animate(c, g, d, l)),
l &&
((s = !0),
(r = Math.max(r, l)),
clearTimeout(c.animationResetTimer),
(c.animationResetTimer = setTimeout(function () {
((c.animationTime = 0),
(c.prevFromRect = null),
(c.fromRect = null),
(c.prevToRect = null),
(c.thisAnimationDuration = null));
}, l)),
(c.thisAnimationDuration = l)));
}),
clearTimeout(t),
s
? (t = setTimeout(function () {
typeof i == "function" && i();
}, r))
: typeof i == "function" && i(),
(n = []));
},
animate: function (i, o, s, r) {
if (r) {
(b(i, "transition", ""), b(i, "transform", ""));
var a = Nt(this.el),
l = a && a.a,
c = a && a.d,
f = (o.left - s.left) / (l || 1),
d = (o.top - s.top) / (c || 1);
((i.animatingX = !!f),
(i.animatingY = !!d),
b(i, "transform", "translate3d(" + f + "px," + d + "px,0)"),
(this.forRepaintDummy = Nn(i)),
b(
i,
"transition",
"transform " +
r +
"ms" +
(this.options.easing
? " " + this.options.easing
: ""),
),
b(i, "transform", "translate3d(0,0,0)"),
typeof i.animated == "number" && clearTimeout(i.animated),
(i.animated = setTimeout(function () {
(b(i, "transition", ""),
b(i, "transform", ""),
(i.animated = !1),
(i.animatingX = !1),
(i.animatingY = !1));
}, r)));
}
},
};
}
function Nn(n) {
return n.offsetWidth;
}
function kn(n, t, e, i) {
return (
(Math.sqrt(Math.pow(t.top - n.top, 2) + Math.pow(t.left - n.left, 2)) /
Math.sqrt(
Math.pow(t.top - e.top, 2) + Math.pow(t.left - e.left, 2),
)) *
i.animation
);
}
var _t = [],
Re = { initializeByDefault: !0 },
te = {
mount: function (t) {
for (var e in Re)
Re.hasOwnProperty(e) && !(e in t) && (t[e] = Re[e]);
(_t.forEach(function (i) {
if (i.pluginName === t.pluginName)
throw "Sortable: Cannot mount plugin ".concat(
t.pluginName,
" more than once",
);
}),
_t.push(t));
},
pluginEvent: function (t, e, i) {
var o = this;
((this.eventCanceled = !1),
(i.cancel = function () {
o.eventCanceled = !0;
}));
var s = t + "Global";
_t.forEach(function (r) {
e[r.pluginName] &&
(e[r.pluginName][s] &&
e[r.pluginName][s](ft({ sortable: e }, i)),
e.options[r.pluginName] &&
e[r.pluginName][t] &&
e[r.pluginName][t](ft({ sortable: e }, i)));
});
},
initializePlugins: function (t, e, i, o) {
_t.forEach(function (a) {
var l = a.pluginName;
if (!(!t.options[l] && !a.initializeByDefault)) {
var c = new a(t, e, t.options);
((c.sortable = t),
(c.options = t.options),
(t[l] = c),
gt(i, c.defaults));
}
});
for (var s in t.options)
if (t.options.hasOwnProperty(s)) {
var r = this.modifyOption(t, s, t.options[s]);
typeof r < "u" && (t.options[s] = r);
}
},
getEventProperties: function (t, e) {
var i = {};
return (
_t.forEach(function (o) {
typeof o.eventProperties == "function" &&
gt(i, o.eventProperties.call(e[o.pluginName], t));
}),
i
);
},
modifyOption: function (t, e, i) {
var o;
return (
_t.forEach(function (s) {
t[s.pluginName] &&
s.optionListeners &&
typeof s.optionListeners[e] == "function" &&
(o = s.optionListeners[e].call(t[s.pluginName], i));
}),
o
);
},
};
function Bn(n) {
var t = n.sortable,
e = n.rootEl,
i = n.name,
o = n.targetEl,
s = n.cloneEl,
r = n.toEl,
a = n.fromEl,
l = n.oldIndex,
c = n.newIndex,
f = n.oldDraggableIndex,
d = n.newDraggableIndex,
p = n.originalEvent,
u = n.putSortable,
g = n.extraEventProperties;
if (((t = t || (e && e[j])), !!t)) {
var m,
S = t.options,
E = "on" + i.charAt(0).toUpperCase() + i.substr(1);
(window.CustomEvent && !mt && !Zt
? (m = new CustomEvent(i, { bubbles: !0, cancelable: !0 }))
: ((m = document.createEvent("Event")), m.initEvent(i, !0, !0)),
(m.to = r || e),
(m.from = a || e),
(m.item = o || e),
(m.clone = s),
(m.oldIndex = l),
(m.newIndex = c),
(m.oldDraggableIndex = f),
(m.newDraggableIndex = d),
(m.originalEvent = p),
(m.pullMode = u ? u.lastPutMode : void 0));
var w = ft(ft({}, g), te.getEventProperties(i, t));
for (var D in w) m[D] = w[D];
(e && e.dispatchEvent(m), S[E] && S[E].call(t, m));
}
}
var Fn = ["evt"],
G = function (t, e) {
var i =
arguments.length > 2 && arguments[2] !== void 0
? arguments[2]
: {},
o = i.evt,
s = In(i, Fn);
te.pluginEvent.bind(v)(
t,
e,
ft(
{
dragEl: h,
parentEl: R,
ghostEl: y,
rootEl: I,
nextEl: Lt,
lastDownEl: pe,
cloneEl: T,
cloneHidden: St,
dragStarted: Kt,
putSortable: H,
activeSortable: v.active,
originalEvent: o,
oldIndex: Mt,
oldDraggableIndex: qt,
newIndex: Z,
newDraggableIndex: wt,
hideGhostForTarget: $i,
unhideGhostForTarget: Ki,
cloneNowHidden: function () {
St = !0;
},
cloneNowShown: function () {
St = !1;
},
dispatchSortableEvent: function (a) {
K({ sortable: e, name: a, originalEvent: o });
},
},
s,
),
);
};
function K(n) {
Bn(
ft(
{
putSortable: H,
cloneEl: T,
targetEl: h,
rootEl: I,
oldIndex: Mt,
oldDraggableIndex: qt,
newIndex: Z,
newDraggableIndex: wt,
},
n,
),
);
}
var h,
R,
y,
I,
Lt,
pe,
T,
St,
Mt,
Z,
qt,
wt,
ce,
H,
Pt = !1,
ye = !1,
we = [],
At,
at,
Pe,
Me,
Ii,
Ti,
Kt,
Rt,
Jt,
Qt = !1,
de = !1,
ge,
$,
Ne = [],
Ve = !1,
Se = [],
Oe = typeof document < "u",
fe = $e,
_i = Zt || mt ? "cssFloat" : "float",
Hn = Oe && !Pi && !$e && "draggable" in document.createElement("div"),
Wi = (function () {
if (Oe) {
if (mt) return !1;
var n = document.createElement("x");
return (
(n.style.cssText = "pointer-events:auto"),
n.style.pointerEvents === "auto"
);
}
})(),
zi = function (t, e) {
var i = b(t),
o =
parseInt(i.width) -
parseInt(i.paddingLeft) -
parseInt(i.paddingRight) -
parseInt(i.borderLeftWidth) -
parseInt(i.borderRightWidth),
s = kt(t, 0, e),
r = kt(t, 1, e),
a = s && b(s),
l = r && b(r),
c =
a &&
parseInt(a.marginLeft) + parseInt(a.marginRight) + N(s).width,
f =
l &&
parseInt(l.marginLeft) + parseInt(l.marginRight) + N(r).width;
if (i.display === "flex")
return i.flexDirection === "column" ||
i.flexDirection === "column-reverse"
? "vertical"
: "horizontal";
if (i.display === "grid")
return i.gridTemplateColumns.split(" ").length <= 1
? "vertical"
: "horizontal";
if (s && a.float && a.float !== "none") {
var d = a.float === "left" ? "left" : "right";
return r && (l.clear === "both" || l.clear === d)
? "vertical"
: "horizontal";
}
return s &&
(a.display === "block" ||
a.display === "flex" ||
a.display === "table" ||
a.display === "grid" ||
(c >= o && i[_i] === "none") ||
(r && i[_i] === "none" && c + f > o))
? "vertical"
: "horizontal";
},
Vn = function (t, e, i) {
var o = i ? t.left : t.top,
s = i ? t.right : t.bottom,
r = i ? t.width : t.height,
a = i ? e.left : e.top,
l = i ? e.right : e.bottom,
c = i ? e.width : e.height;
return o === a || s === l || o + r / 2 === a + c / 2;
},
Wn = function (t, e) {
var i;
return (
we.some(function (o) {
var s = o[j].options.emptyInsertThreshold;
if (!(!s || Ke(o))) {
var r = N(o),
a = t >= r.left - s && t <= r.right + s,
l = e >= r.top - s && e <= r.bottom + s;
if (a && l) return (i = o);
}
}),
i
);
},
Xi = function (t) {
function e(s, r) {
return function (a, l, c, f) {
var d =
a.options.group.name &&
l.options.group.name &&
a.options.group.name === l.options.group.name;
if (s == null && (r || d)) return !0;
if (s == null || s === !1) return !1;
if (r && s === "clone") return s;
if (typeof s == "function")
return e(s(a, l, c, f), r)(a, l, c, f);
var p = (r ? a : l).options.group.name;
return (
s === !0 ||
(typeof s == "string" && s === p) ||
(s.join && s.indexOf(p) > -1)
);
};
}
var i = {},
o = t.group;
((!o || ue(o) != "object") && (o = { name: o }),
(i.name = o.name),
(i.checkPull = e(o.pull, !0)),
(i.checkPut = e(o.put)),
(i.revertClone = o.revertClone),
(t.group = i));
},
$i = function () {
!Wi && y && b(y, "display", "none");
},
Ki = function () {
!Wi && y && b(y, "display", "");
};
Oe &&
!Pi &&
document.addEventListener(
"click",
function (n) {
if (ye)
return (
n.preventDefault(),
n.stopPropagation && n.stopPropagation(),
n.stopImmediatePropagation && n.stopImmediatePropagation(),
(ye = !1),
!1
);
},
!0,
);
var Ct = function (t) {
if (h) {
t = t.touches ? t.touches[0] : t;
var e = Wn(t.clientX, t.clientY);
if (e) {
var i = {};
for (var o in t) t.hasOwnProperty(o) && (i[o] = t[o]);
((i.target = i.rootEl = e),
(i.preventDefault = void 0),
(i.stopPropagation = void 0),
e[j]._onDragOver(i));
}
}
},
zn = function (t) {
h && h.parentNode[j]._isOutsideThisEl(t.target);
};
function v(n, t) {
if (!(n && n.nodeType && n.nodeType === 1))
throw "Sortable: `el` must be an HTMLElement, not ".concat(
{}.toString.call(n),
);
((this.el = n), (this.options = t = gt({}, t)), (n[j] = this));
var e = {
group: null,
sort: !0,
disabled: !1,
store: null,
handle: null,
draggable: /^[uo]l$/i.test(n.nodeName) ? ">li" : ">*",
swapThreshold: 1,
invertSwap: !1,
invertedSwapThreshold: null,
removeCloneOnHide: !0,
direction: function () {
return zi(n, this.options);
},
ghostClass: "sortable-ghost",
chosenClass: "sortable-chosen",
dragClass: "sortable-drag",
ignore: "a, img",
filter: null,
preventOnFilter: !0,
animation: 0,
easing: null,
setData: function (r, a) {
r.setData("Text", a.textContent);
},
dropBubble: !1,
dragoverBubble: !1,
dataIdAttr: "data-id",
delay: 0,
delayOnTouchOnly: !1,
touchStartThreshold:
(Number.parseInt ? Number : window).parseInt(
window.devicePixelRatio,
10,
) || 1,
forceFallback: !1,
fallbackClass: "sortable-fallback",
fallbackOnBody: !1,
fallbackTolerance: 0,
fallbackOffset: { x: 0, y: 0 },
supportPointer:
v.supportPointer !== !1 && "PointerEvent" in window && (!Gt || $e),
emptyInsertThreshold: 5,
};
te.initializePlugins(this, n, e);
for (var i in e) !(i in t) && (t[i] = e[i]);
Xi(t);
for (var o in this)
o.charAt(0) === "_" &&
typeof this[o] == "function" &&
(this[o] = this[o].bind(this));
((this.nativeDraggable = t.forceFallback ? !1 : Hn),
this.nativeDraggable && (this.options.touchStartThreshold = 1),
t.supportPointer
? O(n, "pointerdown", this._onTapStart)
: (O(n, "mousedown", this._onTapStart),
O(n, "touchstart", this._onTapStart)),
this.nativeDraggable &&
(O(n, "dragover", this), O(n, "dragenter", this)),
we.push(this.el),
t.store && t.store.get && this.sort(t.store.get(this) || []),
gt(this, Mn()));
}
v.prototype = {
constructor: v,
_isOutsideThisEl: function (t) {
!this.el.contains(t) && t !== this.el && (Rt = null);
},
_getDirection: function (t, e) {
return typeof this.options.direction == "function"
? this.options.direction.call(this, t, e, h)
: this.options.direction;
},
_onTapStart: function (t) {
if (t.cancelable) {
var e = this,
i = this.el,
o = this.options,
s = o.preventOnFilter,
r = t.type,
a =
(t.touches && t.touches[0]) ||
(t.pointerType && t.pointerType === "touch" && t),
l = (a || t).target,
c =
(t.target.shadowRoot &&
((t.path && t.path[0]) ||
(t.composedPath && t.composedPath()[0]))) ||
l,
f = o.filter;
if (
(qn(i),
!h &&
!(
(/mousedown|pointerdown/.test(r) && t.button !== 0) ||
o.disabled
) &&
!c.isContentEditable &&
!(
!this.nativeDraggable &&
Gt &&
l &&
l.tagName.toUpperCase() === "SELECT"
) &&
((l = lt(l, o.draggable, i, !1)),
!(l && l.animated) && pe !== l))
) {
if (
((Mt = ot(l)),
(qt = ot(l, o.draggable)),
typeof f == "function")
) {
if (f.call(this, t, l, this)) {
(K({
sortable: e,
rootEl: c,
name: "filter",
targetEl: l,
toEl: i,
fromEl: i,
}),
G("filter", e, { evt: t }),
s && t.preventDefault());
return;
}
} else if (
f &&
((f = f.split(",").some(function (d) {
if (((d = lt(c, d.trim(), i, !1)), d))
return (
K({
sortable: e,
rootEl: d,
name: "filter",
targetEl: l,
fromEl: i,
toEl: i,
}),
G("filter", e, { evt: t }),
!0
);
})),
f)
) {
s && t.preventDefault();
return;
}
(o.handle && !lt(c, o.handle, i, !1)) ||
this._prepareDragStart(t, a, l);
}
}
},
_prepareDragStart: function (t, e, i) {
var o = this,
s = o.el,
r = o.options,
a = s.ownerDocument,
l;
if (i && !h && i.parentNode === s) {
var c = N(i);
if (
((I = s),
(h = i),
(R = h.parentNode),
(Lt = h.nextSibling),
(pe = i),
(ce = r.group),
(v.dragged = h),
(At = {
target: h,
clientX: (e || t).clientX,
clientY: (e || t).clientY,
}),
(Ii = At.clientX - c.left),
(Ti = At.clientY - c.top),
(this._lastX = (e || t).clientX),
(this._lastY = (e || t).clientY),
(h.style["will-change"] = "all"),
(l = function () {
if ((G("delayEnded", o, { evt: t }), v.eventCanceled)) {
o._onDrop();
return;
}
(o._disableDelayedDragEvents(),
!Di && o.nativeDraggable && (h.draggable = !0),
o._triggerDragStart(t, e),
K({ sortable: o, name: "choose", originalEvent: t }),
Q(h, r.chosenClass, !0));
}),
r.ignore.split(",").forEach(function (f) {
ki(h, f.trim(), ke);
}),
O(a, "dragover", Ct),
O(a, "mousemove", Ct),
O(a, "touchmove", Ct),
r.supportPointer
? (O(a, "pointerup", o._onDrop),
!this.nativeDraggable && O(a, "pointercancel", o._onDrop))
: (O(a, "mouseup", o._onDrop),
O(a, "touchend", o._onDrop),
O(a, "touchcancel", o._onDrop)),
Di &&
this.nativeDraggable &&
((this.options.touchStartThreshold = 4),
(h.draggable = !0)),
G("delayStart", this, { evt: t }),
r.delay &&
(!r.delayOnTouchOnly || e) &&
(!this.nativeDraggable || !(Zt || mt)))
) {
if (v.eventCanceled) {
this._onDrop();
return;
}
(r.supportPointer
? (O(a, "pointerup", o._disableDelayedDrag),
O(a, "pointercancel", o._disableDelayedDrag))
: (O(a, "mouseup", o._disableDelayedDrag),
O(a, "touchend", o._disableDelayedDrag),
O(a, "touchcancel", o._disableDelayedDrag)),
O(a, "mousemove", o._delayedDragTouchMoveHandler),
O(a, "touchmove", o._delayedDragTouchMoveHandler),
r.supportPointer &&
O(a, "pointermove", o._delayedDragTouchMoveHandler),
(o._dragStartTimer = setTimeout(l, r.delay)));
} else l();
}
},
_delayedDragTouchMoveHandler: function (t) {
var e = t.touches ? t.touches[0] : t;
Math.max(
Math.abs(e.clientX - this._lastX),
Math.abs(e.clientY - this._lastY),
) >=
Math.floor(
this.options.touchStartThreshold /
((this.nativeDraggable && window.devicePixelRatio) || 1),
) && this._disableDelayedDrag();
},
_disableDelayedDrag: function () {
(h && ke(h),
clearTimeout(this._dragStartTimer),
this._disableDelayedDragEvents());
},
_disableDelayedDragEvents: function () {
var t = this.el.ownerDocument;
(x(t, "mouseup", this._disableDelayedDrag),
x(t, "touchend", this._disableDelayedDrag),
x(t, "touchcancel", this._disableDelayedDrag),
x(t, "pointerup", this._disableDelayedDrag),
x(t, "pointercancel", this._disableDelayedDrag),
x(t, "mousemove", this._delayedDragTouchMoveHandler),
x(t, "touchmove", this._delayedDragTouchMoveHandler),
x(t, "pointermove", this._delayedDragTouchMoveHandler));
},
_triggerDragStart: function (t, e) {
((e = e || (t.pointerType == "touch" && t)),
!this.nativeDraggable || e
? this.options.supportPointer
? O(document, "pointermove", this._onTouchMove)
: e
? O(document, "touchmove", this._onTouchMove)
: O(document, "mousemove", this._onTouchMove)
: (O(h, "dragend", this),
O(I, "dragstart", this._onDragStart)));
try {
document.selection
? me(function () {
document.selection.empty();
})
: window.getSelection().removeAllRanges();
} catch {}
},
_dragStarted: function (t, e) {
if (((Pt = !1), I && h)) {
(G("dragStarted", this, { evt: e }),
this.nativeDraggable && O(document, "dragover", zn));
var i = this.options;
(!t && Q(h, i.dragClass, !1),
Q(h, i.ghostClass, !0),
(v.active = this),
t && this._appendGhost(),
K({ sortable: this, name: "start", originalEvent: e }));
} else this._nulling();
},
_emulateDragOver: function () {
if (at) {
((this._lastX = at.clientX), (this._lastY = at.clientY), $i());
for (
var t = document.elementFromPoint(at.clientX, at.clientY),
e = t;
t &&
t.shadowRoot &&
((t = t.shadowRoot.elementFromPoint(at.clientX, at.clientY)),
t !== e);
)
e = t;
if ((h.parentNode[j]._isOutsideThisEl(t), e))
do {
if (e[j]) {
var i = void 0;
if (
((i = e[j]._onDragOver({
clientX: at.clientX,
clientY: at.clientY,
target: t,
rootEl: e,
})),
i && !this.options.dragoverBubble)
)
break;
}
t = e;
} while ((e = Ni(e)));
Ki();
}
},
_onTouchMove: function (t) {
if (At) {
var e = this.options,
i = e.fallbackTolerance,
o = e.fallbackOffset,
s = t.touches ? t.touches[0] : t,
r = y && Nt(y, !0),
a = y && r && r.a,
l = y && r && r.d,
c = fe && $ && Li($),
f =
(s.clientX - At.clientX + o.x) / (a || 1) +
(c ? c[0] - Ne[0] : 0) / (a || 1),
d =
(s.clientY - At.clientY + o.y) / (l || 1) +
(c ? c[1] - Ne[1] : 0) / (l || 1);
if (!v.active && !Pt) {
if (
i &&
Math.max(
Math.abs(s.clientX - this._lastX),
Math.abs(s.clientY - this._lastY),
) < i
)
return;
this._onDragStart(t, !0);
}
if (y) {
r
? ((r.e += f - (Pe || 0)), (r.f += d - (Me || 0)))
: (r = { a: 1, b: 0, c: 0, d: 1, e: f, f: d });
var p = "matrix("
.concat(r.a, ",")
.concat(r.b, ",")
.concat(r.c, ",")
.concat(r.d, ",")
.concat(r.e, ",")
.concat(r.f, ")");
(b(y, "webkitTransform", p),
b(y, "mozTransform", p),
b(y, "msTransform", p),
b(y, "transform", p),
(Pe = f),
(Me = d),
(at = s));
}
t.cancelable && t.preventDefault();
}
},
_appendGhost: function () {
if (!y) {
var t = this.options.fallbackOnBody ? document.body : I,
e = N(h, !0, fe, !0, t),
i = this.options;
if (fe) {
for (
$ = t;
b($, "position") === "static" &&
b($, "transform") === "none" &&
$ !== document;
)
$ = $.parentNode;
($ !== document.body && $ !== document.documentElement
? ($ === document && ($ = dt()),
(e.top += $.scrollTop),
(e.left += $.scrollLeft))
: ($ = dt()),
(Ne = Li($)));
}
((y = h.cloneNode(!0)),
Q(y, i.ghostClass, !1),
Q(y, i.fallbackClass, !0),
Q(y, i.dragClass, !0),
b(y, "transition", ""),
b(y, "transform", ""),
b(y, "box-sizing", "border-box"),
b(y, "margin", 0),
b(y, "top", e.top),
b(y, "left", e.left),
b(y, "width", e.width),
b(y, "height", e.height),
b(y, "opacity", "0.8"),
b(y, "position", fe ? "absolute" : "fixed"),
b(y, "zIndex", "100000"),
b(y, "pointerEvents", "none"),
(v.ghost = y),
t.appendChild(y),
b(
y,
"transform-origin",
(Ii / parseInt(y.style.width)) * 100 +
"% " +
(Ti / parseInt(y.style.height)) * 100 +
"%",
));
}
},
_onDragStart: function (t, e) {
var i = this,
o = t.dataTransfer,
s = i.options;
if ((G("dragStart", this, { evt: t }), v.eventCanceled)) {
this._onDrop();
return;
}
(G("setupClone", this),
v.eventCanceled ||
((T = Hi(h)),
T.removeAttribute("id"),
(T.draggable = !1),
(T.style["will-change"] = ""),
this._hideClone(),
Q(T, this.options.chosenClass, !1),
(v.clone = T)),
(i.cloneId = me(function () {
(G("clone", i),
!v.eventCanceled &&
(i.options.removeCloneOnHide || I.insertBefore(T, h),
i._hideClone(),
K({ sortable: i, name: "clone" })));
})),
!e && Q(h, s.dragClass, !0),
e
? ((ye = !0), (i._loopId = setInterval(i._emulateDragOver, 50)))
: (x(document, "mouseup", i._onDrop),
x(document, "touchend", i._onDrop),
x(document, "touchcancel", i._onDrop),
o &&
((o.effectAllowed = "move"),
s.setData && s.setData.call(i, o, h)),
O(document, "drop", i),
b(h, "transform", "translateZ(0)")),
(Pt = !0),
(i._dragStartId = me(i._dragStarted.bind(i, e, t))),
O(document, "selectstart", i),
(Kt = !0),
window.getSelection().removeAllRanges(),
Gt && b(document.body, "user-select", "none"));
},
_onDragOver: function (t) {
var e = this.el,
i = t.target,
o,
s,
r,
a = this.options,
l = a.group,
c = v.active,
f = ce === l,
d = a.sort,
p = H || c,
u,
g = this,
m = !1;
if (Ve) return;
function S(L, et) {
G(
L,
g,
ft(
{
evt: t,
isOwner: f,
axis: u ? "vertical" : "horizontal",
revert: r,
dragRect: o,
targetRect: s,
canSort: d,
fromSortable: p,
target: i,
completed: w,
onMove: function (Ge, Gi) {
return he(I, e, h, o, Ge, N(Ge), t, Gi);
},
changed: D,
},
et,
),
);
}
function E() {
(S("dragOverAnimationCapture"),
g.captureAnimationState(),
g !== p && p.captureAnimationState());
}
function w(L) {
return (
S("dragOverCompleted", { insertion: L }),
L &&
(f ? c._hideClone() : c._showClone(g),
g !== p &&
(Q(
h,
H ? H.options.ghostClass : c.options.ghostClass,
!1,
),
Q(h, a.ghostClass, !0)),
H !== g && g !== v.active
? (H = g)
: g === v.active && H && (H = null),
p === g && (g._ignoreWhileAnimating = i),
g.animateAll(function () {
(S("dragOverAnimationComplete"),
(g._ignoreWhileAnimating = null));
}),
g !== p &&
(p.animateAll(), (p._ignoreWhileAnimating = null))),
((i === h && !h.animated) || (i === e && !i.animated)) &&
(Rt = null),
!a.dragoverBubble &&
!t.rootEl &&
i !== document &&
(h.parentNode[j]._isOutsideThisEl(t.target), !L && Ct(t)),
!a.dragoverBubble && t.stopPropagation && t.stopPropagation(),
(m = !0)
);
}
function D() {
((Z = ot(h)),
(wt = ot(h, a.draggable)),
K({
sortable: g,
name: "change",
toEl: e,
newIndex: Z,
newDraggableIndex: wt,
originalEvent: t,
}));
}
if (
(t.preventDefault !== void 0 && t.cancelable && t.preventDefault(),
(i = lt(i, a.draggable, e, !0)),
S("dragOver"),
v.eventCanceled)
)
return m;
if (
h.contains(t.target) ||
(i.animated && i.animatingX && i.animatingY) ||
g._ignoreWhileAnimating === i
)
return w(!1);
if (
((ye = !1),
c &&
!a.disabled &&
(f
? d || (r = R !== I)
: H === this ||
((this.lastPutMode = ce.checkPull(this, c, h, t)) &&
l.checkPut(this, c, h, t))))
) {
if (
((u = this._getDirection(t, i) === "vertical"),
(o = N(h)),
S("dragOverValid"),
v.eventCanceled)
)
return m;
if (r)
return (
(R = I),
E(),
this._hideClone(),
S("revert"),
v.eventCanceled ||
(Lt ? I.insertBefore(h, Lt) : I.appendChild(h)),
w(!0)
);
var A = Ke(e, a.draggable);
if (!A || (Yn(t, u, this) && !A.animated)) {
if (A === h) return w(!1);
if (
(A && e === t.target && (i = A),
i && (s = N(i)),
he(I, e, h, o, i, s, t, !!i) !== !1)
)
return (
E(),
A && A.nextSibling
? e.insertBefore(h, A.nextSibling)
: e.appendChild(h),
(R = e),
D(),
w(!0)
);
} else if (A && Kn(t, u, this)) {
var C = kt(e, 0, a, !0);
if (C === h) return w(!1);
if (((i = C), (s = N(i)), he(I, e, h, o, i, s, t, !1) !== !1))
return (E(), e.insertBefore(h, C), (R = e), D(), w(!0));
} else if (i.parentNode === e) {
s = N(i);
var F = 0,
q,
J = h.parentNode !== e,
_ = !Vn(
(h.animated && h.toRect) || o,
(i.animated && i.toRect) || s,
u,
),
V = u ? "top" : "left",
W = Ci(i, "top", "top") || Ci(h, "top", "top"),
tt = W ? W.scrollTop : void 0;
(Rt !== i &&
((q = s[V]), (Qt = !1), (de = (!_ && a.invertSwap) || J)),
(F = Un(
t,
i,
s,
u,
_ ? 1 : a.swapThreshold,
a.invertedSwapThreshold == null
? a.swapThreshold
: a.invertedSwapThreshold,
de,
Rt === i,
)));
var z;
if (F !== 0) {
var k = ot(h);
do ((k -= F), (z = R.children[k]));
while (z && (b(z, "display") === "none" || z === y));
}
if (F === 0 || z === i) return w(!1);
((Rt = i), (Jt = F));
var Y = i.nextElementSibling,
B = !1;
B = F === 1;
var X = he(I, e, h, o, i, s, t, B);
if (X !== !1)
return (
(X === 1 || X === -1) && (B = X === 1),
(Ve = !0),
setTimeout($n, 30),
E(),
B && !Y
? e.appendChild(h)
: i.parentNode.insertBefore(h, B ? Y : i),
W && Fi(W, 0, tt - W.scrollTop),
(R = h.parentNode),
q !== void 0 && !de && (ge = Math.abs(q - N(i)[V])),
D(),
w(!0)
);
}
if (e.contains(h)) return w(!1);
}
return !1;
},
_ignoreWhileAnimating: null,
_offMoveEvents: function () {
(x(document, "mousemove", this._onTouchMove),
x(document, "touchmove", this._onTouchMove),
x(document, "pointermove", this._onTouchMove),
x(document, "dragover", Ct),
x(document, "mousemove", Ct),
x(document, "touchmove", Ct));
},
_offUbEvents: function () {
var t = this.el.ownerDocument;
(x(t, "mouseup", this._onDrop),
x(t, "touchend", this._onDrop),
x(t, "pointerup", this._onDrop),
x(t, "pointercancel", this._onDrop),
x(t, "touchcancel", this._onDrop),
x(document, "selectstart", this));
},
_onDrop: function (t) {
var e = this.el,
i = this.options;
if (
((Z = ot(h)),
(wt = ot(h, i.draggable)),
G("drop", this, { evt: t }),
(R = h && h.parentNode),
(Z = ot(h)),
(wt = ot(h, i.draggable)),
v.eventCanceled)
) {
this._nulling();
return;
}
((Pt = !1),
(de = !1),
(Qt = !1),
clearInterval(this._loopId),
clearTimeout(this._dragStartTimer),
We(this.cloneId),
We(this._dragStartId),
this.nativeDraggable &&
(x(document, "drop", this),
x(e, "dragstart", this._onDragStart)),
this._offMoveEvents(),
this._offUbEvents(),
Gt && b(document.body, "user-select", ""),
b(h, "transform", ""),
t &&
(Kt &&
(t.cancelable && t.preventDefault(),
!i.dropBubble && t.stopPropagation()),
y && y.parentNode && y.parentNode.removeChild(y),
(I === R || (H && H.lastPutMode !== "clone")) &&
T &&
T.parentNode &&
T.parentNode.removeChild(T),
h &&
(this.nativeDraggable && x(h, "dragend", this),
ke(h),
(h.style["will-change"] = ""),
Kt &&
!Pt &&
Q(
h,
H ? H.options.ghostClass : this.options.ghostClass,
!1,
),
Q(h, this.options.chosenClass, !1),
K({
sortable: this,
name: "unchoose",
toEl: R,
newIndex: null,
newDraggableIndex: null,
originalEvent: t,
}),
I !== R
? (Z >= 0 &&
(K({
rootEl: R,
name: "add",
toEl: R,
fromEl: I,
originalEvent: t,
}),
K({
sortable: this,
name: "remove",
toEl: R,
originalEvent: t,
}),
K({
rootEl: R,
name: "sort",
toEl: R,
fromEl: I,
originalEvent: t,
}),
K({
sortable: this,
name: "sort",
toEl: R,
originalEvent: t,
})),
H && H.save())
: Z !== Mt &&
Z >= 0 &&
(K({
sortable: this,
name: "update",
toEl: R,
originalEvent: t,
}),
K({
sortable: this,
name: "sort",
toEl: R,
originalEvent: t,
})),
v.active &&
((Z == null || Z === -1) && ((Z = Mt), (wt = qt)),
K({
sortable: this,
name: "end",
toEl: R,
originalEvent: t,
}),
this.save()))),
this._nulling());
},
_nulling: function () {
(G("nulling", this),
(I =
h =
R =
y =
Lt =
T =
pe =
St =
At =
at =
Kt =
Z =
wt =
Mt =
qt =
Rt =
Jt =
H =
ce =
v.dragged =
v.ghost =
v.clone =
v.active =
null),
Se.forEach(function (t) {
t.checked = !0;
}),
(Se.length = Pe = Me = 0));
},
handleEvent: function (t) {
switch (t.type) {
case "drop":
case "dragend":
this._onDrop(t);
break;
case "dragenter":
case "dragover":
h && (this._onDragOver(t), Xn(t));
break;
case "selectstart":
t.preventDefault();
break;
}
},
toArray: function () {
for (
var t = [],
e,
i = this.el.children,
o = 0,
s = i.length,
r = this.options;
o < s;
o++
)
((e = i[o]),
lt(e, r.draggable, this.el, !1) &&
t.push(e.getAttribute(r.dataIdAttr) || jn(e)));
return t;
},
sort: function (t, e) {
var i = {},
o = this.el;
(this.toArray().forEach(function (s, r) {
var a = o.children[r];
lt(a, this.options.draggable, o, !1) && (i[s] = a);
}, this),
e && this.captureAnimationState(),
t.forEach(function (s) {
i[s] && (o.removeChild(i[s]), o.appendChild(i[s]));
}),
e && this.animateAll());
},
save: function () {
var t = this.options.store;
t && t.set && t.set(this);
},
closest: function (t, e) {
return lt(t, e || this.options.draggable, this.el, !1);
},
option: function (t, e) {
var i = this.options;
if (e === void 0) return i[t];
var o = te.modifyOption(this, t, e);
(typeof o < "u" ? (i[t] = o) : (i[t] = e), t === "group" && Xi(i));
},
destroy: function () {
G("destroy", this);
var t = this.el;
((t[j] = null),
x(t, "mousedown", this._onTapStart),
x(t, "touchstart", this._onTapStart),
x(t, "pointerdown", this._onTapStart),
this.nativeDraggable &&
(x(t, "dragover", this), x(t, "dragenter", this)),
Array.prototype.forEach.call(
t.querySelectorAll("[draggable]"),
function (e) {
e.removeAttribute("draggable");
},
),
this._onDrop(),
this._disableDelayedDragEvents(),
we.splice(we.indexOf(this.el), 1),
(this.el = t = null));
},
_hideClone: function () {
if (!St) {
if ((G("hideClone", this), v.eventCanceled)) return;
(b(T, "display", "none"),
this.options.removeCloneOnHide &&
T.parentNode &&
T.parentNode.removeChild(T),
(St = !0));
}
},
_showClone: function (t) {
if (t.lastPutMode !== "clone") {
this._hideClone();
return;
}
if (St) {
if ((G("showClone", this), v.eventCanceled)) return;
(h.parentNode == I && !this.options.group.revertClone
? I.insertBefore(T, h)
: Lt
? I.insertBefore(T, Lt)
: I.appendChild(T),
this.options.group.revertClone && this.animate(h, T),
b(T, "display", ""),
(St = !1));
}
},
};
function Xn(n) {
(n.dataTransfer && (n.dataTransfer.dropEffect = "move"),
n.cancelable && n.preventDefault());
}
function he(n, t, e, i, o, s, r, a) {
var l,
c = n[j],
f = c.options.onMove,
d;
return (
window.CustomEvent && !mt && !Zt
? (l = new CustomEvent("move", { bubbles: !0, cancelable: !0 }))
: ((l = document.createEvent("Event")),
l.initEvent("move", !0, !0)),
(l.to = t),
(l.from = n),
(l.dragged = e),
(l.draggedRect = i),
(l.related = o || t),
(l.relatedRect = s || N(t)),
(l.willInsertAfter = a),
(l.originalEvent = r),
n.dispatchEvent(l),
f && (d = f.call(c, l, r)),
d
);
}
function ke(n) {
n.draggable = !1;
}
function $n() {
Ve = !1;
}
function Kn(n, t, e) {
var i = N(kt(e.el, 0, e.options, !0)),
o = Vi(e.el, e.options, y),
s = 10;
return t
? n.clientX < o.left - s || (n.clientY < i.top && n.clientX < i.right)
: n.clientY < o.top - s || (n.clientY < i.bottom && n.clientX < i.left);
}
function Yn(n, t, e) {
var i = N(Ke(e.el, e.options.draggable)),
o = Vi(e.el, e.options, y),
s = 10;
return t
? n.clientX > o.right + s ||
(n.clientY > i.bottom && n.clientX > i.left)
: n.clientY > o.bottom + s ||
(n.clientX > i.right && n.clientY > i.top);
}
function Un(n, t, e, i, o, s, r, a) {
var l = i ? n.clientY : n.clientX,
c = i ? e.height : e.width,
f = i ? e.top : e.left,
d = i ? e.bottom : e.right,
p = !1;
if (!r) {
if (a && ge < c * o) {
if (
(!Qt &&
(Jt === 1 ? l > f + (c * s) / 2 : l < d - (c * s) / 2) &&
(Qt = !0),
Qt)
)
p = !0;
else if (Jt === 1 ? l < f + ge : l > d - ge) return -Jt;
} else if (l > f + (c * (1 - o)) / 2 && l < d - (c * (1 - o)) / 2)
return Gn(t);
}
return (
(p = p || r),
p && (l < f + (c * s) / 2 || l > d - (c * s) / 2)
? l > f + c / 2
? 1
: -1
: 0
);
}
function Gn(n) {
return ot(h) < ot(n) ? 1 : -1;
}
function jn(n) {
for (
var t = n.tagName + n.className + n.src + n.href + n.textContent,
e = t.length,
i = 0;
e--;
)
i += t.charCodeAt(e);
return i.toString(36);
}
function qn(n) {
Se.length = 0;
for (var t = n.getElementsByTagName("input"), e = t.length; e--; ) {
var i = t[e];
i.checked && Se.push(i);
}
}
function me(n) {
return setTimeout(n, 0);
}
function We(n) {
return clearTimeout(n);
}
Oe &&
O(document, "touchmove", function (n) {
(v.active || Pt) && n.cancelable && n.preventDefault();
});
v.utils = {
on: O,
off: x,
css: b,
find: ki,
is: function (t, e) {
return !!lt(t, e, t, !1);
},
extend: Rn,
throttle: Bi,
closest: lt,
toggleClass: Q,
clone: Hi,
index: ot,
nextTick: me,
cancelNextTick: We,
detectDirection: zi,
getChild: kt,
expando: j,
};
v.get = function (n) {
return n[j];
};
v.mount = function () {
for (var n = arguments.length, t = new Array(n), e = 0; e < n; e++)
t[e] = arguments[e];
(t[0].constructor === Array && (t = t[0]),
t.forEach(function (i) {
if (!i.prototype || !i.prototype.constructor)
throw "Sortable: Mounted plugin must be a constructor function, not ".concat(
{}.toString.call(i),
);
(i.utils && (v.utils = ft(ft({}, v.utils), i.utils)), te.mount(i));
}));
};
v.create = function (n, t) {
return new v(n, t);
};
v.version = Tn;
var M = [],
Yt,
ze,
Xe = !1,
Be,
Fe,
xe,
Ut;
function Jn() {
function n() {
this.defaults = {
scroll: !0,
forceAutoScrollFallback: !1,
scrollSensitivity: 30,
scrollSpeed: 10,
bubbleScroll: !0,
};
for (var t in this)
t.charAt(0) === "_" &&
typeof this[t] == "function" &&
(this[t] = this[t].bind(this));
}
return (
(n.prototype = {
dragStarted: function (e) {
var i = e.originalEvent;
this.sortable.nativeDraggable
? O(document, "dragover", this._handleAutoScroll)
: this.options.supportPointer
? O(
document,
"pointermove",
this._handleFallbackAutoScroll,
)
: i.touches
? O(
document,
"touchmove",
this._handleFallbackAutoScroll,
)
: O(
document,
"mousemove",
this._handleFallbackAutoScroll,
);
},
dragOverCompleted: function (e) {
var i = e.originalEvent;
!this.options.dragOverBubble &&
!i.rootEl &&
this._handleAutoScroll(i);
},
drop: function () {
(this.sortable.nativeDraggable
? x(document, "dragover", this._handleAutoScroll)
: (x(
document,
"pointermove",
this._handleFallbackAutoScroll,
),
x(document, "touchmove", this._handleFallbackAutoScroll),
x(document, "mousemove", this._handleFallbackAutoScroll)),
Ri(),
be(),
Pn());
},
nulling: function () {
((xe = ze = Yt = Xe = Ut = Be = Fe = null), (M.length = 0));
},
_handleFallbackAutoScroll: function (e) {
this._handleAutoScroll(e, !0);
},
_handleAutoScroll: function (e, i) {
var o = this,
s = (e.touches ? e.touches[0] : e).clientX,
r = (e.touches ? e.touches[0] : e).clientY,
a = document.elementFromPoint(s, r);
if (
((xe = e),
i || this.options.forceAutoScrollFallback || Zt || mt || Gt)
) {
He(e, this.options, a, i);
var l = xt(a, !0);
Xe &&
(!Ut || s !== Be || r !== Fe) &&
(Ut && Ri(),
(Ut = setInterval(function () {
var c = xt(document.elementFromPoint(s, r), !0);
(c !== l && ((l = c), be()),
He(e, o.options, c, i));
}, 10)),
(Be = s),
(Fe = r));
} else {
if (!this.options.bubbleScroll || xt(a, !0) === dt()) {
be();
return;
}
He(e, this.options, xt(a, !1), !1);
}
},
}),
gt(n, { pluginName: "scroll", initializeByDefault: !0 })
);
}
function be() {
(M.forEach(function (n) {
clearInterval(n.pid);
}),
(M = []));
}
function Ri() {
clearInterval(Ut);
}
var He = Bi(function (n, t, e, i) {
if (t.scroll) {
var o = (n.touches ? n.touches[0] : n).clientX,
s = (n.touches ? n.touches[0] : n).clientY,
r = t.scrollSensitivity,
a = t.scrollSpeed,
l = dt(),
c = !1,
f;
ze !== e &&
((ze = e),
be(),
(Yt = t.scroll),
(f = t.scrollFn),
Yt === !0 && (Yt = xt(e, !0)));
var d = 0,
p = Yt;
do {
var u = p,
g = N(u),
m = g.top,
S = g.bottom,
E = g.left,
w = g.right,
D = g.width,
A = g.height,
C = void 0,
F = void 0,
q = u.scrollWidth,
J = u.scrollHeight,
_ = b(u),
V = u.scrollLeft,
W = u.scrollTop;
u === l
? ((C =
D < q &&
(_.overflowX === "auto" ||
_.overflowX === "scroll" ||
_.overflowX === "visible")),
(F =
A < J &&
(_.overflowY === "auto" ||
_.overflowY === "scroll" ||
_.overflowY === "visible")))
: ((C =
D < q &&
(_.overflowX === "auto" || _.overflowX === "scroll")),
(F =
A < J &&
(_.overflowY === "auto" ||
_.overflowY === "scroll")));
var tt =
C &&
(Math.abs(w - o) <= r && V + D < q) -
(Math.abs(E - o) <= r && !!V),
z =
F &&
(Math.abs(S - s) <= r && W + A < J) -
(Math.abs(m - s) <= r && !!W);
if (!M[d]) for (var k = 0; k <= d; k++) M[k] || (M[k] = {});
((M[d].vx != tt || M[d].vy != z || M[d].el !== u) &&
((M[d].el = u),
(M[d].vx = tt),
(M[d].vy = z),
clearInterval(M[d].pid),
(tt != 0 || z != 0) &&
((c = !0),
(M[d].pid = setInterval(
function () {
i &&
this.layer === 0 &&
v.active._onTouchMove(xe);
var Y = M[this.layer].vy
? M[this.layer].vy * a
: 0,
B = M[this.layer].vx
? M[this.layer].vx * a
: 0;
(typeof f == "function" &&
f.call(
v.dragged.parentNode[j],
B,
Y,
n,
xe,
M[this.layer].el,
) !== "continue") ||
Fi(M[this.layer].el, B, Y);
}.bind({ layer: d }),
24,
)))),
d++);
} while (t.bubbleScroll && p !== l && (p = xt(p, !1)));
Xe = c;
}
}, 30),
Yi = function (t) {
var e = t.originalEvent,
i = t.putSortable,
o = t.dragEl,
s = t.activeSortable,
r = t.dispatchSortableEvent,
a = t.hideGhostForTarget,
l = t.unhideGhostForTarget;
if (e) {
var c = i || s;
a();
var f =
e.changedTouches && e.changedTouches.length
? e.changedTouches[0]
: e,
d = document.elementFromPoint(f.clientX, f.clientY);
(l(),
c &&
!c.el.contains(d) &&
(r("spill"), this.onSpill({ dragEl: o, putSortable: i })));
}
};
function Ye() {}
Ye.prototype = {
startIndex: null,
dragStart: function (t) {
var e = t.oldDraggableIndex;
this.startIndex = e;
},
onSpill: function (t) {
var e = t.dragEl,
i = t.putSortable;
(this.sortable.captureAnimationState(), i && i.captureAnimationState());
var o = kt(this.sortable.el, this.startIndex, this.options);
(o
? this.sortable.el.insertBefore(e, o)
: this.sortable.el.appendChild(e),
this.sortable.animateAll(),
i && i.animateAll());
},
drop: Yi,
};
gt(Ye, { pluginName: "revertOnSpill" });
function Ue() {}
Ue.prototype = {
onSpill: function (t) {
var e = t.dragEl,
i = t.putSortable,
o = i || this.sortable;
(o.captureAnimationState(),
e.parentNode && e.parentNode.removeChild(e),
o.animateAll());
},
drop: Yi,
};
gt(Ue, { pluginName: "removeOnSpill" });
v.mount(new Jn());
v.mount(Ue, Ye);
var Ui = v;
function bt(n) {
return n == null || n === "" || (typeof n == "string" && n.trim() === "");
}
function P(n) {
return !bt(n);
}
var Ee = class {
constructor({
canOptionLabelsWrap: t = !0,
canSelectPlaceholder: e = !0,
element: i,
getOptionLabelUsing: o = null,
getOptionLabelsUsing: s = null,
getOptionsUsing: r = null,
getSearchResultsUsing: a = null,
hasDynamicOptions: l = !1,
hasDynamicSearchResults: c = !0,
hasInitialNoOptionsMessage: f = !1,
initialOptionLabel: d = null,
initialOptionLabels: p = null,
initialState: u = null,
isAutofocused: g = !1,
isDisabled: m = !1,
isHtmlAllowed: S = !1,
isMultiple: E = !1,
isReorderable: w = !1,
isSearchable: D = !1,
livewireId: A = null,
loadingMessage: C = "Loading...",
maxItems: F = null,
maxItemsMessage: q = "Maximum number of items selected",
noOptionsMessage: J = "No options available",
noSearchResultsMessage: _ = "No results found",
onStateChange: V = () => {},
options: W,
optionsLimit: tt = null,
placeholder: z,
position: k = null,
searchableOptionFields: Y = ["label"],
searchDebounce: B = 1e3,
searchingMessage: X = "Searching...",
searchPrompt: L = "Search...",
state: et,
statePath: ee = null,
}) {
((this.canOptionLabelsWrap = t),
(this.canSelectPlaceholder = e),
(this.element = i),
(this.getOptionLabelUsing = o),
(this.getOptionLabelsUsing = s),
(this.getOptionsUsing = r),
(this.getSearchResultsUsing = a),
(this.hasDynamicOptions = l),
(this.hasDynamicSearchResults = c),
(this.hasInitialNoOptionsMessage = f),
(this.initialOptionLabel = d),
(this.initialOptionLabels = p),
(this.initialState = u),
(this.isAutofocused = g),
(this.isDisabled = m),
(this.isHtmlAllowed = S),
(this.isMultiple = E),
(this.isReorderable = w),
(this.isSearchable = D),
(this.livewireId = A),
(this.loadingMessage = C),
(this.maxItems = F),
(this.maxItemsMessage = q),
(this.noOptionsMessage = J),
(this.noSearchResultsMessage = _),
(this.onStateChange = V),
(this.options = W),
(this.optionsLimit = tt),
(this.originalOptions = JSON.parse(JSON.stringify(W))),
(this.placeholder = z),
(this.position = k),
(this.searchableOptionFields = Array.isArray(Y) ? Y : ["label"]),
(this.searchDebounce = B),
(this.searchingMessage = X),
(this.searchPrompt = L),
(this.state = et),
(this.statePath = ee),
(this.activeSearchId = 0),
(this.labelRepository = {}),
(this.isOpen = !1),
(this.selectedIndex = -1),
(this.searchQuery = ""),
(this.searchTimeout = null),
(this.isSearching = !1),
(this.selectedDisplayVersion = 0),
this.render(),
this.setUbEventListeners(),
this.isAutofocused && this.selectButton.focus());
}
populateLabelRepositoryFromOptions(t) {
if (!(!t || !Array.isArray(t)))
for (let e of t)
e.options && Array.isArray(e.options)
? this.populateLabelRepositoryFromOptions(e.options)
: e.value !== void 0 &&
e.label !== void 0 &&
(this.labelRepository[e.value] = e.label);
}
render() {
(this.populateLabelRepositoryFromOptions(this.options),
(this.container = document.createElement("div")),
(this.container.className = "fi-select-input-ctn"),
this.canOptionLabelsWrap ||
this.container.classList.add(
"fi-select-input-ctn-option-labels-not-wrapped",
),
this.container.setAttribute("aria-haspopup", "listbox"),
(this.selectButton = document.createElement("button")),
(this.selectButton.className = "fi-select-input-btn"),
(this.selectButton.type = "button"),
this.selectButton.setAttribute("aria-expanded", "false"),
(this.selectedDisplay = document.createElement("div")),
(this.selectedDisplay.className = "fi-select-input-value-ctn"),
this.updateSelectedDisplay(),
this.selectButton.appendChild(this.selectedDisplay),
(this.dropdown = document.createElement("div")),
(this.dropdown.className = "fi-dropdown-panel fi-scrollable"),
this.dropdown.setAttribute("role", "listbox"),
this.dropdown.setAttribute("tabindex", "-1"),
(this.dropdown.style.display = "none"),
(this.dropdownId = `fi-select-input-dropdown-${Math.random().toString(36).substring(2, 11)}`),
(this.dropdown.id = this.dropdownId),
this.isMultiple &&
this.dropdown.setAttribute("aria-multiselectable", "true"),
this.isSearchable &&
((this.searchContainer = document.createElement("div")),
(this.searchContainer.className = "fi-select-input-search-ctn"),
(this.searchInput = document.createElement("input")),
(this.searchInput.className = "fi-input"),
(this.searchInput.type = "text"),
(this.searchInput.placeholder = this.searchPrompt),
this.searchInput.setAttribute("aria-label", "Search"),
this.searchContainer.appendChild(this.searchInput),
this.dropdown.appendChild(this.searchContainer),
this.searchInput.addEventListener("input", (t) => {
this.isDisabled || this.handleSearch(t);
}),
this.searchInput.addEventListener("keydown", (t) => {
if (!this.isDisabled) {
if (t.key === "Tab") {
t.preventDefault();
let e = this.getVisibleOptions();
if (e.length === 0) return;
(t.shiftKey
? (this.selectedIndex = e.length - 1)
: (this.selectedIndex = 0),
e.forEach((i) => {
i.classList.remove("fi-selected");
}),
e[this.selectedIndex].classList.add(
"fi-selected",
),
e[this.selectedIndex].focus());
} else if (t.key === "ArrowDown") {
if (
(t.preventDefault(),
t.stopPropagation(),
this.getVisibleOptions().length === 0)
)
return;
((this.selectedIndex = -1),
this.searchInput.blur(),
this.focusNextOption());
} else if (t.key === "ArrowUp") {
(t.preventDefault(), t.stopPropagation());
let e = this.getVisibleOptions();
if (e.length === 0) return;
((this.selectedIndex = e.length - 1),
this.searchInput.blur(),
e[this.selectedIndex].classList.add(
"fi-selected",
),
e[this.selectedIndex].focus(),
e[this.selectedIndex].id &&
this.dropdown.setAttribute(
"aria-activedescendant",
e[this.selectedIndex].id,
),
this.scrollOptionIntoView(
e[this.selectedIndex],
));
} else if (t.key === "Enter") {
if (
(t.preventDefault(),
t.stopPropagation(),
this.isSearching)
)
return;
let e = this.getVisibleOptions();
if (e.length === 0) return;
let i = e.find((s) => {
let r =
s.getAttribute("aria-disabled") ===
"true",
a = s.classList.contains("fi-disabled"),
l = s.offsetParent === null;
return !(r || a || l);
});
if (!i) return;
let o = i.getAttribute("data-value");
if (o === null) return;
this.selectOption(o);
}
}
})),
(this.optionsList = document.createElement("ul")),
this.renderOptions(),
this.container.appendChild(this.selectButton),
this.container.appendChild(this.dropdown),
this.element.appendChild(this.container),
this.applyDisabledState());
}
renderOptions() {
this.optionsList.innerHTML = "";
let t = 0,
e = this.options,
i = 0,
o = !1;
(this.options.forEach((a) => {
a.options && Array.isArray(a.options)
? ((i += a.options.length), (o = !0))
: i++;
}),
o
? (this.optionsList.className = "fi-select-input-options-ctn")
: i > 0 && (this.optionsList.className = "fi-dropdown-list"));
let s = o ? null : this.optionsList,
r = 0;
for (let a of e) {
if (this.optionsLimit > 0 && r >= this.optionsLimit) break;
if (a.options && Array.isArray(a.options)) {
let l = a.options;
if (
(this.isMultiple &&
Array.isArray(this.state) &&
this.state.length > 0 &&
(l = a.options.filter(
(c) => !this.state.includes(c.value),
)),
l.length > 0)
) {
if (this.optionsLimit > 0) {
let c = this.optionsLimit - r;
c < l.length && (l = l.slice(0, c));
}
(this.renderOptionGroup(a.label, l),
(r += l.length),
(t += l.length));
}
} else {
if (
this.isMultiple &&
Array.isArray(this.state) &&
this.state.includes(a.value)
)
continue;
!s &&
o &&
((s = document.createElement("ul")),
(s.className = "fi-dropdown-list"),
this.optionsList.appendChild(s));
let l = this.createOptionElement(a.value, a);
(s.appendChild(l), r++, t++);
}
}
t === 0
? (this.searchQuery
? this.showNoResultsMessage()
: this.hasInitialNoOptionsMessage || this.hasDynamicOptions
? this.showNoOptionsMessage()
: this.isMultiple &&
this.isOpen &&
!this.isSearchable &&
this.closeDropdown(),
this.optionsList.parentNode === this.dropdown &&
this.dropdown.removeChild(this.optionsList))
: (this.hideLoadingState(),
this.optionsList.parentNode !== this.dropdown &&
this.dropdown.appendChild(this.optionsList));
}
renderOptionGroup(t, e) {
if (e.length === 0) return;
let i = document.createElement("li");
i.className = "fi-select-input-option-group";
let o = document.createElement("div");
((o.className = "fi-dropdown-header"), (o.textContent = t));
let s = document.createElement("ul");
((s.className = "fi-dropdown-list"),
e.forEach((r) => {
let a = this.createOptionElement(r.value, r);
s.appendChild(a);
}),
i.appendChild(o),
i.appendChild(s),
this.optionsList.appendChild(i));
}
createOptionElement(t, e) {
let i = t,
o = e,
s = !1;
typeof e == "object" &&
e !== null &&
"label" in e &&
"value" in e &&
((i = e.value), (o = e.label), (s = e.isDisabled || !1));
let r = document.createElement("li");
((r.className = "fi-dropdown-list-item fi-select-input-option"),
s && r.classList.add("fi-disabled"));
let a = `fi-select-input-option-${Math.random().toString(36).substring(2, 11)}`;
if (
((r.id = a),
r.setAttribute("role", "option"),
r.setAttribute("data-value", i),
r.setAttribute("tabindex", "0"),
s && r.setAttribute("aria-disabled", "true"),
this.isHtmlAllowed && typeof o == "string")
) {
let f = document.createElement("div");
f.innerHTML = o;
let d = f.textContent || f.innerText || o;
r.setAttribute("aria-label", d);
}
let l = this.isMultiple
? Array.isArray(this.state) && this.state.includes(i)
: this.state === i;
(r.setAttribute("aria-selected", l ? "true" : "false"),
l && r.classList.add("fi-selected"));
let c = document.createElement("span");
return (
this.isHtmlAllowed ? (c.innerHTML = o) : (c.textContent = o),
r.appendChild(c),
s ||
r.addEventListener("click", (f) => {
(f.preventDefault(),
f.stopPropagation(),
this.selectOption(i),
this.isMultiple &&
(this.isSearchable && this.searchInput
? setTimeout(() => {
this.searchInput.focus();
}, 0)
: setTimeout(() => {
r.focus();
}, 0)));
}),
r
);
}
async updateSelectedDisplay() {
this.selectedDisplayVersion = this.selectedDisplayVersion + 1;
let t = this.selectedDisplayVersion,
e = document.createDocumentFragment();
if (this.isMultiple) {
if (!Array.isArray(this.state) || this.state.length === 0) {
let o = document.createElement("span");
((o.textContent = this.placeholder),
o.classList.add("fi-select-input-placeholder"),
e.appendChild(o));
} else {
let o = await this.getLabelsForMultipleSelection();
if (t !== this.selectedDisplayVersion) return;
this.addBadgesForSelectedOptions(o, e);
}
t === this.selectedDisplayVersion &&
(this.selectedDisplay.replaceChildren(e),
this.isOpen && this.deferPositionDropdown());
return;
}
if (this.state === null || this.state === "") {
let o = document.createElement("span");
if (
((o.textContent = this.placeholder),
o.classList.add("fi-select-input-placeholder"),
e.appendChild(o),
t === this.selectedDisplayVersion)
) {
this.selectedDisplay.replaceChildren(e);
let s = this.container.querySelector(
".fi-select-input-value-remove-btn",
);
(s && s.remove(),
this.container.classList.remove(
"fi-select-input-ctn-clearable",
));
}
return;
}
let i = await this.getLabelForSingleSelection();
t === this.selectedDisplayVersion &&
(this.addSingleSelectionDisplay(i, e),
t === this.selectedDisplayVersion &&
this.selectedDisplay.replaceChildren(e));
}
async getLabelsForMultipleSelection() {
let t = this.getSelectedOptionLabels(),
e = [];
if (Array.isArray(this.state)) {
for (let o of this.state)
if (!P(this.labelRepository[o])) {
if (P(t[o])) {
this.labelRepository[o] = t[o];
continue;
}
e.push(o.toString());
}
}
if (
e.length > 0 &&
P(this.initialOptionLabels) &&
JSON.stringify(this.state) === JSON.stringify(this.initialState)
) {
if (Array.isArray(this.initialOptionLabels))
for (let o of this.initialOptionLabels)
P(o) &&
o.value !== void 0 &&
o.label !== void 0 &&
e.includes(o.value) &&
(this.labelRepository[o.value] = o.label);
} else if (e.length > 0 && this.getOptionLabelsUsing)
try {
let o = await this.getOptionLabelsUsing();
for (let s of o)
P(s) &&
s.value !== void 0 &&
s.label !== void 0 &&
(this.labelRepository[s.value] = s.label);
} catch (o) {
console.error("Error fetching option labels:", o);
}
let i = [];
if (Array.isArray(this.state))
for (let o of this.state)
P(this.labelRepository[o])
? i.push(this.labelRepository[o])
: P(t[o])
? i.push(t[o])
: i.push(o);
return i;
}
createBadgeElement(t, e) {
let i = document.createElement("span");
((i.className =
"fi-badge fi-size-md fi-color fi-color-primary fi-text-color-600 dark:fi-text-color-200"),
P(t) && i.setAttribute("data-value", t));
let o = document.createElement("span");
o.className = "fi-badge-label-ctn";
let s = document.createElement("span");
((s.className = "fi-badge-label"),
this.canOptionLabelsWrap && s.classList.add("fi-wrapped"),
this.isHtmlAllowed ? (s.innerHTML = e) : (s.textContent = e),
o.appendChild(s),
i.appendChild(o));
let r = this.createRemoveButton(t, e);
return (i.appendChild(r), i);
}
createRemoveButton(t, e) {
let i = document.createElement("button");
return (
(i.type = "button"),
(i.className = "fi-badge-delete-btn"),
(i.innerHTML =
'<svg class="fi-icon fi-size-xs" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" data-slot="icon"><path d="M5.28 4.22a.75.75 0 0 0-1.06 1.06L6.94 8l-2.72 2.72a.75.75 0 1 0 1.06 1.06L8 9.06l2.72 2.72a.75.75 0 1 0 1.06-1.06L9.06 8l2.72-2.72a.75.75 0 0 0-1.06-1.06L8 6.94 5.28 4.22Z"></path></svg>'),
i.setAttribute(
"aria-label",
"Remove " +
(this.isHtmlAllowed ? e.replace(/<[^>]*>/g, "") : e),
),
i.addEventListener("click", (o) => {
(o.stopPropagation(), P(t) && this.selectOption(t));
}),
i.addEventListener("keydown", (o) => {
(o.key === " " || o.key === "Enter") &&
(o.preventDefault(),
o.stopPropagation(),
P(t) && this.selectOption(t));
}),
i
);
}
addBadgesForSelectedOptions(t, e = this.selectedDisplay) {
let i = document.createElement("div");
((i.className = "fi-select-input-value-badges-ctn"),
t.forEach((o, s) => {
let r = Array.isArray(this.state) ? this.state[s] : null,
a = this.createBadgeElement(r, o);
i.appendChild(a);
}),
e.appendChild(i),
this.isReorderable &&
(i.addEventListener("click", (o) => {
o.stopPropagation();
}),
i.addEventListener("mousedown", (o) => {
o.stopPropagation();
}),
new Ui(i, {
animation: 150,
onEnd: () => {
let o = [];
(i.querySelectorAll("[data-value]").forEach((s) => {
o.push(s.getAttribute("data-value"));
}),
(this.state = o),
this.onStateChange(this.state));
},
})));
}
async getLabelForSingleSelection() {
let t = this.labelRepository[this.state];
if (
(bt(t) && (t = this.getSelectedOptionLabel(this.state)),
bt(t) &&
P(this.initialOptionLabel) &&
this.state === this.initialState)
)
((t = this.initialOptionLabel),
P(this.state) && (this.labelRepository[this.state] = t));
else if (bt(t) && this.getOptionLabelUsing)
try {
((t = await this.getOptionLabelUsing()),
P(t) &&
P(this.state) &&
(this.labelRepository[this.state] = t));
} catch (e) {
(console.error("Error fetching option label:", e),
(t = this.state));
}
else bt(t) && (t = this.state);
return t;
}
addSingleSelectionDisplay(t, e = this.selectedDisplay) {
let i = document.createElement("span");
if (
((i.className = "fi-select-input-value-label"),
this.isHtmlAllowed ? (i.innerHTML = t) : (i.textContent = t),
e.appendChild(i),
!this.canSelectPlaceholder ||
this.container.querySelector(
".fi-select-input-value-remove-btn",
))
)
return;
let o = document.createElement("button");
((o.type = "button"),
(o.className = "fi-select-input-value-remove-btn"),
(o.innerHTML =
'<svg class="fi-icon fi-size-sm" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" /></svg>'),
o.setAttribute("aria-label", "Clear selection"),
o.addEventListener("click", (s) => {
(s.stopPropagation(), this.selectOption(""));
}),
o.addEventListener("keydown", (s) => {
(s.key === " " || s.key === "Enter") &&
(s.preventDefault(),
s.stopPropagation(),
this.selectOption(""));
}),
this.container.appendChild(o),
this.container.classList.add("fi-select-input-ctn-clearable"));
}
getSelectedOptionLabel(t) {
if (P(this.labelRepository[t])) return this.labelRepository[t];
let e = "";
for (let i of this.options)
if (i.options && Array.isArray(i.options)) {
for (let o of i.options)
if (o.value === t) {
((e = o.label), (this.labelRepository[t] = e));
break;
}
} else if (i.value === t) {
((e = i.label), (this.labelRepository[t] = e));
break;
}
return e;
}
setUbEventListeners() {
((this.buttonClickListener = () => {
this.toggleDropdown();
}),
(this.documentClickListener = (t) => {
!this.container.contains(t.target) &&
this.isOpen &&
this.closeDropdown();
}),
(this.buttonKeydownListener = (t) => {
this.isDisabled || this.handleSelectButtonKeydown(t);
}),
(this.dropdownKeydownListener = (t) => {
this.isDisabled ||
(this.isSearchable &&
document.activeElement === this.searchInput &&
!["Tab", "Escape"].includes(t.key)) ||
this.handleDropdownKeydown(t);
}),
this.selectButton.addEventListener(
"click",
this.buttonClickListener,
),
document.addEventListener("click", this.documentClickListener),
this.selectButton.addEventListener(
"keydown",
this.buttonKeydownListener,
),
this.dropdown.addEventListener(
"keydown",
this.dropdownKeydownListener,
),
!this.isMultiple &&
this.livewireId &&
this.statePath &&
this.getOptionLabelUsing &&
((this.refreshOptionLabelListener = async (t) => {
if (
t.detail.livewireId === this.livewireId &&
t.detail.statePath === this.statePath &&
P(this.state)
)
try {
delete this.labelRepository[this.state];
let e = await this.getOptionLabelUsing();
P(e) && (this.labelRepository[this.state] = e);
let i = this.selectedDisplay.querySelector(
".fi-select-input-value-label",
);
(P(i) &&
(this.isHtmlAllowed
? (i.innerHTML = e)
: (i.textContent = e)),
this.updateOptionLabelInList(this.state, e));
} catch (e) {
console.error("Error refreshing option label:", e);
}
}),
window.addEventListener(
"filament-forms::select.refreshSelectedOptionLabel",
this.refreshOptionLabelListener,
)));
}
updateOptionLabelInList(t, e) {
this.labelRepository[t] = e;
let i = this.getVisibleOptions();
for (let o of i)
if (o.getAttribute("data-value") === String(t)) {
if (((o.innerHTML = ""), this.isHtmlAllowed)) {
let s = document.createElement("span");
((s.innerHTML = e), o.appendChild(s));
} else o.appendChild(document.createTextNode(e));
break;
}
for (let o of this.options)
if (o.options && Array.isArray(o.options)) {
for (let s of o.options)
if (s.value === t) {
s.label = e;
break;
}
} else if (o.value === t) {
o.label = e;
break;
}
for (let o of this.originalOptions)
if (o.options && Array.isArray(o.options)) {
for (let s of o.options)
if (s.value === t) {
s.label = e;
break;
}
} else if (o.value === t) {
o.label = e;
break;
}
}
handleSelectButtonKeydown(t) {
switch (t.key) {
case "ArrowDown":
(t.preventDefault(),
t.stopPropagation(),
this.isOpen ? this.focusNextOption() : this.openDropdown());
break;
case "ArrowUp":
(t.preventDefault(),
t.stopPropagation(),
this.isOpen
? this.focusPreviousOption()
: this.openDropdown());
break;
case " ":
if ((t.preventDefault(), this.isOpen)) {
if (this.selectedIndex >= 0) {
let e = this.getVisibleOptions()[this.selectedIndex];
e && e.click();
}
} else this.openDropdown();
break;
case "Enter":
break;
case "Escape":
this.isOpen && (t.preventDefault(), this.closeDropdown());
break;
case "Tab":
this.isOpen && this.closeDropdown();
break;
default:
if (
this.isSearchable &&
!t.ctrlKey &&
!t.metaKey &&
!t.altKey &&
typeof t.key == "string" &&
t.key.length === 1
) {
t.preventDefault();
let e = t.key;
(this.isOpen || this.openDropdown(),
this.searchInput &&
(this.searchInput.focus(),
(this.searchInput.value =
(this.searchInput.value || "") + e),
this.searchInput.dispatchEvent(
new Event("input", { bubbles: !0 }),
)));
}
break;
}
}
handleDropdownKeydown(t) {
switch (t.key) {
case "ArrowDown":
(t.preventDefault(),
t.stopPropagation(),
this.focusNextOption());
break;
case "ArrowUp":
(t.preventDefault(),
t.stopPropagation(),
this.focusPreviousOption());
break;
case " ":
if ((t.preventDefault(), this.selectedIndex >= 0)) {
let e = this.getVisibleOptions()[this.selectedIndex];
e && e.click();
}
break;
case "Enter":
if ((t.preventDefault(), this.selectedIndex >= 0)) {
let e = this.getVisibleOptions()[this.selectedIndex];
e && e.click();
} else {
let e = this.element.closest("form");
e && e.submit();
}
break;
case "Escape":
(t.preventDefault(),
this.closeDropdown(),
this.selectButton.focus());
break;
case "Tab":
this.closeDropdown();
break;
default:
if (
this.isSearchable &&
!t.ctrlKey &&
!t.metaKey &&
!t.altKey &&
typeof t.key == "string" &&
t.key.length === 1
) {
t.preventDefault();
let e = t.key;
this.searchInput &&
(this.searchInput.focus(),
(this.searchInput.value =
(this.searchInput.value || "") + e),
this.searchInput.dispatchEvent(
new Event("input", { bubbles: !0 }),
));
}
break;
}
}
toggleDropdown() {
if (!this.isDisabled) {
if (this.isOpen) {
this.closeDropdown();
return;
}
(this.isMultiple &&
!this.isSearchable &&
!this.hasAvailableOptions()) ||
this.openDropdown();
}
}
hasAvailableOptions() {
for (let t of this.options)
if (t.options && Array.isArray(t.options)) {
for (let e of t.options)
if (
!Array.isArray(this.state) ||
!this.state.includes(e.value)
)
return !0;
} else if (
!Array.isArray(this.state) ||
!this.state.includes(t.value)
)
return !0;
return !1;
}
async openDropdown() {
((this.dropdown.style.display = "block"),
(this.dropdown.style.opacity = "0"));
let t =
this.selectButton.closest(".fi-fixed-positioning-context") !==
null &&
this.selectButton.closest(".fi-absolute-positioning-context") ===
null;
if (
((this.dropdown.style.position = t ? "fixed" : "absolute"),
(this.dropdown.style.width = `${this.selectButton.offsetWidth}px`),
this.selectButton.setAttribute("aria-expanded", "true"),
(this.isOpen = !0),
this.positionDropdown(),
this.resizeListener ||
((this.resizeListener = () => {
((this.dropdown.style.width = `${this.selectButton.offsetWidth}px`),
this.positionDropdown());
}),
window.addEventListener("resize", this.resizeListener)),
this.scrollListener ||
((this.scrollListener = () => this.positionDropdown()),
window.addEventListener("scroll", this.scrollListener, !0)),
(this.dropdown.style.opacity = "1"),
this.isSearchable &&
this.searchInput &&
((this.searchInput.value = ""),
(this.searchQuery = ""),
this.hasDynamicOptions ||
((this.options = JSON.parse(
JSON.stringify(this.originalOptions),
)),
this.renderOptions())),
this.hasDynamicOptions && this.getOptionsUsing)
) {
this.showLoadingState(!1);
try {
let e = await this.getOptionsUsing(),
i = Array.isArray(e)
? e
: e && Array.isArray(e.options)
? e.options
: [];
if (
((this.options = i),
(this.originalOptions = JSON.parse(JSON.stringify(i))),
this.populateLabelRepositoryFromOptions(i),
this.isSearchable &&
this.searchInput &&
((this.searchInput.value &&
this.searchInput.value.trim() !== "") ||
(this.searchQuery &&
this.searchQuery.trim() !== "")))
) {
let o = (this.searchInput.value || this.searchQuery || "")
.trim()
.toLowerCase();
(this.hideLoadingState(), this.filterOptions(o));
} else this.renderOptions();
} catch (e) {
(console.error("Error fetching options:", e),
this.hideLoadingState());
}
} else
(!this.hasInitialNoOptionsMessage || this.searchQuery) &&
this.hideLoadingState();
if (this.isSearchable && this.searchInput) this.searchInput.focus();
else {
this.selectedIndex = -1;
let e = this.getVisibleOptions();
if (this.isMultiple) {
if (Array.isArray(this.state) && this.state.length > 0) {
for (let i = 0; i < e.length; i++)
if (
this.state.includes(e[i].getAttribute("data-value"))
) {
this.selectedIndex = i;
break;
}
}
} else
for (let i = 0; i < e.length; i++)
if (e[i].getAttribute("data-value") === this.state) {
this.selectedIndex = i;
break;
}
(this.selectedIndex === -1 &&
e.length > 0 &&
(this.selectedIndex = 0),
this.selectedIndex >= 0 &&
(e[this.selectedIndex].classList.add("fi-selected"),
e[this.selectedIndex].focus()));
}
}
positionDropdown() {
let t = this.position === "top" ? "top-start" : "bottom-start",
e = [wi(4), Si({ padding: 5 })];
this.position !== "top" && this.position !== "bottom" && e.push(xi());
let i =
this.selectButton.closest(".fi-fixed-positioning-context") !==
null &&
this.selectButton.closest(".fi-absolute-positioning-context") ===
null;
Oi(this.selectButton, this.dropdown, {
placement: t,
middleware: e,
strategy: i ? "fixed" : "absolute",
}).then(({ x: o, y: s }) => {
Object.assign(this.dropdown.style, {
left: `${o}px`,
top: `${s}px`,
});
});
}
deferPositionDropdown() {
this.isOpen &&
(this.positioningRequestAnimationFrame &&
(cancelAnimationFrame(this.positioningRequestAnimationFrame),
(this.positioningRequestAnimationFrame = null)),
(this.positioningRequestAnimationFrame = requestAnimationFrame(
() => {
(this.positionDropdown(),
(this.positioningRequestAnimationFrame = null));
},
)));
}
closeDropdown() {
((this.dropdown.style.display = "none"),
this.selectButton.setAttribute("aria-expanded", "false"),
(this.isOpen = !1),
this.searchTimeout &&
(clearTimeout(this.searchTimeout), (this.searchTimeout = null)),
this.activeSearchId++,
(this.isSearching = !1),
this.hideLoadingState(),
this.resizeListener &&
(window.removeEventListener("resize", this.resizeListener),
(this.resizeListener = null)),
this.scrollListener &&
(window.removeEventListener("scroll", this.scrollListener, !0),
(this.scrollListener = null)),
this.getVisibleOptions().forEach((e) => {
e.classList.remove("fi-selected");
}),
this.dropdown.removeAttribute("aria-activedescendant"));
}
focusNextOption() {
let t = this.getVisibleOptions();
if (t.length !== 0) {
if (
(this.selectedIndex >= 0 &&
this.selectedIndex < t.length &&
t[this.selectedIndex].classList.remove("fi-selected"),
this.selectedIndex === t.length - 1 &&
this.isSearchable &&
this.searchInput)
) {
((this.selectedIndex = -1),
this.searchInput.focus(),
this.dropdown.removeAttribute("aria-activedescendant"));
return;
}
((this.selectedIndex = (this.selectedIndex + 1) % t.length),
t[this.selectedIndex].classList.add("fi-selected"),
t[this.selectedIndex].focus(),
t[this.selectedIndex].id &&
this.dropdown.setAttribute(
"aria-activedescendant",
t[this.selectedIndex].id,
),
this.scrollOptionIntoView(t[this.selectedIndex]));
}
}
focusPreviousOption() {
let t = this.getVisibleOptions();
if (t.length !== 0) {
if (
(this.selectedIndex >= 0 &&
this.selectedIndex < t.length &&
t[this.selectedIndex].classList.remove("fi-selected"),
(this.selectedIndex === 0 || this.selectedIndex === -1) &&
this.isSearchable &&
this.searchInput)
) {
((this.selectedIndex = -1),
this.searchInput.focus(),
this.dropdown.removeAttribute("aria-activedescendant"));
return;
}
((this.selectedIndex =
(this.selectedIndex - 1 + t.length) % t.length),
t[this.selectedIndex].classList.add("fi-selected"),
t[this.selectedIndex].focus(),
t[this.selectedIndex].id &&
this.dropdown.setAttribute(
"aria-activedescendant",
t[this.selectedIndex].id,
),
this.scrollOptionIntoView(t[this.selectedIndex]));
}
}
scrollOptionIntoView(t) {
if (!t) return;
let e = this.dropdown.getBoundingClientRect(),
i = t.getBoundingClientRect();
i.bottom > e.bottom
? (this.dropdown.scrollTop += i.bottom - e.bottom)
: i.top < e.top && (this.dropdown.scrollTop -= e.top - i.top);
}
getVisibleOptions() {
let t = [];
this.optionsList.classList.contains("fi-dropdown-list")
? (t = Array.from(
this.optionsList.querySelectorAll(
':scope > li[role="option"]',
),
))
: (t = Array.from(
this.optionsList.querySelectorAll(
':scope > ul.fi-dropdown-list > li[role="option"]',
),
));
let e = Array.from(
this.optionsList.querySelectorAll(
'li.fi-select-input-option-group > ul > li[role="option"]',
),
);
return [...t, ...e];
}
getSelectedOptionLabels() {
if (!Array.isArray(this.state) || this.state.length === 0) return {};
let t = {};
for (let e of this.state) {
let i = !1;
for (let o of this.options)
if (o.options && Array.isArray(o.options)) {
for (let s of o.options)
if (s.value === e) {
((t[e] = s.label), (i = !0));
break;
}
if (i) break;
} else if (o.value === e) {
((t[e] = o.label), (i = !0));
break;
}
}
return t;
}
handleSearch(t) {
let e = t.target.value.trim();
if (
((this.searchQuery = e),
this.searchTimeout && clearTimeout(this.searchTimeout),
e === "")
) {
((this.options = JSON.parse(JSON.stringify(this.originalOptions))),
this.renderOptions());
return;
}
if (
!this.getSearchResultsUsing ||
typeof this.getSearchResultsUsing != "function" ||
!this.hasDynamicSearchResults
) {
this.filterOptions(e);
return;
}
this.searchTimeout = setTimeout(async () => {
this.searchTimeout = null;
let i = ++this.activeSearchId;
this.isSearching = !0;
try {
this.showLoadingState(!0);
let o = await this.getSearchResultsUsing(e);
if (i !== this.activeSearchId || !this.isOpen) return;
let s = Array.isArray(o)
? o
: o && Array.isArray(o.options)
? o.options
: [];
((this.options = s),
this.populateLabelRepositoryFromOptions(s),
this.hideLoadingState(),
this.renderOptions(),
this.isOpen && this.deferPositionDropdown(),
this.options.length === 0 && this.showNoResultsMessage());
} catch (o) {
i === this.activeSearchId &&
(console.error("Error fetching search results:", o),
this.hideLoadingState(),
(this.options = JSON.parse(
JSON.stringify(this.originalOptions),
)),
this.renderOptions());
} finally {
i === this.activeSearchId && (this.isSearching = !1);
}
}, this.searchDebounce);
}
showLoadingState(t = !1) {
(this.optionsList.parentNode === this.dropdown &&
this.dropdown.removeChild(this.optionsList),
this.hideLoadingState());
let e = document.createElement("div");
((e.className = "fi-select-input-message"),
(e.textContent = t ? this.searchingMessage : this.loadingMessage),
this.dropdown.appendChild(e),
this.isOpen && this.deferPositionDropdown());
}
hideLoadingState() {
let t = this.dropdown.querySelector(".fi-select-input-message");
t && t.remove();
}
showNoOptionsMessage() {
(this.optionsList.parentNode === this.dropdown &&
this.dropdown.removeChild(this.optionsList),
this.hideLoadingState());
let t = document.createElement("div");
((t.className = "fi-select-input-message"),
(t.textContent = this.noOptionsMessage),
this.dropdown.appendChild(t),
this.isOpen && this.deferPositionDropdown());
}
showNoResultsMessage() {
(this.optionsList.parentNode === this.dropdown &&
this.dropdown.removeChild(this.optionsList),
this.hideLoadingState());
let t = document.createElement("div");
((t.className = "fi-select-input-message"),
(t.textContent = this.noSearchResultsMessage),
this.dropdown.appendChild(t),
this.isOpen && this.deferPositionDropdown());
}
filterOptions(t) {
let e = this.searchableOptionFields.includes("label"),
i = this.searchableOptionFields.includes("value");
t = t.toLowerCase();
let o = [];
for (let s of this.originalOptions)
if (s.options && Array.isArray(s.options)) {
let r = s.options.filter(
(a) =>
(e && a.label.toLowerCase().includes(t)) ||
(i && String(a.value).toLowerCase().includes(t)),
);
r.length > 0 && o.push({ label: s.label, options: r });
} else
((e && s.label.toLowerCase().includes(t)) ||
(i && String(s.value).toLowerCase().includes(t))) &&
o.push(s);
((this.options = o),
this.renderOptions(),
this.options.length === 0 && this.showNoResultsMessage(),
this.isOpen && this.positionDropdown());
}
selectOption(t) {
if (this.isDisabled) return;
if (!this.isMultiple) {
((this.state = t),
this.updateSelectedDisplay(),
this.renderOptions(),
this.closeDropdown(),
this.selectButton.focus(),
this.onStateChange(this.state));
return;
}
let e = Array.isArray(this.state) ? [...this.state] : [];
if (e.includes(t)) {
let o = this.selectedDisplay.querySelector(`[data-value="${t}"]`);
if (P(o)) {
let s = o.parentElement;
P(s) && s.children.length === 1
? ((e = e.filter((r) => r !== t)),
(this.state = e),
this.updateSelectedDisplay())
: (o.remove(),
(e = e.filter((r) => r !== t)),
(this.state = e));
} else
((e = e.filter((s) => s !== t)),
(this.state = e),
this.updateSelectedDisplay());
(this.renderOptions(),
this.isOpen && this.deferPositionDropdown(),
this.maintainFocusInMultipleMode(),
this.onStateChange(this.state));
return;
}
if (this.maxItems && e.length >= this.maxItems) {
this.maxItemsMessage && alert(this.maxItemsMessage);
return;
}
(e.push(t), (this.state = e));
let i = this.selectedDisplay.querySelector(
".fi-select-input-value-badges-ctn",
);
(bt(i) ? this.updateSelectedDisplay() : this.addSingleBadge(t, i),
this.renderOptions(),
this.isOpen && this.deferPositionDropdown(),
this.maintainFocusInMultipleMode(),
this.onStateChange(this.state));
}
async addSingleBadge(t, e) {
let i = this.labelRepository[t];
if (
(bt(i) &&
((i = this.getSelectedOptionLabel(t)),
P(i) && (this.labelRepository[t] = i)),
bt(i) && this.getOptionLabelsUsing)
)
try {
let s = await this.getOptionLabelsUsing();
for (let r of s)
if (P(r) && r.value === t && r.label !== void 0) {
((i = r.label), (this.labelRepository[t] = i));
break;
}
} catch (s) {
console.error("Error fetching option label:", s);
}
bt(i) && (i = t);
let o = this.createBadgeElement(t, i);
e.appendChild(o);
}
maintainFocusInMultipleMode() {
if (this.isSearchable && this.searchInput) {
this.searchInput.focus();
return;
}
let t = this.getVisibleOptions();
if (t.length !== 0) {
if (
((this.selectedIndex = -1),
Array.isArray(this.state) && this.state.length > 0)
) {
for (let e = 0; e < t.length; e++)
if (this.state.includes(t[e].getAttribute("data-value"))) {
this.selectedIndex = e;
break;
}
}
(this.selectedIndex === -1 && (this.selectedIndex = 0),
t[this.selectedIndex].classList.add("fi-selected"),
t[this.selectedIndex].focus());
}
}
disable() {
this.isDisabled ||
((this.isDisabled = !0),
this.applyDisabledState(),
this.isOpen && this.closeDropdown());
}
enable() {
this.isDisabled && ((this.isDisabled = !1), this.applyDisabledState());
}
applyDisabledState() {
if (this.isDisabled) {
if (
(this.selectButton.setAttribute("disabled", "disabled"),
this.selectButton.setAttribute("aria-disabled", "true"),
this.selectButton.classList.add("fi-disabled"),
this.isMultiple &&
this.container
.querySelectorAll(".fi-select-input-badge-remove")
.forEach((e) => {
(e.setAttribute("disabled", "disabled"),
e.classList.add("fi-disabled"));
}),
!this.isMultiple && this.canSelectPlaceholder)
) {
let t = this.container.querySelector(
".fi-select-input-value-remove-btn",
);
t &&
(t.setAttribute("disabled", "disabled"),
t.classList.add("fi-disabled"));
}
this.isSearchable &&
this.searchInput &&
(this.searchInput.setAttribute("disabled", "disabled"),
this.searchInput.classList.add("fi-disabled"));
} else {
if (
(this.selectButton.removeAttribute("disabled"),
this.selectButton.removeAttribute("aria-disabled"),
this.selectButton.classList.remove("fi-disabled"),
this.isMultiple &&
this.container
.querySelectorAll(".fi-select-input-badge-remove")
.forEach((e) => {
(e.removeAttribute("disabled"),
e.classList.remove("fi-disabled"));
}),
!this.isMultiple && this.canSelectPlaceholder)
) {
let t = this.container.querySelector(
".fi-select-input-value-remove-btn",
);
t &&
(t.removeAttribute("disabled"),
t.classList.add("fi-disabled"));
}
this.isSearchable &&
this.searchInput &&
(this.searchInput.removeAttribute("disabled"),
this.searchInput.classList.remove("fi-disabled"));
}
}
destroy() {
(this.selectButton &&
this.buttonClickListener &&
this.selectButton.removeEventListener(
"click",
this.buttonClickListener,
),
this.documentClickListener &&
document.removeEventListener(
"click",
this.documentClickListener,
),
this.selectButton &&
this.buttonKeydownListener &&
this.selectButton.removeEventListener(
"keydown",
this.buttonKeydownListener,
),
this.dropdown &&
this.dropdownKeydownListener &&
this.dropdown.removeEventListener(
"keydown",
this.dropdownKeydownListener,
),
this.resizeListener &&
(window.removeEventListener("resize", this.resizeListener),
(this.resizeListener = null)),
this.scrollListener &&
(window.removeEventListener("scroll", this.scrollListener, !0),
(this.scrollListener = null)),
this.refreshOptionLabelListener &&
window.removeEventListener(
"filament-forms::select.refreshSelectedOptionLabel",
this.refreshOptionLabelListener,
),
this.isOpen && this.closeDropdown(),
this.searchTimeout &&
(clearTimeout(this.searchTimeout), (this.searchTimeout = null)),
this.container && this.container.remove());
}
};
function Qn({
canOptionLabelsWrap: n,
canSelectPlaceholder: t,
getOptionLabelUsing: e,
getOptionLabelsUsing: i,
getOptionsUsing: o,
getSearchResultsUsing: s,
hasDynamicOptions: r,
hasDynamicSearchResults: a,
hasInitialNoOptionsMessage: l,
initialOptionLabel: c,
initialOptionLabels: f,
initialState: d,
isAutofocused: p,
isDisabled: u,
isHtmlAllowed: g,
isMultiple: m,
isReorderable: S,
isSearchable: E,
livewireId: w,
loadingMessage: D,
maxItems: A,
maxItemsMessage: C,
noOptionsMessage: F,
noSearchResultsMessage: q,
options: J,
optionsLimit: _,
placeholder: V,
position: W,
searchDebounce: tt,
searchingMessage: z,
searchPrompt: k,
searchableOptionFields: Y,
state: B,
statePath: X,
}) {
return {
select: null,
state: B,
init() {
((this.select = new Ee({
canOptionLabelsWrap: n,
canSelectPlaceholder: t,
element: this.$refs.select,
getOptionLabelUsing: e,
getOptionLabelsUsing: i,
getOptionsUsing: o,
getSearchResultsUsing: s,
hasDynamicOptions: r,
hasDynamicSearchResults: a,
hasInitialNoOptionsMessage: l,
initialOptionLabel: c,
initialOptionLabels: f,
initialState: d,
isAutofocused: p,
isDisabled: u,
isHtmlAllowed: g,
isMultiple: m,
isReorderable: S,
isSearchable: E,
livewireId: w,
loadingMessage: D,
maxItems: A,
maxItemsMessage: C,
noOptionsMessage: F,
noSearchResultsMessage: q,
onStateChange: (L) => {
this.state = L;
},
options: J,
optionsLimit: _,
placeholder: V,
position: W,
searchableOptionFields: Y,
searchDebounce: tt,
searchingMessage: z,
searchPrompt: k,
state: this.state,
statePath: X,
})),
this.$watch("state", (L) => {
this.$nextTick(() => {
this.select &&
this.select.state !== L &&
((this.select.state = L),
this.select.updateSelectedDisplay(),
this.select.renderOptions());
});
}));
},
destroy() {
this.select && (this.select.destroy(), (this.select = null));
},
};
}
export { Qn as default };
/*! Bundled license information:
sortablejs/modular/sortable.esm.js:
(**!
* Sortable 1.15.6
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*)
*/