: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
setupDelayTrigger(event) {
this.state._delayed = true;
this.timeoutStore.add('dragDelay', () => {
this.state._step = [0, 0];
this.startPointerDrag(event);
const deltaFn = KEYS_DELTA_MAP[event.key];
const state = this.state;
const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
state._delta = deltaFn(this.config.keyboardDisplacement, factor);
state._keyboardActive = true;
V.addTo(state._movement, state._delta);
if (!(event.key in KEYS_DELTA_MAP)) return;
this.state._keyboardActive = false;
const device = this.config.device;
bindFunction(device, 'start', this.pointerDown.bind(this));
if (this.config.pointerCapture) {
bindFunction(device, 'change', this.pointerMove.bind(this));
bindFunction(device, 'end', this.pointerUp.bind(this));
bindFunction(device, 'cancel', this.pointerUp.bind(this));
bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
bindFunction('key', 'down', this.keyDown.bind(this));
bindFunction('key', 'up', this.keyUp.bind(this));
if (this.config.filterTaps) {
bindFunction('click', '', this.pointerClick.bind(this), {
function persistEvent(event) {
'persist' in event && typeof event.persist === 'function' && event.persist();
const actions_fe213e88_esm_isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
function supportsTouchEvents() {
return actions_fe213e88_esm_isBrowser && 'ontouchstart' in window;
function isTouchScreen() {
return supportsTouchEvents() || actions_fe213e88_esm_isBrowser && window.navigator.maxTouchPoints > 1;
function supportsPointerEvents() {
return actions_fe213e88_esm_isBrowser && 'onpointerdown' in window;
function supportsPointerLock() {
return actions_fe213e88_esm_isBrowser && 'exitPointerLock' in window.document;
function supportsGestureEvents() {
return 'constructor' in GestureEvent;
isBrowser: actions_fe213e88_esm_isBrowser,
gesture: supportsGestureEvents(),
touch: supportsTouchEvents(),
touchscreen: isTouchScreen(),
pointer: supportsPointerEvents(),
pointerLock: supportsPointerLock()
const DEFAULT_PREVENT_SCROLL_DELAY = 250;
const DEFAULT_DRAG_DELAY = 180;
const DEFAULT_SWIPE_VELOCITY = 0.5;
const DEFAULT_SWIPE_DISTANCE = 50;
const DEFAULT_SWIPE_DURATION = 250;
const DEFAULT_KEYBOARD_DISPLACEMENT = 10;
const DEFAULT_DRAG_AXIS_THRESHOLD = {
const dragConfigResolver = _objectSpread2(_objectSpread2({}, coordinatesConfigResolver), {}, {
this.pointerLock = lock && SUPPORT.pointerLock;
if (SUPPORT.touch && touch) return 'touch';
if (this.pointerLock) return 'mouse';
if (SUPPORT.pointer && !mouse) return 'pointer';
if (SUPPORT.touch) return 'touch';
preventScrollAxis(value, _k, {
this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
return value ? value : preventScroll !== undefined ? 'y' : undefined;
this.pointerButtons = buttons;
return !this.pointerLock && this.device === 'pointer' && capture;
const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
this.filterTaps = filterTaps;
this.tapsThreshold = tapsThreshold;
velocity = DEFAULT_SWIPE_VELOCITY,
distance = DEFAULT_SWIPE_DISTANCE,
duration = DEFAULT_SWIPE_DURATION
velocity: this.transform(V.toVector(velocity)),
distance: this.transform(V.toVector(distance)),
return DEFAULT_DRAG_DELAY;
if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
return _objectSpread2(_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
keyboardDisplacement(value = DEFAULT_KEYBOARD_DISPLACEMENT) {
function clampStateInternalMovementToBounds(state) {
const [ox, oy] = state.overflow;
const [dx, dy] = state._delta;
const [dirx, diry] = state._direction;
if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
state._movement[0] = state._movementBound[0];
if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
state._movement[1] = state._movementBound[1];
const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
const PINCH_WHEEL_RATIO = 100;
class PinchEngine extends Engine {
_defineProperty(this, "ingKey", 'pinching');
_defineProperty(this, "aliasKey", 'da');
this.state.offset = [1, 0];
this.state.lastOffset = [1, 0];
this.state._pointerEvents = new Map();
const state = this.state;
state.cancel = this.cancel.bind(this);
this.state.offset = V.add(movement, lastOffset);
this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
const state = this.state;
const [_m0, _m1] = state._movement;
const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
if (this.config.lockDirection) {
if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
const state = this.state;
if (state.canceled) return;
this.ctrl.setEventIds(event);
const state = this.state;
const ctrlTouchIds = this.ctrl.touchIds;
if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
if (ctrlTouchIds.size < 2) return;
state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
const payload = touchDistanceAngle(event, state._touchIds);
this.pinchStart(event, payload);
if (event.buttons != null && event.buttons % 2 !== 1) return;
this.ctrl.setEventIds(event);
event.target.setPointerCapture(event.pointerId);
const state = this.state;
const _pointerEvents = state._pointerEvents;
const ctrlPointerIds = this.ctrl.pointerIds;
if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
if (_pointerEvents.size < 2) {
_pointerEvents.set(event.pointerId, event);
if (state._pointerEvents.size < 2) return;
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
this.pinchStart(event, payload);
pinchStart(event, payload) {
const state = this.state;
state.origin = payload.origin;
this.computeValues([payload.distance, payload.angle]);
if (!this.state._active) return;
const payload = touchDistanceAngle(event, this.state._touchIds);
this.pinchMove(event, payload);
const _pointerEvents = this.state._pointerEvents;
if (_pointerEvents.has(event.pointerId)) {
_pointerEvents.set(event.pointerId, event);
if (!this.state._active) return;
const payload = distanceAngle(...Array.from(_pointerEvents.values()));
this.pinchMove(event, payload);
pinchMove(event, payload) {
const state = this.state;
const prev_a = state._values[1];
const delta_a = payload.angle - prev_a;
if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
state.origin = payload.origin;
state.turns = delta_turns;
state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
this.ctrl.setEventIds(event);
if (!this.state._active) return;
if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
this.state._active = false;
const state = this.state;
this.ctrl.setEventIds(event);
event.target.releasePointerCapture(event.pointerId);
if (state._pointerEvents.has(event.pointerId)) {
state._pointerEvents.delete(event.pointerId);
if (!state._active) return;
if (state._pointerEvents.size < 2) {
if (event.cancelable) event.preventDefault();
const state = this.state;
if (state._active) return;
this.computeValues([event.scale, event.rotation]);
state.origin = [event.clientX, event.clientY];
if (event.cancelable) event.preventDefault();
if (!this.state._active) return;
const state = this.state;
this.computeValues([event.scale, event.rotation]);
state.origin = [event.clientX, event.clientY];
const _previousMovement = state._movement;
state._movement = [event.scale - 1, event.rotation];
state._delta = V.sub(state._movement, _previousMovement);
if (!this.state._active) return;
this.state._active = false;
const modifierKey = this.config.modifierKey;
if (modifierKey && (Array.isArray(modifierKey) ? !modifierKey.find(k => event[k]) : !event[modifierKey])) return;
if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
const isR3f = ('uv' in event);
const state = this.state;
state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
V.addTo(state._movement, state._delta);
clampStateInternalMovementToBounds(state);
this.state.origin = [event.clientX, event.clientY];
if (!this.state._active) return;
this.state._active = false;
const device = this.config.device;
bindFunction(device, 'start', this[device + 'Start'].bind(this));
bindFunction(device, 'change', this[device + 'Move'].bind(this));
bindFunction(device, 'end', this[device + 'End'].bind(this));
bindFunction(device, 'cancel', this[device + 'End'].bind(this));
bindFunction('lostPointerCapture', '', this[device + 'End'].bind(this));
if (this.config.pinchOnWheel) {
bindFunction('wheel', '', this.wheel.bind(this), {
const pinchConfigResolver = _objectSpread2(_objectSpread2({}, commonConfigResolver), {}, {
const sharedConfig = shared;
if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
if (SUPPORT.touch && touch) return 'touch';
if (SUPPORT.touchscreen) {
if (SUPPORT.pointer) return 'pointer';
if (SUPPORT.touch) return 'touch';
const _scaleBounds = state => {
const D = assignDefault(call(scaleBounds, state), {
const _angleBounds = state => {
const A = assignDefault(call(angleBounds, state), {
if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
return state => [_scaleBounds(state), _angleBounds(state)];
threshold(value, _k, config) {
this.lockDirection = config.axis === 'lock';
const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
if (value === undefined) return 'ctrlKey';
pinchOnWheel(value = true) {
class MoveEngine extends CoordinatesEngine {
_defineProperty(this, "ingKey", 'moving');
if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
if (!this.state._active) this.moveStart(event);else this.moveChange(event);
this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
this.computeValues(pointerValues(event));
if (!this.state._active) return;
const values = pointerValues(event);
const state = this.state;
state._delta = V.sub(values, state._values);
V.addTo(state._movement, state._delta);
this.computeValues(values);
if (!this.state._active) return;
this.state._active = false;
bindFunction('pointer', 'change', this.move.bind(this));