: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
return this.ctrl.gestureEventStores[this.key];
return this.ctrl.gestureTimeoutStores[this.key];
return this.ctrl.config[this.key];
return this.ctrl.config.shared;
return this.ctrl.handlers[this.key];
shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
state._step = [false, false];
state.intentional = false;
state._movement = [0, 0];
state._distance = [0, 0];
state._direction = [0, 0];
state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
state.elapsedTime = state.timeDelta = 0;
state.direction = [0, 0];
state._movementBound = [false, false];
const state = this.state;
const config = this.config;
state.target = event.target;
state.currentTarget = event.currentTarget;
state.lastOffset = config.from ? call(config.from, state) : state.offset;
state.offset = state.lastOffset;
state.startTime = state.timeStamp = event.timeStamp;
const state = this.state;
state.values = this.config.transform(values);
const state = this.state;
state._initial = state._values;
state.initial = state.values;
if (config.preventDefault && event.cancelable) state.event.preventDefault();
shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
shared.locked = !!document.pointerLockElement;
Object.assign(shared, getEventDetails(event));
shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
dt = event.timeStamp - state.timeStamp;
state.timeStamp = event.timeStamp;
state.elapsedTime = state.timeStamp - state.startTime;
const _absoluteDelta = state._delta.map(Math.abs);
V.addTo(state._distance, _absoluteDelta);
if (this.axisIntent) this.axisIntent(event);
const [_m0, _m1] = state._movement;
const [t0, t1] = config.threshold;
if (config.hasCustomTransform) {
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
state.intentional = _step[0] !== false || _step[1] !== false;
if (!state.intentional) return;
if (config.hasCustomTransform) {
movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
const previousOffset = state.offset;
const gestureIsActive = state._active && !state._blocked || state.active;
state.first = state._active && !state.active;
state.last = !state._active && state.active;
state.active = shared[this.ingKey] = state._active;
if ('bounds' in config) state._bounds = call(config.bounds, state);
if (this.setup) this.setup();
state.movement = movement;
const [ox, oy] = state.offset;
const [[x0, x1], [y0, y1]] = state._bounds;
state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
state.offset = computeRubberband(state._bounds, state.offset, rubberband);
state.delta = V.sub(state.offset, previousOffset);
if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
state.delta = V.sub(state.offset, previousOffset);
const absoluteDelta = state.delta.map(Math.abs);
V.addTo(state.distance, absoluteDelta);
state.direction = state.delta.map(Math.sign);
state._direction = state._delta.map(Math.sign);
if (!state.first && dt > 0) {
state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
const state = this.state;
const shared = this.shared;
const config = this.config;
if (!state._active) this.clean();
if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
const memo = this.handler(_objectSpread2(_objectSpread2(_objectSpread2({}, shared), state), {}, {
[this.aliasKey]: state.values
if (memo !== undefined) state.memo = memo;
this.timeoutStore.clean();
function selectAxis([dx, dy], threshold) {
const absDx = Math.abs(dx);
const absDy = Math.abs(dy);
if (absDx > absDy && absDx > threshold) {
if (absDy > absDx && absDy > threshold) {
class CoordinatesEngine extends Engine {
_defineProperty(this, "aliasKey", 'xy');
this.state.axis = undefined;
this.state.offset = [0, 0];
this.state.lastOffset = [0, 0];
this.state.offset = V.add(this.state.lastOffset, this.state.movement);
this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
const state = this.state;
const config = this.config;
if (!state.axis && event) {
const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
state.axis = selectAxis(state._movement, threshold);
state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
if (this.config.axis || this.config.lockDirection) {
switch (this.state.axis) {
const actions_fe213e88_esm_identity = v => v;
const DEFAULT_RUBBERBAND = 0.15;
const commonConfigResolver = {
eventOptions(value, _k, config) {
return _objectSpread2(_objectSpread2({}, config.shared.eventOptions), value);
preventDefault(value = false) {
triggerAllEvents(value = false) {
return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
return V.toVector(value);
if (typeof value === 'function') return value;
if (value != null) return V.toVector(value);
transform(value, _k, config) {
const transform = value || config.shared.transform;
this.hasCustomTransform = !!transform;
return transform || actions_fe213e88_esm_identity;
return V.toVector(value, 0);
const DEFAULT_AXIS_THRESHOLD = 0;
const coordinatesConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
this.lockDirection = axis === 'lock';
if (!this.lockDirection) return axis;
axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
if (typeof value === 'function') {
return state => coordinatesConfigResolver.bounds(value(state));
if ('current' in value) {
return () => value.current;
if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
return [[left, right], [top, bottom]];
ArrowRight: (displacement, factor = 1) => [displacement * factor, 0],
ArrowLeft: (displacement, factor = 1) => [-1 * displacement * factor, 0],
ArrowUp: (displacement, factor = 1) => [0, -1 * displacement * factor],
ArrowDown: (displacement, factor = 1) => [0, displacement * factor]
class DragEngine extends CoordinatesEngine {
_defineProperty(this, "ingKey", 'dragging');
const state = this.state;
state._pointerId = undefined;
state._pointerActive = false;
state._keyboardActive = false;
state._preventScroll = false;
state.cancel = this.cancel.bind(this);
const state = this.state;
if (state._bounds instanceof HTMLElement) {
const boundRect = state._bounds.getBoundingClientRect();
const targetRect = state.currentTarget.getBoundingClientRect();
left: boundRect.left - targetRect.left + state.offset[0],
right: boundRect.right - targetRect.right + state.offset[0],
top: boundRect.top - targetRect.top + state.offset[1],
bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
state._bounds = coordinatesConfigResolver.bounds(_bounds);
const state = this.state;
if (state.canceled) return;
this.state._active = this.state._pointerActive || this.state._keyboardActive;
this.state._pointerActive = false;
this.state._keyboardActive = false;
const config = this.config;
const state = this.state;
if (event.buttons != null && (Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) : config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
const ctrlIds = this.ctrl.setEventIds(event);
if (config.pointerCapture) {
event.target.setPointerCapture(event.pointerId);
if (ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
this.setupPointer(event);
state._pointerId = pointerId(event);
state._pointerActive = true;
this.computeValues(pointerValues(event));
if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
this.setupScrollPrevention(event);
} else if (config.delay > 0) {
this.setupDelayTrigger(event);
if (config.triggerAllEvents) {
this.startPointerDrag(event);
startPointerDrag(event) {
const state = this.state;
state._preventScroll = true;
const state = this.state;
const config = this.config;
if (!state._pointerActive) return;
const id = pointerId(event);
if (state._pointerId !== undefined && id !== state._pointerId) return;
const _values = pointerValues(event);
if (document.pointerLockElement === event.target) {
state._delta = [event.movementX, event.movementY];
state._delta = V.sub(_values, state._values);
this.computeValues(_values);
V.addTo(state._movement, state._delta);
if (state._delayed && state.intentional) {
this.timeoutStore.remove('dragDelay');
this.startPointerDrag(event);
if (config.preventScrollAxis && !state._preventScroll) {
if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
this.timeoutStore.remove('startPointerDrag');
this.startPointerDrag(event);
this.ctrl.setEventIds(event);
if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
event.target.releasePointerCapture(event.pointerId);
const state = this.state;
const config = this.config;
if (!state._active || !state._pointerActive) return;
const id = pointerId(event);
if (state._pointerId !== undefined && id !== state._pointerId) return;
this.state._pointerActive = false;
const [dx, dy] = state._distance;
state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
if (state.tap && config.filterTaps) {
const [_dx, _dy] = state._delta;
const [_mx, _my] = state._movement;
const [svx, svy] = config.swipe.velocity;
const [sx, sy] = config.swipe.distance;
const sdt = config.swipe.duration;
if (state.elapsedTime < sdt) {
const _vx = Math.abs(_dx / state.timeDelta);
const _vy = Math.abs(_dy / state.timeDelta);
if (_vx > svx && Math.abs(_mx) > sx) state.swipe[0] = Math.sign(_dx);
if (_vy > svy && Math.abs(_my) > sy) state.swipe[1] = Math.sign(_dy);
if (!this.state.tap && event.detail > 0) {
const config = this.config;
const device = config.device;
if (config.pointerLock) {
event.currentTarget.requestPointerLock();
if (!config.pointerCapture) {
this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
document.exitPointerLock();
if (this.state._preventScroll && event.cancelable) {
setupScrollPrevention(event) {
this.state._preventScroll = false;
const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);