{"version":3,"file":"overlayscrollbars.browser.es5.js","sources":["../../src/support/cache.ts","../../src/support/compatibility/isBrowser.ts","../../src/support/utils/alias.ts","../../src/support/compatibility/apis.ts","../../src/support/utils/types.ts","../../src/support/utils/animation.ts","../../src/support/utils/array.ts","../../src/support/utils/strings.ts","../../src/support/utils/equal.ts","../../src/support/utils/noop.ts","../../src/support/utils/function.ts","../../src/support/utils/object.ts","../../src/support/utils/math.ts","../../src/support/dom/attribute.ts","../../src/support/dom/class.ts","../../src/support/dom/traversal.ts","../../src/support/dom/manipulation.ts","../../src/support/dom/create.ts","../../src/support/dom/style.ts","../../src/support/dom/dimensions.ts","../../src/support/dom/events.ts","../../src/support/dom/offset.ts","../../src/support/dom/scroll.ts","../../src/support/eventListeners.ts","../../src/options.ts","../../src/classnames.ts","../../src/plugins/plugins.ts","../../../../node_modules/@babel/runtime/helpers/extends.js","../../src/plugins/optionsValidationPlugin/validation.ts","../../src/plugins/optionsValidationPlugin/optionsValidationPlugin.ts","../../src/plugins/sizeObserverPlugin/sizeObserverPlugin.ts","../../src/setups/structureSetup/structureSetup.utils.ts","../../src/plugins/scrollbarsHidingPlugin/scrollbarsHidingPlugin.ts","../../src/plugins/clickScrollPlugin/clickScrollPlugin.ts","../../src/environment.ts","../../src/initialization.ts","../../src/instances.ts","../../src/observers/domObserver.ts","../../src/observers/sizeObserver.ts","../../src/observers/trinsicObserver.ts","../../src/setups/observersSetup/observersSetup.ts","../../src/setups/scrollbarsSetup/scrollbarsSetup.elements.ts","../../src/setups/scrollbarsSetup/scrollbarsSetup.events.ts","../../src/setups/scrollbarsSetup/scrollbarsSetup.ts","../../src/setups/structureSetup/structureSetup.elements.ts","../../src/setups/structureSetup/updateSegments/trinsicUpdateSegment.ts","../../src/setups/structureSetup/updateSegments/paddingUpdateSegment.ts","../../src/setups/structureSetup/updateSegments/overflowUpdateSegment.ts","../../src/setups/structureSetup/structureSetup.ts","../../src/setups/setups.ts","../../src/overlayscrollbars.ts"],"sourcesContent":["export interface CacheOptions {\n // initial value of _value.\n _initialValue: Value;\n // Custom comparison function if shallow compare isn't enough. Returns true if nothing changed.\n _equal?: EqualCachePropFunction;\n // If true always updates _value and _previous, otherwise they update only when they changed.\n _alwaysUpdateValues?: boolean;\n}\n\nexport type CacheValues = [value: T, changed: boolean, previous?: T];\n\nexport type EqualCachePropFunction = (currentVal: Value, newVal: Value) => boolean;\n\nexport type CacheUpdater = (current: Value, previous?: Value) => Value;\n\nexport type UpdateCacheContextual = (newValue: Value, force?: boolean) => CacheValues;\n\nexport type UpdateCache = (force?: boolean) => CacheValues;\n\nexport type GetCurrentCache = (force?: boolean) => CacheValues;\n\nexport type Cache = [UpdateCache, GetCurrentCache];\n\nexport type CacheContextual = [UpdateCacheContextual, GetCurrentCache];\n\ntype CreateCache = {\n (options: CacheOptions): CacheContextual;\n (options: CacheOptions, update: CacheUpdater): Cache;\n (options: CacheOptions, update?: CacheUpdater):\n | CacheContextual\n | Cache;\n};\n\nexport const createCache: CreateCache = (\n options: CacheOptions,\n update?: CacheUpdater\n): CacheContextual | Cache => {\n const { _initialValue, _equal, _alwaysUpdateValues } = options;\n let _value: Value = _initialValue;\n let _previous: Value | undefined;\n\n const cacheUpdateContextual: UpdateCacheContextual = (newValue, force?) => {\n const curr = _value;\n\n const newVal = newValue;\n const changed = force || (_equal ? !_equal(curr, newVal) : curr !== newVal);\n\n if (changed || _alwaysUpdateValues) {\n _value = newVal;\n _previous = curr;\n }\n\n return [_value, changed, _previous];\n };\n const cacheUpdateIsolated: UpdateCache = (force?) =>\n cacheUpdateContextual(update!(_value, _previous), force);\n\n const getCurrentCache: GetCurrentCache = (force?: boolean) => [\n _value,\n !!force, // changed\n _previous,\n ];\n\n return [update ? cacheUpdateIsolated : cacheUpdateContextual, getCurrentCache] as\n | CacheContextual\n | Cache;\n};\n","export const isBrowser =\r\n typeof window !== 'undefined' &&\r\n // deno has the global `window` defined, so additionally check for document\r\n typeof document !== 'undefined';\r\n","import { isBrowser } from '../compatibility/isBrowser';\r\n\r\nexport const wnd = (isBrowser ? window : {}) as typeof window;\r\nexport const mathMax = Math.max;\r\nexport const mathMin = Math.min;\r\nexport const mathRound = Math.round;\r\nexport const mathFloor = Math.floor;\r\nexport const mathCeil = Math.ceil;\r\nexport const mathAbs = Math.abs;\r\nexport const cAF = wnd.cancelAnimationFrame;\r\nexport const rAF = wnd.requestAnimationFrame;\r\nexport const setT = wnd.setTimeout;\r\nexport const clearT = wnd.clearTimeout;\r\n","import { wnd } from '../utils/alias';\r\n\r\nconst getApi = (name: string) =>\r\n (typeof wnd[name as keyof typeof wnd] !== 'undefined'\r\n ? wnd[name as keyof typeof wnd]\r\n : undefined) as T;\r\n\r\nexport const MutationObserverConstructor = getApi('MutationObserver');\r\nexport const IntersectionObserverConstructor =\r\n getApi('IntersectionObserver');\r\nexport const ResizeObserverConstructor = getApi('ResizeObserver');\r\nexport const scrollT = getApi AnimationTimeline>('ScrollTimeline');\r\n","import type { PlainObject } from '~/typings';\r\nimport { isBrowser } from '../compatibility/isBrowser';\r\n\r\nconst ElementNodeType = isBrowser && Node.ELEMENT_NODE;\r\nconst { toString, hasOwnProperty } = Object.prototype;\r\nconst typeRgx = /^\\[object (.+)\\]$/;\r\n\r\nexport const isUndefined = (obj: any): obj is undefined => obj === undefined;\r\n\r\nexport const isNull = (obj: any): obj is null => obj === null;\r\n\r\nexport const type = (obj: any): string =>\r\n isUndefined(obj) || isNull(obj)\r\n ? `${obj}`\r\n : toString.call(obj).replace(typeRgx, '$1').toLowerCase();\r\n\r\nexport const isNumber = (obj: any): obj is number => typeof obj === 'number';\r\n\r\nexport const isString = (obj: any): obj is string => typeof obj === 'string';\r\n\r\nexport const isBoolean = (obj: any): obj is boolean => typeof obj === 'boolean';\r\n\r\nexport const isFunction = (obj: any): obj is (...args: any[]) => any => typeof obj === 'function';\r\n\r\nexport const isArray = (obj: any): obj is Array => Array.isArray(obj);\r\n\r\nexport const isObject = (obj: any): obj is object =>\r\n typeof obj === 'object' && !isArray(obj) && !isNull(obj);\r\n\r\n/**\r\n * Returns true if the given object is array like, false otherwise.\r\n * @param obj The Object\r\n */\r\nexport const isArrayLike = (obj: any): obj is ArrayLike => {\r\n const length = !!obj && obj.length;\r\n const lengthCorrectFormat = isNumber(length) && length > -1 && length % 1 == 0; // eslint-disable-line eqeqeq\r\n\r\n return isArray(obj) || (!isFunction(obj) && lengthCorrectFormat)\r\n ? length > 0 && isObject(obj)\r\n ? length - 1 in obj\r\n : true\r\n : false;\r\n};\r\n\r\n/**\r\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport const isPlainObject = (obj: any): obj is PlainObject => {\r\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\r\n\r\n let key;\r\n const cstr = 'constructor';\r\n const ctor = obj[cstr];\r\n const ctorProto = ctor && ctor.prototype;\r\n const hasOwnConstructor = hasOwnProperty.call(obj, cstr);\r\n const hasIsPrototypeOf = ctorProto && hasOwnProperty.call(ctorProto, 'isPrototypeOf');\r\n\r\n if (ctor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n return false;\r\n }\r\n\r\n /* eslint-disable no-restricted-syntax */\r\n for (key in obj) {\r\n /**/\r\n }\r\n /* eslint-enable */\r\n\r\n return isUndefined(key) || hasOwnProperty.call(obj, key);\r\n};\r\n\r\n/**\r\n * Checks whether the given object is a HTMLElement.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport const isHTMLElement = (obj: any): obj is HTMLElement => {\r\n const instanceofObj = HTMLElement;\r\n return obj\r\n ? instanceofObj\r\n ? obj instanceof instanceofObj\r\n : obj.nodeType === ElementNodeType\r\n : false;\r\n};\r\n\r\n/**\r\n * Checks whether the given object is a Element.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport const isElement = (obj: any): obj is Element => {\r\n const instanceofObj = Element;\r\n return obj\r\n ? instanceofObj\r\n ? obj instanceof instanceofObj\r\n : obj.nodeType === ElementNodeType\r\n : false;\r\n};\r\n","import { mathMax, rAF, cAF } from './alias';\r\nimport { isFunction } from './types';\r\n\r\n/**\r\n * percent: current percent (0 - 1),\r\n * time: current time (duration * percent),\r\n * min: start value\r\n * max: end value\r\n * duration: duration in ms\r\n */\r\nexport type EasingFn = (\r\n percent: number,\r\n time: number,\r\n min: number,\r\n max: number,\r\n duration: number\r\n) => number;\r\n\r\nconst animationCurrentTime = () => performance.now();\r\n\r\nexport const animateNumber = (\r\n from: number,\r\n to: number,\r\n duration: number,\r\n onFrame: (progress: number, percent: number, completed: boolean) => any,\r\n easing?: EasingFn | false\r\n): ((complete?: boolean) => void) => {\r\n let animationFrameId = 0;\r\n const timeStart = animationCurrentTime();\r\n const finalDuration = mathMax(0, duration);\r\n const frame = (complete?: boolean) => {\r\n const timeNow = animationCurrentTime();\r\n const timeElapsed = timeNow - timeStart;\r\n const stopAnimation = timeElapsed >= finalDuration;\r\n const percent = complete\r\n ? 1\r\n : 1 - (mathMax(0, timeStart + finalDuration - timeNow) / finalDuration || 0);\r\n const progress =\r\n (to - from) *\r\n (isFunction(easing)\r\n ? easing(percent, percent * finalDuration, 0, 1, finalDuration)\r\n : percent) +\r\n from;\r\n const animationCompleted = stopAnimation || percent === 1;\r\n\r\n onFrame && onFrame(progress, percent, animationCompleted);\r\n\r\n animationFrameId = animationCompleted ? 0 : rAF!(() => frame());\r\n };\r\n frame();\r\n return (complete) => {\r\n cAF!(animationFrameId);\r\n complete && frame(complete);\r\n };\r\n};\r\n","import type { PlainObject } from '~/typings';\r\nimport { isArray, isArrayLike, isString } from './types';\r\n\r\ntype RunEachItem = ((...args: any) => any | any[]) | false | null | undefined;\r\n\r\nexport function each | ReadonlyArray>(\r\n array: T,\r\n callback: (\r\n value: T extends Array | ReadonlyArray ? V : never,\r\n index: number,\r\n source: T\r\n ) => boolean | unknown\r\n): T;\r\nexport function each>(\r\n arrayLikeObject: T,\r\n callback: (\r\n value: T extends ArrayLike ? V : never,\r\n index: number,\r\n source: T\r\n ) => boolean | unknown\r\n): T;\r\nexport function each(\r\n obj: T,\r\n callback: (value: any, key: string, source: T) => boolean | unknown\r\n): T;\r\nexport function each(\r\n source: Array | ArrayLike | ReadonlyArray | PlainObject,\r\n callback: (value: any, indexOrKey: any, source: any) => boolean | unknown\r\n): Array | ArrayLike | ReadonlyArray | Set | PlainObject {\r\n if (isArrayLike(source)) {\r\n for (let i = 0; i < source.length; i++) {\r\n if (callback(source[i], i, source) === false) {\r\n break;\r\n }\r\n }\r\n } else if (source) {\r\n // cant use support func keys here due to circular dep\r\n each(Object.keys(source), (key) => callback(source[key], key, source));\r\n }\r\n return source;\r\n}\r\n\r\n/**\r\n * Returns true when the passed item is in the passed array and false otherwise.\r\n * @param arr The array.\r\n * @param item The item.\r\n * @returns Whether the item is in the array.\r\n */\r\nexport const inArray = (arr: T[], item: T): boolean => arr.indexOf(item) >= 0;\r\n\r\n/**\r\n * Concats two arrays and returns an new array without modifying any of the passed arrays.\r\n * @param a Array A.\r\n * @param b Array B.\r\n * @returns A new array which has the entries of both arrays.\r\n */\r\nexport const concat = (a: T[] | ReadonlyArray, b: T[] | ReadonlyArray): T[] => a.concat(b);\r\n\r\n/**\r\n * Pushesh all given items into the given array and returns it.\r\n * @param array The array the items shall be pushed into.\r\n * @param items The items which shall be pushed into the array.\r\n */\r\nexport const push = (array: T[], items: T | ArrayLike, arrayIsSingleItem?: boolean): T[] => {\r\n !arrayIsSingleItem && !isString(items) && isArrayLike(items)\r\n ? Array.prototype.push.apply(array, items as T[])\r\n : array.push(items as T);\r\n return array;\r\n};\r\n\r\n/**\r\n * Creates a shallow-copied Array instance from an array-like or iterable object.\r\n * @param arr The object from which the array instance shall be created.\r\n */\r\nexport const from = (arr?: ArrayLike | Set) => Array.from(arr || []);\r\n\r\n/**\r\n * Creates an array if the passed value is not an array, or returns the value if it is.\r\n * @param value The value.\r\n * @returns An array which represents the passed value(s).\r\n */\r\nexport const createOrKeepArray = (value: T | T[]): T[] => (isArray(value) ? value : [value]);\r\n\r\n/**\r\n * Check whether the passed array is empty.\r\n * @param array The array which shall be checked.\r\n */\r\nexport const isEmptyArray = (array: any[] | null | undefined): boolean => !!array && !array.length;\r\n\r\n/**\r\n * Deduplicates all items of the array.\r\n * @param array The array to be deduplicated.\r\n * @returns The deduplicated array.\r\n */\r\nexport const deduplicateArray = (array: T): T => from(new Set(array)) as T;\r\n\r\n/**\r\n * Calls all functions in the passed array/set of functions.\r\n * @param arr The array filled with function which shall be called.\r\n * @param args The args with which each function is called.\r\n * @param keep True when the Set / array should not be cleared afterwards, false otherwise.\r\n */\r\nexport const runEachAndClear = (arr: RunEachItem[], args?: any[], keep?: boolean): void => {\r\n // eslint-disable-next-line prefer-spread\r\n const runFn = (fn: RunEachItem) => fn && fn.apply(undefined, args || []);\r\n each(arr, runFn);\r\n !keep && ((arr as any[]).length = 0);\r\n};\r\n","export const strPaddingTop = 'paddingTop';\r\nexport const strPaddingRight = 'paddingRight';\r\nexport const strPaddingLeft = 'paddingLeft';\r\nexport const strPaddingBottom = 'paddingBottom';\r\nexport const strMarginLeft = 'marginLeft';\r\nexport const strMarginRight = 'marginRight';\r\nexport const strMarginBottom = 'marginBottom';\r\nexport const strOverflowX = 'overflowX';\r\nexport const strOverflowY = 'overflowY';\r\nexport const strWidth = 'width';\r\nexport const strHeight = 'height';\r\nexport const strHidden = 'hidden';\r\nexport const strVisible = 'visible';\r\n","import type { WH } from '../dom/dimensions';\r\nimport type { XY } from '../dom/offset';\r\nimport type { TRBL } from '../dom/style';\r\nimport type { PlainObject } from '~/typings';\r\nimport { each } from './array';\r\nimport { mathRound } from './alias';\r\nimport { strHeight, strWidth } from './strings';\r\n\r\n/**\r\n * Compares two objects and returns true if all values of the passed prop names are identical, false otherwise or if one of the two object is falsy.\r\n * @param a Object a.\r\n * @param b Object b.\r\n * @param props The props which shall be compared.\r\n */\r\nexport const equal = (\r\n a: T | undefined,\r\n b: T | undefined,\r\n props: Array,\r\n propMutation?: ((value: any) => any) | null | false\r\n): boolean => {\r\n if (a && b) {\r\n let result = true;\r\n each(props, (prop) => {\r\n const compareA = propMutation ? propMutation(a[prop]) : a[prop];\r\n const compareB = propMutation ? propMutation(b[prop]) : b[prop];\r\n if (compareA !== compareB) {\r\n result = false;\r\n }\r\n });\r\n return result;\r\n }\r\n return false;\r\n};\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalWH = (a?: WH, b?: WH) => equal>(a, b, ['w', 'h']);\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalXY = (a?: XY, b?: XY) => equal>(a, b, ['x', 'y']);\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalTRBL = (a?: TRBL, b?: TRBL) => equal(a, b, ['t', 'r', 'b', 'l']);\r\n\r\n/**\r\n * Compares two DOM Rects for their equality of their width and height properties\r\n * Also returns false if one of the DOM Rects is undefined or null.\r\n * @param a DOM Rect a.\r\n * @param b DOM Rect b.\r\n * @param round Whether the values should be rounded.\r\n */\r\nexport const equalBCRWH = (a?: DOMRect, b?: DOMRect, round?: boolean) =>\r\n equal(a, b, [strWidth, strHeight], round && ((value) => mathRound(value)));\r\n","export const noop = () => {}; // eslint-disable-line\r\n","import { isNumber, isFunction } from './types';\r\nimport { from } from './array';\r\nimport { rAF, cAF, setT, clearT } from './alias';\r\nimport { noop } from './noop';\r\n\r\ntype DebounceTiming = number | false | null | undefined;\r\n\r\nexport interface DebounceOptions any> {\r\n /**\r\n * The timeout for debouncing. If null, no debounce is applied.\r\n */\r\n _timeout?: DebounceTiming | (() => DebounceTiming);\r\n /**\r\n * A maximum amount of ms. before the function will be called even with debounce.\r\n */\r\n _maxDelay?: DebounceTiming | (() => DebounceTiming);\r\n /**\r\n * Function which merges parameters for each canceled debounce.\r\n * If parameters can't be merged the function will return null, otherwise it returns the merged parameters.\r\n */\r\n _mergeParams?: (\r\n prev: Parameters,\r\n curr: Parameters\r\n ) => Parameters | false | null | undefined;\r\n}\r\n\r\nexport interface Debounced any> {\r\n (...args: Parameters): ReturnType;\r\n _flush(): void;\r\n}\r\n\r\nexport const bind = (\r\n fn: (...args: [...A, ...B]) => R,\r\n ...args: A\r\n): ((...args: B) => R) => fn.bind(0, ...args);\r\n\r\n/**\r\n * Creates a timeout and cleartimeout tuple. The timeout function always clears the previously created timeout before it runs.\r\n * @param timeout The timeout in ms. If no timeout (or 0) is passed requestAnimationFrame is used instead of setTimeout.\r\n * @returns A tuple with the timeout function as the first value and the clearTimeout function as the second value.\r\n */\r\nexport const selfClearTimeout = (timeout?: number | (() => number)) => {\r\n let id: number;\r\n const setTFn = timeout ? setT : rAF!;\r\n const clearTFn = timeout ? clearT : cAF!;\r\n return [\r\n (callback: () => any) => {\r\n clearTFn(id);\r\n // @ts-ignore\r\n id = setTFn(callback, isFunction(timeout) ? timeout() : timeout);\r\n },\r\n () => clearTFn(id),\r\n ] as [timeout: (callback: () => any) => void, clear: () => void];\r\n};\r\n\r\n/**\r\n * Debounces the given function either with a timeout or a animation frame.\r\n * @param functionToDebounce The function which shall be debounced.\r\n * @param options Options for debouncing.\r\n */\r\nexport const debounce = any>(\r\n functionToDebounce: FunctionToDebounce,\r\n options?: DebounceOptions\r\n): Debounced => {\r\n let maxTimeoutId: number | undefined;\r\n let prevArguments: Parameters | null | undefined;\r\n let latestArguments: Parameters | null | undefined;\r\n let clear = noop;\r\n const { _timeout, _maxDelay, _mergeParams } = options || {};\r\n\r\n const invokeFunctionToDebounce = function (args: IArguments) {\r\n clear();\r\n clearT(maxTimeoutId);\r\n maxTimeoutId = prevArguments = undefined;\r\n clear = noop;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n functionToDebounce.apply(this, args);\r\n };\r\n\r\n const mergeParms = (\r\n curr: Parameters\r\n ): Parameters | false | null | undefined =>\r\n _mergeParams && prevArguments ? _mergeParams(prevArguments, curr) : curr;\r\n\r\n const flush = () => {\r\n /* istanbul ignore next */\r\n if (clear !== noop) {\r\n invokeFunctionToDebounce(mergeParms(latestArguments!) || latestArguments!);\r\n }\r\n };\r\n\r\n const debouncedFn = function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n const args: Parameters = from(arguments) as Parameters;\r\n const finalTimeout = isFunction(_timeout) ? _timeout() : _timeout;\r\n const hasTimeout = isNumber(finalTimeout) && finalTimeout >= 0;\r\n\r\n if (hasTimeout) {\r\n const finalMaxWait = isFunction(_maxDelay) ? _maxDelay() : _maxDelay;\r\n const hasMaxWait = isNumber(finalMaxWait) && finalMaxWait >= 0;\r\n const setTimeoutFn = finalTimeout > 0 ? setT : rAF!;\r\n const clearTimeoutFn = finalTimeout > 0 ? clearT : cAF!;\r\n const mergeParamsResult = mergeParms(args);\r\n const invokedArgs = mergeParamsResult || args;\r\n const boundInvoke = invokeFunctionToDebounce.bind(0, invokedArgs);\r\n\r\n // if (!mergeParamsResult) {\r\n // invokeFunctionToDebounce(prevArguments || args);\r\n // }\r\n\r\n clear();\r\n // @ts-ignore\r\n const timeoutId = setTimeoutFn(boundInvoke, finalTimeout);\r\n clear = () => clearTimeoutFn(timeoutId);\r\n\r\n if (hasMaxWait && !maxTimeoutId) {\r\n maxTimeoutId = setT(flush, finalMaxWait as number);\r\n }\r\n\r\n prevArguments = latestArguments = invokedArgs;\r\n } else {\r\n invokeFunctionToDebounce(args);\r\n }\r\n };\r\n debouncedFn._flush = flush;\r\n\r\n return debouncedFn as Debounced;\r\n};\r\n","import type { PlainObject } from '~/typings';\r\nimport { isArray, isFunction, isPlainObject, isNull } from './types';\r\nimport { each } from './array';\r\n\r\n/**\r\n * Determines whether the passed object has a property with the passed name.\r\n * @param obj The object.\r\n * @param prop The name of the property.\r\n */\r\nexport const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean =>\r\n Object.prototype.hasOwnProperty.call(obj, prop);\r\n\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object.\r\n * @param obj The object of which the properties shall be returned.\r\n */\r\nexport const keys = (obj: any): Array => (obj ? Object.keys(obj) : []);\r\n\r\ntype AssignDeep = {\r\n (target: T, object1: U): T & U;\r\n (target: T, object1: U, object2: V): T & U & V;\r\n (target: T, object1: U, object2: V, object3: W): T & U & V & W;\r\n (target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;\r\n (target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T &\r\n U &\r\n V &\r\n W &\r\n X &\r\n Y;\r\n (\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n ): T & U & V & W & X & Y & Z;\r\n};\r\n\r\n// https://github.com/jquery/jquery/blob/master/src/core.js#L116\r\nexport const assignDeep: AssignDeep = (\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n): T & U & V & W & X & Y & Z => {\r\n const sources: Array = [object1, object2, object3, object4, object5, object6];\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {\r\n target = {} as T;\r\n }\r\n\r\n each(sources, (source) => {\r\n // Extend the base object\r\n each(source, (_, key) => {\r\n const copy: any = source[key];\r\n\r\n // Prevent Object.prototype pollution\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n return true;\r\n }\r\n\r\n const copyIsArray = isArray(copy);\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (copy && isPlainObject(copy)) {\r\n const src = target[key as keyof T];\r\n let clone: any = src;\r\n\r\n // Ensure proper type for the source value\r\n if (copyIsArray && !isArray(src)) {\r\n clone = [];\r\n } else if (!copyIsArray && !isPlainObject(src)) {\r\n clone = {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[key as keyof T] = assignDeep(clone, copy) as any;\r\n } else {\r\n target[key as keyof T] = copyIsArray ? copy.slice() : copy;\r\n }\r\n });\r\n });\r\n\r\n // Return the modified object\r\n return target as any;\r\n};\r\n\r\nexport const removeUndefinedProperties = (target: T, deep?: boolean): T =>\r\n each(assignDeep({}, target), (value, key, copy) => {\r\n if (value === undefined) {\r\n delete copy[key];\r\n } else if (deep && value && isPlainObject(value)) {\r\n copy[key as keyof typeof copy] = removeUndefinedProperties(value, deep) as any;\r\n }\r\n });\r\n\r\n/**\r\n * Returns true if the given object is empty, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport const isEmptyObject = (obj: any): boolean => {\r\n // eslint-disable-next-line no-restricted-syntax, no-unreachable-loop, guard-for-in\r\n for (const name in obj) return false;\r\n return true;\r\n /* eslint-enable */\r\n};\r\n","import { mathMax, mathMin } from './alias';\r\n\r\n/**\r\n * Caps the passed number between the `min` and `max` bounds.\r\n * @param min The min bound.\r\n * @param max The max bound.\r\n * @param number The number to be capped.\r\n * @returns The capped number between min and max.\r\n */\r\nexport const capNumber = (min: number, max: number, number: number) =>\r\n mathMax(min, mathMin(max, number));\r\n","import type { HTMLElementTarget } from './types';\r\nimport { bind, each, from, isArray } from '../utils';\r\n\r\nexport type AttributeElementTarget = HTMLElementTarget | Element;\r\n\r\nexport type DomTokens = string | string[] | false | null | undefined | void;\r\n\r\nexport const getDomTokensArray = (tokens: DomTokens) =>\r\n from(new Set((isArray(tokens) ? tokens : (tokens || '').split(' ')).filter((token) => token)));\r\n\r\n/**\r\n * Gets a attribute with the given attribute of the given element.\r\n * @param elm The element of which the attribute shall be get.\r\n * @param attrName The attribute name which shall be get.\r\n * @returns The attribute value or `null` when the attribute is not set or `false` if the element is undefined.\r\n */\r\nexport const getAttr = (elm: AttributeElementTarget, attrName: string) =>\r\n elm && elm.getAttribute(attrName);\r\n\r\n/**\r\n * Returns whether the given attribute exists on the given element.\r\n * @param elm The element.\r\n * @param attrName The attribute.\r\n * @returns A Truthy value indicates a present attrubte.\r\n */\r\nexport const hasAttr = (elm: AttributeElementTarget, attrName: string) =>\r\n elm && elm.hasAttribute(attrName);\r\n\r\n/**\r\n * Sets the given attributes to the given element.\r\n * @param elm The element of which the attributes shall be removed.\r\n * @param attrName The attribute names separated by a space.\r\n */\r\nexport const setAttrs = (\r\n elm: AttributeElementTarget,\r\n attrNames: string | string[],\r\n value: string | false | null | undefined\r\n) => {\r\n each(getDomTokensArray(attrNames), (attrName) => {\r\n elm && elm.setAttribute(attrName, value || '');\r\n });\r\n};\r\n\r\n/**\r\n * Removes the given attributes from the given element.\r\n * @param elm The element of which the attribute shall be removed.\r\n * @param attrName The attribute names separated by a space.\r\n */\r\nexport const removeAttrs = (elm: AttributeElementTarget, attrNames: string | string[]): void => {\r\n each(getDomTokensArray(attrNames), (attrName) => elm && elm.removeAttribute(attrName));\r\n};\r\n\r\nexport const domTokenListAttr = (elm: AttributeElementTarget, attrName: string) => {\r\n const initialArr = getDomTokensArray(getAttr(elm, attrName));\r\n const setElmAttr = bind(setAttrs, elm, attrName);\r\n const domTokenListOperation = (operationTokens: DomTokens, operation: 'add' | 'delete') => {\r\n const initialArrSet = new Set(initialArr);\r\n each(getDomTokensArray(operationTokens), (token) => initialArrSet[operation](token));\r\n return from(initialArrSet).join(' ');\r\n };\r\n\r\n return {\r\n _remove: (removeTokens: DomTokens) => setElmAttr(domTokenListOperation(removeTokens, 'delete')),\r\n _add: (addTokens: DomTokens) => setElmAttr(domTokenListOperation(addTokens, 'add')),\r\n _has: (hasTokens: DomTokens) => {\r\n const tokenSet = getDomTokensArray(hasTokens);\r\n return tokenSet.reduce(\r\n (boolean, token) => boolean && initialArr.includes(token),\r\n tokenSet.length > 0\r\n );\r\n },\r\n };\r\n};\r\n\r\n/**\r\n * Treats the given attribute like the \"class\" attribute and removes the given value from it.\r\n * @param elm The element.\r\n * @param attrName The attributeName to which the value shall be removed.\r\n * @param value The value which shall be removed.\r\n */\r\nexport const removeAttrClass = (\r\n elm: AttributeElementTarget,\r\n attrName: string,\r\n value: DomTokens\r\n) => {\r\n domTokenListAttr(elm, attrName)._remove(value);\r\n};\r\n\r\n/**\r\n * Treats the given attribute like the \"class\" attribute and adds value to it.\r\n * @param elm The element.\r\n * @param attrName The attributeName to which the value shall be added.\r\n * @param value The value which shall be added.\r\n */\r\nexport const addAttrClass = (elm: AttributeElementTarget, attrName: string, value: DomTokens) => {\r\n domTokenListAttr(elm, attrName)._add(value);\r\n return bind(removeAttrClass, elm, attrName, value);\r\n};\r\n\r\nexport const addRemoveAttrClass = (\r\n elm: AttributeElementTarget,\r\n attrName: string,\r\n value: DomTokens,\r\n add?: boolean\r\n) => {\r\n (add ? addAttrClass : removeAttrClass)(elm, attrName, value);\r\n};\r\n\r\n/**\r\n * Treats the given attribute like the \"class\" attribute and checks if the given value is in it.\r\n * @param elm The element.\r\n * @param attrName The attributeName from which the content shall be checked.\r\n * @param value The value.\r\n * @returns True if the given attribute has the value in it, false otherwise.\r\n */\r\nexport const hasAttrClass = (\r\n elm: AttributeElementTarget,\r\n attrName: string,\r\n value: DomTokens\r\n): boolean => domTokenListAttr(elm, attrName)._has(value);\r\n","import type { HTMLElementTarget } from './types';\r\nimport type { DomTokens } from './attribute';\r\nimport { each, from } from '../utils/array';\r\nimport { bind } from '../utils/function';\r\nimport { domTokenListAttr } from './attribute';\r\n\r\nconst createDomTokenListClass = (elm: HTMLElementTarget) => domTokenListAttr(elm, 'class');\r\n\r\n/**\r\n * Check whether the given element has the given class name(s).\r\n * @param elm The element.\r\n * @param className The class name(s).\r\n */\r\nexport const hasClass = (elm: HTMLElementTarget, className: DomTokens): boolean =>\r\n createDomTokenListClass(elm)._has(className);\r\n\r\n/**\r\n * Removes the given class name(s) from the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be removed. (separated by spaces)\r\n */\r\nexport const removeClass = (elm: HTMLElementTarget, className: DomTokens): void => {\r\n createDomTokenListClass(elm)._remove(className);\r\n};\r\n\r\n/**\r\n * Adds the given class name(s) to the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be added. (separated by spaces)\r\n * @returns A function which removes the added class name(s).\r\n */\r\nexport const addClass = (elm: HTMLElementTarget, className: DomTokens): (() => void) => {\r\n createDomTokenListClass(elm)._add(className);\r\n return bind(removeClass, elm, className);\r\n};\r\n\r\n/**\r\n * Takes two className strings, compares them and returns the difference as array.\r\n * @param classNameA ClassName A.\r\n * @param classNameB ClassName B.\r\n */\r\nexport const diffClass = (classNameA: string, classNameB: string) => {\r\n const set = new Set(classNameA ? classNameA.split(' ') : []);\r\n\r\n each(classNameB ? classNameB.split(' ') : [], (className) => {\r\n set.has(className) ? set.delete(className) : set.add(className);\r\n });\r\n\r\n return from(set);\r\n};\r\n","import { isElement } from '../utils/types';\r\nimport { push, from } from '../utils/array';\r\n\r\ntype InputElementType = Node | Element | false | null | undefined;\r\ntype OutputElementType = Node | Element | false | null | undefined;\r\n\r\n/**\r\n * Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nconst find = (selector: string, elm?: InputElementType): Element[] => {\r\n const arr: Array = [];\r\n const rootElm = elm ? isElement(elm) && elm : document;\r\n\r\n return rootElm ? push(arr, rootElm.querySelectorAll(selector)) : arr;\r\n};\r\n\r\n/**\r\n * Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nconst findFirst = (selector: string, elm?: InputElementType): OutputElementType => {\r\n const rootElm = elm ? isElement(elm) && elm : document;\r\n\r\n return rootElm ? rootElm.querySelector(selector) : null;\r\n};\r\n\r\n/**\r\n * Determines whether the passed element is matching with the passed selector.\r\n * @param elm The element which has to be compared with the passed selector.\r\n * @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.\r\n */\r\nconst is = (elm: InputElementType, selector: string): boolean => {\r\n if (isElement(elm)) {\r\n return elm.matches(selector);\r\n }\r\n return false;\r\n};\r\n\r\nconst isBodyElement = (elm: InputElementType) => is(elm, 'body'); // don't do targetElement === ownerDocument.body in case initialization happens in memory\r\n\r\n/**\r\n * Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the children shall be returned.\r\n * @param selector The selector which must match with the children elements.\r\n */\r\nconst children = (elm: InputElementType, selector?: string): ReadonlyArray => {\r\n const childs: Array = [];\r\n\r\n return isElement(elm)\r\n ? push(\r\n childs,\r\n from(elm.children).filter((child) => (selector ? is(child, selector) : child))\r\n )\r\n : childs;\r\n};\r\n\r\n/**\r\n * Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the childNodes shall be returned.\r\n */\r\nconst contents = (elm: InputElementType): ReadonlyArray =>\r\n elm ? from(elm.childNodes) : [];\r\n\r\n/**\r\n * Returns the parent element of the passed element, or null if the passed element is null.\r\n * @param elm The element of which the parent element shall be returned.\r\n */\r\nconst parent = (elm: InputElementType): OutputElementType => elm && elm.parentElement;\r\n\r\n/**\r\n * Returns the closest element to the passed element which matches the given selector.\r\n * @param elm The element.\r\n * @param selector The selector.\r\n * @returns The closest element to the passed element which matches the given selector.\r\n */\r\nconst closest = (elm: InputElementType, selector: string): OutputElementType =>\r\n isElement(elm) && elm.closest(selector);\r\n\r\n/**\r\n * Gets the focused element of the passed or default document.\r\n * @returns The focused element of the passed document.\r\n */\r\nconst getFocusedElement = (doc?: Document) => (doc || document).activeElement;\r\n\r\n/**\r\n * Determines whether the given element lies between two selectors in the DOM.\r\n * @param elm The element.\r\n * @param highBoundarySelector The high boundary selector.\r\n * @param deepBoundarySelector The deep boundary selector.\r\n */\r\nconst liesBetween = (\r\n elm: InputElementType,\r\n highBoundarySelector: string,\r\n deepBoundarySelector: string\r\n): boolean => {\r\n const closestHighBoundaryElm = closest(elm, highBoundarySelector);\r\n const closestDeepBoundaryElm = elm && findFirst(deepBoundarySelector, closestHighBoundaryElm);\r\n const deepBoundaryIsValid =\r\n closest(closestDeepBoundaryElm, highBoundarySelector) === closestHighBoundaryElm;\r\n\r\n return closestHighBoundaryElm && closestDeepBoundaryElm\r\n ? closestHighBoundaryElm === elm ||\r\n closestDeepBoundaryElm === elm ||\r\n (deepBoundaryIsValid &&\r\n closest(closest(elm, deepBoundarySelector), highBoundarySelector) !==\r\n closestHighBoundaryElm)\r\n : false;\r\n};\r\n\r\nexport {\r\n find,\r\n findFirst,\r\n is,\r\n isBodyElement,\r\n children,\r\n contents,\r\n parent,\r\n liesBetween,\r\n closest,\r\n getFocusedElement,\r\n};\r\n","import { isArrayLike } from '../utils/types';\r\nimport { each, from } from '../utils/array';\r\nimport { noop } from '../utils/noop';\r\nimport { parent } from './traversal';\r\n\r\ntype ManipulationTarget = Node | false | null | undefined;\r\ntype NodeCollection = ArrayLike | ManipulationTarget;\r\n\r\n/**\r\n * Removes the given Nodes from their parent.\r\n * @param nodes The Nodes which shall be removed.\r\n */\r\nexport const removeElements = (nodes: NodeCollection): void => {\r\n if (isArrayLike(nodes)) {\r\n each(from(nodes), (e) => removeElements(e));\r\n } else if (nodes) {\r\n const parentElm = parent(nodes);\r\n parentElm && parentElm.removeChild(nodes);\r\n }\r\n};\r\n\r\n/**\r\n * Inserts Nodes before the given preferredAnchor element.\r\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\r\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\r\n * @param insertedElms The Nodes which shall be inserted.\r\n * @returns A function which removes the inserted nodes.\r\n */\r\nconst before = (\r\n parentElm: ManipulationTarget,\r\n preferredAnchor: ManipulationTarget,\r\n insertedElms: NodeCollection\r\n): (() => void) => {\r\n if (insertedElms && parentElm) {\r\n let anchor: ManipulationTarget = preferredAnchor;\r\n let fragment: DocumentFragment | Node | null | undefined;\r\n\r\n if (isArrayLike(insertedElms)) {\r\n fragment = document.createDocumentFragment();\r\n\r\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\r\n each(insertedElms, (insertedElm) => {\r\n if (insertedElm === anchor) {\r\n anchor = insertedElm.previousSibling;\r\n }\r\n fragment!.appendChild(insertedElm);\r\n });\r\n } else {\r\n fragment = insertedElms;\r\n }\r\n\r\n // if the preferred anchor isn't null set it to a valid anchor\r\n if (preferredAnchor) {\r\n if (!anchor) {\r\n anchor = parentElm.firstChild;\r\n } else if (anchor !== preferredAnchor) {\r\n anchor = anchor.nextSibling;\r\n }\r\n }\r\n\r\n parentElm.insertBefore(fragment, anchor || null);\r\n return () => removeElements(insertedElms);\r\n }\r\n return noop;\r\n};\r\n\r\n/**\r\n * Appends the given children at the end of the given Node.\r\n * @param node The Node to which the children shall be appended.\r\n * @param children The Nodes which shall be appended.\r\n * @returns A function which removes the inserted nodes.\r\n */\r\nexport const appendChildren = (node: ManipulationTarget, children: NodeCollection) =>\r\n before(node, null, children);\r\n\r\n/**\r\n * Prepends the given children at the start of the given Node.\r\n * @param node The Node to which the children shall be prepended.\r\n * @param children The Nodes which shall be prepended.\r\n * @returns A function which removes the inserted nodes.\r\n */\r\nexport const prependChildren = (node: ManipulationTarget, children: NodeCollection) =>\r\n before(node, node && node.firstChild, children);\r\n\r\n/**\r\n * Inserts the given Nodes before the given Node.\r\n * @param node The Node before which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n * @returns A function which removes the inserted nodes.\r\n */\r\nexport const insertBefore = (node: ManipulationTarget, insertedNodes: NodeCollection) =>\r\n before(parent(node), node, insertedNodes);\r\n\r\n/**\r\n * Inserts the given Nodes after the given Node.\r\n * @param node The Node after which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n * @returns A function which removes the inserted nodes.\r\n */\r\nexport const insertAfter = (node: ManipulationTarget, insertedNodes: NodeCollection) =>\r\n before(parent(node), node && node.nextSibling, insertedNodes);\r\n","import { each } from '../utils/array';\r\nimport { setAttrs } from './attribute';\r\nimport { contents } from './traversal';\r\nimport { removeElements } from './manipulation';\r\n\r\n/**\r\n * Creates a div DOM node.\r\n */\r\nexport const createDiv = (classNames?: string): HTMLDivElement => {\r\n const div = document.createElement('div');\r\n setAttrs(div, 'class', classNames);\r\n return div;\r\n};\r\n\r\n/**\r\n * Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.\r\n * @param html The html string after which the DOM nodes shall be created.\r\n */\r\nexport const createDOM = (html: string): ReadonlyArray => {\r\n const createdDiv = createDiv();\r\n createdDiv.innerHTML = html.trim();\r\n\r\n return each(contents(createdDiv), (elm) => removeElements(elm));\r\n};\r\n","import type { PlainObject, StyleObject, StyleObjectKey, StyleObjectValue } from '~/typings';\r\nimport type { XY } from './offset';\r\nimport type { HTMLElementTarget } from './types';\r\nimport { wnd } from '../utils/alias';\r\nimport { each } from '../utils/array';\r\nimport { isString, isNumber, isObject } from '../utils/types';\r\n\r\nexport interface TRBL {\r\n t: number;\r\n r: number;\r\n b: number;\r\n l: number;\r\n}\r\n\r\nconst customCssPropRegex = /^--/;\r\n\r\nconst getCSSVal = (computedStyle: CSSStyleDeclaration, prop: StyleObjectKey): string =>\r\n computedStyle.getPropertyValue(prop) || computedStyle[prop as any] || '';\r\n\r\nconst validFiniteNumber = (number: number) => {\r\n const notNaN = number || 0;\r\n return isFinite(notNaN) ? notNaN : 0;\r\n};\r\n\r\nconst parseToZeroOrNumber = (value?: string): number => validFiniteNumber(parseFloat(value || ''));\r\n\r\nexport const ratioToCssPercent = (ratio: number) =>\r\n `${(validFiniteNumber(ratio) * 100).toFixed(3)}%`;\r\n\r\nexport const numberToCssPx = (number: number) => `${validFiniteNumber(number)}px`;\r\n\r\nexport function setStyles(elm: HTMLElementTarget, styles: StyleObject): void {\r\n elm &&\r\n each(styles, (rawValue: StyleObjectValue, name) => {\r\n try {\r\n const elmStyle = elm.style;\r\n const value = isNumber(rawValue) ? numberToCssPx(rawValue) : (rawValue || '') + '';\r\n\r\n if (customCssPropRegex.test(name)) {\r\n elmStyle.setProperty(name, value);\r\n } else {\r\n elmStyle[name as any] = value;\r\n }\r\n } catch {}\r\n });\r\n}\r\n\r\nexport function getStyles(\r\n elm: HTMLElementTarget,\r\n styles: Array,\r\n pseudoElm?: string | null | undefined\r\n): Partial>;\r\nexport function getStyles(\r\n elm: HTMLElementTarget,\r\n styles: StyleObjectKey,\r\n pseudoElm?: string | null | undefined\r\n): string;\r\nexport function getStyles(\r\n elm: HTMLElementTarget,\r\n styles: Array | StyleObjectKey,\r\n pseudoElm?: string | null | undefined\r\n): Partial> | string {\r\n const getSingleStyle = isString(styles);\r\n let getStylesResult: string | PlainObject = getSingleStyle ? '' : {};\r\n\r\n if (elm) {\r\n const computedStyle = wnd.getComputedStyle(elm, pseudoElm) || elm.style;\r\n getStylesResult = getSingleStyle\r\n ? getCSSVal(computedStyle, styles)\r\n : styles.reduce((result, key) => {\r\n result[key] = getCSSVal(computedStyle, key);\r\n return result;\r\n }, getStylesResult as PlainObject);\r\n }\r\n return getStylesResult;\r\n}\r\n\r\nexport const getDirectionIsRTL = (elm: HTMLElementTarget): boolean =>\r\n getStyles(elm, 'direction') === 'rtl';\r\n\r\n/**\r\n * Returns the top right bottom left values of the passed css property.\r\n * @param elm The element of which the values shall be returned.\r\n * @param propertyPrefix The css property prefix. (e.g. \"border\")\r\n * @param propertySuffix The css property suffix. (e.g. \"width\")\r\n */\r\nexport const topRightBottomLeft = (\r\n elm?: HTMLElementTarget,\r\n propertyPrefix?: string,\r\n propertySuffix?: string\r\n): TRBL => {\r\n const finalPrefix = propertyPrefix ? `${propertyPrefix}-` : '';\r\n const finalSuffix = propertySuffix ? `-${propertySuffix}` : '';\r\n const top = `${finalPrefix}top${finalSuffix}` as StyleObjectKey;\r\n const right = `${finalPrefix}right${finalSuffix}` as StyleObjectKey;\r\n const bottom = `${finalPrefix}bottom${finalSuffix}` as StyleObjectKey;\r\n const left = `${finalPrefix}left${finalSuffix}` as StyleObjectKey;\r\n const result = getStyles(elm, [top, right, bottom, left]);\r\n return {\r\n t: parseToZeroOrNumber(result[top]),\r\n r: parseToZeroOrNumber(result[right]),\r\n b: parseToZeroOrNumber(result[bottom]),\r\n l: parseToZeroOrNumber(result[left]),\r\n };\r\n};\r\n\r\nexport const getTrasformTranslateValue = (\r\n value: string | number | XY,\r\n isHorizontal?: boolean\r\n) =>\r\n `translate${\r\n isObject(value) ? `(${value.x},${value.y})` : `${isHorizontal ? 'X' : 'Y'}(${value})`\r\n }`;\r\n","import type { HTMLElementTarget } from './types';\r\nimport { getStyles } from './style';\r\nimport { mathRound, wnd } from '../utils/alias';\r\nimport { bind } from '../utils/function';\r\nimport { strHeight, strWidth } from '../utils/strings';\r\n\r\nexport interface WH {\r\n w: T;\r\n h: T;\r\n}\r\n\r\nconst elementHasDimensions = (elm: HTMLElement): boolean =>\r\n !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\r\nconst zeroObj: WH = {\r\n w: 0,\r\n h: 0,\r\n};\r\n\r\nconst getElmWidthHeightProperty = (\r\n property: E extends HTMLElement ? 'client' | 'offset' | 'scroll' : 'inner',\r\n elm: E | false | null | undefined\r\n): Readonly =>\r\n elm\r\n ? {\r\n w: (elm as any)[`${property}Width`],\r\n h: (elm as any)[`${property}Height`],\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the window inner- width and height.\r\n */\r\nexport const windowSize = (customWnd?: Window): Readonly =>\r\n getElmWidthHeightProperty('inner', customWnd || wnd);\r\n\r\n/**\r\n * Returns the scroll- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the scroll- width and height shall be returned.\r\n */\r\nexport const offsetSize = bind(getElmWidthHeightProperty, 'offset') satisfies (\r\n elm: HTMLElementTarget\r\n) => Readonly;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const clientSize = bind(getElmWidthHeightProperty, 'client') satisfies (\r\n elm: HTMLElementTarget\r\n) => Readonly;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const scrollSize = bind(getElmWidthHeightProperty, 'scroll') satisfies (\r\n elm: HTMLElementTarget\r\n) => Readonly;\r\n\r\n/**\r\n * Returns the fractional- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the fractional- width and height shall be returned.\r\n */\r\nexport const fractionalSize = (elm: HTMLElementTarget): Readonly => {\r\n const cssWidth = parseFloat(getStyles(elm, strWidth)) || 0;\r\n const cssHeight = parseFloat(getStyles(elm, strHeight)) || 0;\r\n return {\r\n w: cssWidth - mathRound(cssWidth),\r\n h: cssHeight - mathRound(cssHeight),\r\n };\r\n};\r\n\r\n/**\r\n * Returns the BoundingClientRect of the passed element.\r\n * @param elm The element of which the BoundingClientRect shall be returned.\r\n */\r\nexport const getBoundingClientRect = (elm: HTMLElement): DOMRect => elm.getBoundingClientRect();\r\n\r\n/**\r\n * Determines whether the passed element has any dimensions.\r\n * @param elm The element.\r\n */\r\nexport const hasDimensions = (elm: HTMLElementTarget): boolean =>\r\n !!elm && elementHasDimensions(elm);\r\n\r\n/**\r\n * Determines whether the passed DOM Rect has any dimensions.\r\n */\r\nexport const domRectHasDimensions = (rect?: DOMRectReadOnly | false | null) =>\r\n !!(rect && (rect[strHeight] || rect[strWidth]));\r\n\r\n/**\r\n * Determines whether current DOM Rect has appeared according the the previous dom rect..\r\n * @param currContentRect The current DOM Rect.\r\n * @param prevContentRect The previous DOM Rect.\r\n * @returns Whether the dom rect appeared.\r\n */\r\nexport const domRectAppeared = (\r\n currContentRect: DOMRectReadOnly | false | null | undefined,\r\n prevContentRect: DOMRectReadOnly | false | null | undefined\r\n) => {\r\n const rectHasDimensions = domRectHasDimensions(currContentRect);\r\n const rectHadDimensions = domRectHasDimensions(prevContentRect);\r\n return !rectHadDimensions && rectHasDimensions;\r\n};\r\n","import type { DomTokens } from './attribute';\r\nimport { each, runEachAndClear } from '../utils/array';\r\nimport { bind } from '../utils/function';\r\nimport { keys } from '../utils';\r\nimport { getDomTokensArray } from './attribute';\r\n\r\nexport interface EventListenerOptions {\r\n _capture?: boolean;\r\n _passive?: boolean;\r\n _once?: boolean;\r\n}\r\n\r\nexport type EventListenerMap = {\r\n [eventNames: string]: (event: Event) => any;\r\n};\r\n\r\n/**\r\n * Removes the passed event listener for the passed event names with the passed options.\r\n * @param target The element from which the listener shall be removed.\r\n * @param eventNames The eventsnames for which the listener shall be removed.\r\n * @param listener The listener which shall be removed.\r\n * @param capture The options of the removed listener.\r\n */\r\nexport const removeEventListener = (\r\n target: EventTarget,\r\n eventNames: DomTokens,\r\n listener: (event: T) => any,\r\n capture?: boolean\r\n): void => {\r\n each(getDomTokensArray(eventNames), (eventName) => {\r\n target.removeEventListener(eventName, listener as EventListener, capture);\r\n });\r\n};\r\n\r\n/**\r\n * Adds the passed event listener for the passed event names with the passed options.\r\n * @param target The element to which the listener shall be added.\r\n * @param eventNames The eventsnames for which the listener shall be called.\r\n * @param listener The listener which is called on the eventnames.\r\n * @param options The options of the added listener.\r\n */\r\nexport const addEventListener = (\r\n target: EventTarget,\r\n eventNames: DomTokens,\r\n listener: (event: T) => any,\r\n options?: EventListenerOptions\r\n): (() => void) => {\r\n const passive = (options && options._passive) ?? true;\r\n const capture = (options && options._capture) || false;\r\n const once = (options && options._once) || false;\r\n const nativeOptions: AddEventListenerOptions = {\r\n passive,\r\n capture,\r\n };\r\n\r\n return bind(\r\n runEachAndClear,\r\n getDomTokensArray(eventNames).map((eventName) => {\r\n const finalListener = (\r\n once\r\n ? (evt: T) => {\r\n removeEventListener(target, eventName, finalListener, capture);\r\n listener(evt);\r\n }\r\n : listener\r\n ) as EventListener;\r\n\r\n target.addEventListener(eventName, finalListener, nativeOptions);\r\n return bind(removeEventListener, target, eventName, finalListener, capture);\r\n })\r\n );\r\n};\r\n\r\n/**\r\n * Adds the passed event listeners for the passed event names with the passed options.\r\n * @param target The element to which the listener shall be added.\r\n * @param eventListenerMap A map which descirbes the event names and event listeners to be added.\r\n * @param options The options of the added listeners.\r\n */\r\nexport const addEventListeners = (\r\n target: EventTarget,\r\n eventListenerMap: EventListenerMap,\r\n options?: EventListenerOptions\r\n): (() => void) =>\r\n bind(\r\n runEachAndClear,\r\n keys(eventListenerMap).map((eventNames) =>\r\n addEventListener(target, eventNames, eventListenerMap[eventNames], options)\r\n )\r\n );\r\n\r\n/**\r\n * Shorthand for the stopPropagation event Method.\r\n * @param evt The event of which the stopPropagation method shall be called.\r\n */\r\nexport const stopPropagation = (evt: Event): void => evt.stopPropagation();\r\n\r\n/**\r\n * Shorthand for the preventDefault event Method.\r\n * @param evt The event of which the preventDefault method shall be called.\r\n */\r\nexport const preventDefault = (evt: Event): void => evt.preventDefault();\r\n\r\n/**\r\n * Shorthand for the stopPropagation and preventDefault event Method.\r\n * @param evt The event of which the stopPropagation and preventDefault methods shall be called.\r\n */\r\nexport const stopAndPrevent = (evt: Event): void =>\r\n (stopPropagation(evt) as undefined) || (preventDefault(evt) as undefined);\r\n","import type { HTMLElementTarget } from './types';\r\nimport { getBoundingClientRect } from './dimensions';\r\nimport { wnd } from '../utils/alias';\r\n\r\nexport interface XY {\r\n x: T;\r\n y: T;\r\n}\r\n\r\nconst zeroObj: XY = {\r\n x: 0,\r\n y: 0,\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const absoluteCoordinates = (elm: HTMLElementTarget): Readonly => {\r\n const rect = elm && getBoundingClientRect(elm);\r\n return rect\r\n ? {\r\n x: rect.left + wnd.scrollX,\r\n y: rect.top + wnd.scrollY,\r\n }\r\n : zeroObj;\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const offsetCoordinates = (elm: HTMLElementTarget): Readonly =>\r\n elm\r\n ? {\r\n x: elm.offsetLeft,\r\n y: elm.offsetTop,\r\n }\r\n : zeroObj;\r\n","import type { Env } from '~/environment';\r\nimport type { XY } from './offset';\r\nimport { capNumber, isNumber } from '../utils';\r\n\r\nexport type RTLScrollBehavior = Env['_rtlScrollBehavior'] | false | null | undefined;\r\n\r\n/**\r\n * Transforms a normalized scroll position to a RTL compatilbe scroll position value or vice versa (depending on the input format).\r\n * @param scrollPosition The scroll position value.\r\n * @param overflowAmount The (normalized) overflow amount value.\r\n * @param rtlScrollBehavior The RTL scroll behavior or `falsy` if the rtl scroll behavior doesn't apply.\r\n * @returns The input scroll position, just converted.\r\n * If the input `scrollPosition` is normalized the raw (RTL Compatible) format is returned.\r\n * If the input `scrollPosition` is raw (RTL Compatible) the normalized format is returned.\r\n */\r\nexport const convertScrollPosition = (\r\n scrollPosition: number,\r\n overflowAmount: number,\r\n rtlScrollBehavior?: RTLScrollBehavior\r\n) =>\r\n rtlScrollBehavior\r\n ? rtlScrollBehavior.n\r\n ? -scrollPosition + 0 // +0 avoids negative zero (-0) as a result\r\n : rtlScrollBehavior.i\r\n ? overflowAmount - scrollPosition\r\n : scrollPosition\r\n : scrollPosition;\r\n\r\n/**\r\n * Gets the raw (RTL compatilbe) scroll boundaries from the normalized overflow amount.\r\n * @param overflowAmount The normalzed overflow amount value.\r\n * @param rtlScrollBehavior The RTL scroll behavior or `falsy` if the rtl scroll behavior doesn't apply.\r\n * @returns The raw (RTL compatible) scroll boundaries. (min value will scroll to start (0%) and max will scroll to end (100%))\r\n */\r\nexport const getRawScrollBounds = (\r\n overflowAmount: number,\r\n rtlScrollBehavior?: RTLScrollBehavior\r\n): [min: number, max: number] => [\r\n convertScrollPosition(0, overflowAmount, rtlScrollBehavior),\r\n convertScrollPosition(overflowAmount, overflowAmount, rtlScrollBehavior),\r\n];\r\n\r\n/**\r\n * Gets the scroll ratio of the current raw (RTL compatilbe) scroll position.\r\n * @param rawScrollPosition The raw (RTL compatible) scroll position.\r\n * @param overflowAmount The normalized overflow amount.\r\n * @param rtlScrollBehavior The RTL scroll behavior or `falsy` if the rtl scroll behavior doesn't apply.\r\n * @returns The scroll ratio of the current scroll position 0..1.\r\n */\r\nexport const getRawScrollRatio = (\r\n rawScrollPosition: number,\r\n overflowAmount: number,\r\n rtlScrollBehavior?: RTLScrollBehavior\r\n) =>\r\n capNumber(\r\n 0,\r\n 1,\r\n convertScrollPosition(rawScrollPosition, overflowAmount, rtlScrollBehavior) / overflowAmount ||\r\n 0\r\n );\r\n\r\n/**\r\n * Scroll the passed element to the passed position.\r\n * @param elm The element to be scrolled.\r\n * @param position The scroll position.\r\n */\r\nexport const scrollElementTo = (\r\n elm: HTMLElement,\r\n position: Partial | number | false | null | undefined\r\n): void => {\r\n const { x, y } = isNumber(position) ? { x: position, y: position } : position || {};\r\n isNumber(x) && (elm.scrollLeft = x);\r\n isNumber(y) && (elm.scrollTop = y);\r\n};\r\n\r\n/**\r\n * Scroll the passed element to the passed position.\r\n * @param elm The element to be scrolled.\r\n * @param position The scroll position.\r\n */\r\nexport const getElmentScroll = (elm: HTMLElement): Readonly => ({\r\n x: elm.scrollLeft,\r\n y: elm.scrollTop,\r\n});\r\n","import { isBoolean, isFunction, isString } from './utils/types';\r\nimport { keys } from './utils/object';\r\nimport { each, push, from, isEmptyArray, runEachAndClear, createOrKeepArray } from './utils/array';\r\nimport { bind } from './utils/function';\r\n\r\nexport type EventListener, N extends keyof EventArgs> = (\r\n ...args: EventArgs[N]\r\n) => void;\r\n\r\nexport type EventListeners> = {\r\n [K in keyof EventArgs]?: EventListener | EventListener[] | null;\r\n};\r\n\r\nexport type RemoveEvent> = {\r\n (name?: N, listener?: EventListener): void;\r\n (name?: N, listener?: EventListener[]): void;\r\n (\r\n name?: N,\r\n listener?: EventListener | EventListener[]\r\n ): void;\r\n};\r\n\r\nexport type AddEvent> = {\r\n (eventListeners: EventListeners, pure?: boolean): () => void;\r\n (name: N, listener: EventListener): () => void;\r\n (name: N, listener: EventListener[]): () => void;\r\n (\r\n nameOrEventListeners: N | EventListeners,\r\n listener?: EventListener | EventListener[] | boolean\r\n ): () => void;\r\n};\r\n\r\nexport type TriggerEvent> = {\r\n (name: N, args: EventArgs[N]): void;\r\n};\r\n\r\nexport type EventListenerHub> = [\r\n AddEvent,\r\n RemoveEvent,\r\n TriggerEvent\r\n];\r\n\r\nconst manageListener = , N extends keyof EventArgs>(\r\n callback: (listener?: EventListener) => void,\r\n listener?: EventListener | EventListener[]\r\n) => {\r\n each(createOrKeepArray(listener), callback);\r\n};\r\n\r\nexport const createEventListenerHub = >(\r\n initialEventListeners?: EventListeners\r\n): EventListenerHub => {\r\n const events = new Map>>();\r\n\r\n const removeEvent: RemoveEvent = (name, listener) => {\r\n if (name) {\r\n const eventSet = events.get(name);\r\n manageListener((currListener) => {\r\n if (eventSet) {\r\n eventSet[currListener ? 'delete' : 'clear'](currListener! as any);\r\n }\r\n }, listener);\r\n } else {\r\n events.forEach((eventSet) => {\r\n eventSet.clear();\r\n });\r\n events.clear();\r\n }\r\n };\r\n\r\n const addEvent: AddEvent = (\r\n nameOrEventListeners: keyof EventArgs | EventListeners,\r\n listenerOrPure?:\r\n | EventListener\r\n | EventListener[]\r\n | boolean\r\n ) => {\r\n if (isString(nameOrEventListeners)) {\r\n const eventSet = events.get(nameOrEventListeners) || new Set();\r\n events.set(nameOrEventListeners, eventSet);\r\n\r\n manageListener((currListener) => {\r\n isFunction(currListener) && eventSet.add(currListener);\r\n }, listenerOrPure as Exclude);\r\n\r\n return bind(\r\n removeEvent,\r\n nameOrEventListeners,\r\n listenerOrPure as Exclude\r\n );\r\n }\r\n if (isBoolean(listenerOrPure) && listenerOrPure) {\r\n removeEvent();\r\n }\r\n\r\n const eventListenerKeys = keys(nameOrEventListeners) as (keyof EventListeners)[];\r\n const offFns: (() => void)[] = [];\r\n each(eventListenerKeys, (key) => {\r\n const eventListener = (nameOrEventListeners as EventListeners)[key];\r\n eventListener && push(offFns, addEvent(key, eventListener));\r\n });\r\n\r\n return bind(runEachAndClear, offFns);\r\n };\r\n\r\n const triggerEvent: TriggerEvent = (name, args) => {\r\n each(from(events.get(name)), (event) => {\r\n if (args && !isEmptyArray(args)) {\r\n (event as (...eventArgs: EventArgs[keyof EventArgs]) => void).apply(0, args);\r\n } else {\r\n (event as () => void)();\r\n }\r\n });\r\n };\r\n\r\n addEvent(initialEventListeners || {});\r\n\r\n return [addEvent, removeEvent, triggerEvent];\r\n};\r\n","import {\r\n assignDeep,\r\n each,\r\n isObject,\r\n keys,\r\n isArray,\r\n hasOwnProperty,\r\n isFunction,\r\n isEmptyObject,\r\n concat,\r\n} from '~/support';\r\nimport type { DeepPartial, DeepReadonly } from '~/typings';\r\n\r\nexport type OptionsField = string;\r\n\r\nexport type OptionsPrimitiveValue =\r\n | boolean\r\n | number\r\n | string\r\n | Array\r\n | ReadonlyArray\r\n | [any]\r\n | [any, ...any[]]\r\n | ((this: any, ...args: any[]) => any)\r\n | null;\r\n\r\nexport type OptionsObject = {\r\n [field: OptionsField]: OptionsPrimitiveValue | OptionsObject;\r\n};\r\n\r\ntype OptionsObjectFieldNameTuples = T extends OptionsPrimitiveValue\r\n ? []\r\n : {\r\n [K in Extract]: [K, ...OptionsObjectFieldNameTuples];\r\n }[Extract];\r\n\r\ntype JoinOptionsObjectFieldTuples<\r\n T extends OptionsField[],\r\n IncompletePath extends boolean = false\r\n> = T extends [infer F]\r\n ? F\r\n : T extends [infer F, ...infer R]\r\n ? F extends OptionsField\r\n ?\r\n | (IncompletePath extends true ? F : never)\r\n | `${F}.${JoinOptionsObjectFieldTuples>}`\r\n : never\r\n : OptionsField;\r\n\r\ntype SplitJoinedOptionsObjectFieldTuples = string extends S\r\n ? OptionsField[]\r\n : S extends ''\r\n ? []\r\n : S extends `${infer T}.${infer U}`\r\n ? [T, ...SplitJoinedOptionsObjectFieldTuples]\r\n : [S];\r\n\r\ntype OptionsObjectFieldTuplesType = T extends [infer F]\r\n ? F extends keyof O\r\n ? O[F]\r\n : never\r\n : T extends [infer F, ...infer R]\r\n ? F extends keyof O\r\n ? O[F] extends OptionsPrimitiveValue\r\n ? O[F]\r\n : OptionsObjectFieldTuplesType>\r\n : never\r\n : never;\r\n\r\ntype OptionsObjectFieldPath = JoinOptionsObjectFieldTuples<\r\n OptionsObjectFieldNameTuples,\r\n true\r\n>;\r\n\r\ntype OptionsObjectFieldPathType<\r\n O extends OptionsObject,\r\n P extends string\r\n> = OptionsObjectFieldTuplesType>;\r\n\r\nconst opsStringify = (value: any) =>\r\n JSON.stringify(value, (_, val) => {\r\n if (isFunction(val)) {\r\n throw 0;\r\n }\r\n return val;\r\n });\r\n\r\nconst getPropByPath = (obj: any, path: string): T =>\r\n obj\r\n ? `${path}`\r\n .split('.')\r\n .reduce((o, prop) => (o && hasOwnProperty(o, prop) ? o[prop] : undefined), obj)\r\n : undefined;\r\n\r\n/**\r\n * The overflow behavior of an axis.\r\n */\r\nexport type OverflowBehavior =\r\n /** No scrolling is possible and the content is clipped. */\r\n | 'hidden'\r\n /** No scrolling is possible and the content isn't clipped. */\r\n | 'visible'\r\n /** Scrolling is possible if there is an overflow. */\r\n | 'scroll'\r\n /**\r\n * If the other axis has no overflow the behavior is similar to `visible`.\r\n * If the other axis has overflow the behavior is similar to `hidden`.\r\n */\r\n | 'visible-hidden'\r\n /**\r\n * If the other axis has no overflow the behavior is similar to `visible`.\r\n * If the other axis has overflow the behavior is similar to `scroll`.\r\n */\r\n | 'visible-scroll';\r\n\r\n/**\r\n * The scrollbars visibility behavior.\r\n */\r\nexport type ScrollbarsVisibilityBehavior =\r\n /** The scrollbars are always visible. */\r\n | 'visible'\r\n /** The scrollbars are always hidden. */\r\n | 'hidden'\r\n /** The scrollbars are only visibile if there is overflow. */\r\n | 'auto';\r\n\r\n/**\r\n * The scrollbars auto hide behavior\r\n */\r\nexport type ScrollbarsAutoHideBehavior =\r\n /** The scrollbars are never hidden automatically. */\r\n | 'never'\r\n /** The scrollbars are hidden unless the user scrolls. */\r\n | 'scroll'\r\n /** The scrollbars are hidden unless the pointer moves in the host element or the user scrolls. */\r\n | 'move'\r\n /** The scrollbars are hidden if the pointer leaves the host element or unless the user scrolls. */\r\n | 'leave';\r\n\r\n/**\r\n * The options of a OverlayScrollbars instance.\r\n */\r\nexport type Options = {\r\n /** Whether the padding shall be absolute. */\r\n paddingAbsolute: boolean;\r\n /** Whether to show the native scrollbars. Has only an effect it the native scrollbars are overlaid. */\r\n showNativeOverlaidScrollbars: boolean;\r\n /** Customizes the automatic update behavior. */\r\n update: {\r\n /**\r\n * The given Event(s) from the elements with the given selector(s) will trigger an update.\r\n * Useful for everything the MutationObserver and ResizeObserver can't detect\r\n * e.g.: and Images `load` event or the `transitionend` / `animationend` events.\r\n */\r\n elementEvents: Array<[elementSelector: string, eventNames: string]> | null;\r\n /**\r\n * The debounce which is used to detect content changes.\r\n * If a tuple is provided you can customize the `timeout` and the `maxWait` in milliseconds.\r\n * If a single number customizes only the `timeout`.\r\n *\r\n * If the `timeout` is `0`, a debounce still exists. (its executed via `requestAnimationFrame`).\r\n */\r\n debounce: [timeout: number, maxWait: number] | number | null;\r\n /**\r\n * HTML attributes which will trigger an update if they're changed.\r\n * Basic attributes like `id`, `class`, `style` etc. are always observed and doesn't have to be added explicitly.\r\n */\r\n attributes: string[] | null;\r\n /**\r\n * A function which makes it possible to ignore a content mutation or null if nothing shall be ignored.\r\n * @param mutation The MutationRecord from the MutationObserver.\r\n * @returns A Truthy value if the mutation shall be ignored, a falsy value otherwise.\r\n */\r\n ignoreMutation: ((mutation: MutationRecord) => any) | null;\r\n };\r\n /** Customizes the overflow behavior per axis. */\r\n overflow: {\r\n /** The overflow behavior of the horizontal (x) axis. */\r\n x: OverflowBehavior;\r\n /** The overflow behavior of the vertical (y) axis. */\r\n y: OverflowBehavior;\r\n };\r\n /** Customizes appearance of the scrollbars. */\r\n scrollbars: {\r\n /**\r\n * The scrollbars theme.\r\n * The theme value will be added as `class` to all `scrollbar` elements of the instance.\r\n */\r\n theme: string | null;\r\n /** The scrollbars visibility behavior. */\r\n visibility: ScrollbarsVisibilityBehavior;\r\n /** The scrollbars auto hide behavior. */\r\n autoHide: ScrollbarsAutoHideBehavior;\r\n /** The scrollbars auto hide delay in milliseconds. */\r\n autoHideDelay: number;\r\n /** Whether the scrollbars auto hide behavior is suspended until a scroll happened. */\r\n autoHideSuspend: boolean;\r\n /** Whether its possible to drag the handle of a scrollbar to scroll the viewport. */\r\n dragScroll: boolean;\r\n /** Whether its possible to click the track of a scrollbar to scroll the viewport. */\r\n clickScroll: boolean;\r\n /**\r\n * An array of pointer types which shall be supported.\r\n * Common pointer types are: `mouse`, `pen` and `touch`.\r\n * https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\r\n */\r\n pointers: string[] | null;\r\n };\r\n};\r\n\r\nexport type ReadonlyOptions = DeepReadonly;\r\n\r\nexport type PartialOptions = DeepPartial;\r\n\r\nexport type OptionsCheckFn =

>(\r\n path: P\r\n) => [value: OptionsObjectFieldPathType, changed: boolean];\r\n\r\nexport const defaultOptions: ReadonlyOptions = {\r\n paddingAbsolute: false,\r\n showNativeOverlaidScrollbars: false,\r\n update: {\r\n elementEvents: [['img', 'load']],\r\n debounce: [0, 33],\r\n attributes: null,\r\n ignoreMutation: null,\r\n },\r\n overflow: {\r\n x: 'scroll',\r\n y: 'scroll',\r\n },\r\n scrollbars: {\r\n theme: 'os-theme-dark',\r\n visibility: 'auto',\r\n autoHide: 'never',\r\n autoHideDelay: 1300,\r\n autoHideSuspend: false,\r\n dragScroll: true,\r\n clickScroll: false,\r\n pointers: ['mouse', 'touch', 'pen'],\r\n },\r\n} satisfies OptionsObject & Options;\r\n\r\nexport const getOptionsDiff = (currOptions: T, newOptions: DeepPartial): DeepPartial => {\r\n const diff: DeepPartial = {};\r\n const optionsKeys = concat(keys(newOptions), keys(currOptions)) as Array<\r\n keyof T & keyof DeepPartial\r\n >;\r\n\r\n each(optionsKeys, (optionKey) => {\r\n const currOptionValue = currOptions[optionKey];\r\n const newOptionValue = newOptions[optionKey];\r\n\r\n if (isObject(currOptionValue) && isObject(newOptionValue)) {\r\n assignDeep((diff[optionKey] = {} as any), getOptionsDiff(currOptionValue, newOptionValue));\r\n // delete empty nested objects\r\n if (isEmptyObject(diff[optionKey])) {\r\n delete diff[optionKey];\r\n }\r\n } else if (hasOwnProperty(newOptions, optionKey) && newOptionValue !== currOptionValue) {\r\n let isDiff = true;\r\n\r\n if (isArray(currOptionValue) || isArray(newOptionValue)) {\r\n try {\r\n if (opsStringify(currOptionValue) === opsStringify(newOptionValue)) {\r\n isDiff = false;\r\n }\r\n } catch {}\r\n }\r\n\r\n if (isDiff) {\r\n diff[optionKey] = newOptionValue;\r\n }\r\n }\r\n });\r\n\r\n return diff;\r\n};\r\n\r\nexport const createOptionCheck =\r\n (\r\n options: T,\r\n changedOptions: DeepPartial,\r\n force?: boolean\r\n ): OptionsCheckFn =>\r\n (path) =>\r\n [getPropByPath(options, path), force || getPropByPath(changedOptions, path) !== undefined];\r\n","const dataAttributePrefix = `data-overlayscrollbars`;\r\n\r\n// environment\r\nexport const classNameEnvironment = 'os-environment';\r\nexport const classNameEnvironmentScrollbarHidden = `${classNameEnvironment}-scrollbar-hidden`;\r\n\r\n// initialize\r\nexport const dataAttributeInitialize = `${dataAttributePrefix}-initialize`;\r\n\r\n// host\r\nexport const dataAttributeHost = dataAttributePrefix;\r\nexport const dataAttributeHostOverflowX = `${dataAttributeHost}-overflow-x`;\r\nexport const dataAttributeHostOverflowY = `${dataAttributeHost}-overflow-y`;\r\nexport const dataValueHostOverflowVisible = 'overflowVisible';\r\nexport const dataValueHostScrollbarHidden = 'scrollbarHidden';\r\nexport const dataValueHostScrollbarPressed = 'scrollbarPressed';\r\nexport const dataValueHostUpdating = 'updating';\r\nexport const dataValueHostHtmlBody = 'body';\r\n\r\n// viewport\r\nexport const dataAttributeViewport = `${dataAttributePrefix}-viewport`;\r\nexport const dataValueViewportArrange = 'arrange';\r\nexport const dataValueViewportScrollbarHidden = 'scrollbarHidden';\r\nexport const dataValueViewportOverflowVisible = dataValueHostOverflowVisible;\r\n\r\n// padding\r\nexport const dataAttributePadding = `${dataAttributePrefix}-padding`;\r\nexport const dataValuePaddingOverflowVisible = dataValueViewportOverflowVisible;\r\n\r\n// content\r\nexport const dataAttributeContent = `${dataAttributePrefix}-content`;\r\n\r\n// size observer\r\nexport const classNameSizeObserver = 'os-size-observer';\r\nexport const classNameSizeObserverAppear = `${classNameSizeObserver}-appear`;\r\nexport const classNameSizeObserverListener = `${classNameSizeObserver}-listener`;\r\nexport const classNameSizeObserverListenerScroll = `${classNameSizeObserverListener}-scroll`;\r\nexport const classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;\r\nexport const classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;\r\n\r\n// trinsic observer\r\nexport const classNameTrinsicObserver = 'os-trinsic-observer';\r\n\r\n// scrollbars\r\nexport const classNameScrollbarThemeNone = 'os-theme-none';\r\nexport const classNameScrollbar = 'os-scrollbar';\r\nexport const classNameScrollbarRtl = `${classNameScrollbar}-rtl`;\r\nexport const classNameScrollbarHorizontal = `${classNameScrollbar}-horizontal`;\r\nexport const classNameScrollbarVertical = `${classNameScrollbar}-vertical`;\r\nexport const classNameScrollbarTrack = `${classNameScrollbar}-track`;\r\nexport const classNameScrollbarHandle = `${classNameScrollbar}-handle`;\r\nexport const classNameScrollbarVisible = `${classNameScrollbar}-visible`;\r\nexport const classNameScrollbarCornerless = `${classNameScrollbar}-cornerless`;\r\nexport const classNameScrollbarTransitionless = `${classNameScrollbar}-transitionless`;\r\nexport const classNameScrollbarInteraction = `${classNameScrollbar}-interaction`;\r\nexport const classNameScrollbarUnusable = `${classNameScrollbar}-unusable`;\r\nexport const classNameScrollbarAutoHide = `${classNameScrollbar}-auto-hide`;\r\nexport const classNameScrollbarAutoHideHidden = `${classNameScrollbarAutoHide}-hidden`;\r\nexport const classNameScrollbarWheel = `${classNameScrollbar}-wheel`;\r\nexport const classNameScrollbarTrackInteractive = `${classNameScrollbarTrack}-interactive`;\r\nexport const classNameScrollbarHandleInteractive = `${classNameScrollbarHandle}-interactive`;\r\n","import { each, keys } from '~/support';\r\nimport type { OverlayScrollbars, OverlayScrollbarsStatic } from '~/overlayscrollbars';\r\nimport type { EventListener, EventListenerArgs, EventListeners } from '..';\r\n\r\nexport type PluginModuleInstance = Record;\r\n\r\nexport type InstancePluginEvent = {\r\n /**\r\n * Adds event listeners to the instance.\r\n * @param eventListeners An object which contains the added listeners.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n (eventListeners: EventListeners): () => void;\r\n /**\r\n * Adds a single event listener to the instance.\r\n * @param name The name of the event.\r\n * @param listener The listener which is invoked on that event.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n (name: N, listener: EventListener): () => void;\r\n /**\r\n * Adds multiple event listeners to the instance.\r\n * @param name The name of the event.\r\n * @param listener The listeners which are invoked on that event.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n (name: N, listener: EventListener[]): () => void;\r\n};\r\n\r\n/**\r\n * Describes a OverlayScrollbars plugin module.\r\n * Plugin modules must be side-effect free and deterministic. (same input produces same output)\r\n */\r\nexport type PluginModule<\r\n S extends PluginModuleInstance | void = PluginModuleInstance | void,\r\n I extends PluginModuleInstance | void = PluginModuleInstance | void\r\n> = (S extends PluginModuleInstance\r\n ? {\r\n /**\r\n * Creates a plugin which is bound to the static object.\r\n * The function will be called once with the static object as soon as the plugin is registered.\r\n * The plugin can add new methods or fields to the passed static object.\r\n * @param osStatic The static object the plugin is bound to.\r\n * @returns The plugins instance object or a falsy value if the plugin doesn't need any instance object.\r\n */\r\n static: (osStatic: OverlayScrollbarsStatic) => S | void;\r\n }\r\n : object) &\r\n (I extends PluginModuleInstance\r\n ? {\r\n /**\r\n * Creates a A plugin which is bound to an instance.\r\n * The function will be called each time a new instance is created.\r\n * The plugin can add new methods or fields to the passed instance object.\r\n * @param osInstance The instance object the plugin is bound to.\r\n * @param event A function which adds events to the instance which can't be removed from outside the plugin. (instance events added with the `on` function can be removed with the optional `pure` parameter)\r\n * @param osStatic The static object the plugin is bound to.\r\n * @returns The plugins instance object or a falsy value if the plugin doesn't need any instance object.\r\n */\r\n instance: (\r\n osInstance: OverlayScrollbars,\r\n event: InstancePluginEvent,\r\n osStatic: OverlayScrollbarsStatic\r\n ) => I | void;\r\n }\r\n : object);\r\n\r\n/**\r\n * Describes a OverlayScrollbar plugin.\r\n */\r\nexport type Plugin<\r\n Name extends string = string,\r\n S extends PluginModuleInstance | void = PluginModuleInstance | void,\r\n I extends PluginModuleInstance | void = PluginModuleInstance | void\r\n> = {\r\n /** The field is the plugins name. Plugin names must be globally unique, please choose wisely. */\r\n [pluginName in Name]: PluginModule;\r\n};\r\n\r\n/**\r\n * Describes a OverlayScrollbar plugin which has only a static module.\r\n */\r\nexport type StaticPlugin<\r\n Name extends string = string,\r\n T extends PluginModuleInstance = PluginModuleInstance\r\n> = Plugin;\r\n\r\n/**\r\n * Describes a OverlayScrollbar plugin which has only a instance module.\r\n */\r\nexport type InstancePlugin<\r\n Name extends string = string,\r\n T extends PluginModuleInstance = PluginModuleInstance\r\n> = Plugin;\r\n\r\n/**\r\n * Infers the type of the static modules instance of the passed plugin.\r\n */\r\nexport type InferStaticPluginModuleInstance = T extends StaticPlugin<\r\n infer Name\r\n>\r\n ? T[Name]['static'] extends (...args: any[]) => any\r\n ? ReturnType\r\n : void\r\n : void;\r\n\r\n/**\r\n * Infers the type of the instance modules instance of the passed plugin.\r\n */\r\nexport type InferInstancePluginModuleInstance = T extends InstancePlugin<\r\n infer Name\r\n>\r\n ? T[Name]['instance'] extends (...args: any[]) => any\r\n ? ReturnType\r\n : void\r\n : void;\r\n\r\n/** All registered plugin modules. */\r\nexport const pluginModules: Record = {};\r\n\r\n/** All static plugin module instances. */\r\nexport const staticPluginModuleInstances: Record = {};\r\n\r\n/**\r\n * Adds plugins.\r\n * @param addedPlugin The plugin(s) to add.\r\n * @returns The added plugin modules of the registered plugins.\r\n */\r\nexport const addPlugins = (addedPlugin: Plugin[]) => {\r\n each(addedPlugin, (plugin) =>\r\n each(plugin, (_, key) => {\r\n pluginModules[key] = plugin[key];\r\n })\r\n );\r\n};\r\n\r\nexport const registerPluginModuleInstances = (\r\n plugin: Plugin,\r\n staticObj: OverlayScrollbarsStatic,\r\n instanceInfo?: [\r\n instanceObj: OverlayScrollbars,\r\n event: InstancePluginEvent,\r\n instancePluginMap?: Record\r\n ]\r\n): Array =>\r\n keys(plugin).map((name) => {\r\n const { static: osStatic, instance: osInstance } = (\r\n plugin as Plugin\r\n )[name];\r\n const [instanceObj, event, instancePluginMap] = instanceInfo || [];\r\n const ctor = instanceInfo ? osInstance : osStatic;\r\n if (ctor) {\r\n const instance = instanceInfo\r\n ? (\r\n ctor as Extract<\r\n typeof ctor,\r\n (\r\n osInstance: OverlayScrollbars,\r\n event: InstancePluginEvent,\r\n osStatic: OverlayScrollbarsStatic\r\n ) => PluginModuleInstance | void\r\n >\r\n )(instanceObj!, event!, staticObj)\r\n : (\r\n ctor as Extract<\r\n typeof ctor,\r\n (osStatic: OverlayScrollbarsStatic) => PluginModuleInstance | void\r\n >\r\n )(staticObj);\r\n return ((instancePluginMap || staticPluginModuleInstances)[name] = instance);\r\n }\r\n });\r\n\r\nexport const getStaticPluginModuleInstance = (\r\n pluginModuleName: T extends StaticPlugin ? N : never\r\n): InferStaticPluginModuleInstance | undefined =>\r\n staticPluginModuleInstances[pluginModuleName] as InferStaticPluginModuleInstance | undefined;\r\n","function _extends() {\n module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _extends.apply(this, arguments);\n}\nmodule.exports = _extends, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","import {\r\n each,\r\n hasOwnProperty,\r\n keys,\r\n push,\r\n isEmptyObject,\r\n type,\r\n isUndefined,\r\n isPlainObject,\r\n isString,\r\n createOrKeepArray,\r\n} from '~/support';\r\nimport type { PlainObject, DeepPartial } from '~/typings';\r\nimport type { OptionsObject } from '~/options';\r\n\r\nexport type OptionsFunctionType = (this: any, ...args: any[]) => any;\r\nexport type OptionsTemplateType = ExtractPropsKey<\r\n OptionsTemplateTypeMap,\r\n T\r\n>;\r\nexport type OptionsTemplateTypes = keyof OptionsTemplateTypeMap;\r\nexport type OptionsTemplateNativeTypes = OptionsTemplateTypeMap[keyof OptionsTemplateTypeMap];\r\n\r\nexport type OptionsTemplateValue = T extends string\r\n ? string extends T\r\n ? OptionsTemplateValueNonEnum\r\n : string\r\n : OptionsTemplateValueNonEnum;\r\n\r\nexport type OptionsTemplate = {\r\n [P in keyof T]: T[P] extends OptionsObject\r\n ? OptionsTemplate\r\n : T[P] extends OptionsTemplateNativeTypes\r\n ? OptionsTemplateValue\r\n : never;\r\n};\r\n\r\nexport type OptionsValidationResult = [\r\n validated: DeepPartial,\r\n foreign: Record\r\n];\r\n\r\ntype OptionsTemplateTypeMap = {\r\n __TPL_boolean_TYPE__: boolean;\r\n __TPL_number_TYPE__: number;\r\n __TPL_string_TYPE__: string;\r\n __TPL_array_TYPE__: Array | ReadonlyArray;\r\n __TPL_function_TYPE__: OptionsFunctionType;\r\n __TPL_null_TYPE__: null;\r\n __TPL_object_TYPE__: OptionsObject;\r\n};\r\n\r\ntype OptionsTemplateValueNonEnum =\r\n | OptionsTemplateType\r\n | [OptionsTemplateType, ...Array];\r\n\r\ntype ExtractPropsKey = {\r\n [P in keyof T]: TProps extends T[P] ? P : never;\r\n}[keyof T];\r\n\r\ntype OptionsTemplateTypesDictionary = {\r\n readonly boolean: OptionsTemplateType;\r\n readonly number: OptionsTemplateType;\r\n readonly string: OptionsTemplateType;\r\n readonly array: OptionsTemplateType>;\r\n readonly object: OptionsTemplateType;\r\n readonly function: OptionsTemplateType;\r\n readonly null: OptionsTemplateType;\r\n};\r\n\r\nconst optionsTemplateTypes: OptionsTemplateTypesDictionary = {\r\n boolean: '__TPL_boolean_TYPE__',\r\n number: '__TPL_number_TYPE__',\r\n string: '__TPL_string_TYPE__',\r\n array: '__TPL_array_TYPE__',\r\n object: '__TPL_object_TYPE__',\r\n function: '__TPL_function_TYPE__',\r\n null: '__TPL_null_TYPE__',\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param template The template according to which the options object shall be validated.\r\n * @param options The options object which shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n * @param propPath The propertyPath which lead to this object. (used for error logging)\r\n */\r\nconst validateRecursive = (\r\n template: OptionsTemplate,\r\n options: DeepPartial,\r\n doWriteErrors?: boolean,\r\n propPath?: string\r\n): OptionsValidationResult => {\r\n const validatedOptions: DeepPartial = {};\r\n const optionsCopy: DeepPartial = { ...options };\r\n const props = keys(template).filter((prop) => hasOwnProperty(options, prop));\r\n\r\n each(props, (prop: Extract) => {\r\n const optionsValue: any = options[prop];\r\n const templateValue: PlainObject | string | OptionsTemplateTypes | Array =\r\n template[prop];\r\n const templateIsComplex = isPlainObject(templateValue);\r\n const propPrefix = propPath ? `${propPath}.` : '';\r\n\r\n // if the template has a object as value, it means that the options are complex (verschachtelt)\r\n if (templateIsComplex && isPlainObject(optionsValue)) {\r\n const [validated, foreign] = validateRecursive(\r\n templateValue as T,\r\n optionsValue,\r\n doWriteErrors,\r\n propPrefix + prop\r\n );\r\n validatedOptions[prop] = validated as any;\r\n optionsCopy[prop] = foreign as any;\r\n\r\n each([optionsCopy, validatedOptions], (value) => {\r\n if (isEmptyObject(value[prop])) {\r\n delete value[prop];\r\n }\r\n });\r\n } else if (!templateIsComplex) {\r\n let isValid = false;\r\n const errorEnumStrings: Array = [];\r\n const errorPossibleTypes: Array = [];\r\n const optionsValueType = type(optionsValue) as keyof typeof optionsTemplateTypes;\r\n const templateValueArr: Array =\r\n createOrKeepArray(templateValue);\r\n\r\n each(templateValueArr, (currTemplateType) => {\r\n // if currType value isn't inside possibleTemplateTypes we assume its a enum string value\r\n let typeString: string | undefined;\r\n each(optionsTemplateTypes, (value: string, key: string) => {\r\n if (value === currTemplateType) {\r\n typeString = key;\r\n }\r\n });\r\n const isEnumString = isUndefined(typeString);\r\n if (isEnumString && isString(optionsValue)) {\r\n // split it into a array which contains all possible values for example: [\"yes\", \"no\", \"maybe\"]\r\n const enumStringSplit = currTemplateType.split(' ');\r\n isValid = !!enumStringSplit.find((possibility) => possibility === optionsValue);\r\n\r\n // build error message\r\n push(errorEnumStrings, enumStringSplit);\r\n } else {\r\n isValid = optionsTemplateTypes[optionsValueType] === currTemplateType;\r\n }\r\n\r\n // build error message\r\n push(errorPossibleTypes, isEnumString ? optionsTemplateTypes.string : typeString!);\r\n\r\n // continue if invalid, break if valid\r\n return !isValid;\r\n });\r\n\r\n if (isValid) {\r\n validatedOptions[prop] = optionsValue;\r\n } else if (doWriteErrors) {\r\n console.warn(\r\n `${\r\n `The option \"${propPrefix}${prop}\" wasn't set, because it doesn't accept the type [ ${optionsValueType.toUpperCase()} ] with the value of \"${optionsValue}\".\\r\\n` +\r\n `Accepted types are: [ ${errorPossibleTypes.join(', ').toUpperCase()} ].\\r\\n`\r\n }${\r\n errorEnumStrings.length > 0\r\n ? `\\r\\nValid strings are: [ ${errorEnumStrings.join(', ')} ].`\r\n : ''\r\n }`\r\n );\r\n }\r\n\r\n delete optionsCopy[prop];\r\n }\r\n });\r\n\r\n return [validatedOptions, optionsCopy]; // optionsCopy equals now to foreign options\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a tuple which looks like:\r\n * [\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * ]\r\n * @param template The template according to which the options object shall be validated.\r\n * @param options The options object which shall be validated.\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n */\r\nconst validateOptions = (\r\n template: OptionsTemplate,\r\n options: DeepPartial,\r\n doWriteErrors?: boolean\r\n): OptionsValidationResult => validateRecursive(template, options, doWriteErrors);\r\n\r\nexport { validateOptions, optionsTemplateTypes };\r\n","import type {\r\n Options,\r\n PartialOptions,\r\n OverflowBehavior,\r\n ScrollbarsVisibilityBehavior,\r\n ScrollbarsAutoHideBehavior,\r\n} from '~/options';\r\nimport type { OptionsTemplate, OptionsTemplateValue } from './validation';\r\nimport type { StaticPlugin } from '~/plugins';\r\nimport { validateOptions, optionsTemplateTypes as oTypes } from './validation';\r\n\r\nexport const optionsValidationPluginModuleName = '__osOptionsValidationPlugin';\r\n\r\nexport const OptionsValidationPlugin = /* @__PURE__ */ (() => ({\r\n [optionsValidationPluginModuleName]: {\r\n static: () => {\r\n const numberAllowedValues: OptionsTemplateValue = oTypes.number;\r\n const booleanAllowedValues: OptionsTemplateValue = oTypes.boolean;\r\n const arrayNullValues: OptionsTemplateValue | null> = [\r\n oTypes.array,\r\n oTypes.null,\r\n ];\r\n const overflowAllowedValues: OptionsTemplateValue =\r\n 'hidden scroll visible visible-hidden';\r\n const scrollbarsVisibilityAllowedValues: OptionsTemplateValue =\r\n 'visible hidden auto';\r\n const scrollbarsAutoHideAllowedValues: OptionsTemplateValue =\r\n 'never scroll leavemove';\r\n\r\n const optionsTemplate: OptionsTemplate = {\r\n // resize: resizeAllowedValues, // none || both || horizontal || vertical || n || b ||\r\n paddingAbsolute: booleanAllowedValues, // true || false\r\n showNativeOverlaidScrollbars: booleanAllowedValues, // true || false\r\n update: {\r\n elementEvents: arrayNullValues, // array of tuples || null\r\n attributes: arrayNullValues,\r\n debounce: [oTypes.number, oTypes.array, oTypes.null], // number || number array || null\r\n ignoreMutation: [oTypes.function, oTypes.null], // function || null\r\n },\r\n overflow: {\r\n x: overflowAllowedValues, // visible-hidden || visible-scroll || hidden || scrol\r\n y: overflowAllowedValues, // visible-hidden || visible-scroll || hidden || scrol\r\n },\r\n scrollbars: {\r\n theme: [oTypes.string, oTypes.null], // string || null\r\n visibility: scrollbarsVisibilityAllowedValues, // visible || hidden || auto || v ||\r\n autoHide: scrollbarsAutoHideAllowedValues, // never || scroll || leave || move ||\r\n autoHideDelay: numberAllowedValues, // number\r\n autoHideSuspend: booleanAllowedValues, // true || false\r\n dragScroll: booleanAllowedValues, // true || false\r\n clickScroll: booleanAllowedValues, // true || false\r\n pointers: [oTypes.array, oTypes.null], // string array\r\n },\r\n /*\r\n textarea: {\r\n dynWidth: booleanAllowedValues, // true || false\r\n dynHeight: booleanAllowedValues, // true || false\r\n inheritedAttrs: stringArrayNullAllowedValues, // string || array || nul\r\n },\r\n */\r\n };\r\n return (options: PartialOptions, doWriteErrors?: boolean): PartialOptions => {\r\n const [validated, foreign] = validateOptions(optionsTemplate, options, doWriteErrors);\r\n return { ...foreign, ...validated };\r\n };\r\n },\r\n },\r\n}))() satisfies StaticPlugin;\r\n","import {\r\n createDOM,\r\n appendChildren,\r\n offsetSize,\r\n addEventListener,\r\n addClass,\r\n equalWH,\r\n cAF,\r\n rAF,\r\n stopPropagation,\r\n bind,\r\n scrollElementTo,\r\n strWidth,\r\n strHeight,\r\n setStyles,\r\n} from '~/support';\r\nimport {\r\n classNameSizeObserverListenerScroll,\r\n classNameSizeObserverListenerItem,\r\n classNameSizeObserverListenerItemFinal,\r\n} from '~/classnames';\r\nimport type { StaticPlugin } from '../plugins';\r\n\r\nexport const sizeObserverPluginName = '__osSizeObserverPlugin';\r\n\r\nexport const SizeObserverPlugin = /* @__PURE__ */ (() => ({\r\n [sizeObserverPluginName]: {\r\n static:\r\n () =>\r\n (\r\n listenerElement: HTMLElement,\r\n onSizeChangedCallback: (appear: boolean) => any,\r\n observeAppearChange: boolean | null | undefined\r\n ): [appearCallback: () => void, offFns: (() => any)[]] => {\r\n const scrollAmount = 3333333;\r\n const scrollEventName = 'scroll';\r\n const observerElementChildren = createDOM(\r\n `

`\r\n );\r\n const observerElementChildrenRoot = observerElementChildren[0] as HTMLElement;\r\n const shrinkElement = observerElementChildrenRoot.lastChild as HTMLElement;\r\n const expandElement = observerElementChildrenRoot.firstChild as HTMLElement;\r\n const expandElementChild = expandElement?.firstChild as HTMLElement;\r\n\r\n let cacheSize = offsetSize(observerElementChildrenRoot);\r\n let currSize = cacheSize;\r\n let isDirty = false;\r\n let rAFId: number;\r\n\r\n const reset = () => {\r\n scrollElementTo(expandElement, scrollAmount);\r\n scrollElementTo(shrinkElement, scrollAmount);\r\n };\r\n const onResized = (appear?: unknown) => {\r\n rAFId = 0;\r\n if (isDirty) {\r\n cacheSize = currSize;\r\n onSizeChangedCallback(appear === true);\r\n }\r\n };\r\n const onScroll = (scrollEvent?: Event | false) => {\r\n currSize = offsetSize(observerElementChildrenRoot);\r\n isDirty = !scrollEvent || !equalWH(currSize, cacheSize);\r\n\r\n if (scrollEvent) {\r\n stopPropagation(scrollEvent);\r\n\r\n if (isDirty && !rAFId) {\r\n cAF!(rAFId);\r\n rAFId = rAF!(onResized);\r\n }\r\n } else {\r\n onResized(scrollEvent === false);\r\n }\r\n\r\n reset();\r\n };\r\n const destroyFns = [\r\n appendChildren(listenerElement, observerElementChildren),\r\n addEventListener(expandElement, scrollEventName, onScroll),\r\n addEventListener(shrinkElement, scrollEventName, onScroll),\r\n ];\r\n\r\n addClass(listenerElement, classNameSizeObserverListenerScroll);\r\n\r\n // lets assume that the divs will never be that large and a constant value is enough\r\n setStyles(expandElementChild, {\r\n [strWidth]: scrollAmount,\r\n [strHeight]: scrollAmount,\r\n });\r\n\r\n rAF!(reset);\r\n\r\n return [observeAppearChange ? bind(onScroll, false) : reset, destroyFns];\r\n },\r\n },\r\n}))() satisfies StaticPlugin;\r\n","import { getStyles, strOverflowX, strOverflowY, strVisible } from '~/support';\r\nimport type { Env } from '~/environment';\r\nimport type { XY } from '~/support';\r\nimport type { Options, OptionsCheckFn, OverflowBehavior } from '~/options';\r\nimport type { OverflowStyle, StyleObject, StyleObjectKey } from '~/typings';\r\nimport type { StructureSetupElementsObj } from './structureSetup.elements';\r\n\r\nexport interface ViewportOverflowState {\r\n _overflowScroll: XY;\r\n _overflowStyle: XY;\r\n}\r\n\r\nexport const getShowNativeOverlaidScrollbars = (checkOption: OptionsCheckFn, env: Env) => {\r\n const { _nativeScrollbarsOverlaid } = env;\r\n const [showNativeOverlaidScrollbarsOption, showNativeOverlaidScrollbarsChanged] = checkOption(\r\n 'showNativeOverlaidScrollbars'\r\n );\r\n\r\n return [\r\n showNativeOverlaidScrollbarsOption &&\r\n _nativeScrollbarsOverlaid.x &&\r\n _nativeScrollbarsOverlaid.y,\r\n showNativeOverlaidScrollbarsChanged,\r\n ] as const;\r\n};\r\n\r\nexport const overflowIsVisible = (overflowBehavior: string) =>\r\n overflowBehavior.indexOf(strVisible) === 0;\r\n\r\n/**\r\n * Gets the current overflow state of the viewport.\r\n * @param showNativeOverlaidScrollbars Whether native overlaid scrollbars are shown instead of hidden.\r\n * @param viewportStyleObj The viewport style object where the overflow scroll property can be read of, or undefined if shall be determined.\r\n * @returns A object which contains informations about the current overflow state.\r\n */\r\nexport const getViewportOverflowState = (\r\n structureSetupElements: StructureSetupElementsObj,\r\n viewportStyleObj?: StyleObject\r\n): ViewportOverflowState => {\r\n const { _viewport } = structureSetupElements;\r\n const getStatePerAxis = (styleKey: StyleObjectKey) => {\r\n const overflowStyle = getStyles(_viewport, styleKey);\r\n // can't do something like \"viewportStyleObj && viewportStyleObj[styleKey] || overflowStyle\" here!\r\n const objectPrefferedOverflowStyle = viewportStyleObj\r\n ? viewportStyleObj[styleKey]\r\n : overflowStyle;\r\n const overflowScroll = objectPrefferedOverflowStyle === 'scroll';\r\n\r\n return [overflowStyle, overflowScroll] as [\r\n overflowStyle: OverflowStyle,\r\n overflowScroll: boolean\r\n ];\r\n };\r\n\r\n const [xOverflowStyle, xOverflowScroll] = getStatePerAxis(strOverflowX);\r\n const [yOverflowStyle, yOverflowScroll] = getStatePerAxis(strOverflowY);\r\n\r\n return {\r\n _overflowStyle: {\r\n x: xOverflowStyle,\r\n y: yOverflowStyle,\r\n },\r\n _overflowScroll: {\r\n x: xOverflowScroll,\r\n y: yOverflowScroll,\r\n },\r\n };\r\n};\r\n\r\n/**\r\n * Sets the overflow property of the viewport and calculates the a overflow state according to the new parameters.\r\n * @param showNativeOverlaidScrollbars Whether to show natively overlaid scrollbars.\r\n * @param overflowAmount The overflow amount.\r\n * @param overflow The overflow behavior according to the options.\r\n * @param viewportStyleObj The viewport style object to which the overflow style shall be applied.\r\n * @returns A object which represents the newly set overflow state.\r\n */\r\nexport const setViewportOverflowState = (\r\n structureSetupElements: StructureSetupElementsObj,\r\n hasOverflow: XY,\r\n overflowOption: XY,\r\n viewportStyleObj: StyleObject\r\n): ViewportOverflowState => {\r\n const hasAnyOverflow = hasOverflow.x || hasOverflow.y;\r\n\r\n const setAxisOverflowStyle = (behavior: OverflowBehavior, hasOverflowAxis: boolean) => {\r\n const overflowVisible = overflowIsVisible(behavior);\r\n const fallbackVisibilityBehavior = overflowVisible && hasAnyOverflow ? 'hidden' : '';\r\n const overflowVisibleBehavior =\r\n (hasOverflowAxis && overflowVisible && behavior.replace(`${strVisible}-`, '')) ||\r\n fallbackVisibilityBehavior;\r\n\r\n return [\r\n hasOverflowAxis && !overflowVisible ? behavior : '',\r\n overflowIsVisible(overflowVisibleBehavior) ? 'hidden' : overflowVisibleBehavior,\r\n ];\r\n };\r\n\r\n const [overflowX, visibleBehaviorX] = setAxisOverflowStyle(overflowOption.x, hasOverflow.x);\r\n const [overflowY, visibleBehaviorY] = setAxisOverflowStyle(overflowOption.y, hasOverflow.y);\r\n\r\n viewportStyleObj[strOverflowX] = visibleBehaviorX && overflowY ? visibleBehaviorX : overflowX;\r\n viewportStyleObj[strOverflowY] = visibleBehaviorY && overflowX ? visibleBehaviorY : overflowY;\r\n\r\n return getViewportOverflowState(structureSetupElements, viewportStyleObj);\r\n};\r\n","import {\r\n keys,\r\n noop,\r\n each,\r\n assignDeep,\r\n windowSize,\r\n wnd,\r\n mathAbs,\r\n mathRound,\r\n strMarginBottom,\r\n strMarginLeft,\r\n strMarginRight,\r\n strPaddingBottom,\r\n strPaddingLeft,\r\n strPaddingRight,\r\n strPaddingTop,\r\n getStyles,\r\n setStyles,\r\n addAttrClass,\r\n removeAttrClass,\r\n strWidth,\r\n} from '~/support';\r\nimport { dataValueViewportArrange, dataAttributeViewport } from '~/classnames';\r\nimport {\r\n getShowNativeOverlaidScrollbars,\r\n getViewportOverflowState,\r\n} from '~/setups/structureSetup/structureSetup.utils';\r\nimport type { ObserversSetupState } from '~/setups';\r\nimport type { Options, OptionsCheckFn } from '~/options';\r\nimport type { StructureSetupElementsObj } from '~/setups/structureSetup/structureSetup.elements';\r\nimport type { ViewportOverflowState } from '~/setups/structureSetup/structureSetup.utils';\r\nimport type { Env } from '~/environment';\r\nimport type { UpdateCache, WH, XY } from '~/support';\r\nimport type { StyleObject, StyleObjectKey } from '~/typings';\r\nimport type { StructureSetupState } from '~/setups/structureSetup';\r\nimport type { StaticPlugin } from '~/plugins';\r\n\r\nexport const scrollbarsHidingPluginName = '__osScrollbarsHidingPlugin';\r\n\r\nexport const ScrollbarsHidingPlugin = /* @__PURE__ */ (() => ({\r\n [scrollbarsHidingPluginName]: {\r\n static: () => ({\r\n _viewportArrangement: (\r\n structureSetupElements: StructureSetupElementsObj,\r\n structureSetupState: StructureSetupState,\r\n observersSetupState: ObserversSetupState,\r\n env: Env,\r\n checkOptions: OptionsCheckFn\r\n ) => {\r\n const { _viewportIsTarget, _viewport } = structureSetupElements;\r\n const { _nativeScrollbarsHiding, _nativeScrollbarsOverlaid, _nativeScrollbarsSize } = env;\r\n const doViewportArrange =\r\n !_viewportIsTarget &&\r\n !_nativeScrollbarsHiding &&\r\n (_nativeScrollbarsOverlaid.x || _nativeScrollbarsOverlaid.y);\r\n const [showNativeOverlaidScrollbars] = getShowNativeOverlaidScrollbars(checkOptions, env);\r\n\r\n const _getViewportOverflowHideOffset = (viewportOverflowState: ViewportOverflowState) => {\r\n const { _overflowScroll } = viewportOverflowState;\r\n const arrangeHideOffset =\r\n _nativeScrollbarsHiding || showNativeOverlaidScrollbars ? 0 : 42;\r\n\r\n const getHideOffsetPerAxis = (\r\n isOverlaid: boolean,\r\n overflowScroll: boolean,\r\n nativeScrollbarSize: number\r\n ) => {\r\n const nonScrollbarStylingHideOffset = isOverlaid\r\n ? arrangeHideOffset\r\n : nativeScrollbarSize;\r\n const scrollbarsHideOffset =\r\n overflowScroll && !_nativeScrollbarsHiding ? nonScrollbarStylingHideOffset : 0;\r\n const scrollbarsHideOffsetArrange = isOverlaid && !!arrangeHideOffset;\r\n\r\n return [scrollbarsHideOffset, scrollbarsHideOffsetArrange] as const;\r\n };\r\n\r\n const [xScrollbarsHideOffset, xScrollbarsHideOffsetArrange] = getHideOffsetPerAxis(\r\n _nativeScrollbarsOverlaid.x,\r\n _overflowScroll.x,\r\n _nativeScrollbarsSize.x\r\n );\r\n const [yScrollbarsHideOffset, yScrollbarsHideOffsetArrange] = getHideOffsetPerAxis(\r\n _nativeScrollbarsOverlaid.y,\r\n _overflowScroll.y,\r\n _nativeScrollbarsSize.y\r\n );\r\n\r\n return {\r\n _scrollbarsHideOffset: {\r\n x: xScrollbarsHideOffset,\r\n y: yScrollbarsHideOffset,\r\n },\r\n _scrollbarsHideOffsetArrange: {\r\n x: xScrollbarsHideOffsetArrange,\r\n y: yScrollbarsHideOffsetArrange,\r\n },\r\n };\r\n };\r\n\r\n /**\r\n * Hides the native scrollbars according to the passed parameters.\r\n * @param viewportOverflowState The viewport overflow state.\r\n * @param directionIsRTL Whether the direction is RTL or not.\r\n * @param viewportArrange Whether special styles related to the viewport arrange strategy shall be applied.\r\n * @param viewportStyleObj The viewport style object to which the needed styles shall be applied.\r\n */\r\n const _hideNativeScrollbars = (\r\n viewportOverflowState: ViewportOverflowState,\r\n { _directionIsRTL }: ObserversSetupState,\r\n viewportArrange: boolean,\r\n viewportStyleObj: StyleObject\r\n ): void => {\r\n assignDeep(viewportStyleObj, {\r\n [strMarginRight]: 0,\r\n [strMarginBottom]: 0,\r\n [strMarginLeft]: 0,\r\n });\r\n if (!_viewportIsTarget) {\r\n const { _scrollbarsHideOffset, _scrollbarsHideOffsetArrange } =\r\n _getViewportOverflowHideOffset(viewportOverflowState);\r\n const { x: arrangeX, y: arrangeY } = _scrollbarsHideOffsetArrange;\r\n const { x: hideOffsetX, y: hideOffsetY } = _scrollbarsHideOffset;\r\n const { _viewportPaddingStyle } = structureSetupState;\r\n const horizontalMarginKey: keyof StyleObject = _directionIsRTL\r\n ? strMarginLeft\r\n : strMarginRight;\r\n const viewportHorizontalPaddingKey: keyof StyleObject = _directionIsRTL\r\n ? strPaddingLeft\r\n : strPaddingRight;\r\n const horizontalMarginValue = _viewportPaddingStyle[horizontalMarginKey] as number;\r\n const verticalMarginValue = _viewportPaddingStyle[strMarginBottom] as number;\r\n const horizontalPaddingValue = _viewportPaddingStyle[\r\n viewportHorizontalPaddingKey\r\n ] as number;\r\n const verticalPaddingValue = _viewportPaddingStyle[strPaddingBottom] as number;\r\n\r\n // horizontal\r\n viewportStyleObj[strWidth] = `calc(100% + ${\r\n hideOffsetY + horizontalMarginValue * -1\r\n }px)`;\r\n viewportStyleObj[horizontalMarginKey] = -hideOffsetY + horizontalMarginValue;\r\n\r\n // vertical\r\n viewportStyleObj[strMarginBottom] = -hideOffsetX + verticalMarginValue;\r\n\r\n // viewport arrange additional styles\r\n if (viewportArrange) {\r\n viewportStyleObj[viewportHorizontalPaddingKey] =\r\n horizontalPaddingValue + (arrangeY ? hideOffsetY : 0);\r\n viewportStyleObj[strPaddingBottom] =\r\n verticalPaddingValue + (arrangeX ? hideOffsetX : 0);\r\n }\r\n }\r\n };\r\n\r\n /**\r\n * Sets the styles of the viewport arrange element.\r\n * @param viewportOverflowState The viewport overflow state according to which the scrollbars shall be hidden.\r\n * @param viewportScrollSize The content scroll size.\r\n * @param directionIsRTL Whether the direction is RTL or not.\r\n * @returns A boolean which indicates whether the viewport arrange element was adjusted.\r\n */\r\n const _arrangeViewport = (\r\n viewportOverflowState: ViewportOverflowState,\r\n viewportScrollSize: WH,\r\n sizeFraction: WH\r\n ) => {\r\n if (doViewportArrange) {\r\n const { _viewportPaddingStyle } = structureSetupState;\r\n const { _scrollbarsHideOffset, _scrollbarsHideOffsetArrange } =\r\n _getViewportOverflowHideOffset(viewportOverflowState);\r\n const { x: arrangeX, y: arrangeY } = _scrollbarsHideOffsetArrange;\r\n const { x: hideOffsetX, y: hideOffsetY } = _scrollbarsHideOffset;\r\n const { _directionIsRTL } = observersSetupState;\r\n const viewportArrangeHorizontalPaddingKey: keyof StyleObject = _directionIsRTL\r\n ? strPaddingRight\r\n : strPaddingLeft;\r\n const viewportArrangeHorizontalPaddingValue = _viewportPaddingStyle[\r\n viewportArrangeHorizontalPaddingKey\r\n ] as number;\r\n const viewportArrangeVerticalPaddingValue = _viewportPaddingStyle.paddingTop as number;\r\n const fractionalContentWidth = viewportScrollSize.w + sizeFraction.w;\r\n const fractionalContenHeight = viewportScrollSize.h + sizeFraction.h;\r\n const arrangeSize = {\r\n w:\r\n hideOffsetY && arrangeY\r\n ? `${\r\n hideOffsetY + fractionalContentWidth - viewportArrangeHorizontalPaddingValue\r\n }px`\r\n : '',\r\n h:\r\n hideOffsetX && arrangeX\r\n ? `${\r\n hideOffsetX + fractionalContenHeight - viewportArrangeVerticalPaddingValue\r\n }px`\r\n : '',\r\n };\r\n\r\n setStyles(_viewport, {\r\n '--os-vaw': arrangeSize.w,\r\n '--os-vah': arrangeSize.h,\r\n });\r\n }\r\n\r\n return doViewportArrange;\r\n };\r\n\r\n /**\r\n * Removes all styles applied because of the viewport arrange strategy.\r\n * @param showNativeOverlaidScrollbars Whether native overlaid scrollbars are shown instead of hidden.\r\n * @param directionIsRTL Whether the direction is RTL or not.\r\n * @param viewportOverflowState The currentviewport overflow state or undefined if it has to be determined.\r\n * @returns A object with a function which applies all the removed styles and the determined viewport vverflow state.\r\n */\r\n const _undoViewportArrange = (viewportOverflowState?: ViewportOverflowState) => {\r\n if (doViewportArrange) {\r\n const finalViewportOverflowState =\r\n viewportOverflowState || getViewportOverflowState(structureSetupElements);\r\n const { _viewportPaddingStyle: viewportPaddingStyle } = structureSetupState;\r\n const { _scrollbarsHideOffsetArrange } = _getViewportOverflowHideOffset(\r\n finalViewportOverflowState\r\n );\r\n const { x: arrangeX, y: arrangeY } = _scrollbarsHideOffsetArrange;\r\n const finalPaddingStyle: StyleObject = {};\r\n const assignProps = (props: string[]) =>\r\n each(props, (prop) => {\r\n finalPaddingStyle[prop as StyleObjectKey] =\r\n viewportPaddingStyle[prop as StyleObjectKey];\r\n });\r\n\r\n if (arrangeX) {\r\n assignProps([strMarginBottom, strPaddingTop, strPaddingBottom]);\r\n }\r\n\r\n if (arrangeY) {\r\n assignProps([strMarginLeft, strMarginRight, strPaddingLeft, strPaddingRight]);\r\n }\r\n\r\n const prevStyle = getStyles(_viewport, keys(finalPaddingStyle) as StyleObjectKey[]);\r\n removeAttrClass(_viewport, dataAttributeViewport, dataValueViewportArrange);\r\n\r\n setStyles(_viewport, finalPaddingStyle);\r\n\r\n return [\r\n () => {\r\n _hideNativeScrollbars(\r\n finalViewportOverflowState,\r\n observersSetupState,\r\n doViewportArrange,\r\n prevStyle\r\n );\r\n setStyles(_viewport, prevStyle);\r\n addAttrClass(_viewport, dataAttributeViewport, dataValueViewportArrange);\r\n },\r\n finalViewportOverflowState,\r\n ] as const;\r\n }\r\n return [noop] as const;\r\n };\r\n\r\n return {\r\n _getViewportOverflowHideOffset,\r\n _arrangeViewport,\r\n _undoViewportArrange,\r\n _hideNativeScrollbars,\r\n };\r\n },\r\n _envWindowZoom: () => {\r\n let size = { w: 0, h: 0 };\r\n let dpr = 0;\r\n const getWindowDPR = (): number => {\r\n const screen = wnd.screen;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const dDPI = screen.deviceXDPI || 0;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const sDPI = screen.logicalXDPI || 1;\r\n return wnd.devicePixelRatio || dDPI / sDPI;\r\n };\r\n const diffBiggerThanOne = (valOne: number, valTwo: number): boolean => {\r\n const absValOne = mathAbs(valOne);\r\n const absValTwo = mathAbs(valTwo);\r\n return !(\r\n absValOne === absValTwo ||\r\n absValOne + 1 === absValTwo ||\r\n absValOne - 1 === absValTwo\r\n );\r\n };\r\n\r\n return (\r\n envInstance: Env,\r\n updateNativeScrollbarSizeCache: UpdateCache>\r\n ): boolean | undefined => {\r\n const sizeNew = windowSize();\r\n const deltaSize = {\r\n w: sizeNew.w - size.w,\r\n h: sizeNew.h - size.h,\r\n };\r\n\r\n if (deltaSize.w === 0 && deltaSize.h === 0) {\r\n return;\r\n }\r\n\r\n const deltaAbsSize = {\r\n w: mathAbs(deltaSize.w),\r\n h: mathAbs(deltaSize.h),\r\n };\r\n const deltaAbsRatio = {\r\n w: mathAbs(mathRound(sizeNew.w / (size.w / 100.0))),\r\n h: mathAbs(mathRound(sizeNew.h / (size.h / 100.0))),\r\n };\r\n const dprNew = getWindowDPR();\r\n const deltaIsBigger = deltaAbsSize.w > 2 && deltaAbsSize.h > 2;\r\n const difference = !diffBiggerThanOne(deltaAbsRatio.w, deltaAbsRatio.h);\r\n const dprChanged = dprNew !== dpr && dprNew > 0;\r\n const isZoom = deltaIsBigger && difference && dprChanged;\r\n let scrollbarSizeChanged;\r\n let scrollbarSize;\r\n\r\n if (isZoom) {\r\n [scrollbarSize, scrollbarSizeChanged] = updateNativeScrollbarSizeCache();\r\n\r\n assignDeep(envInstance._nativeScrollbarsSize, scrollbarSize); // keep the object same!\r\n }\r\n\r\n size = sizeNew;\r\n dpr = dprNew;\r\n\r\n return scrollbarSizeChanged;\r\n };\r\n },\r\n }),\r\n },\r\n}))() satisfies StaticPlugin;\r\n","import { animateNumber, noop, setT } from '~/support';\r\nimport type { StaticPlugin } from '~/plugins';\r\n\r\nexport const clickScrollPluginModuleName = '__osClickScrollPlugin';\r\n\r\nexport const ClickScrollPlugin = /* @__PURE__ */ (() => ({\r\n [clickScrollPluginModuleName]: {\r\n static:\r\n () =>\r\n (\r\n moveHandleRelative: (deltaMovement: number) => void,\r\n getHandleOffset: (handleRect?: DOMRect, trackRect?: DOMRect) => number,\r\n startOffset: number,\r\n handleLength: number,\r\n relativeTrackPointerOffset: number\r\n ): (() => void) => {\r\n // click scroll animation\r\n let iteration = 0;\r\n let clear = noop;\r\n const animateClickScroll = (clickScrollProgress: number) => {\r\n clear = animateNumber(\r\n clickScrollProgress,\r\n clickScrollProgress + handleLength * Math.sign(startOffset),\r\n 133,\r\n (animationProgress, _, animationCompleted) => {\r\n moveHandleRelative(animationProgress);\r\n const handleStartBound = getHandleOffset();\r\n const handleEndBound = handleStartBound + handleLength;\r\n const mouseBetweenHandleBounds =\r\n relativeTrackPointerOffset >= handleStartBound &&\r\n relativeTrackPointerOffset <= handleEndBound;\r\n\r\n if (animationCompleted && !mouseBetweenHandleBounds) {\r\n if (iteration) {\r\n animateClickScroll(animationProgress);\r\n } else {\r\n const firstIterationPauseTimeout = setT(() => {\r\n animateClickScroll(animationProgress);\r\n }, 222);\r\n clear = () => {\r\n clearTimeout(firstIterationPauseTimeout);\r\n };\r\n }\r\n iteration++;\r\n }\r\n }\r\n );\r\n };\r\n\r\n animateClickScroll(0);\r\n\r\n return () => clear();\r\n },\r\n },\r\n}))() satisfies StaticPlugin;\r\n","import {\r\n createDOM,\r\n addClass,\r\n appendChildren,\r\n fractionalSize,\r\n clientSize,\r\n absoluteCoordinates,\r\n offsetSize,\r\n removeAttrs,\r\n removeElements,\r\n assignDeep,\r\n createCache,\r\n equalXY,\r\n createEventListenerHub,\r\n scrollT,\r\n bind,\r\n wnd,\r\n noop,\r\n scrollElementTo,\r\n strHidden,\r\n strOverflowX,\r\n strOverflowY,\r\n getStyles,\r\n setStyles,\r\n isBodyElement,\r\n} from '~/support';\r\nimport { classNameEnvironment, classNameEnvironmentScrollbarHidden } from '~/classnames';\r\nimport { defaultOptions } from '~/options';\r\nimport { getStaticPluginModuleInstance, scrollbarsHidingPluginName } from '~/plugins';\r\nimport type { XY, EventListener } from '~/support';\r\nimport type { Options, PartialOptions } from '~/options';\r\nimport type { ScrollbarsHidingPlugin } from '~/plugins';\r\nimport type { Initialization, PartialInitialization } from '~/initialization';\r\nimport type { StyleObjectKey } from './typings';\r\n\r\ntype EnvironmentEventArgs = {\r\n r: [scrollbarSizeChanged?: boolean];\r\n};\r\n\r\nexport interface Env {\r\n readonly _nativeScrollbarsSize: XY;\r\n readonly _nativeScrollbarsOverlaid: XY;\r\n readonly _nativeScrollbarsHiding: boolean;\r\n readonly _rtlScrollBehavior: { n: boolean; i: boolean };\r\n readonly _scrollTimeline: boolean;\r\n readonly _staticDefaultInitialization: Initialization;\r\n readonly _staticDefaultOptions: Options;\r\n _addResizeListener(listener: EventListener): () => void;\r\n _getDefaultInitialization(): Initialization;\r\n _setDefaultInitialization(newInitialization: PartialInitialization): Initialization;\r\n _getDefaultOptions(): Options;\r\n _setDefaultOptions(newDefaultOptions: PartialOptions): Options;\r\n}\r\n\r\nlet environmentInstance: Env;\r\n\r\nconst createEnvironment = (): Env => {\r\n const getNativeScrollbarSize = (\r\n measureElm: HTMLElement,\r\n measureElmChild: HTMLElement,\r\n clear?: boolean\r\n ): XY => {\r\n // fix weird safari issue where getComputedStyle returns all empty styles by appending twice\r\n appendChildren(document.body, measureElm);\r\n appendChildren(document.body, measureElm);\r\n\r\n const cSize = clientSize(measureElm);\r\n const oSize = offsetSize(measureElm);\r\n const fSize = fractionalSize(measureElmChild);\r\n\r\n clear && removeElements(measureElm);\r\n\r\n return {\r\n x: oSize.h - cSize.h + fSize.h,\r\n y: oSize.w - cSize.w + fSize.w,\r\n };\r\n };\r\n\r\n const getNativeScrollbarsHiding = (testElm: HTMLElement): boolean => {\r\n let result = false;\r\n const revertClass = addClass(testElm, classNameEnvironmentScrollbarHidden);\r\n try {\r\n result =\r\n getStyles(testElm, 'scrollbar-width' as StyleObjectKey) === 'none' ||\r\n getStyles(testElm, 'display', '::-webkit-scrollbar') === 'none';\r\n } catch {}\r\n revertClass();\r\n return result;\r\n };\r\n\r\n const getRtlScrollBehavior = (\r\n parentElm: HTMLElement,\r\n childElm: HTMLElement\r\n ): { i: boolean; n: boolean } => {\r\n setStyles(parentElm, {\r\n [strOverflowX]: strHidden,\r\n [strOverflowY]: strHidden,\r\n direction: 'rtl',\r\n });\r\n scrollElementTo(parentElm, { x: 0 });\r\n\r\n const parentOffset = absoluteCoordinates(parentElm);\r\n const childOffset = absoluteCoordinates(childElm);\r\n scrollElementTo(parentElm, { x: -999 }); // https://github.com/KingSora/OverlayScrollbars/issues/187\r\n const childOffsetAfterScroll = absoluteCoordinates(childElm);\r\n return {\r\n /**\r\n * origin direction = determines if the zero scroll position is on the left or right side\r\n * 'i' means 'invert' (i === true means that the axis must be inverted to be correct)\r\n * true = on the left side\r\n * false = on the right side\r\n */\r\n i: parentOffset.x === childOffset.x,\r\n /**\r\n * negative = determines if the maximum scroll is positive or negative\r\n * 'n' means 'negate' (n === true means that the axis must be negated to be correct)\r\n * true = negative\r\n * false = positive\r\n */\r\n n: childOffset.x !== childOffsetAfterScroll.x,\r\n };\r\n };\r\n\r\n // changes to this styles need to be reflected in the \"hide native scrollbars\" section of the structure styles\r\n const envStyle = `.${classNameEnvironment}{scroll-behavior:auto!important;position:fixed;opacity:0;visibility:hidden;overflow:scroll;height:200px;width:200px;z-index:-1}.${classNameEnvironment} div{width:200%;height:200%;margin:10px 0}.${classNameEnvironmentScrollbarHidden}{scrollbar-width:none!important}.${classNameEnvironmentScrollbarHidden}::-webkit-scrollbar,.${classNameEnvironmentScrollbarHidden}::-webkit-scrollbar-corner{appearance:none!important;display:none!important;width:0!important;height:0!important}`;\r\n const envDOM = createDOM(\r\n `
`\r\n );\r\n const envElm = envDOM[0] as HTMLElement;\r\n const envChildElm = envElm.firstChild as HTMLElement;\r\n const [addEvent, , triggerEvent] = createEventListenerHub();\r\n const [updateNativeScrollbarSizeCache, getNativeScrollbarSizeCache] = createCache(\r\n {\r\n _initialValue: getNativeScrollbarSize(envElm, envChildElm),\r\n _equal: equalXY,\r\n },\r\n bind(getNativeScrollbarSize, envElm, envChildElm, true)\r\n );\r\n const [nativeScrollbarsSize] = getNativeScrollbarSizeCache();\r\n const nativeScrollbarsHiding = getNativeScrollbarsHiding(envElm);\r\n const nativeScrollbarsOverlaid = {\r\n x: nativeScrollbarsSize.x === 0,\r\n y: nativeScrollbarsSize.y === 0,\r\n };\r\n const staticDefaultInitialization: Initialization = {\r\n elements: {\r\n host: null,\r\n padding: !nativeScrollbarsHiding,\r\n viewport: (target) => nativeScrollbarsHiding && isBodyElement(target) && target,\r\n content: false,\r\n },\r\n scrollbars: {\r\n slot: true,\r\n },\r\n cancel: {\r\n nativeScrollbarsOverlaid: false,\r\n body: null,\r\n },\r\n };\r\n const staticDefaultOptions = assignDeep({}, defaultOptions);\r\n const getDefaultOptions = bind(\r\n assignDeep as typeof assignDeep,\r\n {} as Options,\r\n staticDefaultOptions\r\n );\r\n const getDefaultInitialization = bind(\r\n assignDeep as typeof assignDeep,\r\n {} as Initialization,\r\n staticDefaultInitialization\r\n );\r\n\r\n const env: Env = {\r\n _nativeScrollbarsSize: nativeScrollbarsSize,\r\n _nativeScrollbarsOverlaid: nativeScrollbarsOverlaid,\r\n _nativeScrollbarsHiding: nativeScrollbarsHiding,\r\n _scrollTimeline: !!scrollT,\r\n _rtlScrollBehavior: getRtlScrollBehavior(envElm, envChildElm),\r\n _addResizeListener: bind(addEvent, 'r'),\r\n _getDefaultInitialization: getDefaultInitialization,\r\n _setDefaultInitialization: (newInitializationStrategy) =>\r\n assignDeep(staticDefaultInitialization, newInitializationStrategy) &&\r\n getDefaultInitialization(),\r\n _getDefaultOptions: getDefaultOptions,\r\n _setDefaultOptions: (newDefaultOptions) =>\r\n assignDeep(staticDefaultOptions, newDefaultOptions) && getDefaultOptions(),\r\n _staticDefaultInitialization: assignDeep({}, staticDefaultInitialization),\r\n _staticDefaultOptions: assignDeep({}, staticDefaultOptions),\r\n };\r\n\r\n removeAttrs(envElm, 'style');\r\n removeElements(envElm);\r\n\r\n // needed in case content has css viewport units\r\n wnd.addEventListener('resize', () => {\r\n let scrollbarSizeChanged;\r\n if (!nativeScrollbarsHiding && (!nativeScrollbarsOverlaid.x || !nativeScrollbarsOverlaid.y)) {\r\n const scrollbarsHidingPlugin = getStaticPluginModuleInstance(\r\n scrollbarsHidingPluginName\r\n );\r\n const zoomFn = scrollbarsHidingPlugin ? scrollbarsHidingPlugin._envWindowZoom() : noop;\r\n scrollbarSizeChanged = !!zoomFn(env, updateNativeScrollbarSizeCache);\r\n }\r\n\r\n triggerEvent('r', [scrollbarSizeChanged]);\r\n });\r\n\r\n return env;\r\n};\r\n\r\nconst getEnvironment = (): Env => {\r\n if (!environmentInstance) {\r\n environmentInstance = createEnvironment();\r\n }\r\n return environmentInstance;\r\n};\r\n\r\nexport { getEnvironment };\r\n","import { isFunction, isHTMLElement, isNull, isUndefined } from '~/support';\r\nimport { getEnvironment } from '~/environment';\r\nimport type { DeepPartial } from '~/typings';\r\n\r\ntype FallbackStaticInitializtationElement = Extract<\r\n StaticInitializationElement,\r\n (...args: Args) => any\r\n> extends (...args: infer P) => any\r\n ? (...args: P) => HTMLElement\r\n : never;\r\ntype FallbackDynamicInitializtationElement = Extract<\r\n DynamicInitializationElement,\r\n (...args: Args) => any\r\n> extends (...args: infer P) => any\r\n ? (...args: P) => HTMLElement\r\n : never;\r\n\r\nexport type StaticInitialization = HTMLElement | false | null;\r\nexport type DynamicInitialization = HTMLElement | boolean | null;\r\n\r\n/**\r\n * Static elements are elements which MUST be present in the final DOM.\r\n * If an `HTMLElement` is passed the passed element will be taken as the repsective element.\r\n * With `false`, `null` or `undefined` an appropriate element is generated automatically.\r\n */\r\nexport type StaticInitializationElement =\r\n /** A function which returns the the StaticInitialization value. */\r\n | ((...args: Args) => StaticInitialization)\r\n /** The StaticInitialization value. */\r\n | StaticInitialization;\r\n\r\n/**\r\n * Dynamic elements are elements which CAN be present in the final DOM.\r\n * If an `HTMLElement`is passed the passed element will be taken as the repsective element.\r\n * With `true` an appropriate element is generated automatically.\r\n * With `false`, `null` or `undefined` the element won't be in the DOM.\r\n */\r\nexport type DynamicInitializationElement =\r\n /** A function which returns the the DynamicInitialization value. */\r\n | ((...args: Args) => DynamicInitialization)\r\n /** The DynamicInitialization value. */\r\n | DynamicInitialization;\r\n\r\n/**\r\n * Describes how a OverlayScrollbar instance should initialize.\r\n */\r\nexport type Initialization = {\r\n /**\r\n * Customizes which elements are generated and used.\r\n * If a function is passed to any of the fields, it receives the `target` element as its argument.\r\n * Any passed function should be a \"pure\" function. (same input produces same output)\r\n */\r\n elements: {\r\n /**\r\n * Assign a custom element as the host element.\r\n * Only relevant if the target element is a Textarea.\r\n */\r\n host: StaticInitializationElement<[target: InitializationTargetElement]>;\r\n /** Assign a custom element as the viewport element. */\r\n viewport: StaticInitializationElement<[target: InitializationTargetElement]>;\r\n /** Assign a custom element as the padding element or force the element not to be generated. */\r\n padding: DynamicInitializationElement<[target: InitializationTargetElement]>;\r\n /** Assign a custom element as the content element or force the element not to be generated. */\r\n content: DynamicInitializationElement<[target: InitializationTargetElement]>;\r\n };\r\n /**\r\n * Customizes elements related to the scrollbars.\r\n * If a function is passed, it receives the `target`, `host` and `viewport` element as arguments.\r\n */\r\n scrollbars: {\r\n slot: DynamicInitializationElement<\r\n [target: InitializationTargetElement, host: HTMLElement, viewport: HTMLElement]\r\n >;\r\n };\r\n /**\r\n * Customizes the cancelation behavior.\r\n */\r\n cancel: {\r\n /** Whether the initialization shall be canceled if the native scrollbars are overlaid. */\r\n nativeScrollbarsOverlaid: boolean;\r\n /**\r\n * Whether the initialization shall be canceled if its applied to a body element.\r\n * With `true` an initialization is always canceled, with `false` its never canceled.\r\n * With `null` the initialization will only be canceled when the initialization would affect the browsers functionality. (window.scrollTo, mobile browser behavior etc.)\r\n */\r\n body: boolean | null;\r\n };\r\n};\r\n\r\nexport type PartialInitialization = DeepPartial;\r\n\r\n/** The initialization target element. */\r\nexport type InitializationTargetElement = HTMLElement; // | HTMLTextAreaElement;\r\n\r\n/**\r\n * The initialization target object.\r\n * OverlayScrollbars({ target: myElement }) is equivalent to OverlayScrollbars(myElement).\r\n */\r\nexport type InitializationTargetObject = PartialInitialization & {\r\n target: InitializationTargetElement;\r\n};\r\n\r\n/** The initialization target. */\r\nexport type InitializationTarget = InitializationTargetElement | InitializationTargetObject;\r\n\r\nexport const resolveInitialization = (\r\n args: any,\r\n value: any\r\n): T => (isFunction(value) ? value.apply(0, args) : value);\r\n\r\nexport const staticInitializationElement = (\r\n args: Args,\r\n fallbackStaticInitializationElement: FallbackStaticInitializtationElement,\r\n defaultStaticInitializationElement: StaticInitializationElement,\r\n staticInitializationElementValue?: StaticInitializationElement\r\n): HTMLElement => {\r\n const staticInitialization = isUndefined(staticInitializationElementValue)\r\n ? defaultStaticInitializationElement\r\n : staticInitializationElementValue;\r\n const resolvedInitialization = resolveInitialization(\r\n args,\r\n staticInitialization\r\n );\r\n return resolvedInitialization || fallbackStaticInitializationElement.apply(0, args);\r\n};\r\n\r\nexport const dynamicInitializationElement = (\r\n args: Args,\r\n fallbackDynamicInitializationElement: FallbackDynamicInitializtationElement,\r\n defaultDynamicInitializationElement: DynamicInitializationElement,\r\n dynamicInitializationElementValue?: DynamicInitializationElement\r\n): HTMLElement | false => {\r\n const dynamicInitialization = isUndefined(dynamicInitializationElementValue)\r\n ? defaultDynamicInitializationElement\r\n : dynamicInitializationElementValue;\r\n const resolvedInitialization = resolveInitialization(\r\n args,\r\n dynamicInitialization\r\n );\r\n return (\r\n !!resolvedInitialization &&\r\n (isHTMLElement(resolvedInitialization)\r\n ? resolvedInitialization\r\n : fallbackDynamicInitializationElement.apply(0, args))\r\n );\r\n};\r\n\r\nexport const cancelInitialization = (\r\n isBody: boolean,\r\n cancelInitializationValue?: DeepPartial | false | null | undefined\r\n): boolean => {\r\n const { nativeScrollbarsOverlaid, body } = cancelInitializationValue || {};\r\n const { _nativeScrollbarsOverlaid, _nativeScrollbarsHiding, _getDefaultInitialization } =\r\n getEnvironment();\r\n const { nativeScrollbarsOverlaid: defaultNativeScrollbarsOverlaid, body: defaultbody } =\r\n _getDefaultInitialization().cancel;\r\n\r\n const resolvedNativeScrollbarsOverlaid =\r\n nativeScrollbarsOverlaid ?? defaultNativeScrollbarsOverlaid;\r\n const resolvedDocumentScrollingElement = isUndefined(body) ? defaultbody : body;\r\n\r\n const finalNativeScrollbarsOverlaid =\r\n (_nativeScrollbarsOverlaid.x || _nativeScrollbarsOverlaid.y) &&\r\n resolvedNativeScrollbarsOverlaid;\r\n const finalDocumentScrollingElement =\r\n isBody &&\r\n (isNull(resolvedDocumentScrollingElement)\r\n ? !_nativeScrollbarsHiding\r\n : resolvedDocumentScrollingElement);\r\n\r\n return !!finalNativeScrollbarsOverlaid || !!finalDocumentScrollingElement;\r\n};\r\n","import type { OverlayScrollbars } from '~/overlayscrollbars';\n\nconst targetInstanceMap: WeakMap = new WeakMap();\n\n/**\n * Adds the given OverlayScrollbars instance to the given element.\n * @param target The element which is the target of the OverlayScrollbars instance.\n * @param osInstance The OverlayScrollbars instance.\n */\nexport const addInstance = (target: Element, osInstance: OverlayScrollbars): void => {\n targetInstanceMap.set(target, osInstance);\n};\n\n/**\n * Removes a OverlayScrollbars instance from the given element.\n * @param target The element from which its OverlayScrollbars instance shall be removed.\n */\nexport const removeInstance = (target: Element): void => {\n targetInstanceMap.delete(target);\n};\n\n/**\n * Gets the OverlayScrollbars from the given element or undefined if it doesn't have one.\n * @param target The element of which its OverlayScrollbars instance shall be get.\n */\nexport const getInstance = (target: Element): OverlayScrollbars | undefined =>\n targetInstanceMap.get(target);\n","import {\r\n each,\r\n noop,\r\n debounce,\r\n MutationObserverConstructor,\r\n addEventListener,\r\n is,\r\n find,\r\n push,\r\n runEachAndClear,\r\n bind,\r\n isEmptyArray,\r\n deduplicateArray,\r\n inArray,\r\n concat,\r\n getAttr,\r\n} from '~/support';\r\n\r\ntype DOMContentObserverCallback = (contentChangedThroughEvent: boolean) => any;\r\n\r\ntype DOMTargetObserverCallback = (targetChangedAttrs: string[], targetStyleChanged: boolean) => any;\r\n\r\ninterface DOMObserverOptionsBase {\r\n _attributes?: string[];\r\n /**\r\n * A function which can ignore a changed attribute if it returns true.\r\n * for DOMTargetObserver this applies to the changes to the observed target\r\n * for DOMContentObserver this applies to changes to nested targets -> nested targets are elements which match the \"_nestedTargetSelector\" selector\r\n */\r\n _ignoreTargetChange?: DOMObserverIgnoreTargetChange;\r\n}\r\n\r\ninterface DOMContentObserverOptions extends DOMObserverOptionsBase {\r\n _eventContentChange?: DOMObserverEventContentChange; // [selector, eventname(s) | function returning eventname(s)] -> eventnames divided by whitespaces\r\n _nestedTargetSelector?: string;\r\n _ignoreContentChange?: DOMObserverIgnoreContentChange; // function which will prevent marking certain dom changes as content change if it returns true\r\n}\r\n\r\ninterface DOMTargetObserverOptions extends DOMObserverOptionsBase {\r\n /**\r\n * Marks certain attributes as style changing, should be a subset of the _attributes prop.\r\n * Used to set the \"targetStyleChanged\" param in the DOMTargetObserverCallback.\r\n */\r\n _styleChangingAttributes?: string[];\r\n}\r\n\r\ntype ContentChangeArrayItem = [selector?: string, eventNames?: string] | null | undefined;\r\n\r\nexport type DOMObserverEventContentChange =\r\n | Array\r\n | false\r\n | null\r\n | undefined;\r\n\r\nexport type DOMObserverIgnoreContentChange = (\r\n mutation: MutationRecord,\r\n isNestedTarget: boolean,\r\n domObserverTarget: HTMLElement,\r\n domObserverOptions?: DOMContentObserverOptions\r\n) => boolean;\r\n\r\nexport type DOMObserverIgnoreTargetChange = (\r\n target: Node,\r\n attributeName: string,\r\n oldAttributeValue: string | null,\r\n newAttributeValue: string | null\r\n) => boolean;\r\n\r\nexport type DOMObserverCallback = ContentObserver extends true\r\n ? DOMContentObserverCallback\r\n : DOMTargetObserverCallback;\r\n\r\nexport type DOMObserverOptions = ContentObserver extends true\r\n ? DOMContentObserverOptions\r\n : DOMTargetObserverOptions;\r\n\r\nexport type DOMObserver = [\r\n construct: () => () => void,\r\n update: () => void | false | Parameters>\r\n];\r\n\r\ntype EventContentChangeUpdateElement = (\r\n getElements?: (selector: string) => Node[],\r\n removed?: boolean\r\n) => void;\r\ntype EventContentChange = [destroy: () => void, updateElements: EventContentChangeUpdateElement];\r\n\r\n/**\r\n * Creates a set of helper functions to observe events of elements inside the target element.\r\n * @param target The target element of which the children elements shall be observed. (not only direct children but also nested ones)\r\n * @param eventContentChange The event content change array. (array of tuples: selector and eventname(s))\r\n * @param callback Callback which is called if one of the elements emits the corresponding event.\r\n * @returns A object which contains a set of helper functions to destroy and update the observation of elements.\r\n */\r\nconst createEventContentChange = (\r\n target: HTMLElement,\r\n callback: (...args: any) => any,\r\n eventContentChange?: DOMObserverEventContentChange\r\n): EventContentChange => {\r\n let destroyed = false;\r\n const map = eventContentChange ? new WeakMap any)[]>() : false; // weak map to prevent memory leak for detached elements\r\n const destroy = () => {\r\n destroyed = true;\r\n };\r\n const updateElements: EventContentChangeUpdateElement = (getElements) => {\r\n if (map && eventContentChange) {\r\n const eventElmList = eventContentChange.map((item) => {\r\n const [selector, eventNames] = item || [];\r\n const elements = eventNames && selector ? (getElements || find)(selector, target) : [];\r\n return [elements, eventNames] as const;\r\n });\r\n\r\n each(eventElmList, (item) =>\r\n each(item[0], (elm) => {\r\n const eventNames = item[1];\r\n const entries = map.get(elm) || [];\r\n const isTargetChild = target.contains(elm);\r\n\r\n if (isTargetChild && eventNames) {\r\n const removeListener = addEventListener(elm, eventNames, (event: Event) => {\r\n if (destroyed) {\r\n removeListener();\r\n map.delete(elm);\r\n } else {\r\n callback(event);\r\n }\r\n });\r\n map.set(elm, push(entries, removeListener));\r\n } else {\r\n runEachAndClear(entries);\r\n map.delete(elm);\r\n }\r\n })\r\n );\r\n }\r\n };\r\n\r\n updateElements();\r\n\r\n return [destroy, updateElements];\r\n};\r\n\r\n/**\r\n * Creates a DOM observer which observes DOM changes to either the target element or its children.\r\n * @param target The element which shall be observed.\r\n * @param isContentObserver Whether this observer is just observing the target or just the targets children. (not only direct children but also nested ones)\r\n * @param callback The callback which gets called if a change was detected.\r\n * @param options The options for DOM change detection.\r\n * @returns A object which represents the instance of the DOM observer.\r\n */\r\nexport const createDOMObserver = (\r\n target: HTMLElement,\r\n isContentObserver: ContentObserver,\r\n callback: DOMObserverCallback,\r\n options?: DOMObserverOptions\r\n): DOMObserver => {\r\n let isConnected = false;\r\n const {\r\n _attributes,\r\n _styleChangingAttributes,\r\n _eventContentChange,\r\n _nestedTargetSelector,\r\n _ignoreTargetChange,\r\n _ignoreContentChange,\r\n } = (options as DOMContentObserverOptions & DOMTargetObserverOptions) || {};\r\n const debouncedEventContentChange = debounce(\r\n () => isConnected && (callback as DOMContentObserverCallback)(true),\r\n { _timeout: 33, _maxDelay: 99 }\r\n );\r\n const [destroyEventContentChange, updateEventContentChangeElements] = createEventContentChange(\r\n target,\r\n debouncedEventContentChange,\r\n _eventContentChange\r\n );\r\n\r\n // MutationObserver\r\n const finalAttributes = _attributes || [];\r\n const finalStyleChangingAttributes = _styleChangingAttributes || [];\r\n const observedAttributes = concat(finalAttributes, finalStyleChangingAttributes);\r\n const observerCallback = (\r\n fromRecords: boolean,\r\n mutations: MutationRecord[]\r\n ): void | Parameters> => {\r\n if (!isEmptyArray(mutations)) {\r\n const ignoreTargetChange = _ignoreTargetChange || noop;\r\n const ignoreContentChange = _ignoreContentChange || noop;\r\n const totalChangedNodes: Node[] = [];\r\n const targetChangedAttrs: string[] = [];\r\n let targetStyleChanged: boolean | '' | null | undefined = false;\r\n let contentChanged: boolean | '' | null | undefined = false;\r\n let childListChanged: boolean | '' | null | undefined = false;\r\n\r\n each(mutations, (mutation) => {\r\n const {\r\n attributeName,\r\n target: mutationTarget,\r\n type,\r\n oldValue,\r\n addedNodes,\r\n removedNodes,\r\n } = mutation;\r\n const isAttributesType = type === 'attributes';\r\n const isChildListType = type === 'childList';\r\n const targetIsMutationTarget = target === mutationTarget;\r\n const isAttrChange = isAttributesType && attributeName;\r\n // isAttrChange check needed, otherwise mutationTarget might not be a valid HTMLElement\r\n const attributeValue =\r\n (isAttrChange && getAttr(mutationTarget as HTMLElement, attributeName || '')) || null;\r\n const attributeChanged = isAttrChange && oldValue !== attributeValue;\r\n const styleChangingAttrChanged =\r\n inArray(finalStyleChangingAttributes, attributeName) && attributeChanged;\r\n\r\n // if is content observer and something changed in children\r\n if (isContentObserver && (isChildListType || !targetIsMutationTarget)) {\r\n const contentAttrChanged = isAttributesType && attributeChanged;\r\n const isNestedTarget =\r\n contentAttrChanged &&\r\n _nestedTargetSelector &&\r\n is(mutationTarget, _nestedTargetSelector);\r\n const baseAssertion = isNestedTarget\r\n ? !ignoreTargetChange(mutationTarget, attributeName, oldValue, attributeValue)\r\n : !isAttributesType || contentAttrChanged;\r\n const contentFinalChanged =\r\n baseAssertion && !ignoreContentChange(mutation, !!isNestedTarget, target, options);\r\n\r\n each(addedNodes, (node) => push(totalChangedNodes, node));\r\n each(removedNodes, (node) => push(totalChangedNodes, node));\r\n\r\n contentChanged = contentChanged || contentFinalChanged;\r\n childListChanged = childListChanged || isChildListType;\r\n }\r\n // if is target observer and target attr changed\r\n if (\r\n !isContentObserver &&\r\n targetIsMutationTarget &&\r\n attributeChanged &&\r\n !ignoreTargetChange(mutationTarget, attributeName!, oldValue, attributeValue)\r\n ) {\r\n push(targetChangedAttrs, attributeName);\r\n targetStyleChanged = targetStyleChanged || styleChangingAttrChanged;\r\n }\r\n });\r\n\r\n // adds / removes the new elements from the event content change\r\n updateEventContentChangeElements((selector: string) =>\r\n deduplicateArray(totalChangedNodes).reduce((arr, node) => {\r\n push(arr, find(selector, node));\r\n return is(node, selector) ? push(arr, node) : arr;\r\n }, [])\r\n );\r\n\r\n if (isContentObserver) {\r\n !fromRecords && contentChanged && (callback as DOMContentObserverCallback)(false);\r\n return [false] satisfies Parameters> as Parameters<\r\n DOMObserverCallback\r\n >;\r\n }\r\n\r\n if (!isEmptyArray(targetChangedAttrs) || targetStyleChanged) {\r\n const args = [\r\n deduplicateArray(targetChangedAttrs),\r\n targetStyleChanged,\r\n ] satisfies Parameters & Parameters>;\r\n !fromRecords && (callback as DOMTargetObserverCallback).apply(0, args);\r\n\r\n return args as Parameters>;\r\n }\r\n }\r\n };\r\n const mutationObserver: MutationObserver = new MutationObserverConstructor!(\r\n bind(observerCallback, false)\r\n );\r\n\r\n return [\r\n () => {\r\n mutationObserver.observe(target, {\r\n attributes: true,\r\n attributeOldValue: true,\r\n attributeFilter: observedAttributes,\r\n subtree: isContentObserver,\r\n childList: isContentObserver,\r\n characterData: isContentObserver,\r\n });\r\n isConnected = true;\r\n\r\n return () => {\r\n if (isConnected) {\r\n destroyEventContentChange();\r\n mutationObserver.disconnect();\r\n isConnected = false;\r\n }\r\n };\r\n },\r\n () => {\r\n if (isConnected) {\r\n debouncedEventContentChange._flush();\r\n return observerCallback(true, mutationObserver.takeRecords());\r\n }\r\n },\r\n ];\r\n};\r\n","import {\r\n createCache,\r\n createDOM,\r\n runEachAndClear,\r\n addEventListener,\r\n addClass,\r\n push,\r\n ResizeObserverConstructor,\r\n removeClass,\r\n stopPropagation,\r\n appendChildren,\r\n getDirectionIsRTL,\r\n domRectHasDimensions,\r\n bind,\r\n noop,\r\n isArray,\r\n convertScrollPosition,\r\n scrollElementTo,\r\n domRectAppeared,\r\n concat,\r\n} from '~/support';\r\nimport { getEnvironment } from '~/environment';\r\nimport {\r\n classNameSizeObserver,\r\n classNameSizeObserverAppear,\r\n classNameSizeObserverListener,\r\n} from '~/classnames';\r\nimport { getStaticPluginModuleInstance, sizeObserverPluginName } from '~/plugins';\r\nimport type { CacheValues } from '~/support';\r\nimport type { SizeObserverPlugin } from '~/plugins';\r\n\r\nexport interface SizeObserverOptions {\r\n /** Whether direction changes should be observed. */\r\n _direction?: boolean;\r\n /** Whether appearing should be observed. */\r\n _appear?: boolean;\r\n}\r\n\r\nexport interface SizeObserverCallbackParams {\r\n _sizeChanged: boolean;\r\n _directionIsRTLCache?: CacheValues;\r\n _appear?: boolean;\r\n}\r\n\r\nexport type SizeObserver = () => () => void;\r\n\r\n/**\r\n * Creates a size observer which observes any size, padding, border, margin and box-sizing changes of the target element. Depending on the options also direction and appear can be observed.\r\n * @param target The target element which shall be observed.\r\n * @param onSizeChangedCallback The callback which gets called after a size change was detected.\r\n * @param options The options for size detection, whether to observe also direction and appear.\r\n * @returns A object which represents the instance of the size observer.\r\n */\r\nexport const createSizeObserver = (\r\n target: HTMLElement,\r\n onSizeChangedCallback: (params: SizeObserverCallbackParams) => any,\r\n options?: SizeObserverOptions\r\n): SizeObserver => {\r\n const scrollAmount = 3333333;\r\n const { _direction: observeDirectionChange, _appear: observeAppearChange } = options || {};\r\n const sizeObserverPlugin =\r\n getStaticPluginModuleInstance(sizeObserverPluginName);\r\n const { _rtlScrollBehavior: rtlScrollBehavior } = getEnvironment();\r\n const getIsDirectionRTL = bind(getDirectionIsRTL, target);\r\n const [updateResizeObserverContentRectCache] = createCache({\r\n _initialValue: false,\r\n _alwaysUpdateValues: true,\r\n });\r\n\r\n return () => {\r\n const destroyFns: (() => void)[] = [];\r\n const baseElements = createDOM(\r\n `
`\r\n );\r\n const sizeObserver = baseElements[0] as HTMLElement;\r\n const listenerElement = sizeObserver.firstChild as HTMLElement;\r\n const onSizeChangedCallbackProxy = (\r\n sizeChangedContext?: CacheValues | ResizeObserverEntry | boolean\r\n ) => {\r\n const isResizeObserverCall = sizeChangedContext instanceof ResizeObserverEntry;\r\n const hasDirectionCache = !isResizeObserverCall && isArray(sizeChangedContext);\r\n\r\n let skip = false;\r\n let appear = false;\r\n let doDirectionScroll = true; // always true if sizeChangedContext is Event (appear callback or RO. Polyfill)\r\n\r\n // if triggered from RO.\r\n if (isResizeObserverCall) {\r\n const [currRContentRect, , prevContentRect] = updateResizeObserverContentRectCache(\r\n sizeChangedContext.contentRect\r\n );\r\n const hasDimensions = domRectHasDimensions(currRContentRect);\r\n const appeared = domRectAppeared(currRContentRect, prevContentRect);\r\n const firstCall = !prevContentRect;\r\n appear = firstCall || appeared;\r\n skip = !appear && !hasDimensions; // skip if display is none or when window resize\r\n\r\n doDirectionScroll = !skip; // direction scroll when not skipping\r\n }\r\n // else if its triggered with DirectionCache\r\n else if (hasDirectionCache) {\r\n [, doDirectionScroll] = sizeChangedContext; // direction scroll when DirectionCache changed, false otherwise\r\n }\r\n // else if it triggered with appear from polyfill\r\n else {\r\n appear = sizeChangedContext === true;\r\n }\r\n\r\n if (observeDirectionChange && doDirectionScroll) {\r\n const rtl = hasDirectionCache ? sizeChangedContext[0] : getDirectionIsRTL(sizeObserver);\r\n scrollElementTo(sizeObserver, {\r\n x: convertScrollPosition(scrollAmount, scrollAmount, rtl && rtlScrollBehavior),\r\n y: scrollAmount,\r\n });\r\n }\r\n\r\n if (!skip) {\r\n onSizeChangedCallback({\r\n _directionIsRTLCache: hasDirectionCache ? sizeChangedContext : undefined,\r\n _sizeChanged: !hasDirectionCache,\r\n _appear: appear,\r\n });\r\n }\r\n };\r\n\r\n if (ResizeObserverConstructor) {\r\n const resizeObserverInstance = new ResizeObserverConstructor((entries) =>\r\n onSizeChangedCallbackProxy(entries.pop())\r\n );\r\n resizeObserverInstance.observe(listenerElement);\r\n push(destroyFns, () => {\r\n resizeObserverInstance.disconnect();\r\n });\r\n } else if (sizeObserverPlugin) {\r\n const [pluginAppearCallback, pluginDestroyFns] = sizeObserverPlugin(\r\n listenerElement,\r\n onSizeChangedCallbackProxy,\r\n observeAppearChange\r\n );\r\n push(\r\n destroyFns,\r\n concat(\r\n [\r\n addClass(sizeObserver, classNameSizeObserverAppear),\r\n addEventListener(sizeObserver, 'animationstart', pluginAppearCallback),\r\n ],\r\n pluginDestroyFns\r\n )\r\n );\r\n } else {\r\n return noop;\r\n }\r\n\r\n if (observeDirectionChange) {\r\n const [updateDirectionIsRTLCache] = createCache(\r\n {\r\n _initialValue: undefined,\r\n },\r\n getIsDirectionRTL\r\n );\r\n\r\n push(\r\n destroyFns,\r\n addEventListener(sizeObserver, 'scroll', (event) => {\r\n const directionIsRTLCacheValues = updateDirectionIsRTLCache();\r\n const [directionIsRTLCache, directionIsRTLCacheChanged, directionIsRTLCachePrevious] =\r\n directionIsRTLCacheValues;\r\n if (directionIsRTLCacheChanged) {\r\n removeClass(listenerElement, 'ltr rtl');\r\n addClass(listenerElement, directionIsRTLCache ? 'rtl' : 'ltr');\r\n\r\n onSizeChangedCallbackProxy([\r\n !!directionIsRTLCache,\r\n directionIsRTLCacheChanged,\r\n directionIsRTLCachePrevious,\r\n ]);\r\n }\r\n\r\n stopPropagation(event);\r\n })\r\n );\r\n }\r\n\r\n return bind(runEachAndClear, push(destroyFns, appendChildren(target, sizeObserver)));\r\n };\r\n};\r\n","import {\r\n createDiv,\r\n offsetSize,\r\n runEachAndClear,\r\n createCache,\r\n push,\r\n IntersectionObserverConstructor,\r\n appendChildren,\r\n bind,\r\n} from '~/support';\r\nimport { createSizeObserver } from '~/observers/sizeObserver';\r\nimport { classNameTrinsicObserver } from '~/classnames';\r\nimport type { WH, CacheValues } from '~/support';\r\n\r\nexport type TrinsicObserverCallback = (heightIntrinsic: CacheValues) => any;\r\nexport type TrinsicObserver = [\r\n construct: () => () => void,\r\n update: () => void | false | null | undefined | Parameters\r\n];\r\n\r\n/**\r\n * Creates a trinsic observer which observes changes to intrinsic or extrinsic sizing for the height of the target element.\r\n * @param target The element which shall be observed.\r\n * @param onTrinsicChangedCallback The callback which gets called after a change was detected.\r\n * @returns A object which represents the instance of the trinsic observer.\r\n */\r\nexport const createTrinsicObserver = (\r\n target: HTMLElement,\r\n onTrinsicChangedCallback: TrinsicObserverCallback\r\n): TrinsicObserver => {\r\n let intersectionObserverInstance: undefined | IntersectionObserver;\r\n const isHeightIntrinsic = (ioEntryOrSize: IntersectionObserverEntry | WH): boolean =>\r\n (ioEntryOrSize as WH).h === 0 ||\r\n (ioEntryOrSize as IntersectionObserverEntry).isIntersecting ||\r\n (ioEntryOrSize as IntersectionObserverEntry).intersectionRatio > 0;\r\n const trinsicObserver = createDiv(classNameTrinsicObserver);\r\n const [updateHeightIntrinsicCache] = createCache({\r\n _initialValue: false,\r\n });\r\n const triggerOnTrinsicChangedCallback = (\r\n updateValue: IntersectionObserverEntry | WH | undefined,\r\n fromRecords?: boolean\r\n ): void | Parameters => {\r\n if (updateValue) {\r\n const heightIntrinsic = updateHeightIntrinsicCache(isHeightIntrinsic(updateValue));\r\n const [, heightIntrinsicChanged] = heightIntrinsic;\r\n return (\r\n heightIntrinsicChanged &&\r\n !fromRecords &&\r\n onTrinsicChangedCallback(heightIntrinsic) && [heightIntrinsic]\r\n );\r\n }\r\n };\r\n const intersectionObserverCallback = (\r\n fromRecords: boolean,\r\n entries: IntersectionObserverEntry[]\r\n ) => triggerOnTrinsicChangedCallback(entries.pop(), fromRecords);\r\n\r\n return [\r\n () => {\r\n const destroyFns: (() => void)[] = [];\r\n\r\n if (IntersectionObserverConstructor) {\r\n intersectionObserverInstance = new IntersectionObserverConstructor(\r\n bind(intersectionObserverCallback, false),\r\n { root: target }\r\n );\r\n intersectionObserverInstance.observe(trinsicObserver);\r\n push(destroyFns, () => {\r\n intersectionObserverInstance!.disconnect();\r\n });\r\n } else {\r\n const onSizeChanged = () => {\r\n const newSize = offsetSize(trinsicObserver);\r\n triggerOnTrinsicChangedCallback(newSize);\r\n };\r\n push(destroyFns, createSizeObserver(trinsicObserver, onSizeChanged)());\r\n onSizeChanged();\r\n }\r\n\r\n return bind(runEachAndClear, push(destroyFns, appendChildren(target, trinsicObserver)));\r\n },\r\n () =>\r\n intersectionObserverInstance &&\r\n intersectionObserverCallback(true, intersectionObserverInstance.takeRecords()),\r\n ];\r\n};\r\n","import {\r\n ResizeObserverConstructor,\r\n assignDeep,\r\n closest,\r\n createCache,\r\n debounce,\r\n getDirectionIsRTL,\r\n each,\r\n equalWH,\r\n fractionalSize,\r\n isArray,\r\n isFunction,\r\n isNumber,\r\n isString,\r\n keys,\r\n liesBetween,\r\n removeAttrs,\r\n scrollSize,\r\n getElmentScroll,\r\n scrollElementTo,\r\n inArray,\r\n domRectAppeared,\r\n concat,\r\n getAttr,\r\n setAttrs,\r\n} from '~/support';\r\nimport { createDOMObserver, createSizeObserver, createTrinsicObserver } from '~/observers';\r\nimport { getEnvironment } from '~/environment';\r\nimport {\r\n classNameScrollbar,\r\n dataAttributeHost,\r\n dataAttributeViewport,\r\n dataValueHostUpdating,\r\n dataValueViewportArrange,\r\n dataValueViewportOverflowVisible,\r\n} from '~/classnames';\r\nimport { getStaticPluginModuleInstance, scrollbarsHidingPluginName } from '~/plugins';\r\nimport type { Options, OptionsCheckFn } from '~/options';\r\nimport type { ScrollbarsHidingPlugin } from '~/plugins';\r\nimport type { SizeObserverCallbackParams } from '~/observers';\r\nimport type { StructureSetupElementsObj } from '../structureSetup/structureSetup.elements';\r\nimport type { Setup, SetupUpdateInfo, StructureSetupState } from '~/setups';\r\nimport type { CacheValues, WH } from '~/support';\r\nimport type { PlainObject } from '~/typings';\r\n\r\nexport interface ObserversSetupState {\r\n _heightIntrinsic: boolean;\r\n _directionIsRTL: boolean;\r\n}\r\n\r\nexport interface ObserversSetupUpdateInfo extends SetupUpdateInfo {\r\n _takeRecords?: boolean;\r\n}\r\n\r\nexport type ObserversSetupUpdateHints = {\r\n _sizeChanged?: boolean;\r\n _directionChanged?: boolean;\r\n _heightIntrinsicChanged?: boolean;\r\n _hostMutation?: boolean;\r\n _contentMutation?: boolean;\r\n _appear?: boolean;\r\n _scrollbarSizeChanged?: boolean;\r\n};\r\n\r\nexport type ObserversSetup = Setup<\r\n ObserversSetupUpdateInfo,\r\n ObserversSetupState,\r\n ObserversSetupUpdateHints\r\n>;\r\n\r\nexport const createObserversSetup = (\r\n structureSetupElements: StructureSetupElementsObj,\r\n structureSetupState: StructureSetupState,\r\n getCurrentOption: OptionsCheckFn,\r\n onObserversUpdated: (updateHints: ObserversSetupUpdateHints) => void\r\n): ObserversSetup => {\r\n let debounceTimeout: number | false | undefined;\r\n let debounceMaxDelay: number | false | undefined;\r\n let updateContentMutationObserver: (() => void) | undefined;\r\n let destroyContentMutationObserver: (() => void) | undefined;\r\n let prevContentRect: DOMRectReadOnly | undefined;\r\n let prevDirectionIsRTL: boolean | undefined;\r\n\r\n const { _nativeScrollbarsHiding } = getEnvironment();\r\n\r\n const hostSelector = `[${dataAttributeHost}]`;\r\n\r\n // TODO: observer textarea attrs if textarea\r\n\r\n const viewportSelector = `[${dataAttributeViewport}]`;\r\n const viewportAttrsFromTarget = ['tabindex'];\r\n const baseStyleChangingAttrsTextarea = ['wrap', 'cols', 'rows'];\r\n const baseStyleChangingAttrs = ['id', 'class', 'style', 'open'];\r\n const {\r\n _target,\r\n _host,\r\n _viewport,\r\n _content,\r\n _isTextarea,\r\n _viewportIsTarget,\r\n _viewportHasClass,\r\n _viewportAddRemoveClass,\r\n } = structureSetupElements;\r\n\r\n const state: ObserversSetupState = {\r\n _heightIntrinsic: false,\r\n _directionIsRTL: getDirectionIsRTL(_target),\r\n };\r\n const env = getEnvironment();\r\n const scrollbarsHidingPlugin = getStaticPluginModuleInstance(\r\n scrollbarsHidingPluginName\r\n );\r\n\r\n const [updateContentSizeCache] = createCache>(\r\n {\r\n _equal: equalWH,\r\n _initialValue: { w: 0, h: 0 },\r\n },\r\n () => {\r\n const _undoViewportArrange =\r\n scrollbarsHidingPlugin &&\r\n scrollbarsHidingPlugin._viewportArrangement(\r\n structureSetupElements,\r\n structureSetupState,\r\n state,\r\n env,\r\n getCurrentOption\r\n )._undoViewportArrange;\r\n\r\n const hasOver = _viewportHasClass(dataValueViewportOverflowVisible);\r\n const isArranged = !_viewportIsTarget && _viewportHasClass(dataValueViewportArrange);\r\n const scrollOffset = isArranged && getElmentScroll(_viewport);\r\n\r\n _viewportAddRemoveClass(dataValueViewportOverflowVisible);\r\n _viewportIsTarget && _viewportAddRemoveClass(dataValueHostUpdating, true);\r\n const redoViewportArrange = isArranged && _undoViewportArrange && _undoViewportArrange()[0];\r\n\r\n const contentScroll = scrollSize(_content);\r\n const viewportScroll = scrollSize(_viewport);\r\n const fractional = fractionalSize(_viewport);\r\n\r\n _viewportAddRemoveClass(dataValueViewportOverflowVisible, hasOver);\r\n _viewportIsTarget && _viewportAddRemoveClass(dataValueHostUpdating);\r\n redoViewportArrange && redoViewportArrange();\r\n\r\n scrollElementTo(_viewport, scrollOffset);\r\n\r\n return {\r\n w: viewportScroll.w + contentScroll.w + fractional.w,\r\n h: viewportScroll.h + contentScroll.h + fractional.h,\r\n };\r\n }\r\n );\r\n\r\n const contentMutationObserverAttr = _isTextarea\r\n ? baseStyleChangingAttrsTextarea\r\n : concat(baseStyleChangingAttrs, baseStyleChangingAttrsTextarea);\r\n\r\n const onObserversUpdatedDebounced = debounce(onObserversUpdated, {\r\n _timeout: () => debounceTimeout,\r\n _maxDelay: () => debounceMaxDelay,\r\n _mergeParams(prev, curr) {\r\n const [prevObj] = prev;\r\n const [currObj] = curr;\r\n return [\r\n concat(keys(prevObj), keys(currObj)).reduce((obj, key) => {\r\n obj[key] = prevObj[key as keyof typeof prevObj] || currObj[key as keyof typeof currObj];\r\n return obj;\r\n }, {} as PlainObject),\r\n ] as [Partial];\r\n },\r\n });\r\n\r\n const setDirectionWhenViewportIsTarget = (updateHints: ObserversSetupUpdateHints) => {\r\n if (_viewportIsTarget) {\r\n const newDirectionIsRTL = getDirectionIsRTL(_target);\r\n assignDeep(updateHints, { _directionChanged: prevDirectionIsRTL !== newDirectionIsRTL });\r\n assignDeep(state, { _directionIsRTL: newDirectionIsRTL });\r\n prevDirectionIsRTL = newDirectionIsRTL;\r\n }\r\n };\r\n\r\n const updateViewportAttrsFromHost = (attributes?: string[]) => {\r\n each(attributes || viewportAttrsFromTarget, (attribute) => {\r\n if (inArray(viewportAttrsFromTarget, attribute)) {\r\n const hostAttr = getAttr(_host, attribute);\r\n if (isString(hostAttr)) {\r\n setAttrs(_viewport, attribute, hostAttr);\r\n } else {\r\n removeAttrs(_viewport, attribute);\r\n }\r\n }\r\n });\r\n };\r\n\r\n const onTrinsicChanged = (\r\n heightIntrinsicCache: CacheValues,\r\n fromRecords?: true\r\n ): ObserversSetupUpdateHints => {\r\n const [heightIntrinsic, heightIntrinsicChanged] = heightIntrinsicCache;\r\n const updateHints: ObserversSetupUpdateHints = {\r\n _heightIntrinsicChanged: heightIntrinsicChanged,\r\n };\r\n\r\n assignDeep(state, { _heightIntrinsic: heightIntrinsic });\r\n !fromRecords && onObserversUpdated(updateHints);\r\n\r\n return updateHints;\r\n };\r\n\r\n const onSizeChanged = ({\r\n _sizeChanged,\r\n _directionIsRTLCache,\r\n _appear,\r\n }: SizeObserverCallbackParams) => {\r\n const exclusiveSizeChange = _sizeChanged && !_appear && !_directionIsRTLCache;\r\n const updateFn =\r\n // use debounceed update:\r\n // if native scrollbars hiding is supported\r\n // and if the update is more than just a exclusive sizeChange (e.g. size change + appear, or size change + direction)\r\n !exclusiveSizeChange && _nativeScrollbarsHiding\r\n ? onObserversUpdatedDebounced\r\n : onObserversUpdated;\r\n\r\n const [directionIsRTL, directionIsRTLChanged] = _directionIsRTLCache || [];\r\n const updateHints: ObserversSetupUpdateHints = {\r\n _sizeChanged: _sizeChanged || _appear,\r\n _appear,\r\n _directionChanged: directionIsRTLChanged,\r\n };\r\n\r\n setDirectionWhenViewportIsTarget(updateHints);\r\n\r\n _directionIsRTLCache && assignDeep(state, { _directionIsRTL: directionIsRTL });\r\n\r\n updateFn(updateHints);\r\n };\r\n\r\n const onContentMutation = (\r\n contentChangedThroughEvent: boolean,\r\n fromRecords?: true\r\n ): ObserversSetupUpdateHints => {\r\n const [, _contentMutation] = updateContentSizeCache();\r\n const updateHints: ObserversSetupUpdateHints = {\r\n _contentMutation,\r\n };\r\n\r\n setDirectionWhenViewportIsTarget(updateHints);\r\n\r\n // if contentChangedThroughEvent is true its already debounced\r\n const updateFn = contentChangedThroughEvent ? onObserversUpdated : onObserversUpdatedDebounced;\r\n\r\n _contentMutation && !fromRecords && updateFn(updateHints);\r\n\r\n return updateHints;\r\n };\r\n\r\n const onHostMutation = (\r\n targetChangedAttrs: string[],\r\n targetStyleChanged: boolean,\r\n fromRecords?: true\r\n ): ObserversSetupUpdateHints => {\r\n const updateHints: ObserversSetupUpdateHints = {\r\n _hostMutation: targetStyleChanged,\r\n };\r\n\r\n setDirectionWhenViewportIsTarget(updateHints);\r\n\r\n if (targetStyleChanged && !fromRecords) {\r\n onObserversUpdatedDebounced(updateHints);\r\n } else if (!_viewportIsTarget) {\r\n updateViewportAttrsFromHost(targetChangedAttrs);\r\n }\r\n\r\n return updateHints;\r\n };\r\n\r\n const { _addResizeListener } = env;\r\n const [constructTrinsicObserver, updateTrinsicObserver] = _content\r\n ? createTrinsicObserver(_host, onTrinsicChanged)\r\n : [];\r\n\r\n const constructSizeObserver =\r\n !_viewportIsTarget &&\r\n createSizeObserver(_host, onSizeChanged, {\r\n _appear: true,\r\n _direction: true,\r\n });\r\n\r\n const [constructHostMutationObserver, updateHostMutationObserver] = createDOMObserver(\r\n _host,\r\n false,\r\n onHostMutation,\r\n {\r\n _styleChangingAttributes: baseStyleChangingAttrs,\r\n _attributes: concat(baseStyleChangingAttrs, viewportAttrsFromTarget),\r\n }\r\n );\r\n\r\n const viewportIsTargetResizeObserver =\r\n _viewportIsTarget &&\r\n ResizeObserverConstructor &&\r\n new ResizeObserverConstructor((entries) => {\r\n const currContentRect = entries[entries.length - 1].contentRect;\r\n onSizeChanged({\r\n _sizeChanged: true,\r\n _appear: domRectAppeared(currContentRect, prevContentRect),\r\n });\r\n prevContentRect = currContentRect;\r\n });\r\n\r\n return [\r\n () => {\r\n // order is matter!\r\n updateViewportAttrsFromHost();\r\n viewportIsTargetResizeObserver && viewportIsTargetResizeObserver.observe(_host);\r\n const destroySizeObserver = constructSizeObserver && constructSizeObserver();\r\n const destroyTrinsicObserver = constructTrinsicObserver && constructTrinsicObserver();\r\n const destroyHostMutationObserver = constructHostMutationObserver();\r\n const removeResizeListener = _addResizeListener((_scrollbarSizeChanged) => {\r\n const [, _contentMutation] = updateContentSizeCache();\r\n onObserversUpdatedDebounced({ _scrollbarSizeChanged, _contentMutation });\r\n });\r\n\r\n return () => {\r\n viewportIsTargetResizeObserver && viewportIsTargetResizeObserver.disconnect();\r\n destroySizeObserver && destroySizeObserver();\r\n destroyTrinsicObserver && destroyTrinsicObserver();\r\n destroyContentMutationObserver && destroyContentMutationObserver();\r\n destroyHostMutationObserver();\r\n removeResizeListener();\r\n };\r\n },\r\n ({ _checkOption, _takeRecords, _force }) => {\r\n const updateHints: ObserversSetupUpdateHints = {};\r\n\r\n const [ignoreMutation] = _checkOption('update.ignoreMutation');\r\n const [attributes, attributesChanged] = _checkOption('update.attributes');\r\n const [elementEvents, elementEventsChanged] = _checkOption('update.elementEvents');\r\n const [debounceValue, debounceChanged] = _checkOption('update.debounce');\r\n const contentMutationObserverChanged = elementEventsChanged || attributesChanged;\r\n const takeRecords = _takeRecords || _force;\r\n const ignoreMutationFromOptions = (mutation: MutationRecord) =>\r\n isFunction(ignoreMutation) && ignoreMutation(mutation);\r\n\r\n if (contentMutationObserverChanged) {\r\n updateContentMutationObserver && updateContentMutationObserver();\r\n destroyContentMutationObserver && destroyContentMutationObserver();\r\n\r\n const [construct, update] = createDOMObserver(\r\n _content || _viewport,\r\n true,\r\n onContentMutation,\r\n {\r\n _attributes: concat(contentMutationObserverAttr, attributes || []),\r\n _eventContentChange: elementEvents,\r\n _nestedTargetSelector: hostSelector,\r\n _ignoreContentChange: (mutation, isNestedTarget) => {\r\n const { target: mutationTarget, attributeName } = mutation;\r\n const ignore =\r\n !isNestedTarget && attributeName && !_viewportIsTarget\r\n ? liesBetween(mutationTarget, hostSelector, viewportSelector)\r\n : false;\r\n return (\r\n ignore ||\r\n !!closest(mutationTarget, `.${classNameScrollbar}`) || // ignore explicitely all scrollbar elements\r\n !!ignoreMutationFromOptions(mutation)\r\n );\r\n },\r\n }\r\n );\r\n\r\n destroyContentMutationObserver = construct();\r\n updateContentMutationObserver = update;\r\n }\r\n\r\n if (debounceChanged) {\r\n onObserversUpdatedDebounced._flush();\r\n if (isArray(debounceValue)) {\r\n const timeout = debounceValue[0];\r\n const maxWait = debounceValue[1];\r\n debounceTimeout = isNumber(timeout) && timeout;\r\n debounceMaxDelay = isNumber(maxWait) && maxWait;\r\n } else if (isNumber(debounceValue)) {\r\n debounceTimeout = debounceValue;\r\n debounceMaxDelay = false;\r\n } else {\r\n debounceTimeout = false;\r\n debounceMaxDelay = false;\r\n }\r\n }\r\n\r\n if (takeRecords) {\r\n const hostUpdateResult = updateHostMutationObserver();\r\n const trinsicUpdateResult = updateTrinsicObserver && updateTrinsicObserver();\r\n const contentUpdateResult =\r\n updateContentMutationObserver && updateContentMutationObserver();\r\n\r\n hostUpdateResult &&\r\n assignDeep(\r\n updateHints,\r\n onHostMutation(hostUpdateResult[0], hostUpdateResult[1], takeRecords)\r\n );\r\n\r\n trinsicUpdateResult &&\r\n assignDeep(updateHints, onTrinsicChanged(trinsicUpdateResult[0], takeRecords));\r\n\r\n contentUpdateResult &&\r\n assignDeep(updateHints, onContentMutation(contentUpdateResult[0], takeRecords));\r\n }\r\n\r\n setDirectionWhenViewportIsTarget(updateHints);\r\n\r\n return updateHints;\r\n },\r\n state,\r\n ];\r\n};\r\n","import {\r\n addClass,\r\n appendChildren,\r\n createDiv,\r\n getDirectionIsRTL,\r\n each,\r\n getTrasformTranslateValue,\r\n isBoolean,\r\n parent,\r\n push,\r\n removeClass,\r\n removeElements,\r\n runEachAndClear,\r\n scrollT,\r\n bind,\r\n getElmentScroll,\r\n inArray,\r\n strWidth,\r\n strHeight,\r\n concat,\r\n assignDeep,\r\n ratioToCssPercent,\r\n numberToCssPx,\r\n setStyles,\r\n createOrKeepArray,\r\n getRawScrollBounds,\r\n getRawScrollRatio,\r\n getBoundingClientRect,\r\n capNumber,\r\n} from '~/support';\r\nimport {\r\n classNameScrollbar,\r\n classNameScrollbarHorizontal,\r\n classNameScrollbarVertical,\r\n classNameScrollbarTrack,\r\n classNameScrollbarHandle,\r\n} from '~/classnames';\r\nimport { getEnvironment } from '~/environment';\r\nimport { dynamicInitializationElement as generalDynamicInitializationElement } from '~/initialization';\r\nimport type { RTLScrollBehavior } from '~/support';\r\nimport type {\r\n InitializationTarget,\r\n InitializationTargetElement,\r\n InitializationTargetObject,\r\n} from '~/initialization';\r\nimport type { StructureSetupElementsObj } from '../structureSetup/structureSetup.elements';\r\nimport type { ScrollbarsSetupEvents } from './scrollbarsSetup.events';\r\nimport type { StyleObject } from '~/typings';\r\nimport type { StructureSetupState } from '../structureSetup';\r\n\r\nexport interface ScrollbarStructure {\r\n _scrollbar: HTMLElement;\r\n _track: HTMLElement;\r\n _handle: HTMLElement;\r\n}\r\n\r\nexport interface ScrollbarsSetupElement {\r\n _scrollTimeline: AnimationTimeline | undefined;\r\n _scrollbarStructures: ScrollbarStructure[];\r\n _clone: () => ScrollbarStructure;\r\n _style: (\r\n elmStyle: (\r\n scrollbarStructure: ScrollbarStructure\r\n ) => [HTMLElement | false | null | undefined, StyleObject]\r\n ) => void;\r\n}\r\n\r\nexport interface ScrollbarsSetupElementsObj {\r\n _scrollbarsAddRemoveClass: (\r\n classNames: string | false | null | undefined,\r\n add?: boolean,\r\n isHorizontal?: boolean\r\n ) => void;\r\n _refreshScrollbarsHandleLength: () => void;\r\n _refreshScrollbarsHandleOffset: () => void;\r\n _refreshScrollbarsScrollbarOffset: () => void;\r\n _horizontal: ScrollbarsSetupElement;\r\n _vertical: ScrollbarsSetupElement;\r\n}\r\n\r\nexport type ScrollbarsSetupElements = [\r\n elements: ScrollbarsSetupElementsObj,\r\n appendElements: () => () => void\r\n];\r\n\r\ntype PotentialAnimation = Animation | false | null | undefined;\r\n\r\nexport const createScrollbarsSetupElements = (\r\n target: InitializationTarget,\r\n structureSetupElements: StructureSetupElementsObj,\r\n structureSetupState: StructureSetupState,\r\n scrollbarsSetupEvents: ScrollbarsSetupEvents\r\n): ScrollbarsSetupElements => {\r\n const { _getDefaultInitialization, _rtlScrollBehavior } = getEnvironment();\r\n const { scrollbars: defaultInitScrollbars } = _getDefaultInitialization();\r\n const { slot: defaultInitScrollbarsSlot } = defaultInitScrollbars;\r\n const {\r\n _target,\r\n _host,\r\n _viewport,\r\n _targetIsElm,\r\n _scrollOffsetElement,\r\n _isBody,\r\n _viewportIsTarget,\r\n } = structureSetupElements;\r\n const { scrollbars: scrollbarsInit } = (_targetIsElm ? {} : target) as InitializationTargetObject;\r\n const { slot: initScrollbarsSlot } = scrollbarsInit || {};\r\n const elementAnimations = new Map();\r\n const initScrollTimeline = (axis: 'x' | 'y') =>\r\n scrollT &&\r\n new scrollT({\r\n source: _scrollOffsetElement,\r\n axis,\r\n });\r\n const scrollTimelineX = initScrollTimeline('x');\r\n const scrollTimelineY = initScrollTimeline('y');\r\n const evaluatedScrollbarSlot = generalDynamicInitializationElement<\r\n [InitializationTargetElement, HTMLElement, HTMLElement]\r\n >(\r\n [_target, _host, _viewport],\r\n () => (_viewportIsTarget && _isBody ? _target : _host),\r\n defaultInitScrollbarsSlot,\r\n initScrollbarsSlot\r\n );\r\n\r\n /**\r\n * Gets the scrollbar handle length ratio.\r\n * @param isHorizontal Whether the axis is horizontal.\r\n * @param scrollbarStructure The scrollbar structure. Only passed when the length ratio is calculated for the offset ratio (respects handle min. & max. size via. css)\r\n * @returns The scrollbar handle length ratio.\r\n */\r\n const getScrollbarHandleLengthRatio = (\r\n isHorizontal?: boolean,\r\n scrollbarStructure?: ScrollbarStructure\r\n ) => {\r\n if (scrollbarStructure) {\r\n const axis = isHorizontal ? strWidth : strHeight;\r\n const { _track, _handle } = scrollbarStructure;\r\n\r\n const handleSize = getBoundingClientRect(_handle)[axis];\r\n const trackSize = getBoundingClientRect(_track)[axis];\r\n\r\n return capNumber(0, 1, handleSize / trackSize || 0);\r\n }\r\n\r\n const axis = isHorizontal ? 'x' : 'y';\r\n const { _overflowAmount, _overflowEdge } = structureSetupState;\r\n\r\n const viewportSize = _overflowEdge[axis];\r\n const overflowAmount = _overflowAmount[axis];\r\n\r\n return capNumber(0, 1, viewportSize / (viewportSize + overflowAmount) || 0);\r\n };\r\n\r\n /**\r\n * Gets the scrollbar handle offset ratio.\r\n * @param structureSetupState The structure setup state.\r\n * @param scrollbarStructure The scrollbar structure.\r\n * @param scrollPercent The scroll percent 0..1.\r\n * @param isHorizontal Whether the axis is horizontal.\r\n * @returns The scrollbar handle offset ratio.\r\n */\r\n const getScrollbarHandleOffsetRatio = (\r\n scrollbarStructure: ScrollbarStructure,\r\n scrollPercent: number,\r\n isHorizontal?: boolean,\r\n rtlScrollBehavior?: RTLScrollBehavior\r\n ) => {\r\n const lengthRatio = getScrollbarHandleLengthRatio(isHorizontal, scrollbarStructure);\r\n\r\n return (\r\n (1 / lengthRatio) *\r\n (1 - lengthRatio) *\r\n (rtlScrollBehavior ? 1 - scrollPercent : scrollPercent) || 0\r\n );\r\n };\r\n\r\n /**\r\n * Adds additional directional keyframes to the passed keyframes.\r\n * @param keyframes The keyframes.\r\n * @param directionRTL Whether the direction is RTL.\r\n * @returns The passed keyframes with additional directional keyframes.\r\n */\r\n const addDirectionRTLKeyframes = (\r\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\r\n directionRTL?: boolean | RTLScrollBehavior\r\n ) =>\r\n assignDeep(\r\n keyframes,\r\n directionRTL\r\n ? {\r\n clear: ['left'], // dummy keyframe for direction rtl animation because of chrome bug\r\n }\r\n : {}\r\n );\r\n\r\n /**\r\n * Cancels the animations of the passed elements or of all elements if no elements are passed.\r\n * @param elements The elements of which the animation shall be canceled.\r\n */\r\n const cancelElementAnimations = (elements?: HTMLElement | HTMLElement[]) => {\r\n elementAnimations.forEach((currAnimations, element) => {\r\n const doCancel = elements ? inArray(createOrKeepArray(elements), element) : true;\r\n if (doCancel) {\r\n each(currAnimations || [], (animation) => {\r\n animation && animation.cancel();\r\n });\r\n elementAnimations.delete(element);\r\n }\r\n });\r\n };\r\n\r\n /**\r\n * Sets of overwrites the animation of the passed element.\r\n * @param element The element of which the animation shall be set.\r\n * @param timeline The animation timeline of the animation.\r\n * @param keyframes The keyframes of the animation.\r\n * @param composite The composite information of the animation.\r\n */\r\n const setElementAnimation = (\r\n element: HTMLElement,\r\n timeline: AnimationTimeline,\r\n keyframes: Keyframe[] | PropertyIndexedKeyframes | null,\r\n composite?: CompositeOperation\r\n ) => {\r\n const activeAnimations = elementAnimations.get(element) || [];\r\n const activeAnimation = activeAnimations.find(\r\n (animation) => animation && animation.timeline === timeline\r\n );\r\n\r\n if (activeAnimation) {\r\n activeAnimation.effect = new KeyframeEffect(element, keyframes, { composite });\r\n } else {\r\n elementAnimations.set(\r\n element,\r\n concat(activeAnimations, [\r\n element.animate(keyframes, {\r\n timeline,\r\n composite,\r\n }),\r\n ])\r\n );\r\n }\r\n };\r\n\r\n const scrollbarStructureAddRemoveClass = (\r\n scrollbarStructures: ScrollbarStructure[],\r\n classNames: string | false | null | undefined,\r\n add?: boolean\r\n ) => {\r\n const action = add ? addClass : removeClass;\r\n each(scrollbarStructures, (scrollbarStructure) => {\r\n action(scrollbarStructure._scrollbar, classNames);\r\n });\r\n };\r\n const scrollbarStyle = (\r\n scrollbarStructures: ScrollbarStructure[],\r\n elmStyle: (\r\n scrollbarStructure: ScrollbarStructure\r\n ) => [HTMLElement | false | null | undefined, StyleObject]\r\n ) => {\r\n each(scrollbarStructures, (scrollbarStructure) => {\r\n const [elm, styles] = elmStyle(scrollbarStructure);\r\n setStyles(elm, styles);\r\n });\r\n };\r\n const scrollbarStructureRefreshHandleLength = (\r\n scrollbarStructures: ScrollbarStructure[],\r\n isHorizontal?: boolean\r\n ) => {\r\n scrollbarStyle(scrollbarStructures, (structure) => {\r\n const { _handle } = structure;\r\n return [\r\n _handle,\r\n {\r\n [isHorizontal ? strWidth : strHeight]: ratioToCssPercent(\r\n getScrollbarHandleLengthRatio(isHorizontal)\r\n ),\r\n },\r\n ];\r\n });\r\n };\r\n const scrollbarStructureRefreshHandleOffset = (\r\n scrollbarStructures: ScrollbarStructure[],\r\n isHorizontal?: boolean\r\n ) => {\r\n const { _overflowAmount } = structureSetupState;\r\n const overflowAmount = isHorizontal ? _overflowAmount.x : _overflowAmount.y;\r\n const getTransformValue = (\r\n structure: ScrollbarStructure,\r\n rawScrollPosition: number,\r\n rtlScrollBehavior: RTLScrollBehavior\r\n ) =>\r\n getTrasformTranslateValue(\r\n ratioToCssPercent(\r\n getScrollbarHandleOffsetRatio(\r\n structure,\r\n getRawScrollRatio(rawScrollPosition, overflowAmount, rtlScrollBehavior),\r\n isHorizontal,\r\n rtlScrollBehavior\r\n )\r\n ),\r\n isHorizontal\r\n );\r\n if (scrollTimelineX && scrollTimelineY) {\r\n each(scrollbarStructures, (structure: ScrollbarStructure) => {\r\n const { _scrollbar, _handle } = structure;\r\n const rtlScrollBehavior =\r\n isHorizontal && getDirectionIsRTL(_scrollbar) && _rtlScrollBehavior;\r\n\r\n setElementAnimation(\r\n _handle,\r\n isHorizontal ? scrollTimelineX : scrollTimelineY,\r\n addDirectionRTLKeyframes(\r\n {\r\n transform: getRawScrollBounds(overflowAmount, rtlScrollBehavior).map((bound) =>\r\n getTransformValue(structure, bound, rtlScrollBehavior)\r\n ),\r\n },\r\n rtlScrollBehavior\r\n )\r\n );\r\n });\r\n } else {\r\n const scroll = getElmentScroll(_scrollOffsetElement);\r\n scrollbarStyle(scrollbarStructures, (structure) => {\r\n const { _handle, _scrollbar } = structure;\r\n return [\r\n _handle,\r\n {\r\n transform: getTransformValue(\r\n structure,\r\n isHorizontal ? scroll.x : scroll.y,\r\n isHorizontal && getDirectionIsRTL(_scrollbar) && _rtlScrollBehavior\r\n ),\r\n },\r\n ];\r\n });\r\n }\r\n };\r\n const doRefreshScrollbarOffset = (scrollbar: HTMLElement) =>\r\n _viewportIsTarget && !_isBody && parent(scrollbar) === _viewport;\r\n\r\n const destroyFns: (() => void)[] = [];\r\n const horizontalScrollbars: ScrollbarStructure[] = [];\r\n const verticalScrollbars: ScrollbarStructure[] = [];\r\n\r\n const scrollbarsAddRemoveClass = (\r\n className: string | false | null | undefined,\r\n add?: boolean,\r\n onlyHorizontal?: boolean\r\n ) => {\r\n const singleAxis = isBoolean(onlyHorizontal);\r\n const runHorizontal = singleAxis ? onlyHorizontal : true;\r\n const runVertical = singleAxis ? !onlyHorizontal : true;\r\n runHorizontal && scrollbarStructureAddRemoveClass(horizontalScrollbars, className, add);\r\n runVertical && scrollbarStructureAddRemoveClass(verticalScrollbars, className, add);\r\n };\r\n const refreshScrollbarsHandleLength = () => {\r\n scrollbarStructureRefreshHandleLength(horizontalScrollbars, true);\r\n scrollbarStructureRefreshHandleLength(verticalScrollbars);\r\n };\r\n const refreshScrollbarsHandleOffset = () => {\r\n scrollbarStructureRefreshHandleOffset(horizontalScrollbars, true);\r\n scrollbarStructureRefreshHandleOffset(verticalScrollbars);\r\n };\r\n const refreshScrollbarsScrollbarOffset = () => {\r\n if (_viewportIsTarget) {\r\n const { _overflowAmount } = structureSetupState;\r\n const cushion = 0.5; // otherwise it sometimes happens that scrolling to 100% will cause the scrollbars to disappear\r\n if (scrollTimelineX && scrollTimelineY) {\r\n each(concat(verticalScrollbars, horizontalScrollbars), ({ _scrollbar }) => {\r\n if (doRefreshScrollbarOffset(_scrollbar)) {\r\n const setScrollbarElementAnimation = (\r\n timeline: AnimationTimeline,\r\n overflowAmount: number,\r\n isHorizontal?: boolean\r\n ) => {\r\n const rtlScrollBehavior =\r\n isHorizontal && getDirectionIsRTL(_scrollbar) && _rtlScrollBehavior;\r\n setElementAnimation(\r\n _scrollbar,\r\n timeline,\r\n addDirectionRTLKeyframes(\r\n {\r\n transform: getRawScrollBounds(overflowAmount - cushion, rtlScrollBehavior).map(\r\n (bound) => getTrasformTranslateValue(numberToCssPx(bound), isHorizontal)\r\n ),\r\n },\r\n rtlScrollBehavior\r\n ),\r\n 'add'\r\n );\r\n };\r\n\r\n setScrollbarElementAnimation(scrollTimelineX, _overflowAmount.x, true);\r\n setScrollbarElementAnimation(scrollTimelineY, _overflowAmount.y);\r\n } else {\r\n cancelElementAnimations(_scrollbar);\r\n }\r\n });\r\n } else {\r\n const scroll = getElmentScroll(_scrollOffsetElement);\r\n const styleScrollbarPosition = (structure: ScrollbarStructure) => {\r\n const { _scrollbar } = structure;\r\n const elm = doRefreshScrollbarOffset(_scrollbar) && _scrollbar;\r\n const getTranslateValue = (\r\n axisScroll: number,\r\n axisOverflowAmount: number,\r\n rtlScrollBehavior?: RTLScrollBehavior\r\n ) => {\r\n const percent = getRawScrollRatio(axisScroll, axisOverflowAmount, rtlScrollBehavior);\r\n const px = axisOverflowAmount * percent;\r\n return numberToCssPx(rtlScrollBehavior ? -px : px);\r\n };\r\n\r\n return [\r\n elm,\r\n {\r\n transform: elm\r\n ? getTrasformTranslateValue({\r\n x: getTranslateValue(\r\n scroll.x,\r\n _overflowAmount.x,\r\n getDirectionIsRTL(_scrollbar) && _rtlScrollBehavior\r\n ),\r\n y: getTranslateValue(scroll.y, _overflowAmount.y),\r\n })\r\n : '',\r\n },\r\n ] as [HTMLElement | false, StyleObject];\r\n };\r\n scrollbarStyle(horizontalScrollbars, styleScrollbarPosition);\r\n scrollbarStyle(verticalScrollbars, styleScrollbarPosition);\r\n }\r\n }\r\n };\r\n const generateScrollbarDOM = (isHorizontal?: boolean): ScrollbarStructure => {\r\n const scrollbarClassName = isHorizontal\r\n ? classNameScrollbarHorizontal\r\n : classNameScrollbarVertical;\r\n const scrollbar = createDiv(`${classNameScrollbar} ${scrollbarClassName}`);\r\n const track = createDiv(classNameScrollbarTrack);\r\n const handle = createDiv(classNameScrollbarHandle);\r\n const result = {\r\n _scrollbar: scrollbar,\r\n _track: track,\r\n _handle: handle,\r\n };\r\n\r\n push(isHorizontal ? horizontalScrollbars : verticalScrollbars, result);\r\n push(destroyFns, [\r\n appendChildren(scrollbar, track),\r\n appendChildren(track, handle),\r\n bind(removeElements, scrollbar),\r\n cancelElementAnimations,\r\n scrollbarsSetupEvents(\r\n result,\r\n scrollbarsAddRemoveClass,\r\n scrollbarStructureRefreshHandleOffset,\r\n isHorizontal\r\n ),\r\n ]);\r\n\r\n return result;\r\n };\r\n const generateHorizontalScrollbarStructure = bind(generateScrollbarDOM, true);\r\n const generateVerticalScrollbarStructure = bind(generateScrollbarDOM, false);\r\n const appendElements = () => {\r\n appendChildren(evaluatedScrollbarSlot, horizontalScrollbars[0]._scrollbar);\r\n appendChildren(evaluatedScrollbarSlot, verticalScrollbars[0]._scrollbar);\r\n\r\n return bind(runEachAndClear, destroyFns);\r\n };\r\n\r\n generateHorizontalScrollbarStructure();\r\n generateVerticalScrollbarStructure();\r\n\r\n return [\r\n {\r\n _refreshScrollbarsHandleLength: refreshScrollbarsHandleLength,\r\n _refreshScrollbarsHandleOffset: refreshScrollbarsHandleOffset,\r\n _refreshScrollbarsScrollbarOffset: refreshScrollbarsScrollbarOffset,\r\n _scrollbarsAddRemoveClass: scrollbarsAddRemoveClass,\r\n _horizontal: {\r\n _scrollTimeline: scrollTimelineX,\r\n _scrollbarStructures: horizontalScrollbars,\r\n _clone: generateHorizontalScrollbarStructure,\r\n _style: bind(scrollbarStyle, horizontalScrollbars),\r\n },\r\n _vertical: {\r\n _scrollTimeline: scrollTimelineY,\r\n _scrollbarStructures: verticalScrollbars,\r\n _clone: generateVerticalScrollbarStructure,\r\n _style: bind(scrollbarStyle, verticalScrollbars),\r\n },\r\n },\r\n appendElements,\r\n ];\r\n};\r\n","import {\r\n getBoundingClientRect,\r\n offsetSize,\r\n addEventListener,\r\n preventDefault,\r\n runEachAndClear,\r\n stopPropagation,\r\n selfClearTimeout,\r\n parent,\r\n closest,\r\n push,\r\n bind,\r\n mathRound,\r\n strWidth,\r\n strHeight,\r\n getElmentScroll,\r\n scrollElementTo,\r\n addAttrClass,\r\n getFocusedElement,\r\n setT,\r\n hasAttr,\r\n} from '~/support';\r\nimport { clickScrollPluginModuleName, getStaticPluginModuleInstance } from '~/plugins';\r\nimport {\r\n classNameScrollbarHandle,\r\n classNameScrollbarInteraction,\r\n classNameScrollbarWheel,\r\n dataAttributeHost,\r\n dataAttributeViewport,\r\n dataValueHostScrollbarPressed,\r\n} from '~/classnames';\r\nimport type { ClickScrollPlugin } from '~/plugins';\r\nimport type { ReadonlyOptions } from '~/options';\r\nimport type { StructureSetupState } from '~/setups';\r\nimport type { ScrollbarsSetupElementsObj, ScrollbarStructure } from './scrollbarsSetup.elements';\r\nimport type { StructureSetupElementsObj } from '../structureSetup/structureSetup.elements';\r\n\r\nexport type ScrollbarsSetupEvents = (\r\n scrollbarStructure: ScrollbarStructure,\r\n scrollbarsAddRemoveClass: ScrollbarsSetupElementsObj['_scrollbarsAddRemoveClass'],\r\n refreshScrollbarStructuresHandleOffset: (\r\n scrollbarStructure: ScrollbarStructure[],\r\n isHorizontal?: boolean\r\n ) => void,\r\n isHorizontal?: boolean\r\n) => () => void;\r\n\r\nexport const createScrollbarsSetupEvents = (\r\n options: ReadonlyOptions,\r\n structureSetupElements: StructureSetupElementsObj,\r\n structureSetupState: StructureSetupState,\r\n scrollbarHandlePointerInteraction: (event: PointerEvent) => void\r\n): ScrollbarsSetupEvents => {\r\n const { _host, _viewport, _viewportIsTarget, _scrollOffsetElement, _documentElm } =\r\n structureSetupElements;\r\n\r\n return (\r\n scrollbarStructure,\r\n scrollbarsAddRemoveClass,\r\n refreshScrollbarStructuresHandleOffset,\r\n isHorizontal\r\n ) => {\r\n const { _scrollbar, _track, _handle } = scrollbarStructure;\r\n const [wheelTimeout, clearWheelTimeout] = selfClearTimeout(333);\r\n const [requestHandleTransitionAnimationFrame, cancelHandleTransitionTimeout] =\r\n selfClearTimeout();\r\n const refreshHandleOffsetTransition = bind(\r\n refreshScrollbarStructuresHandleOffset,\r\n [scrollbarStructure],\r\n isHorizontal\r\n );\r\n const scrollByFn = !!_scrollOffsetElement.scrollBy;\r\n\r\n const clientXYKey = `client${isHorizontal ? 'X' : 'Y'}` as 'clientX' | 'clientY';\r\n const widthHeightKey = isHorizontal ? strWidth : strHeight;\r\n const leftTopKey = isHorizontal ? 'left' : 'top';\r\n const whKey = isHorizontal ? 'w' : 'h';\r\n const xyKey = isHorizontal ? 'x' : 'y';\r\n\r\n const isAffectingTransition = (event: TransitionEvent) =>\r\n event.propertyName.indexOf(widthHeightKey) > -1;\r\n\r\n const createInteractiveScrollEvents = () => {\r\n const releasePointerCaptureEvents = 'pointerup pointerleave pointercancel lostpointercapture';\r\n\r\n const createRelativeHandleMove =\r\n (mouseDownScroll: number, invertedScale: number) => (deltaMovement: number) => {\r\n const { _overflowAmount } = structureSetupState;\r\n const handleTrackDiff = offsetSize(_track)[whKey] - offsetSize(_handle)[whKey];\r\n const scrollDeltaPercent = (invertedScale * deltaMovement) / handleTrackDiff;\r\n const scrollDelta = scrollDeltaPercent * _overflowAmount[xyKey];\r\n\r\n scrollElementTo(_scrollOffsetElement, {\r\n [xyKey]: mouseDownScroll + scrollDelta,\r\n });\r\n };\r\n\r\n return addEventListener(_track, 'pointerdown', (pointerDownEvent: PointerEvent) => {\r\n const isDragScroll =\r\n closest(pointerDownEvent.target as Node, `.${classNameScrollbarHandle}`) === _handle;\r\n const pointerCaptureElement = isDragScroll ? _handle : _track;\r\n\r\n const scrollbarOptions = options.scrollbars;\r\n const { button, isPrimary, pointerType } = pointerDownEvent;\r\n const { pointers } = scrollbarOptions;\r\n\r\n const continuePointerDown =\r\n button === 0 &&\r\n isPrimary &&\r\n scrollbarOptions[isDragScroll ? 'dragScroll' : 'clickScroll'] &&\r\n (pointers || []).includes(pointerType);\r\n\r\n if (continuePointerDown) {\r\n const instantClickScroll = !isDragScroll && pointerDownEvent.shiftKey;\r\n const getHandleRect = bind(getBoundingClientRect, _handle);\r\n const getTrackRect = bind(getBoundingClientRect, _track);\r\n const getHandleOffset = (handleRect?: DOMRect, trackRect?: DOMRect) =>\r\n (handleRect || getHandleRect())[leftTopKey] - (trackRect || getTrackRect())[leftTopKey];\r\n const axisScale =\r\n mathRound(getBoundingClientRect(_scrollOffsetElement)[widthHeightKey]) /\r\n offsetSize(_scrollOffsetElement)[whKey] || 1;\r\n const moveHandleRelative = createRelativeHandleMove(\r\n getElmentScroll(_scrollOffsetElement)[xyKey] || 0,\r\n 1 / axisScale\r\n );\r\n const pointerDownOffset = pointerDownEvent[clientXYKey];\r\n const handleRect = getHandleRect();\r\n const trackRect = getTrackRect();\r\n const handleLength = handleRect[widthHeightKey];\r\n const handleCenter = getHandleOffset(handleRect, trackRect) + handleLength / 2;\r\n const relativeTrackPointerOffset = pointerDownOffset - trackRect[leftTopKey];\r\n const startOffset = isDragScroll ? 0 : relativeTrackPointerOffset - handleCenter;\r\n const releasePointerCapture = (pointerUpEvent: PointerEvent) => {\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n runEachAndClear(offFns);\r\n pointerCaptureElement.releasePointerCapture(pointerUpEvent.pointerId);\r\n };\r\n const removeAttrClass = addAttrClass(\r\n _host,\r\n dataAttributeHost,\r\n dataValueHostScrollbarPressed\r\n );\r\n\r\n const offFns = [\r\n removeAttrClass,\r\n addEventListener(_documentElm, releasePointerCaptureEvents, releasePointerCapture),\r\n addEventListener(_documentElm, 'selectstart', (event: Event) => preventDefault(event), {\r\n _passive: false,\r\n }),\r\n addEventListener(_track, releasePointerCaptureEvents, releasePointerCapture),\r\n addEventListener(_track, 'pointermove', (pointerMoveEvent: PointerEvent) => {\r\n const relativeMovement = pointerMoveEvent[clientXYKey] - pointerDownOffset;\r\n\r\n if (isDragScroll || instantClickScroll) {\r\n moveHandleRelative(startOffset + relativeMovement);\r\n }\r\n }),\r\n ];\r\n\r\n pointerCaptureElement.setPointerCapture(pointerDownEvent.pointerId);\r\n\r\n if (instantClickScroll) {\r\n moveHandleRelative(startOffset);\r\n } else if (!isDragScroll) {\r\n const animateClickScroll = getStaticPluginModuleInstance(\r\n clickScrollPluginModuleName\r\n );\r\n\r\n animateClickScroll &&\r\n push(\r\n offFns,\r\n animateClickScroll(\r\n moveHandleRelative,\r\n getHandleOffset,\r\n startOffset,\r\n handleLength,\r\n relativeTrackPointerOffset\r\n )\r\n );\r\n }\r\n }\r\n });\r\n };\r\n\r\n let wheelScrollBy = true;\r\n\r\n return bind(runEachAndClear, [\r\n addEventListener(_handle, 'pointermove pointerleave', scrollbarHandlePointerInteraction),\r\n addEventListener(_scrollbar, 'pointerenter', () => {\r\n scrollbarsAddRemoveClass(classNameScrollbarInteraction, true);\r\n }),\r\n addEventListener(_scrollbar, 'pointerleave pointercancel', () => {\r\n scrollbarsAddRemoveClass(classNameScrollbarInteraction, false);\r\n }),\r\n // focus viewport when clicking on a scrollbar\r\n !_viewportIsTarget &&\r\n addEventListener(_scrollbar, 'mousedown', () => {\r\n const focusedElement = getFocusedElement();\r\n if (\r\n hasAttr(focusedElement, dataAttributeViewport) ||\r\n hasAttr(focusedElement, dataAttributeHost) ||\r\n focusedElement === document.body\r\n ) {\r\n setT(() => {\r\n _viewport.focus({ preventScroll: true });\r\n }, 25);\r\n }\r\n }),\r\n // propagate wheel events to viewport when mouse is over scrollbar\r\n addEventListener(\r\n _scrollbar,\r\n 'wheel',\r\n (wheelEvent: WheelEvent) => {\r\n const { deltaX, deltaY, deltaMode } = wheelEvent;\r\n\r\n // the first wheel event is swallowed, simulate scroll to compensate for it\r\n if (scrollByFn && wheelScrollBy && deltaMode === 0 && parent(_scrollbar) === _host) {\r\n _scrollOffsetElement.scrollBy({\r\n left: deltaX,\r\n top: deltaY,\r\n behavior: 'smooth',\r\n });\r\n }\r\n\r\n wheelScrollBy = false;\r\n scrollbarsAddRemoveClass(classNameScrollbarWheel, true);\r\n wheelTimeout(() => {\r\n wheelScrollBy = true;\r\n scrollbarsAddRemoveClass(classNameScrollbarWheel);\r\n });\r\n\r\n preventDefault(wheelEvent);\r\n },\r\n { _passive: false, _capture: true }\r\n ),\r\n // when the handle has a size transition, update the handle offset each frame for the time of the transition\r\n addEventListener(_handle, 'transitionstart', (event: TransitionEvent) => {\r\n if (isAffectingTransition(event)) {\r\n const animateHandleOffset = () => {\r\n refreshHandleOffsetTransition();\r\n requestHandleTransitionAnimationFrame(animateHandleOffset);\r\n };\r\n animateHandleOffset();\r\n }\r\n }),\r\n addEventListener(_handle, 'transitionend transitioncancel', (event: TransitionEvent) => {\r\n if (isAffectingTransition(event)) {\r\n cancelHandleTransitionTimeout();\r\n refreshHandleOffsetTransition();\r\n }\r\n }),\r\n // rootClickStopPropagationEvent\r\n addEventListener(\r\n _scrollbar,\r\n 'mousedown',\r\n bind(addEventListener, _documentElm, 'click', stopPropagation, {\r\n _once: true,\r\n _capture: true,\r\n }),\r\n { _capture: true }\r\n ),\r\n createInteractiveScrollEvents(),\r\n clearWheelTimeout,\r\n cancelHandleTransitionTimeout,\r\n ]);\r\n };\r\n};\r\n","import { bind, noop, addEventListener, push, runEachAndClear, selfClearTimeout } from '~/support';\r\nimport { getEnvironment } from '~/environment';\r\nimport {\r\n classNameScrollbarThemeNone,\r\n classNameScrollbarVisible,\r\n classNameScrollbarUnusable,\r\n classNameScrollbarCornerless,\r\n classNameScrollbarAutoHideHidden,\r\n classNameScrollbarHandleInteractive,\r\n classNameScrollbarTrackInteractive,\r\n classNameScrollbarRtl,\r\n classNameScrollbarAutoHide,\r\n} from '~/classnames';\r\nimport type { OverflowBehavior, ReadonlyOptions } from '~/options';\r\nimport type { ScrollbarsSetupElementsObj } from './scrollbarsSetup.elements';\r\nimport type {\r\n ObserversSetupState,\r\n ObserversSetupUpdateHints,\r\n Setup,\r\n SetupUpdateInfo,\r\n StructureSetupState,\r\n StructureSetupUpdateHints,\r\n} from '~/setups';\r\nimport type { InitializationTarget } from '~/initialization';\r\nimport type { OverflowStyle } from '~/typings';\r\nimport type { StructureSetupElementsObj } from '../structureSetup/structureSetup.elements';\r\nimport { createScrollbarsSetupElements } from './scrollbarsSetup.elements';\r\nimport { createScrollbarsSetupEvents } from './scrollbarsSetup.events';\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\r\nexport interface ScrollbarsSetupState {}\r\n\r\nexport interface ScrollbarsSetupUpdateInfo extends SetupUpdateInfo {\r\n _observersUpdateHints?: ObserversSetupUpdateHints;\r\n _structureUpdateHints?: StructureSetupUpdateHints;\r\n}\r\n\r\nexport type ScrollbarsSetup = [\r\n ...Setup,\r\n /** The elements created by the scrollbars setup. */\r\n ScrollbarsSetupElementsObj\r\n];\r\n\r\nexport const createScrollbarsSetup = (\r\n target: InitializationTarget,\r\n options: ReadonlyOptions,\r\n observersSetupState: ObserversSetupState,\r\n structureSetupState: StructureSetupState,\r\n structureSetupElements: StructureSetupElementsObj,\r\n onScroll: (event: Event) => void\r\n): ScrollbarsSetup => {\r\n let mouseInHost: boolean | undefined;\r\n let autoHideIsMove: boolean | undefined;\r\n let autoHideIsLeave: boolean | undefined;\r\n let autoHideIsNever: boolean | undefined;\r\n let prevTheme: string | null | undefined;\r\n let instanceAutoHideSuspendScrollDestroyFn = noop;\r\n let instanceAutoHideDelay = 0;\r\n\r\n // needed to not fire unnecessary operations for pointer events on safari which will cause side effects: https://github.com/KingSora/OverlayScrollbars/issues/560\r\n const isHoverablePointerType = (event: PointerEvent) => event.pointerType === 'mouse';\r\n\r\n const [requestScrollAnimationFrame, cancelScrollAnimationFrame] = selfClearTimeout();\r\n const [autoHideInstantInteractionTimeout, clearAutoHideInstantInteractionTimeout] =\r\n selfClearTimeout(100);\r\n const [autoHideSuspendTimeout, clearAutoHideSuspendTimeout] = selfClearTimeout(100);\r\n const [auotHideTimeout, clearAutoHideTimeout] = selfClearTimeout(() => instanceAutoHideDelay);\r\n const [elements, appendElements] = createScrollbarsSetupElements(\r\n target,\r\n structureSetupElements,\r\n structureSetupState,\r\n createScrollbarsSetupEvents(\r\n options,\r\n structureSetupElements,\r\n structureSetupState,\r\n (event) =>\r\n isHoverablePointerType(event) &&\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n manageScrollbarsAutoHideInstantInteraction()\r\n )\r\n );\r\n const { _host, _scrollEventElement, _isBody } = structureSetupElements;\r\n const {\r\n _scrollbarsAddRemoveClass,\r\n _refreshScrollbarsHandleLength,\r\n _refreshScrollbarsHandleOffset,\r\n _refreshScrollbarsScrollbarOffset,\r\n } = elements;\r\n const manageScrollbarsAutoHide = (removeAutoHide: boolean, delayless?: boolean) => {\r\n clearAutoHideTimeout();\r\n if (removeAutoHide) {\r\n _scrollbarsAddRemoveClass(classNameScrollbarAutoHideHidden);\r\n } else {\r\n const hide = bind(_scrollbarsAddRemoveClass, classNameScrollbarAutoHideHidden, true);\r\n if (instanceAutoHideDelay > 0 && !delayless) {\r\n auotHideTimeout(hide);\r\n } else {\r\n hide();\r\n }\r\n }\r\n };\r\n const manageScrollbarsAutoHideInstantInteraction = () => {\r\n if (autoHideIsLeave ? !mouseInHost : !autoHideIsNever) {\r\n manageScrollbarsAutoHide(true);\r\n autoHideInstantInteractionTimeout(() => {\r\n manageScrollbarsAutoHide(false);\r\n });\r\n }\r\n };\r\n const manageAutoHideSuspension = (add: boolean) => {\r\n _scrollbarsAddRemoveClass(classNameScrollbarAutoHide, add, true);\r\n _scrollbarsAddRemoveClass(classNameScrollbarAutoHide, add, false);\r\n };\r\n const onHostMouseEnter = (event: PointerEvent) => {\r\n if (isHoverablePointerType(event)) {\r\n mouseInHost = autoHideIsLeave;\r\n autoHideIsLeave && manageScrollbarsAutoHide(true);\r\n }\r\n };\r\n const destroyFns: (() => void)[] = [\r\n clearAutoHideTimeout,\r\n clearAutoHideInstantInteractionTimeout,\r\n clearAutoHideSuspendTimeout,\r\n cancelScrollAnimationFrame,\r\n () => instanceAutoHideSuspendScrollDestroyFn(),\r\n\r\n addEventListener(_host, 'pointerover', onHostMouseEnter, { _once: true }),\r\n addEventListener(_host, 'pointerenter', onHostMouseEnter),\r\n addEventListener(_host, 'pointerleave', (event: PointerEvent) => {\r\n if (isHoverablePointerType(event)) {\r\n mouseInHost = false;\r\n autoHideIsLeave && manageScrollbarsAutoHide(false);\r\n }\r\n }),\r\n addEventListener(_host, 'pointermove', (event: PointerEvent) => {\r\n isHoverablePointerType(event) &&\r\n autoHideIsMove &&\r\n manageScrollbarsAutoHideInstantInteraction();\r\n }),\r\n addEventListener(_scrollEventElement, 'scroll', (event) => {\r\n requestScrollAnimationFrame(() => {\r\n _refreshScrollbarsHandleOffset();\r\n manageScrollbarsAutoHideInstantInteraction();\r\n });\r\n\r\n onScroll(event);\r\n\r\n _refreshScrollbarsScrollbarOffset();\r\n }),\r\n ];\r\n\r\n return [\r\n () => bind(runEachAndClear, push(destroyFns, appendElements())),\r\n ({ _checkOption, _force, _observersUpdateHints, _structureUpdateHints }) => {\r\n const { _overflowEdgeChanged, _overflowAmountChanged, _overflowStyleChanged } =\r\n _structureUpdateHints || {};\r\n const { _directionChanged, _appear } = _observersUpdateHints || {};\r\n const { _directionIsRTL } = observersSetupState;\r\n const { _nativeScrollbarsOverlaid } = getEnvironment();\r\n const { _overflowStyle, _hasOverflow } = structureSetupState;\r\n const [showNativeOverlaidScrollbarsOption, showNativeOverlaidScrollbarsChanged] =\r\n _checkOption('showNativeOverlaidScrollbars');\r\n const [theme, themeChanged] = _checkOption('scrollbars.theme');\r\n const [visibility, visibilityChanged] = _checkOption('scrollbars.visibility');\r\n const [autoHide, autoHideChanged] = _checkOption('scrollbars.autoHide');\r\n const [autoHideSuspend, autoHideSuspendChanged] = _checkOption('scrollbars.autoHideSuspend');\r\n const [autoHideDelay] = _checkOption('scrollbars.autoHideDelay');\r\n const [dragScroll, dragScrollChanged] = _checkOption('scrollbars.dragScroll');\r\n const [clickScroll, clickScrollChanged] = _checkOption('scrollbars.clickScroll');\r\n const [overflow, overflowChanged] = _checkOption('overflow');\r\n const trulyAppeared = _appear && !_force;\r\n const hasOverflow = _hasOverflow.x || _hasOverflow.y;\r\n const updateScrollbars =\r\n _overflowEdgeChanged || _overflowAmountChanged || _directionChanged || _force;\r\n const updateVisibility = _overflowStyleChanged || visibilityChanged || overflowChanged;\r\n const showNativeOverlaidScrollbars =\r\n showNativeOverlaidScrollbarsOption &&\r\n _nativeScrollbarsOverlaid.x &&\r\n _nativeScrollbarsOverlaid.y;\r\n\r\n const setScrollbarVisibility = (\r\n overflowBehavior: OverflowBehavior,\r\n overflowStyle: OverflowStyle,\r\n isHorizontal: boolean\r\n ) => {\r\n const isVisible =\r\n overflowBehavior.includes('scroll') &&\r\n (visibility === 'visible' || (visibility === 'auto' && overflowStyle === 'scroll'));\r\n\r\n _scrollbarsAddRemoveClass(classNameScrollbarVisible, isVisible, isHorizontal);\r\n\r\n return isVisible;\r\n };\r\n\r\n instanceAutoHideDelay = autoHideDelay;\r\n\r\n if (trulyAppeared) {\r\n if (autoHideSuspend && hasOverflow) {\r\n manageAutoHideSuspension(false);\r\n instanceAutoHideSuspendScrollDestroyFn();\r\n autoHideSuspendTimeout(() => {\r\n instanceAutoHideSuspendScrollDestroyFn = addEventListener(\r\n _scrollEventElement,\r\n 'scroll',\r\n bind(manageAutoHideSuspension, true),\r\n {\r\n _once: true,\r\n }\r\n );\r\n });\r\n } else {\r\n manageAutoHideSuspension(true);\r\n }\r\n }\r\n\r\n if (showNativeOverlaidScrollbarsChanged) {\r\n _scrollbarsAddRemoveClass(classNameScrollbarThemeNone, showNativeOverlaidScrollbars);\r\n }\r\n\r\n if (themeChanged) {\r\n _scrollbarsAddRemoveClass(prevTheme);\r\n _scrollbarsAddRemoveClass(theme, true);\r\n\r\n prevTheme = theme;\r\n }\r\n\r\n if (autoHideSuspendChanged && !autoHideSuspend) {\r\n manageAutoHideSuspension(true);\r\n }\r\n\r\n if (autoHideChanged) {\r\n autoHideIsMove = autoHide === 'move';\r\n autoHideIsLeave = autoHide === 'leave';\r\n autoHideIsNever = autoHide === 'never';\r\n manageScrollbarsAutoHide(autoHideIsNever, true);\r\n }\r\n\r\n if (dragScrollChanged) {\r\n _scrollbarsAddRemoveClass(classNameScrollbarHandleInteractive, dragScroll);\r\n }\r\n\r\n if (clickScrollChanged) {\r\n _scrollbarsAddRemoveClass(classNameScrollbarTrackInteractive, clickScroll);\r\n }\r\n\r\n if (updateVisibility) {\r\n const xVisible = setScrollbarVisibility(overflow.x, _overflowStyle.x, true);\r\n const yVisible = setScrollbarVisibility(overflow.y, _overflowStyle.y, false);\r\n const hasCorner = xVisible && yVisible;\r\n\r\n _scrollbarsAddRemoveClass(classNameScrollbarCornerless, !hasCorner);\r\n }\r\n\r\n if (updateScrollbars) {\r\n // order is matter! length has to be refreshed before offset\r\n _refreshScrollbarsHandleLength();\r\n _refreshScrollbarsHandleOffset();\r\n _refreshScrollbarsScrollbarOffset();\r\n\r\n _scrollbarsAddRemoveClass(classNameScrollbarUnusable, !_hasOverflow.x, true);\r\n _scrollbarsAddRemoveClass(classNameScrollbarUnusable, !_hasOverflow.y, false);\r\n _scrollbarsAddRemoveClass(classNameScrollbarRtl, _directionIsRTL && !_isBody);\r\n }\r\n },\r\n {},\r\n elements,\r\n ];\r\n};\r\n","import {\r\n isHTMLElement,\r\n appendChildren,\r\n createDiv,\r\n is,\r\n contents,\r\n insertAfter,\r\n parent,\r\n removeElements,\r\n push,\r\n runEachAndClear,\r\n removeAttrs,\r\n hasAttrClass,\r\n addEventListener,\r\n bind,\r\n inArray,\r\n addAttrClass,\r\n addRemoveAttrClass,\r\n setAttrs,\r\n getAttr,\r\n noop,\r\n stopPropagation,\r\n isBodyElement,\r\n getFocusedElement,\r\n wnd,\r\n} from '~/support';\r\nimport {\r\n dataAttributeHost,\r\n dataAttributeInitialize,\r\n dataAttributeHostOverflowX,\r\n dataAttributeHostOverflowY,\r\n dataAttributeViewport,\r\n dataValueViewportScrollbarHidden,\r\n dataAttributePadding,\r\n dataAttributeContent,\r\n dataValueHostHtmlBody,\r\n} from '~/classnames';\r\nimport { getEnvironment } from '~/environment';\r\nimport {\r\n staticInitializationElement as generalStaticInitializationElement,\r\n dynamicInitializationElement as generalDynamicInitializationElement,\r\n} from '~/initialization';\r\nimport type {\r\n InitializationTarget,\r\n InitializationTargetElement,\r\n InitializationTargetObject,\r\n} from '~/initialization';\r\n\r\nexport type StructureSetupElements = [\r\n elements: StructureSetupElementsObj,\r\n appendElements: () => () => void,\r\n canceled: () => void\r\n];\r\n\r\nexport interface StructureSetupElementsObj {\r\n _target: InitializationTargetElement;\r\n _host: HTMLElement;\r\n _viewport: HTMLElement;\r\n _padding: HTMLElement | false;\r\n _content: HTMLElement | false;\r\n _scrollOffsetElement: HTMLElement;\r\n _scrollEventElement: HTMLElement | Document;\r\n _originalScrollOffsetElement: HTMLElement;\r\n // ctx ----\r\n _isTextarea: boolean;\r\n _isBody: boolean;\r\n _documentElm: Document;\r\n _targetIsElm: boolean;\r\n _viewportIsTarget: boolean;\r\n _windowElm: () => Window;\r\n _viewportHasClass: (viewportAttributeClassName: string) => boolean;\r\n _viewportAddRemoveClass: (viewportAttributeClassName: string, add?: boolean) => void;\r\n}\r\n\r\nexport const createStructureSetupElements = (\r\n target: InitializationTarget\r\n): StructureSetupElements => {\r\n const env = getEnvironment();\r\n const { _getDefaultInitialization, _nativeScrollbarsHiding } = env;\r\n const { elements: defaultInitElements } = _getDefaultInitialization();\r\n const {\r\n host: defaultHostInitialization,\r\n padding: defaultPaddingInitialization,\r\n viewport: defaultViewportInitialization,\r\n content: defaultContentInitialization,\r\n } = defaultInitElements;\r\n const targetIsElm = isHTMLElement(target);\r\n const targetStructureInitialization = (targetIsElm ? {} : target) as InitializationTargetObject;\r\n const { elements: initElements } = targetStructureInitialization;\r\n const {\r\n host: hostInitialization,\r\n padding: paddingInitialization,\r\n viewport: viewportInitialization,\r\n content: contentInitialization,\r\n } = initElements || {};\r\n\r\n const targetElement = targetIsElm ? target : targetStructureInitialization.target;\r\n const isBody = isBodyElement(targetElement);\r\n const isTextarea = is(targetElement, 'textarea');\r\n const ownerDocument = targetElement.ownerDocument;\r\n const docElement = ownerDocument.documentElement;\r\n const getDocumentWindow = () => ownerDocument.defaultView || wnd;\r\n const focusElm = (customActiveElm: Element | null) => {\r\n if (customActiveElm && (customActiveElm as HTMLElement).focus) {\r\n (customActiveElm as HTMLElement).focus({ preventScroll: true });\r\n }\r\n };\r\n const staticInitializationElement = bind(generalStaticInitializationElement, [targetElement]);\r\n const dynamicInitializationElement = bind(generalDynamicInitializationElement, [targetElement]);\r\n const createNewDiv = bind(createDiv, '');\r\n const generateViewportElement = bind(\r\n staticInitializationElement,\r\n createNewDiv,\r\n defaultViewportInitialization\r\n );\r\n const generateContentElement = bind(\r\n dynamicInitializationElement,\r\n createNewDiv,\r\n defaultContentInitialization\r\n );\r\n const possibleViewportElement = generateViewportElement(viewportInitialization);\r\n const viewportIsTarget = possibleViewportElement === targetElement;\r\n const viewportIsTargetBody = viewportIsTarget && isBody;\r\n const possibleContentElement = !viewportIsTarget && generateContentElement(contentInitialization);\r\n // edge case if passed viewportElement is contentElement:\r\n // viewport element has higher priority and content element will not be generated\r\n // will act the same way as initialization: `{ elements: { viewport, content: false } }`\r\n const viewportIsContent = !viewportIsTarget && possibleViewportElement === possibleContentElement;\r\n const viewportElement = viewportIsTargetBody ? docElement : possibleViewportElement;\r\n const nonBodyHostElement = isTextarea\r\n ? staticInitializationElement(createNewDiv, defaultHostInitialization, hostInitialization)\r\n : (targetElement as HTMLElement);\r\n const hostElement = viewportIsTargetBody ? viewportElement : nonBodyHostElement;\r\n const paddingElement =\r\n !viewportIsTarget &&\r\n dynamicInitializationElement(createNewDiv, defaultPaddingInitialization, paddingInitialization);\r\n const contentElement = !viewportIsContent && possibleContentElement;\r\n const generatedElements = [contentElement, viewportElement, paddingElement, hostElement].map(\r\n (elm) => isHTMLElement(elm) && !parent(elm) && elm\r\n );\r\n const elementIsGenerated = (elm: HTMLElement | false) => elm && inArray(generatedElements, elm);\r\n const originalNonBodyScrollOffsetElement = elementIsGenerated(viewportElement)\r\n ? targetElement\r\n : viewportElement;\r\n\r\n const evaluatedTargetObj: StructureSetupElementsObj = {\r\n _target: targetElement,\r\n _host: hostElement,\r\n _viewport: viewportElement,\r\n _padding: paddingElement,\r\n _content: contentElement,\r\n _scrollOffsetElement: viewportIsTargetBody ? docElement : viewportElement,\r\n _scrollEventElement: viewportIsTargetBody ? ownerDocument : viewportElement,\r\n _originalScrollOffsetElement: isBody ? docElement : originalNonBodyScrollOffsetElement,\r\n _documentElm: ownerDocument,\r\n _isTextarea: isTextarea,\r\n _isBody: isBody,\r\n _targetIsElm: targetIsElm,\r\n _viewportIsTarget: viewportIsTarget,\r\n _windowElm: getDocumentWindow,\r\n _viewportHasClass: (viewportAttributeClassName: string) =>\r\n hasAttrClass(\r\n viewportElement,\r\n viewportIsTarget ? dataAttributeHost : dataAttributeViewport,\r\n viewportAttributeClassName\r\n ),\r\n _viewportAddRemoveClass: (viewportAttributeClassName: string, add?: boolean) =>\r\n addRemoveAttrClass(\r\n viewportElement,\r\n viewportIsTarget ? dataAttributeHost : dataAttributeViewport,\r\n viewportAttributeClassName,\r\n add\r\n ),\r\n };\r\n const { _target, _host, _padding, _viewport, _content } = evaluatedTargetObj;\r\n const destroyFns: (() => any)[] = [\r\n () => {\r\n // always remove dataAttributeHost & dataAttributeInitialize from host and from element if target is body\r\n removeAttrs(_host, [dataAttributeHost, dataAttributeInitialize]);\r\n removeAttrs(_target, dataAttributeInitialize);\r\n if (isBody) {\r\n removeAttrs(docElement, [dataAttributeInitialize, dataAttributeHost]);\r\n }\r\n },\r\n ];\r\n const isTextareaHostGenerated = isTextarea && elementIsGenerated(_host);\r\n let targetContents = isTextarea\r\n ? _target\r\n : contents(\r\n [_content, _viewport, _padding, _host, _target].find(\r\n (elm) => elm && !elementIsGenerated(elm)\r\n )\r\n );\r\n const contentSlot = viewportIsTargetBody ? _target : _content || _viewport;\r\n const destroy = bind(runEachAndClear, destroyFns);\r\n const appendElements = () => {\r\n const docWnd = getDocumentWindow();\r\n const initActiveElm = getFocusedElement();\r\n const unwrap = (elm: HTMLElement | false | null | undefined) => {\r\n appendChildren(parent(elm), contents(elm));\r\n removeElements(elm);\r\n };\r\n // wrapping / unwrapping will cause the focused element to blur, this should prevent those events to surface\r\n const prepareWrapUnwrapFocus = (activeElement?: Element | null) =>\r\n activeElement\r\n ? addEventListener(\r\n activeElement,\r\n 'focusin focusout focus blur',\r\n (event) => {\r\n stopPropagation(event);\r\n event.stopImmediatePropagation();\r\n },\r\n {\r\n _capture: true,\r\n _passive: false,\r\n }\r\n )\r\n : noop;\r\n const tabIndexStr = 'tabindex';\r\n const ogTabindex = getAttr(_viewport, tabIndexStr);\r\n const undoInitWrapUndwrapFocus = prepareWrapUnwrapFocus(initActiveElm);\r\n setAttrs(_host, dataAttributeHost, viewportIsTarget ? 'viewport' : 'host');\r\n setAttrs(_padding, dataAttributePadding, '');\r\n setAttrs(_content, dataAttributeContent, '');\r\n\r\n if (!viewportIsTarget) {\r\n setAttrs(_viewport, dataAttributeViewport, '');\r\n setAttrs(_viewport, tabIndexStr, ogTabindex || '-1');\r\n isBody && addAttrClass(docElement, dataAttributeHost, dataValueHostHtmlBody);\r\n }\r\n\r\n // only insert host for textarea after target if it was generated\r\n if (isTextareaHostGenerated) {\r\n insertAfter(_target, _host);\r\n\r\n push(destroyFns, () => {\r\n insertAfter(_host, _target);\r\n removeElements(_host);\r\n });\r\n }\r\n\r\n appendChildren(contentSlot, targetContents);\r\n appendChildren(_host, _padding);\r\n appendChildren(_padding || _host, !viewportIsTarget && _viewport);\r\n appendChildren(_viewport, _content);\r\n\r\n push(destroyFns, [\r\n undoInitWrapUndwrapFocus,\r\n () => {\r\n const destroyActiveElm = getFocusedElement();\r\n const undoDestroyWrapUndwrapFocus = prepareWrapUnwrapFocus(destroyActiveElm);\r\n removeAttrs(_padding, dataAttributePadding);\r\n removeAttrs(_content, dataAttributeContent);\r\n removeAttrs(_viewport, [\r\n dataAttributeHostOverflowX,\r\n dataAttributeHostOverflowY,\r\n dataAttributeViewport,\r\n ]);\r\n ogTabindex\r\n ? setAttrs(_viewport, tabIndexStr, ogTabindex)\r\n : removeAttrs(_viewport, tabIndexStr);\r\n\r\n elementIsGenerated(_content) && unwrap(_content);\r\n elementIsGenerated(_viewport) && unwrap(_viewport);\r\n elementIsGenerated(_padding) && unwrap(_padding);\r\n focusElm(destroyActiveElm);\r\n undoDestroyWrapUndwrapFocus();\r\n },\r\n ]);\r\n\r\n if (_nativeScrollbarsHiding && !viewportIsTarget) {\r\n addAttrClass(_viewport, dataAttributeViewport, dataValueViewportScrollbarHidden);\r\n push(destroyFns, bind(removeAttrs, _viewport, dataAttributeViewport));\r\n }\r\n\r\n // focus viewport if previously focused element was target, otherwise focus previously focused element\r\n focusElm(\r\n !viewportIsTarget && initActiveElm === targetElement && docWnd.top === docWnd\r\n ? _viewport\r\n : initActiveElm\r\n );\r\n undoInitWrapUndwrapFocus();\r\n\r\n // @ts-ignore\r\n targetContents = 0;\r\n\r\n return destroy;\r\n };\r\n\r\n return [evaluatedTargetObj, appendElements, destroy];\r\n};\r\n","import { setStyles, strHeight } from '~/support';\r\nimport type { CreateStructureUpdateSegment } from '../structureSetup';\r\n\r\n/**\r\n * Lifecycle with the responsibility to adjust the trinsic behavior of the content element.\r\n * @param structureUpdateHub\r\n * @returns\r\n */\r\nexport const createTrinsicUpdateSegment: CreateStructureUpdateSegment =\r\n ({ _content }) =>\r\n ({ _observersUpdateHints, _observersState, _force }) => {\r\n const { _heightIntrinsicChanged } = _observersUpdateHints || {};\r\n const { _heightIntrinsic } = _observersState;\r\n const heightIntrinsicChanged = _content && (_heightIntrinsicChanged || _force);\r\n\r\n if (heightIntrinsicChanged) {\r\n setStyles(_content, {\r\n [strHeight]: _heightIntrinsic && '100%',\r\n });\r\n }\r\n };\r\n","import {\r\n createCache,\r\n topRightBottomLeft,\r\n equalTRBL,\r\n assignDeep,\r\n bind,\r\n strMarginBottom,\r\n strMarginLeft,\r\n strMarginRight,\r\n strPaddingBottom,\r\n strPaddingLeft,\r\n strPaddingRight,\r\n strPaddingTop,\r\n strWidth,\r\n setStyles,\r\n} from '~/support';\r\nimport { getEnvironment } from '~/environment';\r\nimport type { StyleObject } from '~/typings';\r\nimport type { CreateStructureUpdateSegment } from '../structureSetup';\r\n\r\n/**\r\n * Lifecycle with the responsibility to adjust the padding styling of the padding and viewport element.\r\n * @param structureUpdateHub\r\n * @returns\r\n */\r\nexport const createPaddingUpdateSegment: CreateStructureUpdateSegment = (\r\n { _host, _padding, _viewport, _viewportIsTarget },\r\n state\r\n) => {\r\n const [updatePaddingCache, currentPaddingCache] = createCache(\r\n {\r\n _equal: equalTRBL,\r\n _initialValue: topRightBottomLeft(),\r\n },\r\n bind(topRightBottomLeft, _host, 'padding', '')\r\n );\r\n\r\n return ({ _checkOption, _observersUpdateHints, _observersState, _force }) => {\r\n let [padding, paddingChanged] = currentPaddingCache(_force);\r\n const { _nativeScrollbarsHiding } = getEnvironment();\r\n const { _sizeChanged, _contentMutation, _directionChanged } = _observersUpdateHints || {};\r\n const { _directionIsRTL } = _observersState;\r\n const [paddingAbsolute, paddingAbsoluteChanged] = _checkOption('paddingAbsolute');\r\n const contentMutation = _force || _contentMutation;\r\n\r\n if (_sizeChanged || paddingChanged || contentMutation) {\r\n [padding, paddingChanged] = updatePaddingCache(_force);\r\n }\r\n\r\n const paddingStyleChanged =\r\n !_viewportIsTarget && (paddingAbsoluteChanged || _directionChanged || paddingChanged);\r\n\r\n if (paddingStyleChanged) {\r\n // if there is no padding element and no scrollbar styling, paddingAbsolute isn't supported\r\n const paddingRelative = !paddingAbsolute || (!_padding && !_nativeScrollbarsHiding);\r\n const paddingHorizontal = padding.r + padding.l;\r\n const paddingVertical = padding.t + padding.b;\r\n\r\n const paddingStyle: StyleObject = {\r\n [strMarginRight]: paddingRelative && !_directionIsRTL ? -paddingHorizontal : 0,\r\n [strMarginBottom]: paddingRelative ? -paddingVertical : 0,\r\n [strMarginLeft]: paddingRelative && _directionIsRTL ? -paddingHorizontal : 0,\r\n top: paddingRelative ? -padding.t : 0,\r\n right: paddingRelative ? (_directionIsRTL ? -padding.r : 'auto') : 0,\r\n left: paddingRelative ? (_directionIsRTL ? 'auto' : -padding.l) : 0,\r\n [strWidth]: paddingRelative && `calc(100% + ${paddingHorizontal}px)`,\r\n };\r\n const viewportStyle: StyleObject = {\r\n [strPaddingTop]: paddingRelative ? padding.t : 0,\r\n [strPaddingRight]: paddingRelative ? padding.r : 0,\r\n [strPaddingBottom]: paddingRelative ? padding.b : 0,\r\n [strPaddingLeft]: paddingRelative ? padding.l : 0,\r\n };\r\n\r\n // if there is no padding element apply the style to the viewport element instead\r\n setStyles(_padding || _viewport, paddingStyle);\r\n setStyles(_viewport, viewportStyle);\r\n\r\n assignDeep(state, {\r\n _padding: padding,\r\n _paddingAbsolute: !paddingRelative,\r\n _viewportPaddingStyle: _padding\r\n ? viewportStyle\r\n : assignDeep({}, paddingStyle, viewportStyle),\r\n });\r\n }\r\n\r\n return {\r\n _paddingStyleChanged: paddingStyleChanged,\r\n };\r\n };\r\n};\r\n","import {\r\n createCache,\r\n scrollSize,\r\n fractionalSize,\r\n equalWH,\r\n clientSize,\r\n equalXY,\r\n assignDeep,\r\n bind,\r\n wnd,\r\n mathMax,\r\n windowSize,\r\n strHidden,\r\n strOverflowX,\r\n strOverflowY,\r\n setStyles,\r\n addRemoveAttrClass,\r\n setAttrs,\r\n} from '~/support';\r\nimport { getEnvironment } from '~/environment';\r\nimport {\r\n dataAttributeHost,\r\n dataAttributeHostOverflowX,\r\n dataAttributeHostOverflowY,\r\n dataValueHostOverflowVisible,\r\n dataValueViewportScrollbarHidden,\r\n dataValueViewportOverflowVisible,\r\n dataAttributeViewport,\r\n dataAttributePadding,\r\n dataValuePaddingOverflowVisible,\r\n} from '~/classnames';\r\nimport { getStaticPluginModuleInstance, scrollbarsHidingPluginName } from '~/plugins';\r\nimport type { WH, XY } from '~/support';\r\nimport type { ScrollbarsHidingPlugin } from '~/plugins/scrollbarsHidingPlugin';\r\nimport type { StyleObject, OverflowStyle } from '~/typings';\r\nimport type { CreateStructureUpdateSegment } from '../structureSetup';\r\nimport type { ViewportOverflowState } from '../structureSetup.utils';\r\nimport {\r\n getShowNativeOverlaidScrollbars,\r\n getViewportOverflowState,\r\n overflowIsVisible,\r\n setViewportOverflowState,\r\n} from '../structureSetup.utils';\r\n\r\n/**\r\n * Lifecycle with the responsibility to set the correct overflow and scrollbar hiding styles of the viewport element.\r\n * @param structureUpdateHub\r\n * @returns\r\n */\r\nexport const createOverflowUpdateSegment: CreateStructureUpdateSegment = (\r\n structureSetupElements,\r\n structureSetupState\r\n) => {\r\n const env = getEnvironment();\r\n const {\r\n _host,\r\n _padding,\r\n _viewport,\r\n _viewportIsTarget,\r\n _isBody,\r\n _viewportAddRemoveClass,\r\n _windowElm,\r\n } = structureSetupElements;\r\n const { _nativeScrollbarsHiding } = env;\r\n const viewportIsTargetBody = _isBody && _viewportIsTarget;\r\n const max0 = bind(mathMax, 0);\r\n\r\n const whCacheOptions = {\r\n _equal: equalWH,\r\n _initialValue: { w: 0, h: 0 },\r\n };\r\n const xyCacheOptions = {\r\n _equal: equalXY,\r\n _initialValue: { x: strHidden, y: strHidden } as XY,\r\n };\r\n const getOverflowAmount = (viewportScrollSize: WH, viewportClientSize: WH) => {\r\n const tollerance = wnd.devicePixelRatio % 1 !== 0 ? 1 : 0;\r\n const amount = {\r\n w: max0(viewportScrollSize.w - viewportClientSize.w),\r\n h: max0(viewportScrollSize.h - viewportClientSize.h),\r\n };\r\n\r\n return {\r\n w: amount.w > tollerance ? amount.w : 0,\r\n h: amount.h > tollerance ? amount.h : 0,\r\n };\r\n };\r\n\r\n const [updateSizeFraction, getCurrentSizeFraction] = createCache>(\r\n whCacheOptions,\r\n bind(fractionalSize, _viewport)\r\n );\r\n const [updateViewportScrollSizeCache, getCurrentViewportScrollSizeCache] = createCache<\r\n WH\r\n >(whCacheOptions, bind(scrollSize, _viewport));\r\n const [updateOverflowAmountCache, getCurrentOverflowAmountCache] =\r\n createCache>(whCacheOptions);\r\n const [updateOverflowEdge, getCurrentOverflowEdgeCache] = createCache>(whCacheOptions);\r\n const [updateOverflowStyleCache] = createCache>(xyCacheOptions);\r\n\r\n const scrollbarsHidingPlugin = getStaticPluginModuleInstance(\r\n scrollbarsHidingPluginName\r\n );\r\n\r\n return (\r\n { _checkOption, _observersUpdateHints, _observersState, _force },\r\n { _paddingStyleChanged }\r\n ) => {\r\n const { _sizeChanged, _contentMutation, _directionChanged, _scrollbarSizeChanged } =\r\n _observersUpdateHints || {};\r\n const scrollbarsHidingPluginViewportArrangement =\r\n scrollbarsHidingPlugin &&\r\n scrollbarsHidingPlugin._viewportArrangement(\r\n structureSetupElements,\r\n structureSetupState,\r\n _observersState,\r\n env,\r\n _checkOption\r\n );\r\n\r\n const { _arrangeViewport, _undoViewportArrange, _hideNativeScrollbars } =\r\n scrollbarsHidingPluginViewportArrangement || {};\r\n\r\n const [showNativeOverlaidScrollbars, showNativeOverlaidScrollbarsChanged] =\r\n getShowNativeOverlaidScrollbars(_checkOption, env);\r\n const [overflow, overflowChanged] = _checkOption('overflow');\r\n\r\n const adjustViewportArrange =\r\n _sizeChanged ||\r\n _paddingStyleChanged ||\r\n _contentMutation ||\r\n _directionChanged ||\r\n _scrollbarSizeChanged ||\r\n showNativeOverlaidScrollbarsChanged;\r\n const overflowXVisible = overflowIsVisible(overflow.x);\r\n const overflowYVisible = overflowIsVisible(overflow.y);\r\n const overflowVisible = overflowXVisible || overflowYVisible;\r\n\r\n let sizeFractionCache = getCurrentSizeFraction(_force);\r\n let viewportScrollSizeCache = getCurrentViewportScrollSizeCache(_force);\r\n let overflowAmuntCache = getCurrentOverflowAmountCache(_force);\r\n let overflowEdgeCache = getCurrentOverflowEdgeCache(_force);\r\n\r\n let preMeasureViewportOverflowState: ViewportOverflowState | undefined;\r\n\r\n if (showNativeOverlaidScrollbarsChanged && _nativeScrollbarsHiding) {\r\n _viewportAddRemoveClass(dataValueViewportScrollbarHidden, !showNativeOverlaidScrollbars);\r\n }\r\n\r\n if (adjustViewportArrange) {\r\n if (overflowVisible) {\r\n _viewportAddRemoveClass(dataValueViewportOverflowVisible, false);\r\n }\r\n\r\n const [redoViewportArrange, undoViewportArrangeOverflowState] = _undoViewportArrange\r\n ? _undoViewportArrange(preMeasureViewportOverflowState)\r\n : [];\r\n\r\n const [sizeFraction, sizeFractionChanged] = (sizeFractionCache = updateSizeFraction(_force));\r\n const [viewportScrollSize, viewportScrollSizeChanged] = (viewportScrollSizeCache =\r\n updateViewportScrollSizeCache(_force));\r\n const viewportClientSize = clientSize(_viewport);\r\n const arrangedViewportScrollSize = viewportScrollSize;\r\n const arrangedViewportClientSize = viewportClientSize;\r\n\r\n redoViewportArrange && redoViewportArrange();\r\n\r\n // if re measure is required (only required if content arrange strategy is used)\r\n if (\r\n (viewportScrollSizeChanged || sizeFractionChanged || showNativeOverlaidScrollbarsChanged) &&\r\n undoViewportArrangeOverflowState &&\r\n !showNativeOverlaidScrollbars &&\r\n _arrangeViewport &&\r\n _arrangeViewport(undoViewportArrangeOverflowState, viewportScrollSize, sizeFraction)\r\n ) {\r\n // arrangedViewportClientSize = clientSize(_viewport);\r\n // arrangedViewportScrollSize = scrollSize(_viewport);\r\n }\r\n\r\n const windowInnerSize = windowSize(_windowElm());\r\n const overflowAmountScrollSize = {\r\n w: max0(mathMax(viewportScrollSize.w, arrangedViewportScrollSize.w) + sizeFraction.w),\r\n h: max0(mathMax(viewportScrollSize.h, arrangedViewportScrollSize.h) + sizeFraction.h),\r\n };\r\n\r\n const overflowAmountClientSize = {\r\n w: max0(\r\n (viewportIsTargetBody\r\n ? windowInnerSize.w\r\n : arrangedViewportClientSize.w + max0(viewportClientSize.w - viewportScrollSize.w)) +\r\n sizeFraction.w\r\n ),\r\n h: max0(\r\n (viewportIsTargetBody\r\n ? windowInnerSize.h\r\n : arrangedViewportClientSize.h + max0(viewportClientSize.h - viewportScrollSize.h)) +\r\n sizeFraction.h\r\n ),\r\n };\r\n\r\n overflowEdgeCache = updateOverflowEdge(overflowAmountClientSize);\r\n overflowAmuntCache = updateOverflowAmountCache(\r\n getOverflowAmount(overflowAmountScrollSize, overflowAmountClientSize),\r\n _force\r\n );\r\n }\r\n\r\n const [overflowEdge, overflowEdgeChanged] = overflowEdgeCache;\r\n const [overflowAmount, overflowAmountChanged] = overflowAmuntCache;\r\n const [viewportScrollSize, viewportScrollSizeChanged] = viewportScrollSizeCache;\r\n const [sizeFraction, sizeFractionChanged] = sizeFractionCache;\r\n const hasOverflow = {\r\n x: overflowAmount.w > 0,\r\n y: overflowAmount.h > 0,\r\n };\r\n const removeClipping =\r\n (overflowXVisible && overflowYVisible && (hasOverflow.x || hasOverflow.y)) ||\r\n (overflowXVisible && hasOverflow.x && !hasOverflow.y) ||\r\n (overflowYVisible && hasOverflow.y && !hasOverflow.x);\r\n const adjustViewportStyle =\r\n _paddingStyleChanged ||\r\n _directionChanged ||\r\n _scrollbarSizeChanged ||\r\n sizeFractionChanged ||\r\n viewportScrollSizeChanged ||\r\n overflowEdgeChanged ||\r\n overflowAmountChanged ||\r\n overflowChanged ||\r\n showNativeOverlaidScrollbarsChanged ||\r\n adjustViewportArrange;\r\n\r\n if (adjustViewportStyle) {\r\n const viewportStyle: StyleObject = {};\r\n const viewportOverflowState = setViewportOverflowState(\r\n structureSetupElements,\r\n hasOverflow,\r\n overflow,\r\n viewportStyle\r\n );\r\n\r\n _hideNativeScrollbars &&\r\n _hideNativeScrollbars(\r\n viewportOverflowState,\r\n _observersState,\r\n !!_arrangeViewport &&\r\n _arrangeViewport(viewportOverflowState, viewportScrollSize, sizeFraction),\r\n viewportStyle\r\n );\r\n\r\n if (_viewportIsTarget) {\r\n setAttrs(_host, dataAttributeHostOverflowX, viewportStyle[strOverflowX] as string);\r\n setAttrs(_host, dataAttributeHostOverflowY, viewportStyle[strOverflowY] as string);\r\n } else {\r\n setStyles(_viewport, viewportStyle);\r\n }\r\n }\r\n\r\n addRemoveAttrClass(_host, dataAttributeHost, dataValueHostOverflowVisible, removeClipping);\r\n addRemoveAttrClass(\r\n _padding,\r\n dataAttributePadding,\r\n dataValuePaddingOverflowVisible,\r\n removeClipping\r\n );\r\n if (!_viewportIsTarget) {\r\n addRemoveAttrClass(\r\n _viewport,\r\n dataAttributeViewport,\r\n dataValueViewportOverflowVisible,\r\n overflowVisible\r\n );\r\n }\r\n\r\n const [overflowStyle, overflowStyleChanged] = updateOverflowStyleCache(\r\n getViewportOverflowState(structureSetupElements)._overflowStyle\r\n );\r\n\r\n assignDeep(structureSetupState, {\r\n _overflowStyle: overflowStyle,\r\n _overflowEdge: {\r\n x: overflowEdge.w,\r\n y: overflowEdge.h,\r\n },\r\n _overflowAmount: {\r\n x: overflowAmount.w,\r\n y: overflowAmount.h,\r\n },\r\n _hasOverflow: hasOverflow,\r\n });\r\n\r\n return {\r\n _overflowStyleChanged: overflowStyleChanged,\r\n _overflowEdgeChanged: overflowEdgeChanged,\r\n _overflowAmountChanged: overflowAmountChanged,\r\n };\r\n };\r\n};\r\n","import { getEnvironment } from '~/environment';\r\nimport {\r\n addAttrClass,\r\n assignDeep,\r\n each,\r\n getElmentScroll,\r\n noop,\r\n scrollElementTo,\r\n strHidden,\r\n strMarginBottom,\r\n strMarginLeft,\r\n strMarginRight,\r\n strPaddingBottom,\r\n strPaddingLeft,\r\n strPaddingRight,\r\n strPaddingTop,\r\n type TRBL,\r\n type XY,\r\n} from '~/support';\r\nimport { dataAttributeHost, dataValueHostUpdating } from '~/classnames';\r\nimport type { StructureSetupElementsObj } from './structureSetup.elements';\r\nimport type {\r\n ObserversSetupState,\r\n ObserversSetupUpdateHints,\r\n Setup,\r\n SetupUpdateInfo,\r\n} from '~/setups';\r\nimport type { InitializationTarget } from '~/initialization';\r\nimport type { StyleObject, OverflowStyle } from '~/typings';\r\nimport { createStructureSetupElements } from './structureSetup.elements';\r\nimport {\r\n createOverflowUpdateSegment,\r\n createPaddingUpdateSegment,\r\n createTrinsicUpdateSegment,\r\n} from './updateSegments';\r\n\r\nexport interface StructureSetupState {\r\n _padding: TRBL;\r\n _paddingAbsolute: boolean;\r\n _viewportPaddingStyle: StyleObject;\r\n _overflowEdge: XY;\r\n _overflowAmount: XY;\r\n _overflowStyle: XY;\r\n _hasOverflow: XY;\r\n}\r\n\r\nexport interface StructureSetupUpdateInfo extends SetupUpdateInfo {\r\n _observersState: ObserversSetupState;\r\n _observersUpdateHints?: ObserversSetupUpdateHints;\r\n}\r\n\r\nexport type StructureSetupUpdateHints = {\r\n _overflowEdgeChanged?: boolean;\r\n _overflowAmountChanged?: boolean;\r\n _overflowStyleChanged?: boolean;\r\n _paddingStyleChanged?: boolean;\r\n};\r\n\r\nexport type StructureSetup = [\r\n ...Setup,\r\n /** The elements created by the structure setup. */\r\n StructureSetupElementsObj,\r\n /** Function to be called when the initialization was canceled. */\r\n () => void\r\n];\r\n\r\nexport type StructureUpdateSegment = (\r\n updateInfo: StructureSetupUpdateInfo,\r\n updateHints: Readonly\r\n) => StructureSetupUpdateHints | void;\r\n\r\nexport type CreateStructureUpdateSegment = (\r\n structureSetupElements: StructureSetupElementsObj,\r\n state: StructureSetupState\r\n) => StructureUpdateSegment;\r\n\r\nexport const createStructureSetup = (target: InitializationTarget): StructureSetup => {\r\n const [elements, appendStructureElements, canceled] = createStructureSetupElements(target);\r\n const state: StructureSetupState = {\r\n _padding: {\r\n t: 0,\r\n r: 0,\r\n b: 0,\r\n l: 0,\r\n },\r\n _paddingAbsolute: false,\r\n _viewportPaddingStyle: {\r\n [strMarginRight]: 0,\r\n [strMarginBottom]: 0,\r\n [strMarginLeft]: 0,\r\n [strPaddingTop]: 0,\r\n [strPaddingRight]: 0,\r\n [strPaddingBottom]: 0,\r\n [strPaddingLeft]: 0,\r\n },\r\n _overflowEdge: { x: 0, y: 0 },\r\n _overflowAmount: { x: 0, y: 0 },\r\n _overflowStyle: {\r\n x: strHidden,\r\n y: strHidden,\r\n },\r\n _hasOverflow: {\r\n x: false,\r\n y: false,\r\n },\r\n };\r\n const { _target, _viewport, _viewportIsTarget } = elements;\r\n const { _nativeScrollbarsHiding, _nativeScrollbarsOverlaid } = getEnvironment();\r\n const doViewportArrange =\r\n !_nativeScrollbarsHiding && (_nativeScrollbarsOverlaid.x || _nativeScrollbarsOverlaid.y);\r\n\r\n const updateSegments: StructureUpdateSegment[] = [\r\n createTrinsicUpdateSegment(elements, state),\r\n createPaddingUpdateSegment(elements, state),\r\n createOverflowUpdateSegment(elements, state),\r\n ];\r\n\r\n return [\r\n appendStructureElements,\r\n (updateInfo) => {\r\n const updateHints: StructureSetupUpdateHints = {};\r\n const adjustScrollOffset = doViewportArrange;\r\n const scrollOffset = adjustScrollOffset && getElmentScroll(_viewport);\r\n\r\n const removeAttrClass = _viewportIsTarget\r\n ? addAttrClass(_viewport, dataAttributeHost, dataValueHostUpdating)\r\n : noop;\r\n\r\n each(updateSegments, (updateSegment) => {\r\n assignDeep(updateHints, updateSegment(updateInfo, updateHints) || {});\r\n });\r\n\r\n removeAttrClass();\r\n\r\n scrollElementTo(_viewport, scrollOffset);\r\n !_viewportIsTarget && scrollElementTo(_target, 0);\r\n\r\n return updateHints;\r\n },\r\n state,\r\n elements,\r\n canceled,\r\n ];\r\n};\r\n","import {\r\n assignDeep,\r\n bind,\r\n getElmentScroll,\r\n isEmptyObject,\r\n keys,\r\n runEachAndClear,\r\n scrollElementTo,\r\n} from '~/support';\r\nimport { createOptionCheck } from '~/options';\r\nimport type { OptionsCheckFn, Options, PartialOptions, ReadonlyOptions } from '~/options';\r\nimport type { DeepReadonly } from '~/typings';\r\nimport type { InitializationTarget } from '~/initialization';\r\nimport type { ObserversSetupState, ObserversSetupUpdateHints } from './observersSetup';\r\nimport type { StructureSetupState, StructureSetupUpdateHints } from './structureSetup';\r\nimport type { StructureSetupElementsObj } from './structureSetup/structureSetup.elements';\r\nimport type { ScrollbarsSetupElementsObj } from './scrollbarsSetup/scrollbarsSetup.elements';\r\nimport { createObserversSetup } from './observersSetup';\r\nimport { createScrollbarsSetup } from './scrollbarsSetup';\r\nimport { createStructureSetup } from './structureSetup';\r\n\r\nexport type SetupUpdateHints = Partial>;\r\n\r\nexport type SetupUpdateInfo = {\r\n _checkOption: OptionsCheckFn;\r\n _changedOptions: PartialOptions;\r\n _force: boolean;\r\n};\r\n\r\nexport type Setup<\r\n U extends SetupUpdateInfo,\r\n S extends Readonly>,\r\n H extends SetupUpdateHints | void\r\n> = [\r\n /** The create function which returns the `destroy` function. */\r\n _create: () => () => void,\r\n /** Function which updates the setup and returns the update result. */\r\n _update: (updateInfo: U) => H,\r\n /** Function which returns the current state. */\r\n _state: S\r\n];\r\n\r\nexport interface SetupsUpdateInfo {\r\n /** The options that changed or `undefined` if none changed. */\r\n _changedOptions?: PartialOptions;\r\n /** Whether chache should be ignored. */\r\n _force?: boolean;\r\n /** Whether observers should take their records and thus update as well. */\r\n _takeRecords?: boolean;\r\n /** Whether one or more scrollbars has been cloned. */\r\n _cloneScrollbar?: boolean;\r\n}\r\n\r\nexport interface SetupsUpdateHints {\r\n readonly _observersUpdateHints: DeepReadonly;\r\n readonly _structureUpdateHints: DeepReadonly;\r\n}\r\n\r\nexport interface SetupsState {\r\n readonly _observersSetupState: DeepReadonly;\r\n readonly _structureSetupState: DeepReadonly;\r\n}\r\n\r\nexport interface SetupsElements {\r\n readonly _structureSetupElements: DeepReadonly;\r\n readonly _scrollbarsSetupElements: DeepReadonly;\r\n}\r\n\r\nexport type Setups = [\r\n construct: () => () => void,\r\n update: (updateInfo: SetupsUpdateInfo) => boolean,\r\n getState: () => SetupsState,\r\n elements: SetupsElements,\r\n canceled: () => void\r\n];\r\n\r\nexport const createSetups = (\r\n target: InitializationTarget,\r\n options: ReadonlyOptions,\r\n onUpdated: (updateInfo: SetupsUpdateInfo, updateHints: SetupsUpdateHints) => void,\r\n onScroll: (scrollEvent: Event) => void\r\n): Setups => {\r\n const getCurrentOption = createOptionCheck(options, {});\r\n const [\r\n structureSetupCreate,\r\n structureSetupUpdate,\r\n structureSetupState,\r\n structureSetupElements,\r\n structureSetupCanceled,\r\n ] = createStructureSetup(target);\r\n const [observersSetupCreate, observersSetupUpdate, observersSetupState] = createObserversSetup(\r\n structureSetupElements,\r\n structureSetupState,\r\n getCurrentOption,\r\n (observersUpdateHints) => {\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n update({}, observersUpdateHints);\r\n }\r\n );\r\n const [scrollbarsSetupCreate, scrollbarsSetupUpdate, , scrollbarsSetupElements] =\r\n createScrollbarsSetup(\r\n target,\r\n options,\r\n observersSetupState,\r\n structureSetupState,\r\n structureSetupElements,\r\n onScroll\r\n );\r\n\r\n const updateHintsAreTruthy = (hints: SetupUpdateHints) =>\r\n keys(hints).some((key) => !!hints[key as keyof typeof hints]);\r\n\r\n const update = (\r\n updateInfo: SetupsUpdateInfo,\r\n observerUpdateHints?: ObserversSetupUpdateHints\r\n ): boolean => {\r\n const {\r\n _changedOptions: rawChangedOptions,\r\n _force: rawForce,\r\n _takeRecords,\r\n _cloneScrollbar,\r\n } = updateInfo;\r\n const _changedOptions = rawChangedOptions || {};\r\n const _force = !!rawForce;\r\n const baseUpdateInfoObj: SetupUpdateInfo = {\r\n _checkOption: createOptionCheck(options, _changedOptions, _force),\r\n _changedOptions,\r\n _force,\r\n };\r\n\r\n if (_cloneScrollbar) {\r\n scrollbarsSetupUpdate(baseUpdateInfoObj);\r\n return false;\r\n }\r\n\r\n const observersHints =\r\n observerUpdateHints ||\r\n observersSetupUpdate(\r\n assignDeep({}, baseUpdateInfoObj, {\r\n _takeRecords,\r\n })\r\n );\r\n\r\n const structureHints = structureSetupUpdate(\r\n assignDeep({}, baseUpdateInfoObj, {\r\n _observersState: observersSetupState,\r\n _observersUpdateHints: observersHints,\r\n })\r\n );\r\n scrollbarsSetupUpdate(\r\n assignDeep({}, baseUpdateInfoObj, {\r\n _observersUpdateHints: observersHints,\r\n _structureUpdateHints: structureHints,\r\n })\r\n );\r\n\r\n const truthyObserversHints = updateHintsAreTruthy(observersHints);\r\n const truthyStructureHints = updateHintsAreTruthy(structureHints);\r\n const changed =\r\n truthyObserversHints || truthyStructureHints || !isEmptyObject(_changedOptions) || _force;\r\n\r\n changed &&\r\n onUpdated(updateInfo, {\r\n _observersUpdateHints: observersHints,\r\n _structureUpdateHints: structureHints,\r\n });\r\n\r\n return changed;\r\n };\r\n\r\n return [\r\n () => {\r\n const { _originalScrollOffsetElement, _viewport } = structureSetupElements;\r\n const initialScroll = getElmentScroll(_originalScrollOffsetElement);\r\n const destroyFns = [observersSetupCreate(), structureSetupCreate(), scrollbarsSetupCreate()];\r\n\r\n scrollElementTo(_viewport, initialScroll);\r\n\r\n return bind(runEachAndClear, destroyFns);\r\n },\r\n update,\r\n () => ({\r\n _observersSetupState: observersSetupState,\r\n _structureSetupState: structureSetupState,\r\n }),\r\n {\r\n _structureSetupElements: structureSetupElements,\r\n _scrollbarsSetupElements: scrollbarsSetupElements,\r\n },\r\n structureSetupCanceled,\r\n ];\r\n};\r\n","import {\r\n assignDeep,\r\n isEmptyObject,\r\n isFunction,\r\n isHTMLElement,\r\n createEventListenerHub,\r\n isPlainObject,\r\n keys,\r\n isArray,\r\n push,\r\n runEachAndClear,\r\n bind,\r\n removeUndefinedProperties,\r\n} from '~/support';\r\nimport { getOptionsDiff } from '~/options';\r\nimport { getEnvironment } from '~/environment';\r\nimport { cancelInitialization } from '~/initialization';\r\nimport { addInstance, getInstance, removeInstance } from '~/instances';\r\nimport { createSetups } from '~/setups';\r\nimport {\r\n addPlugins,\r\n getStaticPluginModuleInstance,\r\n optionsValidationPluginModuleName,\r\n pluginModules,\r\n registerPluginModuleInstances,\r\n} from '~/plugins';\r\nimport type { XY, TRBL } from '~/support';\r\nimport type { Options, PartialOptions, ReadonlyOptions } from '~/options';\r\nimport type {\r\n InferInstancePluginModuleInstance,\r\n InferStaticPluginModuleInstance,\r\n InstancePlugin,\r\n OptionsValidationPlugin,\r\n Plugin,\r\n PluginModuleInstance,\r\n StaticPlugin,\r\n} from '~/plugins';\r\nimport type { Initialization, InitializationTarget, PartialInitialization } from '~/initialization';\r\nimport type { OverflowStyle } from '~/typings';\r\nimport type { EventListenerArgs, EventListener, EventListeners } from '~/eventListeners';\r\nimport type {\r\n ScrollbarsSetupElement,\r\n ScrollbarStructure,\r\n} from '~/setups/scrollbarsSetup/scrollbarsSetup.elements';\r\n\r\n// Notes:\r\n// Height intrinsic detection use \"content: true\" init strategy - or open ticket for custom height intrinsic observer\r\n\r\n/**\r\n * Describes the OverlayScrollbars environment.\r\n */\r\nexport interface Environment {\r\n /** The native scrollbars size of the browser / system. */\r\n scrollbarsSize: XY;\r\n /** Whether the native scrollbars are overlaid. */\r\n scrollbarsOverlaid: XY;\r\n /** Whether the browser supports native scrollbars hiding. */\r\n scrollbarsHiding: boolean;\r\n /** The rtl scroll behavior of the browser. */\r\n rtlScrollBehavior: { n: boolean; i: boolean };\r\n /** Whether the browser supports the ScrollTimeline API. */\r\n scrollTimeline: boolean;\r\n /** The default Initialization to use if nothing else is specified. */\r\n staticDefaultInitialization: Initialization;\r\n /** The default Options to use if nothing else is specified. */\r\n staticDefaultOptions: Options;\r\n\r\n /** Returns the current default Initialization. */\r\n getDefaultInitialization(): Initialization;\r\n /** Returns the current default Options. */\r\n getDefaultOptions(): Options;\r\n\r\n /**\r\n * Sets a new default Initialization.\r\n * If the new default Initialization is partially filled, its deeply merged with the current default Initialization.\r\n * @param newDefaultInitialization The new default Initialization.\r\n * @returns The current default Initialization.\r\n */\r\n setDefaultInitialization(newDefaultInitialization: PartialInitialization): Initialization;\r\n /**\r\n * Sets new default Options.\r\n * If the new default Options are partially filled, they're deeply merged with the current default Options.\r\n * @param newDefaultOptions The new default Options.\r\n * @returns The current default options.\r\n */\r\n setDefaultOptions(newDefaultOptions: PartialOptions): Options;\r\n}\r\n\r\n/**\r\n * The primary entry point to OverlayScrollbars.\r\n */\r\nexport interface OverlayScrollbarsStatic {\r\n /**\r\n * Returns the current OverlayScrollbars instance if the target already has an instance.\r\n * @param target The initialization target to from which the instance shall be returned.\r\n */\r\n (target: InitializationTarget): OverlayScrollbars | undefined;\r\n /**\r\n * Initializes a new OverlayScrollbars instance to the given target\r\n * or returns the current OverlayScrollbars instance if the target already has an instance.\r\n * @param target The target.\r\n * @param options The options. (Can be just an empty object)\r\n * @param eventListeners Optional event listeners.\r\n */\r\n (\r\n target: InitializationTarget,\r\n options: PartialOptions,\r\n eventListeners?: EventListeners\r\n ): OverlayScrollbars;\r\n\r\n /**\r\n * Adds a single plugin.\r\n * @param plugin The plugin to be added.\r\n * @returns The plugins static modules instance or `void` if no instance was found.\r\n */\r\n plugin

(\r\n plugin: P\r\n ): P extends StaticPlugin ? InferStaticPluginModuleInstance

: void;\r\n /**\r\n * Adds multiple plugins.\r\n * @param plugins The plugins to be added.\r\n * @returns The plugins static modules instances or `void` if no instance was found.\r\n */\r\n plugin

(\r\n plugins: P\r\n ): P extends [Plugin, ...Plugin[]]\r\n ? {\r\n [K in keyof P]: P[K] extends StaticPlugin ? InferStaticPluginModuleInstance : void;\r\n }\r\n : void;\r\n\r\n /**\r\n * Checks whether the passed value is a valid and not destroyed overlayscrollbars instance.\r\n * @param osInstance The value which shall be checked.\r\n */\r\n valid(osInstance: any): osInstance is OverlayScrollbars;\r\n /**\r\n * Gets the environment.\r\n */\r\n env(): Environment;\r\n}\r\n\r\n/**\r\n * Describes a OverlayScrollbars instances state.\r\n */\r\nexport interface State {\r\n /** Describes the current padding in pixel. */\r\n padding: TRBL;\r\n /** Whether the current padding is absolute. */\r\n paddingAbsolute: boolean;\r\n /** The client width (x) & height (y) of the viewport in pixel. */\r\n overflowEdge: XY;\r\n /** The overflow amount in pixel. */\r\n overflowAmount: XY;\r\n /** The css overflow style of the viewport. */\r\n overflowStyle: XY;\r\n /** Whether the viewport has an overflow. */\r\n hasOverflow: XY;\r\n /** Whether the direction is considered rtl. */\r\n directionRTL: boolean;\r\n /** Whether the instance is considered destroyed. */\r\n destroyed: boolean;\r\n}\r\n\r\n/**\r\n * Describes the elements of a scrollbar.\r\n */\r\nexport interface ScrollbarElements {\r\n /**\r\n * The root element of the scrollbar.\r\n * The HTML structure looks like this:\r\n * \r\n * \r\n * \r\n * \r\n * \r\n */\r\n scrollbar: HTMLElement;\r\n /** The track element of the scrollbar. */\r\n track: HTMLElement;\r\n /** The handle element of the scrollbar. */\r\n handle: HTMLElement;\r\n}\r\n\r\n/**\r\n * Describes the elements of a scrollbar and provides the possibility to clone them.\r\n */\r\nexport interface CloneableScrollbarElements extends ScrollbarElements {\r\n /**\r\n * Clones the current scrollbar and returns the cloned elements.\r\n * The returned elements aren't added to the DOM.\r\n */\r\n clone(): ScrollbarElements;\r\n}\r\n\r\n/**\r\n * Describes the elements of a OverlayScrollbars instance.\r\n */\r\nexport interface Elements {\r\n /** The element the instance was applied to. */\r\n target: HTMLElement;\r\n /** The host element. Its the root of all other elements. */\r\n host: HTMLElement;\r\n /**\r\n * The element which is responsible to apply correct paddings.\r\n * Depending on the Initialization it can be the same as the viewport element.\r\n */\r\n padding: HTMLElement;\r\n /** The element which is responsible to do any scrolling. */\r\n viewport: HTMLElement;\r\n /**\r\n * The element which is responsible to hold the content.\r\n * Depending on the Initialization it can be the same as the viewport element.\r\n */\r\n content: HTMLElement;\r\n /**\r\n * The element through which you can get the current `scrollLeft` or `scrollTop` offset.\r\n * Depending on the target element it can be the same as the viewport element.\r\n */\r\n scrollOffsetElement: HTMLElement;\r\n /**\r\n * The element through which you can add `scroll` events.\r\n * Depending on the target element it can be the same as the viewport element.\r\n */\r\n scrollEventElement: HTMLElement | Document;\r\n /** The horizontal scrollbar elements. */\r\n scrollbarHorizontal: CloneableScrollbarElements;\r\n /** The vertical scrollbar elements. */\r\n scrollbarVertical: CloneableScrollbarElements;\r\n}\r\n\r\n/**\r\n * Describes a OverlayScrollbars instance.\r\n */\r\nexport interface OverlayScrollbars {\r\n /** Gets the current options of the instance. */\r\n options(): Options;\r\n /**\r\n * Sets the options of the instance.\r\n * If the new options are partially filled, they're deeply merged with either the current options or the current default options.\r\n * @param newOptions The new options which should be applied.\r\n * @param pure Whether the options should be reset before the new options are added.\r\n * @returns Returns the current options of the instance.\r\n */\r\n options(newOptions: PartialOptions, pure?: boolean): Options;\r\n\r\n /**\r\n * Adds event listeners to the instance.\r\n * @param eventListeners An object which contains the added listeners.\r\n * @param pure Whether all already added event listeners should be removed before the new listeners are added.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n on(eventListeners: EventListeners, pure?: boolean): () => void;\r\n /**\r\n * Adds a single event listener to the instance.\r\n * @param name The name of the event.\r\n * @param listener The listener which is invoked on that event.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n on(name: N, listener: EventListener): () => void;\r\n /**\r\n * Adds multiple event listeners to the instance.\r\n * @param name The name of the event.\r\n * @param listener The listeners which are invoked on that event.\r\n * @returns Returns a function which removes the added listeners.\r\n */\r\n on(name: N, listener: EventListener[]): () => void;\r\n\r\n /**\r\n * Removes a single event listener from the instance.\r\n * @param name The name of the event.\r\n * @param listener The listener which shall be removed.\r\n */\r\n off(name: N, listener: EventListener): void;\r\n /**\r\n * Removes multiple event listeners from the instance.\r\n * @param name The name of the event.\r\n * @param listener The listeners which shall be removed.\r\n */\r\n off(name: N, listener: EventListener[]): void;\r\n\r\n /**\r\n * Updates the instance.\r\n * @param force Whether the update should force the cache to be invalidated.\r\n * @returns A boolean which indicates whether the `update` event was triggered through this update.\r\n * The update event is only triggered if something changed because of this update.\r\n */\r\n update(force?: boolean): boolean;\r\n /** Returns the state of the instance. */\r\n state(): State;\r\n /** Returns the elements of the instance. */\r\n elements(): Elements;\r\n /** Destroys the instance and removes all added elements. */\r\n destroy(): void;\r\n /** Returns the instance of the passed plugin or `undefined` if no instance was found. */\r\n plugin

(osPlugin: P): InferInstancePluginModuleInstance

| undefined;\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-redeclare\r\nexport const OverlayScrollbars: OverlayScrollbarsStatic = (\r\n target: InitializationTarget,\r\n options?: PartialOptions,\r\n eventListeners?: EventListeners\r\n) => {\r\n const { _getDefaultOptions } = getEnvironment();\r\n const targetIsElement = isHTMLElement(target);\r\n const instanceTarget = targetIsElement ? target : target.target;\r\n const potentialInstance = getInstance(instanceTarget);\r\n if (options && !potentialInstance) {\r\n let destroyed = false;\r\n const destroyFns: (() => void)[] = [];\r\n const instancePluginModuleInstances: Record = {};\r\n const validateOptions = (newOptions: PartialOptions) => {\r\n const newOptionsWithoutUndefined = removeUndefinedProperties(newOptions, true);\r\n const pluginValidate = getStaticPluginModuleInstance(\r\n optionsValidationPluginModuleName\r\n );\r\n return pluginValidate\r\n ? pluginValidate(newOptionsWithoutUndefined, true)\r\n : newOptionsWithoutUndefined;\r\n };\r\n const currentOptions: ReadonlyOptions = assignDeep(\r\n {},\r\n _getDefaultOptions(),\r\n validateOptions(options)\r\n );\r\n const [addPluginEvent, removePluginEvents, triggerPluginEvent] =\r\n createEventListenerHub();\r\n const [addInstanceEvent, removeInstanceEvents, triggerInstanceEvent] =\r\n createEventListenerHub(eventListeners);\r\n const triggerEvent: typeof triggerPluginEvent = (name, args) => {\r\n triggerInstanceEvent(name, args);\r\n triggerPluginEvent(name, args);\r\n };\r\n const [setupsConstruct, setupsUpdate, setupsState, setupsElements, setupsCanceled] =\r\n createSetups(\r\n target,\r\n currentOptions,\r\n ({ _changedOptions, _force }, { _observersUpdateHints, _structureUpdateHints }) => {\r\n const {\r\n _sizeChanged,\r\n _directionChanged,\r\n _heightIntrinsicChanged,\r\n _contentMutation,\r\n _hostMutation,\r\n _appear,\r\n } = _observersUpdateHints;\r\n\r\n const { _overflowEdgeChanged, _overflowAmountChanged, _overflowStyleChanged } =\r\n _structureUpdateHints;\r\n\r\n triggerEvent('updated', [\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n instance,\r\n {\r\n updateHints: {\r\n sizeChanged: !!_sizeChanged,\r\n directionChanged: !!_directionChanged,\r\n heightIntrinsicChanged: !!_heightIntrinsicChanged,\r\n overflowEdgeChanged: !!_overflowEdgeChanged,\r\n overflowAmountChanged: !!_overflowAmountChanged,\r\n overflowStyleChanged: !!_overflowStyleChanged,\r\n contentMutation: !!_contentMutation,\r\n hostMutation: !!_hostMutation,\r\n appear: !!_appear,\r\n },\r\n changedOptions: _changedOptions || {},\r\n force: !!_force,\r\n },\r\n ]);\r\n },\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n (scrollEvent) => triggerEvent('scroll', [instance, scrollEvent])\r\n );\r\n\r\n const destroy = (canceled: boolean) => {\r\n removeInstance(instanceTarget);\r\n runEachAndClear(destroyFns);\r\n\r\n destroyed = true;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\r\n triggerEvent('destroyed', [instance, canceled]);\r\n removePluginEvents();\r\n removeInstanceEvents();\r\n };\r\n\r\n const instance: OverlayScrollbars = {\r\n options(newOptions?: PartialOptions, pure?: boolean) {\r\n if (newOptions) {\r\n const base = pure ? _getDefaultOptions() : {};\r\n const changedOptions = getOptionsDiff(\r\n currentOptions,\r\n assignDeep(base, validateOptions(newOptions))\r\n );\r\n if (!isEmptyObject(changedOptions)) {\r\n assignDeep(currentOptions, changedOptions);\r\n setupsUpdate({ _changedOptions: changedOptions });\r\n }\r\n }\r\n return assignDeep({}, currentOptions);\r\n },\r\n on: addInstanceEvent,\r\n off: (name, listener) => {\r\n name && listener && removeInstanceEvents(name, listener);\r\n },\r\n state() {\r\n const { _observersSetupState, _structureSetupState } = setupsState();\r\n const { _directionIsRTL } = _observersSetupState;\r\n const {\r\n _overflowEdge,\r\n _overflowAmount,\r\n _overflowStyle,\r\n _hasOverflow,\r\n _padding,\r\n _paddingAbsolute,\r\n } = _structureSetupState;\r\n return assignDeep(\r\n {},\r\n {\r\n overflowEdge: _overflowEdge,\r\n overflowAmount: _overflowAmount,\r\n overflowStyle: _overflowStyle,\r\n hasOverflow: _hasOverflow,\r\n padding: _padding,\r\n paddingAbsolute: _paddingAbsolute,\r\n directionRTL: _directionIsRTL,\r\n destroyed,\r\n }\r\n );\r\n },\r\n elements() {\r\n const {\r\n _target,\r\n _host,\r\n _padding,\r\n _viewport,\r\n _content,\r\n _scrollOffsetElement,\r\n _scrollEventElement,\r\n } = setupsElements._structureSetupElements;\r\n const { _horizontal, _vertical } = setupsElements._scrollbarsSetupElements;\r\n const translateScrollbarStructure = (\r\n scrollbarStructure: ScrollbarStructure\r\n ): ScrollbarElements => {\r\n const { _handle, _track, _scrollbar } = scrollbarStructure;\r\n return {\r\n scrollbar: _scrollbar,\r\n track: _track,\r\n handle: _handle,\r\n };\r\n };\r\n const translateScrollbarsSetupElement = (\r\n scrollbarsSetupElement: ScrollbarsSetupElement\r\n ): CloneableScrollbarElements => {\r\n const { _scrollbarStructures, _clone } = scrollbarsSetupElement;\r\n const translatedStructure = translateScrollbarStructure(_scrollbarStructures[0]);\r\n\r\n return assignDeep({}, translatedStructure, {\r\n clone: () => {\r\n const result = translateScrollbarStructure(_clone());\r\n setupsUpdate({ _cloneScrollbar: true });\r\n return result;\r\n },\r\n });\r\n };\r\n return assignDeep(\r\n {},\r\n {\r\n target: _target,\r\n host: _host,\r\n padding: _padding || _viewport,\r\n viewport: _viewport,\r\n content: _content || _viewport,\r\n scrollOffsetElement: _scrollOffsetElement,\r\n scrollEventElement: _scrollEventElement,\r\n scrollbarHorizontal: translateScrollbarsSetupElement(_horizontal),\r\n scrollbarVertical: translateScrollbarsSetupElement(_vertical),\r\n }\r\n );\r\n },\r\n update: (_force?: boolean) => setupsUpdate({ _force, _takeRecords: true }),\r\n destroy: bind(destroy, false),\r\n plugin:

(plugin: P) =>\r\n instancePluginModuleInstances[keys(plugin)[0]] as\r\n | InferInstancePluginModuleInstance

\r\n | undefined,\r\n };\r\n\r\n push(destroyFns, [setupsCanceled]);\r\n\r\n // valid inside plugins\r\n addInstance(instanceTarget, instance);\r\n\r\n // init plugins\r\n registerPluginModuleInstances(pluginModules, OverlayScrollbars, [\r\n instance,\r\n addPluginEvent,\r\n instancePluginModuleInstances,\r\n ]);\r\n\r\n if (\r\n cancelInitialization(\r\n setupsElements._structureSetupElements._isBody,\r\n !targetIsElement && target.cancel\r\n )\r\n ) {\r\n destroy(true);\r\n return instance;\r\n }\r\n\r\n push(destroyFns, setupsConstruct());\r\n\r\n triggerEvent('initialized', [instance]);\r\n\r\n instance.update(true);\r\n\r\n return instance;\r\n }\r\n return potentialInstance!;\r\n};\r\n\r\nOverlayScrollbars.plugin = (plugins: Plugin | Plugin[]) => {\r\n const isArr = isArray(plugins);\r\n const pluginsToAdd: Plugin[] =\r\n isArr ? plugins : [plugins];\r\n const result = pluginsToAdd.map(\r\n (plugin) => registerPluginModuleInstances(plugin, OverlayScrollbars)[0]\r\n );\r\n addPlugins(pluginsToAdd);\r\n return isArr ? result : (result[0] as any);\r\n};\r\nOverlayScrollbars.valid = (osInstance: any): osInstance is OverlayScrollbars => {\r\n const hasElmsFn = osInstance && (osInstance as OverlayScrollbars).elements;\r\n const elements = isFunction(hasElmsFn) && hasElmsFn();\r\n return isPlainObject(elements) && !!getInstance(elements.target);\r\n};\r\nOverlayScrollbars.env = () => {\r\n const {\r\n _nativeScrollbarsSize,\r\n _nativeScrollbarsOverlaid,\r\n _nativeScrollbarsHiding,\r\n _rtlScrollBehavior,\r\n _scrollTimeline,\r\n _staticDefaultInitialization,\r\n _staticDefaultOptions,\r\n _getDefaultInitialization,\r\n _setDefaultInitialization,\r\n _getDefaultOptions,\r\n _setDefaultOptions,\r\n } = getEnvironment();\r\n return assignDeep(\r\n {},\r\n {\r\n scrollbarsSize: _nativeScrollbarsSize,\r\n scrollbarsOverlaid: _nativeScrollbarsOverlaid,\r\n scrollbarsHiding: _nativeScrollbarsHiding,\r\n rtlScrollBehavior: _rtlScrollBehavior,\r\n scrollTimeline: _scrollTimeline,\r\n staticDefaultInitialization: _staticDefaultInitialization,\r\n staticDefaultOptions: _staticDefaultOptions,\r\n\r\n getDefaultInitialization: _getDefaultInitialization,\r\n setDefaultInitialization: _setDefaultInitialization,\r\n getDefaultOptions: _getDefaultOptions,\r\n setDefaultOptions: _setDefaultOptions,\r\n }\r\n );\r\n};\r\n"],"names":["createCache","options","update","_initialValue","_equal","_alwaysUpdateValues","_value","_previous","cacheUpdateContextual","newValue","force","curr","newVal","changed","cacheUpdateIsolated","getCurrentCache","isBrowser","window","document","wnd","mathMax","Math","max","mathMin","min","mathRound","round","mathAbs","abs","cAF","cancelAnimationFrame","rAF","requestAnimationFrame","setT","setTimeout","clearT","clearTimeout","getApi","name","undefined","MutationObserverConstructor","IntersectionObserverConstructor","ResizeObserverConstructor","scrollT","ElementNodeType","Node","ELEMENT_NODE","_Object$prototype","Object","prototype","toString","hasOwnProperty","typeRgx","isUndefined","obj","isNull","type","call","replace","toLowerCase","isNumber","isString","isBoolean","isFunction","isArray","Array","isObject","isArrayLike","length","lengthCorrectFormat","isPlainObject","key","cstr","ctor","ctorProto","hasOwnConstructor","hasIsPrototypeOf","isHTMLElement","instanceofObj","HTMLElement","nodeType","isElement","Element","animationCurrentTime","performance","now","animateNumber","from","to","duration","onFrame","easing","animationFrameId","timeStart","finalDuration","frame","complete","timeNow","timeElapsed","stopAnimation","percent","progress","animationCompleted","each","source","callback","i","keys","inArray","arr","item","indexOf","concat","a","b","push","array","items","arrayIsSingleItem","apply","createOrKeepArray","value","isEmptyArray","deduplicateArray","Set","runEachAndClear","args","keep","runFn","fn","strPaddingTop","strPaddingRight","strPaddingLeft","strPaddingBottom","strMarginLeft","strMarginRight","strMarginBottom","strOverflowX","strOverflowY","strWidth","strHeight","strHidden","strVisible","equal","props","propMutation","result","prop","compareA","compareB","equalWH","equalXY","equalTRBL","noop","bind","_len","arguments","_key","selfClearTimeout","timeout","id","setTFn","clearTFn","debounce","functionToDebounce","maxTimeoutId","prevArguments","latestArguments","clear","_ref","_timeout","_maxDelay","_mergeParams","invokeFunctionToDebounce","this","mergeParms","flush","debouncedFn","finalTimeout","hasTimeout","finalMaxWait","hasMaxWait","setTimeoutFn","clearTimeoutFn","mergeParamsResult","invokedArgs","boundInvoke","timeoutId","_flush","assignDeep","target","object1","object2","object3","object4","object5","object6","sources","_","copy","copyIsArray","src","clone","slice","removeUndefinedProperties","deep","isEmptyObject","capNumber","number","getDomTokensArray","tokens","split","filter","token","getAttr","elm","attrName","getAttribute","hasAttr","hasAttribute","setAttrs","attrNames","setAttribute","removeAttrs","removeAttribute","domTokenListAttr","initialArr","setElmAttr","domTokenListOperation","operationTokens","operation","initialArrSet","join","_remove","removeTokens","_add","addTokens","_has","hasTokens","tokenSet","reduce","boolean","includes","removeAttrClass","addAttrClass","addRemoveAttrClass","add","hasAttrClass","createDomTokenListClass","removeClass","className","addClass","find","selector","rootElm","querySelectorAll","findFirst","querySelector","is","matches","isBodyElement","contents","childNodes","parent","parentElement","closest","getFocusedElement","doc","activeElement","liesBetween","highBoundarySelector","deepBoundarySelector","closestHighBoundaryElm","closestDeepBoundaryElm","deepBoundaryIsValid","removeElements","nodes","e","parentElm","removeChild","before","preferredAnchor","insertedElms","anchor","fragment","createDocumentFragment","insertedElm","previousSibling","appendChild","firstChild","nextSibling","insertBefore","appendChildren","node","children","insertAfter","insertedNodes","createDiv","classNames","div","createElement","createDOM","html","createdDiv","innerHTML","trim","customCssPropRegex","getCSSVal","computedStyle","getPropertyValue","validFiniteNumber","notNaN","isFinite","parseToZeroOrNumber","parseFloat","ratioToCssPercent","ratio","toFixed","numberToCssPx","setStyles","styles","rawValue","elmStyle","style","test","setProperty","_unused","getStyles","pseudoElm","getSingleStyle","getStylesResult","getComputedStyle","getDirectionIsRTL","topRightBottomLeft","propertyPrefix","propertySuffix","finalPrefix","finalSuffix","top","right","bottom","left","t","r","l","getTrasformTranslateValue","isHorizontal","x","y","zeroObj","w","h","getElmWidthHeightProperty","property","windowSize","customWnd","offsetSize","clientSize","scrollSize","fractionalSize","cssWidth","cssHeight","getBoundingClientRect","domRectHasDimensions","rect","domRectAppeared","currContentRect","prevContentRect","rectHasDimensions","rectHadDimensions","removeEventListener","eventNames","listener","capture","eventName","addEventListener","passive","_passive","_capture","once","_once","nativeOptions","map","finalListener","evt","stopPropagation","preventDefault","absoluteCoordinates","scrollX","scrollY","convertScrollPosition","scrollPosition","overflowAmount","rtlScrollBehavior","n","getRawScrollBounds","getRawScrollRatio","rawScrollPosition","scrollElementTo","position","scrollLeft","scrollTop","getElmentScroll","manageListener","createEventListenerHub","initialEventListeners","events","Map","removeEvent","eventSet","get","currListener","forEach","addEvent","nameOrEventListeners","listenerOrPure","set","eventListenerKeys","offFns","eventListener","triggerEvent","event","opsStringify","JSON","stringify","val","getPropByPath","path","o","defaultOptions","paddingAbsolute","showNativeOverlaidScrollbars","elementEvents","attributes","ignoreMutation","overflow","scrollbars","theme","visibility","autoHide","autoHideDelay","autoHideSuspend","dragScroll","clickScroll","pointers","getOptionsDiff","currOptions","newOptions","diff","optionsKeys","optionKey","currOptionValue","newOptionValue","isDiff","createOptionCheck","changedOptions","dataAttributePrefix","classNameEnvironment","classNameEnvironmentScrollbarHidden","dataAttributeInitialize","dataAttributeHost","dataAttributeHostOverflowX","dataAttributeHostOverflowY","dataValueHostOverflowVisible","dataValueHostScrollbarPressed","dataValueHostUpdating","dataValueHostHtmlBody","dataAttributeViewport","dataValueViewportArrange","dataValueViewportScrollbarHidden","dataValueViewportOverflowVisible","dataAttributePadding","dataValuePaddingOverflowVisible","dataAttributeContent","classNameSizeObserver","classNameSizeObserverAppear","classNameSizeObserverListener","classNameSizeObserverListenerScroll","classNameSizeObserverListenerItem","classNameSizeObserverListenerItemFinal","classNameTrinsicObserver","classNameScrollbarThemeNone","classNameScrollbar","classNameScrollbarRtl","classNameScrollbarHorizontal","classNameScrollbarVertical","classNameScrollbarTrack","classNameScrollbarHandle","classNameScrollbarVisible","classNameScrollbarCornerless","classNameScrollbarInteraction","classNameScrollbarUnusable","classNameScrollbarAutoHide","classNameScrollbarAutoHideHidden","classNameScrollbarWheel","classNameScrollbarTrackInteractive","classNameScrollbarHandleInteractive","pluginModules","staticPluginModuleInstances","addPlugins","addedPlugin","plugin","registerPluginModuleInstances","staticObj","instanceInfo","_plugin$name","osStatic","static","osInstance","instance","instanceObj","instancePluginMap","getStaticPluginModuleInstance","pluginModuleName","_extends","module","assign","exports","__esModule","optionsTemplateTypes","string","object","function","null","validateRecursive","template","doWriteErrors","propPath","validatedOptions","optionsCopy","optionsValue","templateValue","templateIsComplex","propPrefix","_validateRecursive","validated","foreign","isValid","errorEnumStrings","errorPossibleTypes","optionsValueType","templateValueArr","currTemplateType","typeString","isEnumString","enumStringSplit","possibility","console","warn","toUpperCase","validateOptions","optionsValidationPluginModuleName","_static","numberAllowedValues","oTypes","booleanAllowedValues","arrayNullValues","overflowAllowedValues","scrollbarsVisibilityAllowedValues","scrollbarsAutoHideAllowedValues","optionsTemplate","_validateOptions","sizeObserverPluginName","SizeObserverPlugin","listenerElement","onSizeChangedCallback","observeAppearChange","_setStyles","scrollAmount","scrollEventName","observerElementChildren","observerElementChildrenRoot","shrinkElement","lastChild","expandElement","expandElementChild","cacheSize","currSize","isDirty","rAFId","reset","onResized","appear","onScroll","scrollEvent","destroyFns","getShowNativeOverlaidScrollbars","checkOption","env","_nativeScrollbarsOverlaid","_checkOption","showNativeOverlaidScrollbarsOption","showNativeOverlaidScrollbarsChanged","overflowIsVisible","overflowBehavior","getViewportOverflowState","structureSetupElements","viewportStyleObj","_viewport","getStatePerAxis","styleKey","overflowStyle","objectPrefferedOverflowStyle","overflowScroll","_getStatePerAxis","xOverflowStyle","xOverflowScroll","_getStatePerAxis2","yOverflowStyle","yOverflowScroll","_overflowStyle","_overflowScroll","setViewportOverflowState","hasOverflow","overflowOption","hasAnyOverflow","setAxisOverflowStyle","behavior","hasOverflowAxis","overflowVisible","fallbackVisibilityBehavior","overflowVisibleBehavior","_setAxisOverflowStyle","overflowX","visibleBehaviorX","_setAxisOverflowStyle2","overflowY","visibleBehaviorY","scrollbarsHidingPluginName","ScrollbarsHidingPlugin","_ref2","_viewportArrangement","structureSetupState","observersSetupState","checkOptions","_viewportIsTarget","_nativeScrollbarsHiding","_nativeScrollbarsSize","doViewportArrange","_getShowNativeOverlai","_getViewportOverflowHideOffset","viewportOverflowState","arrangeHideOffset","getHideOffsetPerAxis","isOverlaid","nativeScrollbarSize","nonScrollbarStylingHideOffset","scrollbarsHideOffset","scrollbarsHideOffsetArrange","_getHideOffsetPerAxis","xScrollbarsHideOffset","xScrollbarsHideOffsetArrange","_getHideOffsetPerAxis2","yScrollbarsHideOffset","yScrollbarsHideOffsetArrange","_scrollbarsHideOffset","_scrollbarsHideOffsetArrange","_hideNativeScrollbars","viewportArrange","_assignDeep","_directionIsRTL","_getViewportOverflowH","arrangeX","arrangeY","hideOffsetX","hideOffsetY","_viewportPaddingStyle","horizontalMarginKey","viewportHorizontalPaddingKey","horizontalMarginValue","verticalMarginValue","horizontalPaddingValue","verticalPaddingValue","_arrangeViewport","viewportScrollSize","sizeFraction","_getViewportOverflowH2","viewportArrangeHorizontalPaddingKey","viewportArrangeHorizontalPaddingValue","viewportArrangeVerticalPaddingValue","paddingTop","fractionalContentWidth","fractionalContenHeight","arrangeSize","_undoViewportArrange","finalViewportOverflowState","viewportPaddingStyle","_getViewportOverflowH3","finalPaddingStyle","assignProps","prevStyle","_envWindowZoom","size","dpr","getWindowDPR","screen","dDPI","deviceXDPI","sDPI","logicalXDPI","devicePixelRatio","diffBiggerThanOne","valOne","valTwo","absValOne","absValTwo","envInstance","updateNativeScrollbarSizeCache","sizeNew","deltaSize","deltaAbsSize","deltaAbsRatio","dprNew","deltaIsBigger","difference","dprChanged","isZoom","scrollbarSizeChanged","scrollbarSize","_updateNativeScrollba","clickScrollPluginModuleName","ClickScrollPlugin","moveHandleRelative","getHandleOffset","startOffset","handleLength","relativeTrackPointerOffset","iteration","animateClickScroll","clickScrollProgress","sign","animationProgress","handleStartBound","handleEndBound","mouseBetweenHandleBounds","firstIterationPauseTimeout","environmentInstance","createEnvironment","getNativeScrollbarSize","measureElm","measureElmChild","body","cSize","oSize","fSize","getNativeScrollbarsHiding","testElm","revertClass","getRtlScrollBehavior","childElm","direction","parentOffset","childOffset","childOffsetAfterScroll","envStyle","envDOM","envElm","envChildElm","_createEventListenerH","_createCache","getNativeScrollbarSizeCache","_getNativeScrollbarSi","nativeScrollbarsSize","nativeScrollbarsHiding","nativeScrollbarsOverlaid","staticDefaultInitialization","elements","host","padding","viewport","content","slot","cancel","staticDefaultOptions","getDefaultOptions","getDefaultInitialization","_scrollTimeline","_rtlScrollBehavior","_addResizeListener","_getDefaultInitialization","_setDefaultInitialization","newInitializationStrategy","_getDefaultOptions","_setDefaultOptions","newDefaultOptions","_staticDefaultInitialization","_staticDefaultOptions","scrollbarsHidingPlugin","zoomFn","getEnvironment","resolveInitialization","staticInitializationElement","fallbackStaticInitializationElement","defaultStaticInitializationElement","staticInitializationElementValue","staticInitialization","resolvedInitialization","dynamicInitializationElement","fallbackDynamicInitializationElement","defaultDynamicInitializationElement","dynamicInitializationElementValue","dynamicInitialization","cancelInitialization","isBody","cancelInitializationValue","_getEnvironment","_getDefaultInitializa","defaultNativeScrollbarsOverlaid","defaultbody","resolvedNativeScrollbarsOverlaid","resolvedDocumentScrollingElement","finalNativeScrollbarsOverlaid","finalDocumentScrollingElement","targetInstanceMap","WeakMap","addInstance","removeInstance","delete","getInstance","createEventContentChange","eventContentChange","destroyed","destroy","updateElements","getElements","eventElmList","entries","isTargetChild","contains","removeListener","createDOMObserver","isContentObserver","isConnected","_attributes","_styleChangingAttributes","_eventContentChange","_nestedTargetSelector","_ignoreTargetChange","_ignoreContentChange","debouncedEventContentChange","_createEventContentCh","destroyEventContentChange","updateEventContentChangeElements","finalAttributes","finalStyleChangingAttributes","observedAttributes","observerCallback","fromRecords","mutations","ignoreTargetChange","ignoreContentChange","totalChangedNodes","targetChangedAttrs","targetStyleChanged","contentChanged","mutation","attributeName","mutationTarget","oldValue","addedNodes","removedNodes","isAttributesType","isChildListType","targetIsMutationTarget","isAttrChange","attributeValue","attributeChanged","styleChangingAttrChanged","contentAttrChanged","isNestedTarget","baseAssertion","contentFinalChanged","mutationObserver","observe","attributeOldValue","attributeFilter","subtree","childList","characterData","disconnect","takeRecords","createSizeObserver","observeDirectionChange","_direction","_appear","sizeObserverPlugin","getIsDirectionRTL","updateResizeObserverContentRectCache","baseElements","sizeObserver","onSizeChangedCallbackProxy","sizeChangedContext","isResizeObserverCall","ResizeObserverEntry","hasDirectionCache","skip","doDirectionScroll","_updateResizeObserver","contentRect","currRContentRect","hasDimensions","appeared","firstCall","rtl","_directionIsRTLCache","_sizeChanged","resizeObserverInstance","pop","_sizeObserverPlugin","pluginAppearCallback","pluginDestroyFns","_createCache2","updateDirectionIsRTLCache","directionIsRTLCacheValues","directionIsRTLCache","directionIsRTLCacheChanged","directionIsRTLCachePrevious","createTrinsicObserver","onTrinsicChangedCallback","intersectionObserverInstance","isHeightIntrinsic","ioEntryOrSize","isIntersecting","intersectionRatio","trinsicObserver","updateHeightIntrinsicCache","triggerOnTrinsicChangedCallback","updateValue","heightIntrinsic","heightIntrinsicChanged","intersectionObserverCallback","root","onSizeChanged","newSize","createObserversSetup","getCurrentOption","onObserversUpdated","debounceTimeout","debounceMaxDelay","updateContentMutationObserver","destroyContentMutationObserver","prevDirectionIsRTL","hostSelector","viewportSelector","viewportAttrsFromTarget","baseStyleChangingAttrsTextarea","baseStyleChangingAttrs","_target","_host","_content","_isTextarea","_viewportHasClass","_viewportAddRemoveClass","state","_heightIntrinsic","hasOver","isArranged","scrollOffset","redoViewportArrange","contentScroll","viewportScroll","fractional","updateContentSizeCache","contentMutationObserverAttr","onObserversUpdatedDebounced","prev","prevObj","currObj","setDirectionWhenViewportIsTarget","updateHints","newDirectionIsRTL","_directionChanged","updateViewportAttrsFromHost","attribute","hostAttr","onTrinsicChanged","heightIntrinsicCache","_heightIntrinsicChanged","exclusiveSizeChange","updateFn","directionIsRTL","directionIsRTLChanged","onContentMutation","contentChangedThroughEvent","_updateContentSizeCac","_contentMutation","onHostMutation","_hostMutation","_ref3","constructTrinsicObserver","updateTrinsicObserver","constructSizeObserver","_createDOMObserver","constructHostMutationObserver","updateHostMutationObserver","viewportIsTargetResizeObserver","destroySizeObserver","destroyTrinsicObserver","destroyHostMutationObserver","removeResizeListener","_scrollbarSizeChanged","_updateContentSizeCac2","_ref4","_takeRecords","_force","_checkOption2","_checkOption3","attributesChanged","_checkOption4","elementEventsChanged","_checkOption5","debounceValue","debounceChanged","contentMutationObserverChanged","ignoreMutationFromOptions","_createDOMObserver2","ignore","construct","maxWait","hostUpdateResult","trinsicUpdateResult","contentUpdateResult","createScrollbarsSetupElements","scrollbarsSetupEvents","defaultInitScrollbars","defaultInitScrollbarsSlot","_targetIsElm","_scrollOffsetElement","_isBody","scrollbarsInit","initScrollbarsSlot","elementAnimations","initScrollTimeline","axis","scrollTimelineX","scrollTimelineY","evaluatedScrollbarSlot","generalDynamicInitializationElement","getScrollbarHandleLengthRatio","scrollbarStructure","_track","_handle","handleSize","trackSize","_overflowAmount","_overflowEdge","viewportSize","getScrollbarHandleOffsetRatio","scrollPercent","lengthRatio","addDirectionRTLKeyframes","keyframes","directionRTL","cancelElementAnimations","currAnimations","element","doCancel","animation","setElementAnimation","timeline","composite","activeAnimations","activeAnimation","effect","KeyframeEffect","animate","scrollbarStructureAddRemoveClass","scrollbarStructures","action","_scrollbar","scrollbarStyle","_elmStyle","scrollbarStructureRefreshHandleLength","structure","scrollbarStructureRefreshHandleOffset","getTransformValue","transform","bound","scroll","doRefreshScrollbarOffset","scrollbar","horizontalScrollbars","verticalScrollbars","scrollbarsAddRemoveClass","onlyHorizontal","singleAxis","runHorizontal","runVertical","refreshScrollbarsHandleLength","refreshScrollbarsHandleOffset","refreshScrollbarsScrollbarOffset","cushion","setScrollbarElementAnimation","styleScrollbarPosition","getTranslateValue","axisScroll","axisOverflowAmount","px","generateScrollbarDOM","scrollbarClassName","track","handle","generateHorizontalScrollbarStructure","generateVerticalScrollbarStructure","appendElements","_refreshScrollbarsHandleLength","_refreshScrollbarsHandleOffset","_refreshScrollbarsScrollbarOffset","_scrollbarsAddRemoveClass","_horizontal","_scrollbarStructures","_clone","_style","_vertical","createScrollbarsSetupEvents","scrollbarHandlePointerInteraction","_documentElm","refreshScrollbarStructuresHandleOffset","_selfClearTimeout","wheelTimeout","clearWheelTimeout","_selfClearTimeout2","requestHandleTransitionAnimationFrame","cancelHandleTransitionTimeout","refreshHandleOffsetTransition","scrollByFn","scrollBy","clientXYKey","widthHeightKey","leftTopKey","whKey","xyKey","isAffectingTransition","propertyName","createInteractiveScrollEvents","releasePointerCaptureEvents","createRelativeHandleMove","mouseDownScroll","invertedScale","deltaMovement","_scrollElementTo","handleTrackDiff","scrollDeltaPercent","scrollDelta","pointerDownEvent","isDragScroll","pointerCaptureElement","scrollbarOptions","button","isPrimary","pointerType","continuePointerDown","instantClickScroll","shiftKey","getHandleRect","getTrackRect","handleRect","trackRect","axisScale","pointerDownOffset","handleCenter","releasePointerCapture","pointerUpEvent","pointerId","pointerMoveEvent","relativeMovement","setPointerCapture","wheelScrollBy","focusedElement","focus","preventScroll","wheelEvent","deltaX","deltaY","deltaMode","animateHandleOffset","createScrollbarsSetup","mouseInHost","autoHideIsMove","autoHideIsLeave","autoHideIsNever","prevTheme","instanceAutoHideSuspendScrollDestroyFn","instanceAutoHideDelay","isHoverablePointerType","requestScrollAnimationFrame","cancelScrollAnimationFrame","autoHideInstantInteractionTimeout","clearAutoHideInstantInteractionTimeout","_selfClearTimeout3","autoHideSuspendTimeout","clearAutoHideSuspendTimeout","_selfClearTimeout4","auotHideTimeout","clearAutoHideTimeout","_createScrollbarsSetu","manageScrollbarsAutoHideInstantInteraction","_scrollEventElement","manageScrollbarsAutoHide","removeAutoHide","delayless","hide","manageAutoHideSuspension","onHostMouseEnter","_observersUpdateHints","_structureUpdateHints","_overflowEdgeChanged","_overflowAmountChanged","_overflowStyleChanged","_hasOverflow","themeChanged","visibilityChanged","autoHideChanged","_checkOption6","autoHideSuspendChanged","_checkOption7","_checkOption8","dragScrollChanged","_checkOption9","clickScrollChanged","_checkOption10","overflowChanged","trulyAppeared","updateScrollbars","updateVisibility","setScrollbarVisibility","isVisible","xVisible","yVisible","hasCorner","createStructureSetupElements","defaultInitElements","defaultHostInitialization","defaultPaddingInitialization","defaultViewportInitialization","defaultContentInitialization","targetIsElm","targetStructureInitialization","initElements","hostInitialization","paddingInitialization","viewportInitialization","contentInitialization","targetElement","isTextarea","ownerDocument","docElement","documentElement","getDocumentWindow","defaultView","focusElm","customActiveElm","generalStaticInitializationElement","createNewDiv","generateViewportElement","generateContentElement","possibleViewportElement","viewportIsTarget","viewportIsTargetBody","possibleContentElement","viewportIsContent","viewportElement","nonBodyHostElement","hostElement","paddingElement","contentElement","generatedElements","elementIsGenerated","originalNonBodyScrollOffsetElement","evaluatedTargetObj","_padding","_originalScrollOffsetElement","_windowElm","viewportAttributeClassName","isTextareaHostGenerated","targetContents","contentSlot","docWnd","initActiveElm","unwrap","prepareWrapUnwrapFocus","stopImmediatePropagation","tabIndexStr","ogTabindex","undoInitWrapUndwrapFocus","destroyActiveElm","undoDestroyWrapUndwrapFocus","createTrinsicUpdateSegment","_observersState","createPaddingUpdateSegment","updatePaddingCache","currentPaddingCache","_currentPaddingCache","paddingChanged","paddingAbsoluteChanged","contentMutation","_updatePaddingCache","paddingStyleChanged","_paddingStyle","_viewportStyle","paddingRelative","paddingHorizontal","paddingVertical","paddingStyle","viewportStyle","_paddingAbsolute","_paddingStyleChanged","createOverflowUpdateSegment","max0","whCacheOptions","xyCacheOptions","getOverflowAmount","viewportClientSize","tollerance","amount","updateSizeFraction","getCurrentSizeFraction","updateViewportScrollSizeCache","getCurrentViewportScrollSizeCache","_createCache3","updateOverflowAmountCache","getCurrentOverflowAmountCache","_createCache4","updateOverflowEdge","getCurrentOverflowEdgeCache","_createCache5","updateOverflowStyleCache","scrollbarsHidingPluginViewportArrangement","adjustViewportArrange","overflowXVisible","overflowYVisible","sizeFractionCache","viewportScrollSizeCache","overflowAmuntCache","overflowEdgeCache","preMeasureViewportOverflowState","_ref5","undoViewportArrangeOverflowState","_sizeFractionCache","sizeFractionChanged","_viewportScrollSizeCa","viewportScrollSizeChanged","arrangedViewportScrollSize","arrangedViewportClientSize","windowInnerSize","overflowAmountScrollSize","overflowAmountClientSize","_overflowEdgeCache","overflowEdge","overflowEdgeChanged","_overflowAmuntCache","overflowAmountChanged","_viewportScrollSizeCa2","_sizeFractionCache2","removeClipping","adjustViewportStyle","_updateOverflowStyleC","overflowStyleChanged","createStructureSetup","_createStructureSetup","appendStructureElements","canceled","updateSegments","updateInfo","adjustScrollOffset","updateSegment","createSetups","onUpdated","structureSetupCreate","structureSetupUpdate","structureSetupCanceled","_createObserversSetup","observersUpdateHints","observersSetupCreate","observersSetupUpdate","scrollbarsSetupCreate","scrollbarsSetupUpdate","scrollbarsSetupElements","updateHintsAreTruthy","hints","some","observerUpdateHints","rawChangedOptions","_changedOptions","rawForce","_cloneScrollbar","baseUpdateInfoObj","observersHints","structureHints","truthyObserversHints","truthyStructureHints","initialScroll","_observersSetupState","_structureSetupState","_structureSetupElements","_scrollbarsSetupElements","OverlayScrollbars","eventListeners","targetIsElement","instanceTarget","potentialInstance","instancePluginModuleInstances","newOptionsWithoutUndefined","pluginValidate","currentOptions","addPluginEvent","removePluginEvents","triggerPluginEvent","_createEventListenerH2","addInstanceEvent","removeInstanceEvents","triggerInstanceEvent","_createSetups","sizeChanged","directionChanged","hostMutation","setupsConstruct","setupsUpdate","setupsState","setupsElements","setupsCanceled","pure","base","on","off","_setupsState","_setupsElements$_stru","_setupsElements$_scro","translateScrollbarStructure","translateScrollbarsSetupElement","scrollbarsSetupElement","translatedStructure","scrollOffsetElement","scrollEventElement","scrollbarHorizontal","scrollbarVertical","plugins","isArr","pluginsToAdd","valid","hasElmsFn","_getEnvironment2","scrollbarsSize","scrollbarsOverlaid","scrollbarsHiding","scrollTimeline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