Files
OverlayScrollbars/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
T
2022-07-11 14:48:50 +02:00

2280 lines
48 KiB
JavaScript

function createCache(t, n) {
const {o: e, u: o, _: s} = t;
let c = e;
let i;
const cacheUpdateContextual = (t, n) => {
const e = c;
const r = t;
const a = n || (o ? !o(e, r) : e !== r);
if (a || s) {
c = r;
i = e;
}
return [ c, a, i ];
};
const cacheUpdateIsolated = t => cacheUpdateContextual(n(c, i), t);
const getCurrentCache = t => [ c, !!t, i ];
return [ n ? cacheUpdateIsolated : cacheUpdateContextual, getCurrentCache ];
}
function isUndefined(t) {
return void 0 === t;
}
function isNull(t) {
return null === t;
}
function isNumber(t) {
return "number" === typeof t;
}
function isString(t) {
return "string" === typeof t;
}
function isBoolean(t) {
return "boolean" === typeof t;
}
function isFunction(t) {
return "function" === typeof t;
}
function isArray(t) {
return Array.isArray(t);
}
function isObject(t) {
return "object" === typeof t && !isArray(t) && !isNull(t);
}
function isArrayLike(t) {
const n = !!t && t.length;
const e = isNumber(n) && n > -1 && n % 1 == 0;
return isArray(t) || !isFunction(t) && e ? n > 0 && isObject(t) ? n - 1 in t : true : false;
}
function isPlainObject(t) {
if (!t || !isObject(t) || "object" !== type(t)) {
return false;
}
let n;
const o = "constructor";
const s = t[o];
const c = s && s.prototype;
const i = e.call(t, o);
const r = c && e.call(c, "isPrototypeOf");
if (s && !i && !r) {
return false;
}
for (n in t) {}
return isUndefined(n) || e.call(t, n);
}
function isHTMLElement(n) {
const e = window.HTMLElement;
return n ? e ? n instanceof e : n.nodeType === t : false;
}
function isElement(n) {
const e = window.Element;
return n ? e ? n instanceof e : n.nodeType === t : false;
}
function each(t, n) {
if (isArrayLike(t)) {
for (let e = 0; e < t.length; e++) {
if (false === n(t[e], e, t)) {
break;
}
}
} else if (t) {
each(Object.keys(t), (e => n(t[e], e, t)));
}
return t;
}
function assignDeep(t, n, e, o, s, c, i) {
const r = [ n, e, o, s, c, i ];
if (("object" !== typeof t || isNull(t)) && !isFunction(t)) {
t = {};
}
each(r, (n => {
each(keys(n), (e => {
const o = n[e];
if (t === o) {
return true;
}
const s = isArray(o);
if (o && (isPlainObject(o) || s)) {
const n = t[e];
let c = n;
if (s && !isArray(n)) {
c = [];
} else if (!s && !isPlainObject(n)) {
c = {};
}
t[e] = assignDeep(c, o);
} else {
t[e] = o;
}
}));
}));
return t;
}
function isEmptyObject(t) {
for (const n in t) {
return false;
}
return true;
}
function getSetProp(t, n, e, o) {
if (isUndefined(o)) {
return e ? e[t] : n;
}
e && (e[t] = o);
}
function attr(t, n, e) {
if (isUndefined(e)) {
return t ? t.getAttribute(n) : null;
}
t && t.setAttribute(n, e);
}
function scrollLeft(t, n) {
return getSetProp("scrollLeft", 0, t, n);
}
function scrollTop(t, n) {
return getSetProp("scrollTop", 0, t, n);
}
function style(t, n) {
const e = isString(n);
const o = isArray(n) || e;
if (o) {
let o = e ? "" : {};
if (t) {
const s = window.getComputedStyle(t, null);
o = e ? getCSSVal(t, s, n) : n.reduce(((n, e) => {
n[e] = getCSSVal(t, s, e);
return n;
}), o);
}
return o;
}
each(keys(n), (e => setCSSVal(t, e, n[e])));
}
const t = Node.ELEMENT_NODE;
const {toString: n, hasOwnProperty: e} = Object.prototype;
const type = t => isUndefined(t) || isNull(t) ? `${t}` : n.call(t).replace(/^\[object (.+)\]$/, "$1").toLowerCase();
const indexOf = (t, n, e) => t.indexOf(n, e);
const push = (t, n, e) => {
!e && !isString(n) && isArrayLike(n) ? Array.prototype.push.apply(t, n) : t.push(n);
return t;
};
const from = t => {
if (Array.from && t) {
return Array.from(t);
}
const n = [];
if (t instanceof Set) {
t.forEach((t => {
push(n, t);
}));
} else {
each(t, (t => {
push(n, t);
}));
}
return n;
};
const isEmptyArray = t => !!t && 0 === t.length;
const runEach = (t, n) => {
const runFn = t => t && t.apply(void 0, n || []);
if (t instanceof Set) {
t.forEach(runFn);
} else {
each(t, runFn);
}
};
const hasOwnProperty = (t, n) => Object.prototype.hasOwnProperty.call(t, n);
const keys = t => t ? Object.keys(t) : [];
const attrClass = (t, n, e, o) => {
const s = attr(t, n) || "";
const c = new Set(s.split(" "));
c[o ? "add" : "delete"](e);
attr(t, n, from(c).join(" ").trim());
};
const hasAttrClass = (t, n, e) => {
const o = attr(t, n) || "";
const s = new Set(o.split(" "));
return s.has(e);
};
const removeAttr = (t, n) => {
t && t.removeAttribute(n);
};
const o = Element.prototype;
const find = (t, n) => {
const e = [];
const o = n ? isElement(n) ? n : null : document;
return o ? push(e, o.querySelectorAll(t)) : e;
};
const findFirst = (t, n) => {
const e = n ? isElement(n) ? n : null : document;
return e ? e.querySelector(t) : null;
};
const is = (t, n) => {
if (isElement(t)) {
const e = o.matches || o.msMatchesSelector;
return e.call(t, n);
}
return false;
};
const contents = t => t ? from(t.childNodes) : [];
const parent = t => t ? t.parentElement : null;
const closest = (t, n) => {
if (isElement(t)) {
const e = o.closest;
if (e) {
return e.call(t, n);
}
do {
if (is(t, n)) {
return t;
}
t = parent(t);
} while (t);
}
return null;
};
const liesBetween = (t, n, e) => {
const o = t && closest(t, n);
const s = t && findFirst(e, o);
return o && s ? o === t || s === t || closest(closest(t, e), n) !== o : false;
};
const before = (t, n, e) => {
if (e) {
let o = n;
let s;
if (t) {
if (isArrayLike(e)) {
s = document.createDocumentFragment();
each(e, (t => {
if (t === o) {
o = t.previousSibling;
}
s.appendChild(t);
}));
} else {
s = e;
}
if (n) {
if (!o) {
o = t.firstChild;
} else if (o !== n) {
o = o.nextSibling;
}
}
t.insertBefore(s, o || null);
}
}
};
const appendChildren = (t, n) => {
before(t, null, n);
};
const prependChildren = (t, n) => {
before(t, t && t.firstChild, n);
};
const insertBefore = (t, n) => {
before(parent(t), t, n);
};
const insertAfter = (t, n) => {
before(parent(t), t && t.nextSibling, n);
};
const removeElements = t => {
if (isArrayLike(t)) {
each(from(t), (t => removeElements(t)));
} else if (t) {
const n = parent(t);
if (n) {
n.removeChild(t);
}
}
};
const createDiv = t => {
const n = document.createElement("div");
if (t) {
attr(n, "class", t);
}
return n;
};
const createDOM = t => {
const n = createDiv();
n.innerHTML = t.trim();
return each(contents(n), (t => removeElements(t)));
};
const firstLetterToUpper = t => t.charAt(0).toUpperCase() + t.slice(1);
const getDummyStyle = () => createDiv().style;
const s = [ "-webkit-", "-moz-", "-o-", "-ms-" ];
const c = [ "WebKit", "Moz", "O", "MS", "webkit", "moz", "o", "ms" ];
const i = {};
const r = {};
const cssProperty = t => {
let n = r[t];
if (hasOwnProperty(r, t)) {
return n;
}
const e = firstLetterToUpper(t);
const o = getDummyStyle();
each(s, (s => {
const c = s.replace(/-/g, "");
const i = [ t, s + t, c + e, firstLetterToUpper(c) + e ];
return !(n = i.find((t => void 0 !== o[t])));
}));
return r[t] = n || "";
};
const jsAPI = t => {
let n = i[t] || window[t];
if (hasOwnProperty(i, t)) {
return n;
}
each(c, (e => {
n = n || window[e + firstLetterToUpper(t)];
return !n;
}));
i[t] = n;
return n;
};
const a = jsAPI("MutationObserver");
const l = jsAPI("IntersectionObserver");
const u = jsAPI("ResizeObserver");
const f = jsAPI("cancelAnimationFrame");
const d = jsAPI("requestAnimationFrame");
const _ = /[^\x20\t\r\n\f]+/g;
const classListAction = (t, n, e) => {
let o;
let s = 0;
let c = false;
if (t && n && isString(n)) {
const i = n.match(_) || [];
c = i.length > 0;
while (o = i[s++]) {
c = !!e(t.classList, o) && c;
}
}
return c;
};
const hasClass = (t, n) => classListAction(t, n, ((t, n) => t.contains(n)));
const removeClass = (t, n) => {
classListAction(t, n, ((t, n) => t.remove(n)));
};
const addClass = (t, n) => {
classListAction(t, n, ((t, n) => t.add(n)));
return removeClass.bind(0, t, n);
};
const equal = (t, n, e, o) => {
if (t && n) {
let s = true;
each(e, (e => {
const c = o ? o(t[e]) : t[e];
const i = o ? o(n[e]) : n[e];
if (c !== i) {
s = false;
}
}));
return s;
}
return false;
};
const equalWH = (t, n) => equal(t, n, [ "w", "h" ]);
const equalXY = (t, n) => equal(t, n, [ "x", "y" ]);
const equalTRBL = (t, n) => equal(t, n, [ "t", "r", "b", "l" ]);
const equalBCRWH = (t, n, e) => equal(t, n, [ "width", "height" ], e && (t => Math.round(t)));
const clearTimeouts = t => {
t && window.clearTimeout(t);
t && f(t);
};
const noop = () => {};
const debounce = (t, n) => {
let e;
let o;
let s;
let c;
const {g: i, p: r, v: a} = n || {};
const l = window.setTimeout;
const u = function invokeFunctionToDebounce(n) {
clearTimeouts(e);
clearTimeouts(o);
o = e = s = void 0;
t.apply(this, n);
};
const mergeParms = t => a && s ? a(s, t) : t;
const flush = () => {
if (e) {
u(mergeParms(c) || c);
}
};
const f = function debouncedFn() {
const t = from(arguments);
const n = isFunction(i) ? i() : i;
const a = isNumber(n) && n >= 0;
if (a) {
const i = isFunction(r) ? r() : r;
const a = isNumber(i) && i >= 0;
const f = n > 0 ? l : d;
const _ = mergeParms(t);
const g = _ || t;
const h = u.bind(0, g);
clearTimeouts(e);
e = f(h, n);
if (a && !o) {
o = l(flush, i);
}
s = c = g;
} else {
u(t);
}
};
f.m = flush;
return f;
};
const g = {
opacity: 1,
zindex: 1
};
const parseToZeroOrNumber = (t, n) => {
const e = n ? parseFloat(t) : parseInt(t, 10);
return Number.isNaN(e) ? 0 : e;
};
const adaptCSSVal = (t, n) => !g[t.toLowerCase()] && isNumber(n) ? `${n}px` : n;
const getCSSVal = (t, n, e) => null != n ? n[e] || n.getPropertyValue(e) : t.style[e];
const setCSSVal = (t, n, e) => {
try {
if (t) {
const {style: o} = t;
if (!isUndefined(o[n])) {
o[n] = adaptCSSVal(n, e);
} else {
o.setProperty(n, e);
}
}
} catch (o) {}
};
const topRightBottomLeft = (t, n, e) => {
const o = n ? `${n}-` : "";
const s = e ? `-${e}` : "";
const c = `${o}top${s}`;
const i = `${o}right${s}`;
const r = `${o}bottom${s}`;
const a = `${o}left${s}`;
const l = style(t, [ c, i, r, a ]);
return {
t: parseToZeroOrNumber(l[c]),
r: parseToZeroOrNumber(l[i]),
b: parseToZeroOrNumber(l[r]),
l: parseToZeroOrNumber(l[a])
};
};
const h = {
w: 0,
h: 0
};
const windowSize = () => ({
w: window.innerWidth,
h: window.innerHeight
});
const offsetSize = t => t ? {
w: t.offsetWidth,
h: t.offsetHeight
} : h;
const clientSize = t => t ? {
w: t.clientWidth,
h: t.clientHeight
} : h;
const scrollSize = t => t ? {
w: t.scrollWidth,
h: t.scrollHeight
} : h;
const fractionalSize = t => {
const n = parseFloat(style(t, "height")) || 0;
const e = parseFloat(style(t, "height")) || 0;
return {
w: e - Math.round(e),
h: n - Math.round(n)
};
};
const getBoundingClientRect = t => t.getBoundingClientRect();
let p;
const supportPassiveEvents = () => {
if (isUndefined(p)) {
p = false;
try {
window.addEventListener("test", null, Object.defineProperty({}, "passive", {
get: function() {
p = true;
}
}));
} catch (t) {}
}
return p;
};
const splitEventNames = t => t.split(" ");
const off = (t, n, e, o) => {
each(splitEventNames(n), (n => {
t.removeEventListener(n, e, o);
}));
};
const on = (t, n, e, o) => {
const s = supportPassiveEvents();
const c = s && o && o.S || false;
const i = o && o.C || false;
const r = o && o.O || false;
const a = [];
const l = s ? {
passive: c,
capture: i
} : i;
each(splitEventNames(n), (n => {
const o = r ? s => {
t.removeEventListener(n, o, i);
e && e(s);
} : e;
push(a, off.bind(null, t, n, o, i));
t.addEventListener(n, o, l);
}));
return runEach.bind(0, a);
};
const stopPropagation = t => t.stopPropagation();
const preventDefault = t => t.preventDefault();
const stopAndPrevent = t => stopPropagation(t) || preventDefault(t);
const v = {
x: 0,
y: 0
};
const absoluteCoordinates = t => {
const n = t ? getBoundingClientRect(t) : 0;
return n ? {
x: n.left + window.pageYOffset,
y: n.top + window.pageXOffset
} : v;
};
const manageListener = (t, n) => {
each(isArray(n) ? n : [ n ], t);
};
const createEventListenerHub = t => {
function removeEvent(t, e) {
if (t) {
const o = n.get(t);
manageListener((t => {
if (o) {
o[t ? "delete" : "clear"](t);
}
}), e);
} else {
n.forEach((t => {
t.clear();
}));
n.clear();
}
}
function addEvent(t, e) {
const o = n.get(t) || new Set;
n.set(t, o);
manageListener((t => {
t && o.add(t);
}), e);
return removeEvent.bind(0, t, e);
}
function triggerEvent(t, ...e) {
const o = n.get(t);
each(from(o), (t => {
if (e) {
t(e);
} else {
t();
}
}));
}
const n = new Map;
const e = keys(t);
each(e, (n => {
addEvent(n, t[n]);
}));
return [ addEvent, removeEvent, triggerEvent ];
};
const getPropByPath = (t, n) => t ? n.split(".").reduce(((t, n) => t && hasOwnProperty(t, n) ? t[n] : void 0), t) : void 0;
const createOptionCheck = (t, n, e) => o => [ getPropByPath(t, o), e || void 0 !== getPropByPath(n, o) ];
const createState = t => {
let n = t;
return [ () => n, t => {
n = assignDeep({}, n, t);
} ];
};
const w = "os-environment";
const b = `${w}-flexbox-glue`;
const y = `${b}-max`;
const m = "data-overlayscrollbars";
const S = `${m}-overflow-x`;
const C = `${m}-overflow-y`;
const x = "overflowVisible";
const O = "viewportStyled";
const A = "os-padding";
const $ = "os-viewport";
const L = `${$}-arrange`;
const I = "os-content";
const T = `${$}-scrollbar-styled`;
const z = `os-overflow-visible`;
const D = "os-size-observer";
const E = `${D}-appear`;
const P = `${D}-listener`;
const M = `${P}-scroll`;
const j = `${P}-item`;
const N = `${j}-final`;
const R = "os-trinsic-observer";
const H = "os-scrollbar";
const F = `${H}-horizontal`;
const k = `${H}-vertical`;
const V = "os-scrollbar-track";
const B = "os-scrollbar-handle";
const opsStringify = t => JSON.stringify(t, ((t, n) => {
if (isFunction(n)) {
throw new Error;
}
return n;
}));
const U = {
paddingAbsolute: false,
updating: {
elementEvents: [ [ "img", "load" ] ],
debounce: [ 0, 33 ],
attributes: null,
ignoreMutation: null
},
overflow: {
x: "scroll",
y: "scroll"
},
nativeScrollbarsOverlaid: {
show: false,
initialize: false
},
scrollbars: {
visibility: "auto",
autoHide: "never",
autoHideDelay: 800,
dragScroll: true,
clickScroll: false,
touch: true
}
};
const getOptionsDiff = (t, n) => {
const e = {};
const o = keys(n).concat(keys(t));
each(o, (o => {
const s = t[o];
const c = n[o];
if (isObject(s) && isObject(c)) {
assignDeep(e[o] = {}, getOptionsDiff(s, c));
} else if (hasOwnProperty(n, o) && c !== s) {
let t = true;
if (isArray(s) || isArray(c)) {
try {
if (opsStringify(s) === opsStringify(c)) {
t = false;
}
} catch (i) {}
}
if (t) {
e[o] = c;
}
}
}));
return e;
};
let Y;
const {abs: q, round: G} = Math;
const diffBiggerThanOne = (t, n) => {
const e = q(t);
const o = q(n);
return !(e === o || e + 1 === o || e - 1 === o);
};
const getNativeScrollbarSize = (t, n, e) => {
appendChildren(t, n);
const o = clientSize(n);
const s = offsetSize(n);
const c = fractionalSize(e);
return {
x: s.h - o.h + c.h,
y: s.w - o.w + c.w
};
};
const getNativeScrollbarStyling = t => {
let n = false;
const e = addClass(t, T);
try {
n = "none" === style(t, cssProperty("scrollbar-width")) || "none" === window.getComputedStyle(t, "::-webkit-scrollbar").getPropertyValue("display");
} catch (o) {}
e();
return n;
};
const getRtlScrollBehavior = (t, n) => {
const e = "hidden";
style(t, {
overflowX: e,
overflowY: e,
direction: "rtl"
});
scrollLeft(t, 0);
const o = absoluteCoordinates(t);
const s = absoluteCoordinates(n);
scrollLeft(t, -999);
const c = absoluteCoordinates(n);
return {
i: o.x === s.x,
n: s.x !== c.x
};
};
const getFlexboxGlue = (t, n) => {
const e = addClass(t, b);
const o = getBoundingClientRect(t);
const s = getBoundingClientRect(n);
const c = equalBCRWH(s, o, true);
const i = addClass(t, y);
const r = getBoundingClientRect(t);
const a = getBoundingClientRect(n);
const l = equalBCRWH(a, r, true);
e();
i();
return c && l;
};
const getWindowDPR = () => {
const t = window.screen.deviceXDPI || 0;
const n = window.screen.logicalXDPI || 1;
return window.devicePixelRatio || t / n;
};
const createEnvironment = () => {
const {body: t} = document;
const n = createDOM(`<div class="${w}"><div></div></div>`);
const e = n[0];
const o = e.firstChild;
const [s, , c] = createEventListenerHub();
const [i, r] = createCache({
o: getNativeScrollbarSize(t, e, o),
u: equalXY
});
const [a] = r();
const l = getNativeScrollbarStyling(e);
const u = {
x: 0 === a.x,
y: 0 === a.y
};
const f = {
A: !l,
$: false
};
const d = assignDeep({}, U);
const _ = {
L: a,
I: u,
T: l,
D: "-1" === style(e, "zIndex"),
P: getRtlScrollBehavior(e, o),
M: getFlexboxGlue(e, o),
j: t => s("_", t),
N: assignDeep.bind(0, {}, f),
R(t) {
assignDeep(f, t);
},
H: assignDeep.bind(0, {}, d),
F(t) {
assignDeep(d, t);
},
k: assignDeep({}, f),
V: assignDeep({}, d)
};
removeAttr(e, "style");
removeElements(e);
if (!l && (!u.x || !u.y)) {
let n = windowSize();
let s = getWindowDPR();
window.addEventListener("resize", (() => {
const r = windowSize();
const a = {
w: r.w - n.w,
h: r.h - n.h
};
if (0 === a.w && 0 === a.h) {
return;
}
const l = {
w: q(a.w),
h: q(a.h)
};
const u = {
w: q(G(r.w / (n.w / 100))),
h: q(G(r.h / (n.h / 100)))
};
const f = getWindowDPR();
const d = l.w > 2 && l.h > 2;
const _ = !diffBiggerThanOne(u.w, u.h);
const g = f !== s && s > 0;
const h = d && _ && g;
if (h) {
const [n, s] = i(getNativeScrollbarSize(t, e, o));
assignDeep(Y.L, n);
removeElements(e);
if (s) {
c("_");
}
}
n = r;
s = f;
}));
}
return _;
};
const getEnvironment = () => {
if (!Y) {
Y = createEnvironment();
}
return Y;
};
const resolveInitialization = (t, n) => isFunction(t) ? t.apply(0, n) : t;
const staticInitializationElement = (t, n, e, o) => resolveInitialization(o || resolveInitialization(e, t), t) || n.apply(0, t);
const dynamicInitializationElement = (t, n, e, o) => {
let s = resolveInitialization(o, t);
if (isNull(s) || isUndefined(s)) {
s = resolveInitialization(e, t);
}
return true === s || isNull(s) || isUndefined(s) ? n.apply(0, t) : s;
};
let W = 0;
const X = createDiv.bind(0, "");
const unwrap = t => {
appendChildren(parent(t), contents(t));
removeElements(t);
};
const createUniqueViewportArrangeElement = () => {
const {T: t, I: n, D: e} = getEnvironment();
const o = !e && !t && (n.x || n.y);
const s = o ? document.createElement("style") : false;
if (s) {
attr(s, "id", `${L}-${W}`);
W++;
}
return s;
};
const addDataAttrHost = (t, n) => {
attr(t, m, n);
return removeAttr.bind(0, t, m);
};
const createStructureSetupElements = t => {
const {N: n, T: e} = getEnvironment();
const {B: o, U: s, A: c, $: i} = n();
const r = isHTMLElement(t);
const a = t;
const l = r ? t : a.target;
const f = is(l, "textarea");
const d = !f && is(l, "body");
const _ = l.ownerDocument;
const g = _.body;
const h = _.defaultView;
const p = !!u && !f && e;
const v = staticInitializationElement.bind(0, [ l ]);
const w = dynamicInitializationElement.bind(0, [ l ]);
const b = [ v(X, s, a.viewport), v(X, s), v(X) ].filter((t => !p ? t !== l : true))[0];
const y = b === l;
const x = {
Y: l,
B: f ? v(X, o, a.host) : l,
U: b,
A: !y && w(X, c, a.padding),
$: !y && w(X, i, a.content),
q: !y && createUniqueViewportArrangeElement(),
G: h,
W: _,
X: parent(g),
J: g,
K: f,
Z: d,
tt: r,
nt: y,
et: (t, n) => y ? hasAttrClass(b, m, n) : hasClass(b, t),
ot: (t, n, e) => y ? attrClass(b, m, n, e) : (e ? addClass : removeClass)(b, t)
};
const O = keys(x).reduce(((t, n) => {
const e = x[n];
return push(t, e && !parent(e) ? e : false);
}), []);
const elementIsGenerated = t => t ? indexOf(O, t) > -1 : null;
const {Y: L, B: z, A: D, U: E, $: P, q: M} = x;
const j = [];
const N = f && elementIsGenerated(z);
const R = f ? L : contents([ P, E, D, z, L ].find((t => false === elementIsGenerated(t))));
const H = P || E;
const F = addDataAttrHost(z, y ? "viewport" : "host");
const k = addClass(D, A);
const V = addClass(E, !y && $);
const B = addClass(P, I);
if (N) {
insertAfter(L, z);
push(j, (() => {
insertAfter(z, L);
removeElements(z);
}));
}
appendChildren(H, R);
appendChildren(z, D);
appendChildren(D || z, !y && E);
appendChildren(E, P);
push(j, (() => {
F();
removeAttr(E, S);
removeAttr(E, C);
if (elementIsGenerated(P)) {
unwrap(P);
}
if (elementIsGenerated(E)) {
unwrap(E);
}
if (elementIsGenerated(D)) {
unwrap(D);
}
k();
V();
B();
}));
if (e && !y) {
push(j, removeClass.bind(0, E, T));
}
if (M) {
insertBefore(E, M);
push(j, removeElements.bind(0, M));
}
return [ x, runEach.bind(0, j) ];
};
const createTrinsicUpdate = (t, n) => {
const {$: e} = t;
const [o] = n;
return t => {
const {M: n} = getEnvironment();
const {st: s} = o();
const {ct: c} = t;
const i = (e || !n) && c;
if (i) {
style(e, {
height: s ? "" : "100%"
});
}
return {
it: i,
rt: i
};
};
};
const createPaddingUpdate = (t, n) => {
const [e, o] = n;
const {B: s, A: c, U: i, nt: r} = t;
const [a, l] = createCache({
u: equalTRBL,
o: topRightBottomLeft()
}, topRightBottomLeft.bind(0, s, "padding", ""));
return (t, n, s) => {
let [u, f] = l(s);
const {T: d, M: _} = getEnvironment();
const {lt: g} = e();
const {it: h, rt: p, ut: v} = t;
const [w, b] = n("paddingAbsolute");
const y = !_ && p;
if (h || f || y) {
[u, f] = a(s);
}
const m = !r && (b || v || f);
if (m) {
const t = !w || !c && !d;
const n = u.r + u.l;
const e = u.t + u.b;
const s = {
marginRight: t && !g ? -n : 0,
marginBottom: t ? -e : 0,
marginLeft: t && g ? -n : 0,
top: t ? -u.t : 0,
right: t ? g ? -u.r : "auto" : 0,
left: t ? g ? "auto" : -u.l : 0,
width: t ? `calc(100% + ${n}px)` : ""
};
const r = {
paddingTop: t ? u.t : 0,
paddingRight: t ? u.r : 0,
paddingBottom: t ? u.b : 0,
paddingLeft: t ? u.l : 0
};
style(c || i, s);
style(i, r);
o({
A: u,
ft: !t,
dt: c ? r : assignDeep({}, s, r)
});
}
return {
_t: m
};
};
};
const {max: J} = Math;
const K = "visible";
const Q = "hidden";
const Z = 42;
const tt = {
u: equalWH,
o: {
w: 0,
h: 0
}
};
const nt = {
u: equalXY,
o: {
x: Q,
y: Q
}
};
const getOverflowAmount = (t, n, e) => {
const o = window.devicePixelRatio % 1 !== 0 ? 1 : 0;
const s = {
w: J(0, t.w - n.w - J(0, e.w)),
h: J(0, t.h - n.h - J(0, e.h))
};
return {
w: s.w > o ? s.w : 0,
h: s.h > o ? s.h : 0
};
};
const conditionalClass = (t, n, e) => e ? addClass(t, n) : removeClass(t, n);
const overflowIsVisible = t => 0 === t.indexOf(K);
const createOverflowUpdate = (t, n) => {
const [e, o] = n;
const {B: s, A: c, U: i, q: r, nt: a, ot: l} = t;
const {L: u, M: f, T: d, I: _} = getEnvironment();
const g = !a && !d && (_.x || _.y);
const [h, p] = createCache(tt, fractionalSize.bind(0, i));
const [v, w] = createCache(tt, scrollSize.bind(0, i));
const [b, y] = createCache(tt);
const [A] = createCache(nt);
const fixFlexboxGlue = (t, n) => {
style(i, {
height: ""
});
if (n) {
const {ft: n, A: o} = e();
const {gt: c, ht: r} = t;
const a = fractionalSize(s);
const l = clientSize(s);
const u = "content-box" === style(i, "boxSizing");
const f = n || u ? o.b + o.t : 0;
const d = !(_.x && u);
style(i, {
height: l.h + a.h + (c.x && d ? r.x : 0) - f
});
}
};
const getViewportOverflowState = (t, n) => {
const e = !d && !t ? Z : 0;
const getStatePerAxis = (t, o, s) => {
const c = style(i, t);
const r = n ? n[t] : c;
const a = "scroll" === r;
const l = o ? e : s;
const u = a && !d ? l : 0;
const f = o && !!e;
return [ c, a, u, f ];
};
const [o, s, c, r] = getStatePerAxis("overflowX", _.x, u.x);
const [a, l, f, g] = getStatePerAxis("overflowY", _.y, u.y);
return {
vt: {
x: o,
y: a
},
gt: {
x: s,
y: l
},
ht: {
x: c,
y: f
},
wt: {
x: r,
y: g
}
};
};
const setViewportOverflowState = (t, n, e, o) => {
const setAxisOverflowStyle = (t, n) => {
const e = overflowIsVisible(t);
const o = n && e && t.replace(`${K}-`, "") || "";
return [ n && !e ? t : "", overflowIsVisible(o) ? "hidden" : o ];
};
const [s, c] = setAxisOverflowStyle(e.x, n.x);
const [i, r] = setAxisOverflowStyle(e.y, n.y);
o.overflowX = c && i ? c : s;
o.overflowY = r && s ? r : i;
return getViewportOverflowState(t, o);
};
const arrangeViewport = (t, n, o, s) => {
if (g) {
const {dt: c} = e();
const {ht: a, wt: l} = t;
const {x: u, y: f} = l;
const {x: d, y: _} = a;
const g = s ? "paddingRight" : "paddingLeft";
const h = c[g];
const p = c.paddingTop;
const v = n.w + o.w;
const w = n.h + o.h;
const b = {
w: _ && f ? `${_ + v - h}px` : "",
h: d && u ? `${d + w - p}px` : ""
};
if (r) {
const {sheet: t} = r;
if (t) {
const {cssRules: n} = t;
if (n) {
if (!n.length) {
t.insertRule(`#${attr(r, "id")} + .${L}::before {}`, 0);
}
const e = n[0].style;
e.width = b.w;
e.height = b.h;
}
}
} else {
style(i, {
"--os-vaw": b.w,
"--os-vah": b.h
});
}
}
return g;
};
const hideNativeScrollbars = (t, n, o, s) => {
const {ht: c, wt: i} = t;
const {x: r, y: a} = i;
const {x: l, y: u} = c;
const {dt: f} = e();
const d = n ? "marginLeft" : "marginRight";
const _ = n ? "paddingLeft" : "paddingRight";
const g = f[d];
const h = f.marginBottom;
const p = f[_];
const v = f.paddingBottom;
s.width = `calc(100% + ${u + -1 * g}px)`;
s[d] = -u + g;
s.marginBottom = -l + h;
if (o) {
s[_] = p + (a ? u : 0);
s.paddingBottom = v + (r ? l : 0);
}
};
const undoViewportArrange = (t, n, o) => {
if (g) {
const s = o || getViewportOverflowState(t);
const {dt: c} = e();
const {wt: r} = s;
const {x: a, y: l} = r;
const u = {};
const assignProps = t => each(t.split(" "), (t => {
u[t] = c[t];
}));
if (a) {
assignProps("marginBottom paddingTop paddingBottom");
}
if (l) {
assignProps("marginLeft marginRight paddingLeft paddingRight");
}
const d = style(i, keys(u));
removeClass(i, L);
if (!f) {
u.height = "";
}
style(i, u);
return [ () => {
hideNativeScrollbars(s, n, g, d);
style(i, d);
addClass(i, L);
}, s ];
}
return [ noop ];
};
return (t, n, r) => {
const {it: u, bt: g, rt: $, _t: L, ct: I, ut: D} = t;
const {st: E, lt: P} = e();
const [M, j] = n("nativeScrollbarsOverlaid.show");
const [N, R] = n("overflow");
const H = M && _.x && _.y;
const F = !a && !f && (u || $ || g || j || I);
const k = overflowIsVisible(N.x);
const V = overflowIsVisible(N.y);
const B = k || V;
let U = p(r);
let Y = w(r);
let q = y(r);
let G;
if (j && d) {
l(T, O, !H);
}
if (F) {
G = getViewportOverflowState(H);
fixFlexboxGlue(G, E);
}
if (u || L || $ || D || j) {
if (B) {
l(z, x, false);
}
const [t, n] = undoViewportArrange(H, P, G);
const [e, o] = U = h(r);
const [s, c] = Y = v(r);
const a = clientSize(i);
let u = s;
let f = a;
t();
if ((c || o || j) && n && !H && arrangeViewport(n, s, e, P)) {
f = clientSize(i);
u = scrollSize(i);
}
q = b(getOverflowAmount({
w: J(s.w, u.w),
h: J(s.h, u.h)
}, {
w: f.w + J(0, a.w - s.w),
h: f.h + J(0, a.h - s.h)
}, e), r);
}
const [W, X] = q;
const [K, Q] = Y;
const [Z, tt] = U;
const nt = {
x: W.w > 0,
y: W.h > 0
};
const et = k && V && (nt.x || nt.y) || k && nt.x && !nt.y || V && nt.y && !nt.x;
if (L || D || tt || Q || X || R || j || F) {
const t = {
marginRight: 0,
marginBottom: 0,
marginLeft: 0,
width: "",
overflowY: "",
overflowX: ""
};
const n = setViewportOverflowState(H, nt, N, t);
const e = arrangeViewport(n, K, Z, P);
if (!a) {
hideNativeScrollbars(n, P, e, t);
}
if (F) {
fixFlexboxGlue(n, E);
}
if (a) {
attr(s, S, t.overflowX);
attr(s, C, t.overflowY);
} else {
style(i, t);
}
}
attrClass(s, m, x, et);
conditionalClass(c, z, et);
!a && conditionalClass(i, z, B);
const [ot, st] = A(getViewportOverflowState(H).vt);
o({
vt: ot,
yt: {
x: W.w,
y: W.h
},
St: nt
});
return {
Ct: st,
xt: X
};
};
};
const prepareUpdateHints = (t, n, e) => {
const o = {};
const s = n || {};
const c = keys(t).concat(keys(s));
each(c, (n => {
const c = t[n];
const i = s[n];
o[n] = !!(e || c || i);
}));
return o;
};
const createStructureSetupUpdate = (t, n) => {
const {U: e} = t;
const {T: o, I: s, M: c} = getEnvironment();
const i = !o && (s.x || s.y);
const r = [ createTrinsicUpdate(t, n), createPaddingUpdate(t, n), createOverflowUpdate(t, n) ];
return (t, n, o) => {
const s = prepareUpdateHints(assignDeep({
it: false,
_t: false,
ut: false,
ct: false,
xt: false,
Ct: false,
bt: false,
rt: false
}, n), {}, o);
const a = i || !c;
const l = a && scrollLeft(e);
const u = a && scrollTop(e);
let f = s;
each(r, (n => {
f = prepareUpdateHints(f, n(f, t, !!o) || {}, o);
}));
if (isNumber(l)) {
scrollLeft(e, l);
}
if (isNumber(u)) {
scrollTop(e, u);
}
return f;
};
};
const et = "animationstart";
const ot = "scroll";
const st = 3333333;
const getElmDirectionIsRTL = t => "rtl" === style(t, "direction");
const domRectHasDimensions = t => t && (t.height || t.width);
const createSizeObserver = (t, n, e) => {
const {Ot: o = false, At: s = false} = e || {};
const {P: c} = getEnvironment();
const i = createDOM(`<div class="${D}"><div class="${P}"></div></div>`);
const r = i[0];
const a = r.firstChild;
const l = getElmDirectionIsRTL.bind(0, r);
const [_] = createCache({
o: void 0,
_: true,
u: (t, n) => !(!t || !domRectHasDimensions(t) && domRectHasDimensions(n))
});
const onSizeChangedCallbackProxy = t => {
const e = isArray(t) && t.length > 0 && isObject(t[0]);
const s = !e && isBoolean(t[0]);
let i = false;
let a = false;
let l = true;
if (e) {
const [n, , e] = _(t.pop().contentRect);
const o = domRectHasDimensions(n);
const s = domRectHasDimensions(e);
i = !e || !o;
a = !s && o;
l = !i;
} else if (s) {
[, l] = t;
} else {
a = true === t;
}
if (o && l) {
const n = s ? t[0] : getElmDirectionIsRTL(r);
scrollLeft(r, n ? c.n ? -st : c.i ? 0 : st : st);
scrollTop(r, st);
}
if (!i) {
n({
it: !s,
$t: s ? t : void 0,
At: !!a
});
}
};
const g = [];
let h = s ? onSizeChangedCallbackProxy : false;
let p;
if (u) {
const t = new u(onSizeChangedCallbackProxy);
t.observe(a);
push(g, (() => {
t.disconnect();
}));
} else {
const t = createDOM(`<div class="${j}" dir="ltr"><div class="${j}"><div class="${N}"></div></div><div class="${j}"><div class="${N}" style="width: 200%; height: 200%"></div></div></div>`);
appendChildren(a, t);
addClass(a, M);
const n = t[0];
const e = n.lastChild;
const o = n.firstChild;
const c = null == o ? void 0 : o.firstChild;
let i = offsetSize(n);
let r = i;
let l = false;
let u;
const reset = () => {
scrollLeft(o, st);
scrollTop(o, st);
scrollLeft(e, st);
scrollTop(e, st);
};
const onResized = t => {
u = 0;
if (l) {
i = r;
onSizeChangedCallbackProxy(true === t);
}
};
const onScroll = t => {
r = offsetSize(n);
l = !t || !equalWH(r, i);
if (t) {
stopAndPrevent(t);
if (l && !u) {
f(u);
u = d(onResized);
}
} else {
onResized(false === t);
}
reset();
};
push(g, [ on(o, ot, onScroll), on(e, ot, onScroll) ]);
style(c, {
width: st,
height: st
});
reset();
h = s ? onScroll.bind(0, false) : reset;
}
if (o) {
p = createCache({
o: !l()
}, l);
const [t] = p;
push(g, on(r, ot, (n => {
const e = t();
const [o, s] = e;
if (s) {
removeClass(a, "ltr rtl");
if (o) {
addClass(a, "rtl");
} else {
addClass(a, "ltr");
}
onSizeChangedCallbackProxy(e);
}
stopAndPrevent(n);
})));
}
if (h) {
addClass(r, E);
push(g, on(r, et, h, {
O: !!u
}));
}
prependChildren(t, r);
return () => {
runEach(g);
removeElements(r);
};
};
const isHeightIntrinsic = t => 0 === t.h || t.isIntersecting || t.intersectionRatio > 0;
const createTrinsicObserver = (t, n) => {
const e = createDiv(R);
const o = [];
const [s] = createCache({
o: false
});
const triggerOnTrinsicChangedCallback = t => {
if (t) {
const e = s(isHeightIntrinsic(t));
const [, o] = e;
if (o) {
n(e);
}
}
};
if (l) {
const n = new l((t => {
if (t && t.length > 0) {
triggerOnTrinsicChangedCallback(t.pop());
}
}), {
root: t
});
n.observe(e);
push(o, (() => {
n.disconnect();
}));
} else {
const onSizeChanged = () => {
const t = offsetSize(e);
triggerOnTrinsicChangedCallback(t);
};
push(o, createSizeObserver(e, onSizeChanged));
onSizeChanged();
}
prependChildren(t, e);
return () => {
runEach(o);
removeElements(e);
};
};
const createEventContentChange = (t, n, e) => {
let o;
let s = false;
const destroy = () => {
s = true;
};
const updateElements = c => {
if (e) {
const i = e.reduce(((n, e) => {
if (e) {
const o = e[0];
const s = e[1];
const i = s && o && (c ? c(o) : find(o, t));
if (i && i.length && s && isString(s)) {
push(n, [ i, s.trim() ], true);
}
}
return n;
}), []);
each(i, (t => each(t[0], (e => {
const c = t[1];
const i = o.get(e);
if (i) {
const t = i[0];
const n = i[1];
if (t === c) {
n();
}
}
const r = on(e, c, (t => {
if (s) {
r();
o.delete(e);
} else {
n(t);
}
}));
o.set(e, [ c, r ]);
}))));
}
};
if (e) {
o = new WeakMap;
updateElements();
}
return [ destroy, updateElements ];
};
const createDOMObserver = (t, n, e, o) => {
let s = false;
const {Lt: c, It: i, Tt: r, zt: l, Dt: u, Et: f} = o || {};
const [d, _] = createEventContentChange(t, debounce((() => {
if (s) {
e(true);
}
}), {
g: 33,
p: 99
}), r);
const g = c || [];
const h = i || [];
const p = g.concat(h);
const observerCallback = s => {
const c = u || noop;
const i = f || noop;
const r = [];
const a = [];
let d = false;
let g = false;
let p = false;
each(s, (e => {
const {attributeName: s, target: u, type: f, oldValue: _, addedNodes: v} = e;
const w = "attributes" === f;
const b = "childList" === f;
const y = t === u;
const m = w && isString(s) ? attr(u, s) : 0;
const S = 0 !== m && _ !== m;
const C = indexOf(h, s) > -1 && S;
if (n && !y) {
const n = !w;
const r = w && C;
const f = r && l && is(u, l);
const d = f ? !c(u, s, _, m) : n || r;
const h = d && !i(e, !!f, t, o);
push(a, v);
g = g || h;
p = p || b;
}
if (!n && y && S && !c(u, s, _, m)) {
push(r, s);
d = d || C;
}
}));
if (p && !isEmptyArray(a)) {
_((t => a.reduce(((n, e) => {
push(n, find(t, e));
return is(e, t) ? push(n, e) : n;
}), [])));
}
if (n) {
g && e(false);
} else if (!isEmptyArray(r) || d) {
e(r, d);
}
};
const v = new a(observerCallback);
v.observe(t, {
attributes: true,
attributeOldValue: true,
attributeFilter: p,
subtree: n,
childList: n,
characterData: n
});
s = true;
return [ () => {
if (s) {
d();
v.disconnect();
s = false;
}
}, () => {
if (s) {
observerCallback(v.takeRecords());
}
} ];
};
const ct = `[${m}]`;
const it = `.${$}`;
const rt = [ "tabindex" ];
const at = [ "wrap", "cols", "rows" ];
const lt = [ "id", "class", "style", "open" ];
const createStructureSetupObservers = (t, n, e) => {
let o;
let s;
let c;
const [, i] = n;
const {B: r, U: a, $: l, K: f, nt: d, et: _, ot: g} = t;
const {T: h, M: p} = getEnvironment();
const [v] = createCache({
u: equalWH,
o: {
w: 0,
h: 0
}
}, (() => {
const t = _(z, x);
t && g(z, x);
const n = scrollSize(l);
const e = scrollSize(a);
const o = fractionalSize(a);
t && g(z, x, true);
return {
w: e.w + n.w + o.w,
h: e.h + n.h + o.h
};
}));
const w = f ? at : lt.concat(at);
const b = debounce(e, {
g: () => o,
p: () => s,
v(t, n) {
const [e] = t;
const [o] = n;
return [ keys(e).concat(keys(o)).reduce(((t, n) => {
t[n] = e[n] || o[n];
return t;
}), {}) ];
}
});
const updateViewportAttrsFromHost = t => {
each(t || rt, (t => {
if (indexOf(rt, t) > -1) {
const n = attr(r, t);
if (isString(n)) {
attr(a, t, n);
} else {
removeAttr(a, t);
}
}
}));
};
const onTrinsicChanged = t => {
const [n, o] = t;
i({
st: n
});
e({
ct: o
});
};
const onSizeChanged = ({it: t, $t: n, At: o}) => {
const s = !t || o ? e : b;
let c = false;
if (n) {
const [t, e] = n;
c = e;
i({
lt: t
});
}
s({
it: t,
ut: c
});
};
const onContentMutation = t => {
const [, n] = v();
const o = t ? e : b;
if (n) {
o({
rt: true
});
}
};
const onHostMutation = (t, n) => {
if (n) {
b({
bt: true
});
} else if (!d) {
updateViewportAttrsFromHost(t);
}
};
const y = (l || !p) && createTrinsicObserver(r, onTrinsicChanged);
const m = !d && createSizeObserver(r, onSizeChanged, {
At: true,
Ot: !h
});
const [S] = createDOMObserver(r, false, onHostMutation, {
It: lt,
Lt: lt.concat(rt)
});
const C = d && new u(onSizeChanged.bind(0, {
it: true
}));
C && C.observe(r);
updateViewportAttrsFromHost();
return [ t => {
const [n] = t("updating.ignoreMutation");
const [e, i] = t("updating.attributes");
const [r, u] = t("updating.elementEvents");
const [f, d] = t("updating.debounce");
const _ = u || i;
const ignoreMutationFromOptions = t => isFunction(n) && n(t);
if (_) {
if (c) {
c[1]();
c[0]();
}
c = createDOMObserver(l || a, true, onContentMutation, {
It: w.concat(e || []),
Lt: w.concat(e || []),
Tt: r,
zt: ct,
Et: (t, n) => {
const {target: e, attributeName: o} = t;
const s = !n && o ? liesBetween(e, ct, it) : false;
return s || !!ignoreMutationFromOptions(t);
}
});
}
if (d) {
b.m();
if (isArray(f)) {
const t = f[0];
const n = f[1];
o = isNumber(t) ? t : false;
s = isNumber(n) ? n : false;
} else if (isNumber(f)) {
o = f;
s = false;
} else {
o = false;
s = false;
}
}
}, () => {
c && c[0]();
y && y();
m && m();
C && C.disconnect();
S();
} ];
};
const ut = {
A: {
t: 0,
r: 0,
b: 0,
l: 0
},
ft: false,
dt: {
marginRight: 0,
marginBottom: 0,
marginLeft: 0,
paddingTop: 0,
paddingRight: 0,
paddingBottom: 0,
paddingLeft: 0
},
yt: {
x: 0,
y: 0
},
vt: {
x: "hidden",
y: "hidden"
},
St: {
x: false,
y: false
},
st: false,
lt: false
};
const createStructureSetup = (t, n) => {
const e = createOptionCheck(n, {});
const o = createState(ut);
const s = new Set;
const [c] = o;
const runOnUpdatedListeners = (t, n, e) => {
runEach(s, [ t, n || {}, !!e ]);
};
const [i, r] = createStructureSetupElements(t);
const a = createStructureSetupUpdate(i, o);
const [l, u] = createStructureSetupObservers(i, o, (t => {
runOnUpdatedListeners(a(e, t));
}));
const f = c.bind(0);
f.Pt = t => {
s.add(t);
};
f.Mt = i;
return [ (t, e) => {
const o = createOptionCheck(n, t, e);
l(o);
runOnUpdatedListeners(a(o, {}, e));
}, f, () => {
s.clear();
u();
r();
} ];
};
const generateScrollbarDOM = t => {
const n = createDiv(`${H} ${t}`);
const e = createDiv(V);
const o = createDiv(B);
appendChildren(n, e);
appendChildren(e, o);
return {
jt: n,
Nt: e,
Rt: o
};
};
const createScrollbarsSetupElements = (t, n) => {
const {N: e} = getEnvironment();
const {Ht: o} = e();
const {Y: s, B: c, U: i, tt: r} = n;
const a = !r && t.scrollbarsSlot;
const l = dynamicInitializationElement([ s, c, i ], (() => c), o, a);
const u = generateScrollbarDOM(F);
const f = generateScrollbarDOM(k);
const {jt: d} = u;
const {jt: _} = f;
appendChildren(l, d);
appendChildren(l, _);
return [ {
Ft: u,
kt: f
}, removeElements.bind(0, [ d, _ ]) ];
};
const createScrollbarsSetup = (t, n, e) => {
const o = createState({});
const [s] = o;
const [c, i] = createScrollbarsSetupElements(t, e);
const r = s.bind(0);
r.Mt = c;
return [ (t, e) => {
const o = createOptionCheck(n, t, e);
console.log(o);
}, r, () => {
i();
} ];
};
const ft = {};
const getPlugins = () => assignDeep({}, ft);
const addPlugin = t => each(isArray(t) ? t : [ t ], (t => {
ft[t[0]] = t[1];
}));
const dt = {
boolean: "__TPL_boolean_TYPE__",
number: "__TPL_number_TYPE__",
string: "__TPL_string_TYPE__",
array: "__TPL_array_TYPE__",
object: "__TPL_object_TYPE__",
function: "__TPL_function_TYPE__",
null: "__TPL_null_TYPE__"
};
const _t = dt.number;
const gt = dt.boolean;
const ht = [ dt.array, dt.null ];
const pt = "hidden scroll visible visible-hidden";
const vt = "visible hidden auto";
const wt = "never scroll leavemove";
({
paddingAbsolute: gt,
updating: {
elementEvents: ht,
attributes: ht,
debounce: [ dt.number, dt.array, dt.null ],
ignoreMutation: [ dt.function, dt.null ]
},
overflow: {
x: pt,
y: pt
},
scrollbars: {
visibility: vt,
autoHide: wt,
autoHideDelay: _t,
dragScroll: gt,
clickScroll: gt,
touch: gt
},
nativeScrollbarsOverlaid: {
show: gt,
initialize: gt
}
});
const bt = "__osOptionsValidationPlugin";
const yt = new Set;
const mt = new WeakMap;
const addInstance = (t, n) => {
mt.set(t, n);
yt.add(t);
};
const removeInstance = t => {
mt.delete(t);
yt.delete(t);
};
const getInstance = t => mt.get(t);
const OverlayScrollbars = (t, n, e) => {
const {H: o, I: s, j: c} = getEnvironment();
const i = getPlugins();
const r = isHTMLElement(t) ? t : t.target;
const a = getInstance(r);
if (a) {
return a;
}
const l = i[bt];
const validateOptions = t => {
const n = t || {};
const e = l && l.Vt;
return e ? e(n, true) : n;
};
const u = assignDeep({}, o(), validateOptions(n));
const [f, d, _] = createEventListenerHub(e);
if (s.x && s.y && !u.nativeScrollbarsOverlaid.initialize) {
_("initializationWithdrawn");
}
const [g, h, p] = createStructureSetup(t, u);
const [v, , w] = createScrollbarsSetup(t, u, h.Mt);
const update = (t, n) => {
g(t, n);
v(t, n);
};
const b = c(update.bind(0, {}, true));
h.Pt(((t, n, e) => {
const {it: o, ut: s, ct: c, xt: i, Ct: r, rt: a, bt: l} = t;
_("updated", {
updateHints: {
sizeChanged: o,
directionChanged: s,
heightIntrinsicChanged: c,
overflowAmountChanged: i,
overflowStyleChanged: r,
contentMutation: a,
hostMutation: l
},
changedOptions: n,
force: e
});
}));
const y = {
options(t) {
if (t) {
const n = getOptionsDiff(u, validateOptions(t));
if (!isEmptyObject(n)) {
assignDeep(u, n);
update(n);
}
}
return assignDeep({}, u);
},
on: f,
off: d,
state() {
const {yt: t, vt: n, St: e, A: o, ft: s} = h();
return assignDeep({}, {
overflowAmount: t,
overflowStyle: n,
hasOverflow: e,
padding: o,
paddingAbsolute: s
});
},
elements() {
const {Y: t, B: n, A: e, U: o, $: s} = h.Mt;
return assignDeep({}, {
target: t,
host: n,
padding: e || o,
viewport: o,
content: s || o
});
},
update(t) {
update({}, t);
},
destroy: () => {
removeInstance(r);
b();
d();
w();
p();
_("destroyed");
}
};
each(keys(i), (t => {
const n = i[t];
if (isFunction(n)) {
n(OverlayScrollbars, y);
}
}));
y.update(true);
addInstance(r, y);
_("initialized");
return y;
};
OverlayScrollbars.plugin = addPlugin;
OverlayScrollbars.env = () => {
const {L: t, I: n, T: e, P: o, M: s, D: c, k: i, V: r, N: a, R: l, H: u, F: f} = getEnvironment();
return assignDeep({}, {
scrollbarSize: t,
scrollbarIsOverlaid: n,
scrollbarStyling: e,
rtlScrollBehavior: o,
flexboxGlue: s,
cssCustomProperties: c,
defaultInitializationStrategy: i,
defaultDefaultOptions: r,
getInitializationStrategy: a,
setInitializationStrategy: l,
getDefaultOptions: u,
setDefaultOptions: f
});
};
export { OverlayScrollbars as default };
//# sourceMappingURL=overlayscrollbars.esm.js.map