Comparing version 1.16.2 to 1.17.0
@@ -6,2 +6,23 @@ # Changelog | ||
## [1.17.0] - 2022-07-04 | ||
* `selecto` 1.17.0 | ||
* `react-selecto` 1.17.0 | ||
* `preact-selecto` 1.17.0 | ||
* `ngx-selecto` 1.17.0 | ||
* `svelte-selecto` 1.17.0 | ||
* `vue-selecto` 1.17.0 | ||
* `vue3-selecto` 1.17.0 | ||
* `lit-selecto` 1.17.0 | ||
### Added | ||
* Add `toggleContinueSelectWithoutDeselect` prop #80 | ||
### Fixed | ||
* enhance large amount of data #81 | ||
* fix vue methods #79 | ||
* fix elementFromPoint in jest #83 | ||
* fix meta key in firefox #82 | ||
* fix vue container #64 | ||
## [1.13.2] - 2021-11-24 | ||
@@ -8,0 +29,0 @@ * `selecto` 1.13.2 |
import { SelectoOptions } from "./types"; | ||
export declare const injector: import("css-styled").StyledInjector; | ||
export declare const CLASS_NAME: string; | ||
export declare const PROPERTIES: readonly ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "toggleContinueSelect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
export declare const OPTIONS: readonly ["dragContainer", "cspNonce", "continueSelectWithoutDeselect", ...("boundContainer" | "selectableTargets" | "selectByClick" | "selectFromInside" | "continueSelect" | "toggleContinueSelect" | "keyContainer" | "hitRate" | "scrollOptions" | "checkInput" | "preventDefault" | "ratio" | "getElementRect" | "preventDragFromInside" | "rootContainer" | "dragCondition" | "clickBySelectEnd")[]]; | ||
export declare const PROPERTIES: readonly ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "continueSelectWithoutDeselect", "toggleContinueSelect", "toggleContinueSelectWithoutDeselect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
export declare const OPTIONS: readonly ["dragContainer", "cspNonce", ...("boundContainer" | "selectableTargets" | "selectByClick" | "selectFromInside" | "continueSelect" | "continueSelectWithoutDeselect" | "toggleContinueSelect" | "toggleContinueSelectWithoutDeselect" | "keyContainer" | "hitRate" | "scrollOptions" | "checkInput" | "preventDefault" | "ratio" | "getElementRect" | "preventDragFromInside" | "rootContainer" | "dragCondition" | "clickBySelectEnd")[]]; | ||
export declare const OPTION_TYPES: { | ||
@@ -7,0 +7,0 @@ [key in keyof SelectoOptions]: any; |
@@ -13,9 +13,7 @@ import EventEmitter from "@scena/event-emitter"; | ||
private keycon; | ||
private _keydownContinueSelect; | ||
private _keydownContinueSelectWithoutDeselection; | ||
constructor(options?: Partial<SelectoOptions>); | ||
setSelectedTargets(selectedTargets: Array<HTMLElement | SVGElement>): this; | ||
getSelectedTargets(): Array<HTMLElement | SVGElement>; | ||
setKeyContainer(keyContainer: HTMLElement | Document | Window): void; | ||
setToggleContinueSelect(toggleContinueSelect: string[][] | string[] | string): void; | ||
setPreventDefault(value: boolean): void; | ||
setCheckInput(value: boolean): void; | ||
triggerDragStart(e: MouseEvent | TouchEvent): this; | ||
@@ -30,2 +28,9 @@ destroy(): void; | ||
private setKeyEvent; | ||
private setKeyContainer; | ||
private getContinueSelect; | ||
private getContinueSelectWithoutDeselect; | ||
private setToggleContinueSelect; | ||
private setToggleContinueSelectWithoutDeselect; | ||
private setPreventDefault; | ||
private setCheckInput; | ||
private initElement; | ||
@@ -46,2 +51,3 @@ private hitTest; | ||
private _findElement; | ||
private _refreshGroups; | ||
} | ||
@@ -48,0 +54,0 @@ interface Selecto extends SelectoProperties { |
@@ -18,2 +18,3 @@ import { IObject } from "@daybrush/utils"; | ||
toggleContinueSelect: string[][] | string[] | string | null; | ||
toggleContinueSelectWithoutDeselect: string[][] | string[] | string | null; | ||
keyContainer: Document | HTMLElement | Window | null; | ||
@@ -89,2 +90,4 @@ hitRate: number | string; | ||
export interface OnKeyEvent<T = Selecto> extends CurrentTarget<T> { | ||
keydownContinueSelect: boolean; | ||
keydownContinueSelectWithoutDeselection: boolean; | ||
} | ||
@@ -130,1 +133,5 @@ export interface OnScroll { | ||
} | ||
export interface InnerGroup { | ||
targets: Array<HTMLElement | SVGElement>; | ||
points: number[][][]; | ||
} |
@@ -7,5 +7,8 @@ import { Hypertext, Rect } from "./types"; | ||
}; | ||
export declare function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null; | ||
export declare function createElement(jsx: Hypertext, prevTarget?: HTMLElement | SVGElement, container?: HTMLElement | SVGElement): HTMLElement | SVGElement; | ||
export declare function h(tag: string, attrs: IObject<any>, ...children: Hypertext[]): Hypertext; | ||
export declare function diffValue<T>(prev: T, cur: T, func: (prev: T, cur: T) => void): void; | ||
export declare function isFastInside(point: number[], points: number[][]): boolean; | ||
export declare function getFastOverlapPoints(points1: number[][], points2: number[][]): number[][]; | ||
export declare function getRect(e: any, ratio: number, boundArea?: any): Rect; | ||
@@ -12,0 +15,0 @@ export declare function getDefaultElementRect(el: HTMLElement | SVGElement): { |
@@ -111,2 +111,7 @@ /* | ||
} | ||
function elementFromPoint(clientX, clientY) { | ||
var _a, _b; | ||
return _b = (_a = document) === null || _a === void 0 ? void 0 : _a.elementFromPoint(clientX, clientY), _b !== null && _b !== void 0 ? _b : null; | ||
} | ||
function createElement(jsx, prevTarget, container) { | ||
@@ -257,3 +262,3 @@ var tag = jsx.tag, | ||
var CLASS_NAME = "selecto-selection " + injector.className; | ||
var PROPERTIES = ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "toggleContinueSelect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
var PROPERTIES = ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "continueSelectWithoutDeselect", "toggleContinueSelect", "toggleContinueSelectWithoutDeselect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
/** | ||
@@ -264,3 +269,3 @@ * @memberof Selecto | ||
var OPTIONS = __spreadArrays([// ignore target, container, | ||
"dragContainer", "cspNonce", "continueSelectWithoutDeselect"], PROPERTIES); | ||
"dragContainer", "cspNonce"], PROPERTIES); | ||
var OPTION_TYPES = { | ||
@@ -276,2 +281,3 @@ boundContainer: null, | ||
toggleContinueSelect: Array, | ||
toggleContinueSelectWithoutDeselect: Array, | ||
keyContainer: null, | ||
@@ -333,4 +339,2 @@ hitRate: Number, | ||
var _a = _this.options, | ||
continueSelect = _a.continueSelect, | ||
continueSelectWithoutDeselect = _a.continueSelectWithoutDeselect, | ||
selectFromInside = _a.selectFromInside, | ||
@@ -350,2 +354,5 @@ selectByClick = _a.selectByClick, | ||
datas.innerWidth = window.innerWidth; | ||
datas.innerHeight = window.innerHeight; | ||
_this.findSelectableTargets(datas); | ||
@@ -429,3 +436,3 @@ | ||
if (!selectFromInside || selectByClick && !clickBySelectEnd) { | ||
var pointTarget = _this._findElement(clickedTarget || document.elementFromPoint(clientX, clientY), datas.selectableTargets); | ||
var pointTarget = _this._findElement(clickedTarget || elementFromPoint(clientX, clientY), datas.selectableTargets); | ||
@@ -481,4 +488,4 @@ firstPassedTargets = pointTarget ? [pointTarget] : []; | ||
if (continueSelect) { | ||
firstPassedTargets = passTargets(_this.selectedTargets, firstPassedTargets, continueSelectWithoutDeselect); | ||
if (_this.continueSelect) { | ||
firstPassedTargets = passTargets(_this.selectedTargets, firstPassedTargets, _this.continueSelectWithoutDeselect); | ||
datas.startPassedTargets = _this.selectedTargets; | ||
@@ -573,3 +580,3 @@ } else { | ||
// only clickBySelectEnd | ||
var pointTarget = _this._findElement(document.elementFromPoint(e.clientX, e.clientY), datas.selectableTargets); | ||
var pointTarget = _this._findElement(elementFromPoint(e.clientX, e.clientY), datas.selectableTargets); | ||
@@ -585,7 +592,22 @@ _this._select(_this.selectedTargets, pointTarget ? [pointTarget] : [], rect, inputEvent); | ||
_this._onKeyDown = function (e) { | ||
if (!_this._sameCombiKey(e)) { | ||
var options = _this.options; | ||
var isKeyDown = false; | ||
if (!_this._keydownContinueSelect) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelect); | ||
_this._keydownContinueSelect = result; | ||
isKeyDown = result; | ||
} | ||
if (!_this._keydownContinueSelectWithoutDeselection) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelectWithoutDeselect); | ||
_this._keydownContinueSelectWithoutDeselection = result; | ||
isKeyDown = isKeyDown || result; | ||
} | ||
if (!isKeyDown) { | ||
return; | ||
} | ||
_this.continueSelect = true; | ||
/** | ||
@@ -618,11 +640,30 @@ * When you keydown the key you specified in toggleContinueSelect, the keydown event is called. | ||
_this.emit("keydown", {}); | ||
_this.emit("keydown", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
}; | ||
_this._onKeyUp = function (e) { | ||
if (!_this._sameCombiKey(e, true)) { | ||
var options = _this.options; | ||
var isKeyUp = false; | ||
if (_this._keydownContinueSelect) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelect, true); | ||
_this._keydownContinueSelect = !result; | ||
isKeyUp = result; | ||
} | ||
if (_this._keydownContinueSelectWithoutDeselection) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelectWithoutDeselect, true); | ||
_this._keydownContinueSelectWithoutDeselection = !result; | ||
isKeyUp = isKeyUp || result; | ||
} | ||
if (!isKeyUp) { | ||
return; | ||
} | ||
_this.continueSelect = false; | ||
/** | ||
@@ -655,10 +696,18 @@ * When you keyup the key you specified in toggleContinueSelect, the keyup event is called. | ||
_this.emit("keyup", {}); | ||
_this.emit("keyup", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
}; | ||
_this._onBlur = function () { | ||
if (_this.toggleContinueSelect && _this.continueSelect) { | ||
_this.continueSelect = false; | ||
if (_this._keydownContinueSelect || _this._keydownContinueSelectWithoutDeselection) { | ||
_this._keydownContinueSelect = false; | ||
_this._keydownContinueSelectWithoutDeselection = false; | ||
_this.emit("keyup", {}); | ||
_this.emit("keyup", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
} | ||
@@ -702,2 +751,3 @@ }; | ||
toggleContinueSelect: null, | ||
toggleContinueSelectWithoutDeselect: null, | ||
keyContainer: null, | ||
@@ -744,32 +794,2 @@ scrollOptions: undefined, | ||
}; | ||
__proto.setKeyContainer = function (keyContainer) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.keyContainer, keyContainer, function () { | ||
options.keyContainer = keyContainer; | ||
_this.setKeyController(); | ||
}); | ||
}; | ||
__proto.setToggleContinueSelect = function (toggleContinueSelect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelect, toggleContinueSelect, function () { | ||
options.toggleContinueSelect = toggleContinueSelect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setPreventDefault = function (value) { | ||
this.gesto.options.preventDefault = value; | ||
}; | ||
__proto.setCheckInput = function (value) { | ||
this.gesto.options.checkInput = value; | ||
}; | ||
/** | ||
@@ -879,2 +899,4 @@ * `OnDragStart` is triggered by an external event. | ||
datas.selectablePoints = selectablePoints; | ||
this._refreshGroups(datas); | ||
}; | ||
@@ -916,3 +938,4 @@ /** | ||
keyContainer = _a.keyContainer, | ||
toggleContinueSelect = _a.toggleContinueSelect; | ||
toggleContinueSelect = _a.toggleContinueSelect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
@@ -924,3 +947,3 @@ if (this.keycon) { | ||
if (toggleContinueSelect) { | ||
if (toggleContinueSelect || toggleContinueSelectWithoutDeselect) { | ||
this.keycon = new KeyController(keyContainer || window); | ||
@@ -932,5 +955,7 @@ this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur", this._onBlur); | ||
__proto.setKeyEvent = function () { | ||
var toggleContinueSelect = this.options.toggleContinueSelect; | ||
var _a = this.options, | ||
toggleContinueSelect = _a.toggleContinueSelect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
if (!toggleContinueSelect || this.keycon) { | ||
if (!toggleContinueSelect && !toggleContinueSelectWithoutDeselect || this.keycon) { | ||
return; | ||
@@ -940,4 +965,70 @@ } | ||
this.setKeyController(); | ||
}; // with getter, setter property | ||
__proto.setKeyContainer = function (keyContainer) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.keyContainer, keyContainer, function () { | ||
options.keyContainer = keyContainer; | ||
_this.setKeyController(); | ||
}); | ||
}; | ||
__proto.getContinueSelect = function () { | ||
var _a = this.options, | ||
continueSelect = _a.continueSelect, | ||
toggleContinueSelect = _a.toggleContinueSelect; | ||
if (!toggleContinueSelect || !this._keydownContinueSelect) { | ||
return continueSelect; | ||
} | ||
return !continueSelect; | ||
}; | ||
__proto.getContinueSelectWithoutDeselect = function () { | ||
var _a = this.options, | ||
continueSelectWithoutDeselect = _a.continueSelectWithoutDeselect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
if (!toggleContinueSelectWithoutDeselect || !this._keydownContinueSelectWithoutDeselection) { | ||
return continueSelectWithoutDeselect; | ||
} | ||
return !continueSelectWithoutDeselect; | ||
}; | ||
__proto.setToggleContinueSelect = function (toggleContinueSelect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelect, toggleContinueSelect, function () { | ||
options.toggleContinueSelect = toggleContinueSelect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setToggleContinueSelectWithoutDeselect = function (toggleContinueSelectWithoutDeselect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelectWithoutDeselect, toggleContinueSelectWithoutDeselect, function () { | ||
options.toggleContinueSelectWithoutDeselect = toggleContinueSelectWithoutDeselect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setPreventDefault = function (value) { | ||
this.gesto.options.preventDefault = value; | ||
}; | ||
__proto.setCheckInput = function (value) { | ||
this.gesto.options.checkInput = value; | ||
}; | ||
__proto.initElement = function () { | ||
@@ -969,3 +1060,3 @@ this.target = createElement(h("div", { | ||
__proto.hitTest = function (selectRect, clientX, clientY, targets, selectablePoints) { | ||
__proto.hitTest = function (selectRect, clientX, clientY, datas) { | ||
var _a = this.options, | ||
@@ -978,5 +1069,8 @@ hitRate = _a.hitRate, | ||
bottom = selectRect.bottom; | ||
var innerGroups = datas.innerGroups; | ||
var innerWidth = datas.innerWidth; | ||
var innerHeight = datas.innerHeight; | ||
var rectPoints = [[left, top], [right, top], [right, bottom], [left, bottom]]; | ||
return targets.filter(function (_, i) { | ||
var points = selectablePoints[i]; | ||
var isHit = function (points) { | ||
var inArea = overlapArea.isInside([clientX, clientY], points); | ||
@@ -1004,3 +1098,47 @@ | ||
} | ||
}); | ||
}; | ||
if (!innerGroups) { | ||
var selectableTargets = datas.selectableTargets; | ||
var selectablePoints_1 = datas.selectablePoints; | ||
return selectableTargets.filter(function (_, i) { | ||
return isHit(selectablePoints_1[i]); | ||
}); | ||
} | ||
var selectedTargets = []; | ||
var minX = Math.floor(left / innerWidth); | ||
var maxX = Math.floor(right / innerWidth); | ||
var minY = Math.floor(top / innerHeight); | ||
var maxY = Math.floor(bottom / innerHeight); | ||
for (var x = minX; x <= maxX; ++x) { | ||
var yGroups = innerGroups[x]; | ||
if (!yGroups) { | ||
continue; | ||
} | ||
var _loop_1 = function (y) { | ||
var group = yGroups[y]; | ||
if (!group) { | ||
return "continue"; | ||
} | ||
var points = group.points, | ||
targets = group.targets; | ||
points.forEach(function (nextPoints, i) { | ||
if (isHit(nextPoints)) { | ||
selectedTargets.push(targets[i]); | ||
} | ||
}); | ||
}; | ||
for (var y = minY; y <= maxY; ++y) { | ||
_loop_1(y); | ||
} | ||
} | ||
return selectedTargets; | ||
}; | ||
@@ -1040,2 +1178,5 @@ | ||
}); | ||
_this._refreshGroups(datas); | ||
boundArea.left -= offsetX; | ||
@@ -1226,3 +1367,2 @@ boundArea.right -= offsetX; | ||
var selectFlag = datas.selectFlag; | ||
var options = this.options; | ||
var containerX = datas.containerX, | ||
@@ -1238,5 +1378,5 @@ containerY = datas.containerY, | ||
this.target.style.cssText += "display: block;" + "left:0px;top:0px;" + ("transform: translate(" + offsetPos[0] + "px, " + offsetPos[1] + "px);") + ("width:" + offsetSize[0] + "px;height:" + offsetSize[1] + "px;"); | ||
var passedTargets = this.hitTest(rect, datas.startX, datas.startY, datas.selectableTargets, datas.selectablePoints); | ||
var passedTargets = this.hitTest(rect, datas.startX, datas.startY, datas); | ||
prevSelectedTargets = this.selectedTargets; | ||
selectedTargets = passTargets(datas.startPassedTargets, passedTargets, options.continueSelect && options.continueSelectWithoutDeselect); | ||
selectedTargets = passTargets(datas.startPassedTargets, passedTargets, this.continueSelect && this.continueSelectWithoutDeselect); | ||
this.selectedTargets = selectedTargets; | ||
@@ -1288,6 +1428,10 @@ } | ||
__proto._sameCombiKey = function (e, isKeyup) { | ||
var toggleContinueSelect = [].concat(this.options.toggleContinueSelect); | ||
__proto._sameCombiKey = function (e, keys, isKeyup) { | ||
if (!keys) { | ||
return false; | ||
} | ||
var combi = KeyController.getCombi(e.inputEvent, e.key); | ||
var toggleKeys = utils.isArray(toggleContinueSelect[0]) ? toggleContinueSelect : [toggleContinueSelect]; | ||
var nextKeys = [].concat(keys); | ||
var toggleKeys = utils.isArray(nextKeys[0]) ? nextKeys : [nextKeys]; | ||
@@ -1324,2 +1468,31 @@ if (isKeyup) { | ||
__proto._refreshGroups = function (datas) { | ||
var innerWidth = datas.innerWidth; | ||
var innerHeight = datas.innerHeight; | ||
if (!innerWidth || !innerHeight) { | ||
datas.innerGroups = null; | ||
} else { | ||
var selectableTargets_1 = datas.selectableTargets; | ||
var selectablePoints = datas.selectablePoints; | ||
var groups_1 = {}; | ||
selectablePoints.forEach(function (points, i) { | ||
var pos = points[0]; | ||
var x = Math.floor(pos[0] / innerWidth); | ||
var y = Math.floor(pos[1] / innerHeight); | ||
groups_1[x] = groups_1[x] || {}; | ||
groups_1[x][y] = groups_1[x][y] || { | ||
points: [], | ||
targets: [] | ||
}; | ||
var _a = groups_1[x][y], | ||
targets = _a.targets, | ||
groupPoints = _a.points; | ||
targets.push(selectableTargets_1[i]); | ||
groupPoints.push(points); | ||
}); | ||
datas.innerGroups = groups_1; | ||
} | ||
}; | ||
Selecto = __decorate([frameworkUtils.Properties(PROPERTIES, function (prototype, property) { | ||
@@ -1333,2 +1506,14 @@ var attributes = { | ||
}; | ||
var getter = utils.camelize("get " + property); | ||
if (prototype[getter]) { | ||
attributes.get = function get() { | ||
return this[getter](); | ||
}; | ||
} else { | ||
attributes.get = function get() { | ||
return this.options[property]; | ||
}; | ||
} | ||
var setter = utils.camelize("set " + property); | ||
@@ -1335,0 +1520,0 @@ |
@@ -12,3 +12,3 @@ /* | ||
import { Properties } from 'framework-utils'; | ||
import { hasClass, addClass, calculateBoundSize, isObject, isString, removeEvent, addEvent, splitUnit, between, isArray, camelize } from '@daybrush/utils'; | ||
import { hasClass, addClass, calculateBoundSize, isObject, isString, removeEvent, addEvent, isArray, camelize, splitUnit, between } from '@daybrush/utils'; | ||
import { diff } from '@egjs/children-differ'; | ||
@@ -110,2 +110,7 @@ import DragScroll from '@scena/dragscroll'; | ||
} | ||
function elementFromPoint(clientX, clientY) { | ||
var _a, _b; | ||
return _b = (_a = document) === null || _a === void 0 ? void 0 : _a.elementFromPoint(clientX, clientY), _b !== null && _b !== void 0 ? _b : null; | ||
} | ||
function createElement(jsx, prevTarget, container) { | ||
@@ -256,3 +261,3 @@ var tag = jsx.tag, | ||
var CLASS_NAME = "selecto-selection " + injector.className; | ||
var PROPERTIES = ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "toggleContinueSelect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
var PROPERTIES = ["boundContainer", "selectableTargets", "selectByClick", "selectFromInside", "continueSelect", "continueSelectWithoutDeselect", "toggleContinueSelect", "toggleContinueSelectWithoutDeselect", "keyContainer", "hitRate", "scrollOptions", "checkInput", "preventDefault", "ratio", "getElementRect", "preventDragFromInside", "rootContainer", "dragCondition", "clickBySelectEnd"]; | ||
/** | ||
@@ -263,3 +268,3 @@ * @memberof Selecto | ||
var OPTIONS = __spreadArrays([// ignore target, container, | ||
"dragContainer", "cspNonce", "continueSelectWithoutDeselect"], PROPERTIES); | ||
"dragContainer", "cspNonce"], PROPERTIES); | ||
var OPTION_TYPES = { | ||
@@ -275,2 +280,3 @@ boundContainer: null, | ||
toggleContinueSelect: Array, | ||
toggleContinueSelectWithoutDeselect: Array, | ||
keyContainer: null, | ||
@@ -332,4 +338,2 @@ hitRate: Number, | ||
var _a = _this.options, | ||
continueSelect = _a.continueSelect, | ||
continueSelectWithoutDeselect = _a.continueSelectWithoutDeselect, | ||
selectFromInside = _a.selectFromInside, | ||
@@ -349,2 +353,5 @@ selectByClick = _a.selectByClick, | ||
datas.innerWidth = window.innerWidth; | ||
datas.innerHeight = window.innerHeight; | ||
_this.findSelectableTargets(datas); | ||
@@ -428,3 +435,3 @@ | ||
if (!selectFromInside || selectByClick && !clickBySelectEnd) { | ||
var pointTarget = _this._findElement(clickedTarget || document.elementFromPoint(clientX, clientY), datas.selectableTargets); | ||
var pointTarget = _this._findElement(clickedTarget || elementFromPoint(clientX, clientY), datas.selectableTargets); | ||
@@ -480,4 +487,4 @@ firstPassedTargets = pointTarget ? [pointTarget] : []; | ||
if (continueSelect) { | ||
firstPassedTargets = passTargets(_this.selectedTargets, firstPassedTargets, continueSelectWithoutDeselect); | ||
if (_this.continueSelect) { | ||
firstPassedTargets = passTargets(_this.selectedTargets, firstPassedTargets, _this.continueSelectWithoutDeselect); | ||
datas.startPassedTargets = _this.selectedTargets; | ||
@@ -572,3 +579,3 @@ } else { | ||
// only clickBySelectEnd | ||
var pointTarget = _this._findElement(document.elementFromPoint(e.clientX, e.clientY), datas.selectableTargets); | ||
var pointTarget = _this._findElement(elementFromPoint(e.clientX, e.clientY), datas.selectableTargets); | ||
@@ -584,7 +591,22 @@ _this._select(_this.selectedTargets, pointTarget ? [pointTarget] : [], rect, inputEvent); | ||
_this._onKeyDown = function (e) { | ||
if (!_this._sameCombiKey(e)) { | ||
var options = _this.options; | ||
var isKeyDown = false; | ||
if (!_this._keydownContinueSelect) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelect); | ||
_this._keydownContinueSelect = result; | ||
isKeyDown = result; | ||
} | ||
if (!_this._keydownContinueSelectWithoutDeselection) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelectWithoutDeselect); | ||
_this._keydownContinueSelectWithoutDeselection = result; | ||
isKeyDown = isKeyDown || result; | ||
} | ||
if (!isKeyDown) { | ||
return; | ||
} | ||
_this.continueSelect = true; | ||
/** | ||
@@ -617,11 +639,30 @@ * When you keydown the key you specified in toggleContinueSelect, the keydown event is called. | ||
_this.emit("keydown", {}); | ||
_this.emit("keydown", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
}; | ||
_this._onKeyUp = function (e) { | ||
if (!_this._sameCombiKey(e, true)) { | ||
var options = _this.options; | ||
var isKeyUp = false; | ||
if (_this._keydownContinueSelect) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelect, true); | ||
_this._keydownContinueSelect = !result; | ||
isKeyUp = result; | ||
} | ||
if (_this._keydownContinueSelectWithoutDeselection) { | ||
var result = _this._sameCombiKey(e, options.toggleContinueSelectWithoutDeselect, true); | ||
_this._keydownContinueSelectWithoutDeselection = !result; | ||
isKeyUp = isKeyUp || result; | ||
} | ||
if (!isKeyUp) { | ||
return; | ||
} | ||
_this.continueSelect = false; | ||
/** | ||
@@ -654,10 +695,18 @@ * When you keyup the key you specified in toggleContinueSelect, the keyup event is called. | ||
_this.emit("keyup", {}); | ||
_this.emit("keyup", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
}; | ||
_this._onBlur = function () { | ||
if (_this.toggleContinueSelect && _this.continueSelect) { | ||
_this.continueSelect = false; | ||
if (_this._keydownContinueSelect || _this._keydownContinueSelectWithoutDeselection) { | ||
_this._keydownContinueSelect = false; | ||
_this._keydownContinueSelectWithoutDeselection = false; | ||
_this.emit("keyup", {}); | ||
_this.emit("keyup", { | ||
keydownContinueSelect: _this._keydownContinueSelect, | ||
keydownContinueSelectWithoutDeselection: _this._keydownContinueSelectWithoutDeselection | ||
}); | ||
} | ||
@@ -701,2 +750,3 @@ }; | ||
toggleContinueSelect: null, | ||
toggleContinueSelectWithoutDeselect: null, | ||
keyContainer: null, | ||
@@ -743,32 +793,2 @@ scrollOptions: undefined, | ||
}; | ||
__proto.setKeyContainer = function (keyContainer) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.keyContainer, keyContainer, function () { | ||
options.keyContainer = keyContainer; | ||
_this.setKeyController(); | ||
}); | ||
}; | ||
__proto.setToggleContinueSelect = function (toggleContinueSelect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelect, toggleContinueSelect, function () { | ||
options.toggleContinueSelect = toggleContinueSelect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setPreventDefault = function (value) { | ||
this.gesto.options.preventDefault = value; | ||
}; | ||
__proto.setCheckInput = function (value) { | ||
this.gesto.options.checkInput = value; | ||
}; | ||
/** | ||
@@ -878,2 +898,4 @@ * `OnDragStart` is triggered by an external event. | ||
datas.selectablePoints = selectablePoints; | ||
this._refreshGroups(datas); | ||
}; | ||
@@ -915,3 +937,4 @@ /** | ||
keyContainer = _a.keyContainer, | ||
toggleContinueSelect = _a.toggleContinueSelect; | ||
toggleContinueSelect = _a.toggleContinueSelect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
@@ -923,3 +946,3 @@ if (this.keycon) { | ||
if (toggleContinueSelect) { | ||
if (toggleContinueSelect || toggleContinueSelectWithoutDeselect) { | ||
this.keycon = new KeyController(keyContainer || window); | ||
@@ -931,5 +954,7 @@ this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur", this._onBlur); | ||
__proto.setKeyEvent = function () { | ||
var toggleContinueSelect = this.options.toggleContinueSelect; | ||
var _a = this.options, | ||
toggleContinueSelect = _a.toggleContinueSelect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
if (!toggleContinueSelect || this.keycon) { | ||
if (!toggleContinueSelect && !toggleContinueSelectWithoutDeselect || this.keycon) { | ||
return; | ||
@@ -939,4 +964,70 @@ } | ||
this.setKeyController(); | ||
}; // with getter, setter property | ||
__proto.setKeyContainer = function (keyContainer) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.keyContainer, keyContainer, function () { | ||
options.keyContainer = keyContainer; | ||
_this.setKeyController(); | ||
}); | ||
}; | ||
__proto.getContinueSelect = function () { | ||
var _a = this.options, | ||
continueSelect = _a.continueSelect, | ||
toggleContinueSelect = _a.toggleContinueSelect; | ||
if (!toggleContinueSelect || !this._keydownContinueSelect) { | ||
return continueSelect; | ||
} | ||
return !continueSelect; | ||
}; | ||
__proto.getContinueSelectWithoutDeselect = function () { | ||
var _a = this.options, | ||
continueSelectWithoutDeselect = _a.continueSelectWithoutDeselect, | ||
toggleContinueSelectWithoutDeselect = _a.toggleContinueSelectWithoutDeselect; | ||
if (!toggleContinueSelectWithoutDeselect || !this._keydownContinueSelectWithoutDeselection) { | ||
return continueSelectWithoutDeselect; | ||
} | ||
return !continueSelectWithoutDeselect; | ||
}; | ||
__proto.setToggleContinueSelect = function (toggleContinueSelect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelect, toggleContinueSelect, function () { | ||
options.toggleContinueSelect = toggleContinueSelect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setToggleContinueSelectWithoutDeselect = function (toggleContinueSelectWithoutDeselect) { | ||
var _this = this; | ||
var options = this.options; | ||
diffValue(options.toggleContinueSelectWithoutDeselect, toggleContinueSelectWithoutDeselect, function () { | ||
options.toggleContinueSelectWithoutDeselect = toggleContinueSelectWithoutDeselect; | ||
_this.setKeyEvent(); | ||
}); | ||
}; | ||
__proto.setPreventDefault = function (value) { | ||
this.gesto.options.preventDefault = value; | ||
}; | ||
__proto.setCheckInput = function (value) { | ||
this.gesto.options.checkInput = value; | ||
}; | ||
__proto.initElement = function () { | ||
@@ -968,3 +1059,3 @@ this.target = createElement(h("div", { | ||
__proto.hitTest = function (selectRect, clientX, clientY, targets, selectablePoints) { | ||
__proto.hitTest = function (selectRect, clientX, clientY, datas) { | ||
var _a = this.options, | ||
@@ -977,5 +1068,8 @@ hitRate = _a.hitRate, | ||
bottom = selectRect.bottom; | ||
var innerGroups = datas.innerGroups; | ||
var innerWidth = datas.innerWidth; | ||
var innerHeight = datas.innerHeight; | ||
var rectPoints = [[left, top], [right, top], [right, bottom], [left, bottom]]; | ||
return targets.filter(function (_, i) { | ||
var points = selectablePoints[i]; | ||
var isHit = function (points) { | ||
var inArea = isInside([clientX, clientY], points); | ||
@@ -1003,3 +1097,47 @@ | ||
} | ||
}); | ||
}; | ||
if (!innerGroups) { | ||
var selectableTargets = datas.selectableTargets; | ||
var selectablePoints_1 = datas.selectablePoints; | ||
return selectableTargets.filter(function (_, i) { | ||
return isHit(selectablePoints_1[i]); | ||
}); | ||
} | ||
var selectedTargets = []; | ||
var minX = Math.floor(left / innerWidth); | ||
var maxX = Math.floor(right / innerWidth); | ||
var minY = Math.floor(top / innerHeight); | ||
var maxY = Math.floor(bottom / innerHeight); | ||
for (var x = minX; x <= maxX; ++x) { | ||
var yGroups = innerGroups[x]; | ||
if (!yGroups) { | ||
continue; | ||
} | ||
var _loop_1 = function (y) { | ||
var group = yGroups[y]; | ||
if (!group) { | ||
return "continue"; | ||
} | ||
var points = group.points, | ||
targets = group.targets; | ||
points.forEach(function (nextPoints, i) { | ||
if (isHit(nextPoints)) { | ||
selectedTargets.push(targets[i]); | ||
} | ||
}); | ||
}; | ||
for (var y = minY; y <= maxY; ++y) { | ||
_loop_1(y); | ||
} | ||
} | ||
return selectedTargets; | ||
}; | ||
@@ -1039,2 +1177,5 @@ | ||
}); | ||
_this._refreshGroups(datas); | ||
boundArea.left -= offsetX; | ||
@@ -1225,3 +1366,2 @@ boundArea.right -= offsetX; | ||
var selectFlag = datas.selectFlag; | ||
var options = this.options; | ||
var containerX = datas.containerX, | ||
@@ -1237,5 +1377,5 @@ containerY = datas.containerY, | ||
this.target.style.cssText += "display: block;" + "left:0px;top:0px;" + ("transform: translate(" + offsetPos[0] + "px, " + offsetPos[1] + "px);") + ("width:" + offsetSize[0] + "px;height:" + offsetSize[1] + "px;"); | ||
var passedTargets = this.hitTest(rect, datas.startX, datas.startY, datas.selectableTargets, datas.selectablePoints); | ||
var passedTargets = this.hitTest(rect, datas.startX, datas.startY, datas); | ||
prevSelectedTargets = this.selectedTargets; | ||
selectedTargets = passTargets(datas.startPassedTargets, passedTargets, options.continueSelect && options.continueSelectWithoutDeselect); | ||
selectedTargets = passTargets(datas.startPassedTargets, passedTargets, this.continueSelect && this.continueSelectWithoutDeselect); | ||
this.selectedTargets = selectedTargets; | ||
@@ -1287,6 +1427,10 @@ } | ||
__proto._sameCombiKey = function (e, isKeyup) { | ||
var toggleContinueSelect = [].concat(this.options.toggleContinueSelect); | ||
__proto._sameCombiKey = function (e, keys, isKeyup) { | ||
if (!keys) { | ||
return false; | ||
} | ||
var combi = getCombi(e.inputEvent, e.key); | ||
var toggleKeys = isArray(toggleContinueSelect[0]) ? toggleContinueSelect : [toggleContinueSelect]; | ||
var nextKeys = [].concat(keys); | ||
var toggleKeys = isArray(nextKeys[0]) ? nextKeys : [nextKeys]; | ||
@@ -1323,2 +1467,31 @@ if (isKeyup) { | ||
__proto._refreshGroups = function (datas) { | ||
var innerWidth = datas.innerWidth; | ||
var innerHeight = datas.innerHeight; | ||
if (!innerWidth || !innerHeight) { | ||
datas.innerGroups = null; | ||
} else { | ||
var selectableTargets_1 = datas.selectableTargets; | ||
var selectablePoints = datas.selectablePoints; | ||
var groups_1 = {}; | ||
selectablePoints.forEach(function (points, i) { | ||
var pos = points[0]; | ||
var x = Math.floor(pos[0] / innerWidth); | ||
var y = Math.floor(pos[1] / innerHeight); | ||
groups_1[x] = groups_1[x] || {}; | ||
groups_1[x][y] = groups_1[x][y] || { | ||
points: [], | ||
targets: [] | ||
}; | ||
var _a = groups_1[x][y], | ||
targets = _a.targets, | ||
groupPoints = _a.points; | ||
targets.push(selectableTargets_1[i]); | ||
groupPoints.push(points); | ||
}); | ||
datas.innerGroups = groups_1; | ||
} | ||
}; | ||
Selecto = __decorate([Properties(PROPERTIES, function (prototype, property) { | ||
@@ -1332,2 +1505,14 @@ var attributes = { | ||
}; | ||
var getter = camelize("get " + property); | ||
if (prototype[getter]) { | ||
attributes.get = function get() { | ||
return this[getter](); | ||
}; | ||
} else { | ||
attributes.get = function get() { | ||
return this.options[property]; | ||
}; | ||
} | ||
var setter = camelize("set " + property); | ||
@@ -1334,0 +1519,0 @@ |
@@ -9,3 +9,3 @@ /* | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Selecto=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Y=function(){return(Y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function u(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var e="object",X="string",l=['"',"'",'\\"',"\\'"],f=1e-7;function F(t){return t&&typeof t===e}function a(t){return Array.isArray(t)}function h(t,e,n,r){for(var i=n;i<r;++i){var o=e[i].trim();if(o===t)return i;var a=i;if("("===o?a=h(")",e,i+1,r):-1<l.indexOf(o)&&(a=h(o,e,i+1,r)),-1===a)break;i=a}return-1}function i(t,e){for(var n=new RegExp("(\\s*"+(e||",")+"\\s*|\\(|\\)|\"|'|\\\\\"|\\\\'|\\s+)","g"),r=t.split(n).filter(Boolean),i=r.length,o=[],a=[],s=0;s<i;++s){var c=r[s].trim(),u=s;if("("===c)u=h(")",r,s+1,i);else{if(")"===c)throw new Error("invalid format");if(-1<l.indexOf(c))u=h(c,r,s+1,i);else if(c===e){a.length&&(o.push(a.join("")),a=[]);continue}}-1===u&&(u=i-1),a.push(r.slice(s,u+1).join("")),s=u}return a.length&&o.push(a.join("")),o}function C(t){return i(t,",")}function _(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var n=e[1],r=e[2];return{prefix:n,unit:e[3],value:parseFloat(r)}}function E(){return Date.now?Date.now():(new Date).getTime()}function m(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function g(t,e,n){return Math.max(e,Math.min(t,n))}function d(t,e){return e?Math.round(t/e)*e:t}function y(t,n,r){return[[d(n[0],f),d(n[0]*t[1]/t[0],f)],[d(n[1]*t[0]/t[1],f),d(n[1],f)]].filter(function(t){return t.every(function(t,e){return r?t<=n[e]:t>=n[e]})})[0]||t}function s(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=Math.atan2(r,n);return 0<=i?i:i+2*Math.PI}function c(t){return[0,1].map(function(e){return function(t){for(var e=t.length,n=0,r=e-1;0<=r;--r)n+=t[r];return e?n/e:0}(t.map(function(t){return t[e]}))})}function p(t){var e=c(t),n=s(e,t[0]),r=s(e,t[1]);return n<r&&r-n<Math.PI||r<n&&r-n<-Math.PI?1:-1}function v(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function b(t,e,n,r){t.addEventListener(e,n,r)}function S(t,e,n){t.removeEventListener(e,n)}var D=function(){return(D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};var t=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(F(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(F(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=m(r,function(t){return t.listener===e});-1<i&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this;void 0===n&&(n={});var t=this._events[e];if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(D({listener:e},n))},t}(),w=function(t,e){return(w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var k=function(){return(k=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function n(t){return 180*(e=[t[0].clientX,t[0].clientY],n=[t[1].clientX,t[1].clientY],r=n[0]-e[0],i=n[1]-e[1],(0<=(o=Math.atan2(i,r))?o:o+2*Math.PI)/Math.PI);var e,n,r,i,o}function P(t){return t.touches?function(t){for(var e=Math.min(t.length,2),n=[],r=0;r<e;++r)n.push(O(t[r]));return n}(t.touches):[O(t)]}function x(t,e,n){var r=n.length,i=M(t,r),o=i.clientX,a=i.clientY,s=i.originalClientX,c=i.originalClientY,u=M(e,r),l=u.clientX,f=u.clientY,h=M(n,r);return{clientX:s,clientY:c,deltaX:o-l,deltaY:a-f,distX:o-h.clientX,distY:a-h.clientY}}function T(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function O(t){return{clientX:t.clientX,clientY:t.clientY}}function M(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var j=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var e=t.prototype;return e.getAngle=function(t){return void 0===t&&(t=this.prevClients),n(t)},e.getRotation=function(t){return void 0===t&&(t=this.prevClients),n(t)-n(this.startClients)},e.getPosition=function(t,e){void 0===t&&(t=this.prevClients);var n=x(t||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=t,n},e.getPositions=function(n){void 0===n&&(n=this.prevClients);var r=this.prevClients;return this.startClients.map(function(t,e){return x([n[e]],[r[e]],[t])})},e.getMovement=function(t){var e=this.movement;if(!t)return e;var n=M(t,this.length),r=M(this.prevClients,this.length),i=n.clientX-r.clientX,o=n.clientY-r.clientY;return Math.sqrt(i*i+o*o)+e},e.getDistance=function(t){return void 0===t&&(t=this.prevClients),T(t)},e.getScale=function(t){return void 0===t&&(t=this.prevClients),T(t)/T(this.startClients)},e.move=function(e,n){this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n})},t}(),K=["textarea","input"],B=function(c){function t(){this.constructor=e}var e,n;function r(t,e){void 0===e&&(e={});var y=c.call(this)||this;y.options={},y.flag=!1,y.pinchFlag=!1,y.datas={},y.isDrag=!1,y.isPinch=!1,y.isMouse=!1,y.isTouch=!1,y.clientStores=[],y.targets=[],y.prevTime=0,y.doubleFlag=!1,y._dragFlag=!1,y.onDragStart=function(t,e){if(void 0===e&&(e=!0),y.flag||!1!==t.cancelable){var n=y.options,r=n.container,i=n.pinchOutside,o=n.preventRightClick,a=n.preventDefault,s=n.checkInput,c=y.isTouch,u=!y.flag;if(u){var l=document.activeElement,f=t.target,h=f.tagName.toLowerCase(),d=-1<K.indexOf(h),p=f.isContentEditable;if(d||p){if(s||l===f)return!1;if(l&&p&&l.isContentEditable&&l.contains(f))return!1}else if((a||"touchstart"===t.type)&&l){var v=l.tagName;(l.isContentEditable||-1<K.indexOf(v))&&l.blur()}if(y.clientStores=[new j(P(t))],y.flag=!0,y.isDrag=!1,y._dragFlag=!0,y.datas={},o&&(3===t.which||2===t.button))return y.initDrag(),!1;y.doubleFlag=E()-y.prevTime<200,!1===y.emit("dragStart",k({datas:y.datas,inputEvent:t,isTrusted:e,isDouble:y.doubleFlag},y.getCurrentStore().getPosition(),{preventDefault:function(){t.preventDefault()},preventDrag:function(){y._dragFlag=!1}}))&&y.initDrag(),y.flag&&a&&t.preventDefault()}if(!y.flag)return!1;var g,m=0;if(u&&c&&i&&(m=setTimeout(function(){b(r,"touchstart",y.onDragStart,{passive:!1})})),!u&&c&&i&&S(r,"touchstart",y.onDragStart),y.flag&&((g=t).touches&&2<=g.touches.length)){if(clearTimeout(m),u&&t.touches.length!==t.changedTouches.length)return;y.pinchFlag||y.onPinchStart(t)}}},y.onDrag=function(t,e){if(y.flag){var n=P(t),r=y.moveClients(n,t,!1);if(y._dragFlag){if(y.pinchFlag||r.deltaX||r.deltaY)if(!1===y.emit("drag",k({},r,{isScroll:!!e,inputEvent:t})))return void y.stop();y.pinchFlag&&y.onPinch(t,n)}y.getCurrentStore().getPosition(n,!0)}},y.onDragEnd=function(t){if(y.flag){var e=y.options,n=e.pinchOutside,r=e.container;y.isTouch&&n&&S(r,"touchstart",y.onDragStart),y.flag=!1;var i=y._getPosition(),o=E(),a=!y.isDrag&&y.doubleFlag;y.prevTime=y.isDrag||a?0:o,y.emit("dragEnd",k({datas:y.datas,isDouble:a,isDrag:y.isDrag,isClick:!y.isDrag,inputEvent:t},i)),y.pinchFlag&&y.onPinchEnd(t),y.clientStores=[]}},y.onBlur=function(){y.onDragEnd()};var n=[].concat(t);y.options=k({checkInput:!1,container:1<n.length?window:n[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},e);var r=y.options,i=r.container,o=r.events,a=r.checkWindowBlur;if(y.isTouch=-1<o.indexOf("touch"),y.isMouse=-1<o.indexOf("mouse"),y.targets=n,y.isMouse&&(n.forEach(function(t){b(t,"mousedown",y.onDragStart)}),b(i,"mousemove",y.onDrag),b(i,"mouseup",y.onDragEnd),b(i,"contextmenu",y.onDragEnd)),a&&b(window,"blur",y.onBlur),y.isTouch){var s={passive:!1};n.forEach(function(t){b(t,"touchstart",y.onDragStart,s)}),b(i,"touchmove",y.onDrag,s),b(i,"touchend",y.onDragEnd,s),b(i,"touchcancel",y.onDragEnd,s)}return y}w(e=r,n=c),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t);var i=r.prototype;return i.stop=function(){this.isDrag=!1,this.flag=!1,this.clientStores=[],this.datas={}},i.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,e){return t+e.movement},0)},i.isDragging=function(){return this.isDrag},i.isFlag=function(){return this.flag},i.isPinchFlag=function(){return this.pinchFlag},i.isDoubleFlag=function(){return this.doubleFlag},i.isPinching=function(){return this.isPinch},i.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},i.move=function(t,e){var r=t[0],i=t[1],n=this.getCurrentStore().prevClients;return this.moveClients(n.map(function(t){var e=t.clientX,n=t.clientY;return{clientX:e+r,clientY:n+i,originalClientX:e,originalClientY:n}}),e,!0)},i.triggerDragStart=function(t){this.onDragStart(t,!1)},i.setEventDatas=function(t){var e=this.datas;for(var n in t)e[n]=t[n];return this},i.getCurrentEvent=function(t){return k({datas:this.datas},this._getPosition(),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:t})},i.getEventDatas=function(){return this.datas},i.unset=function(){var e=this,t=this.targets,n=this.options.container;this.off(),S(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){S(t,"mousedown",e.onDragStart)}),S(n,"mousemove",this.onDrag),S(n,"mouseup",this.onDragEnd),S(n,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){S(t,"touchstart",e.onDragStart)}),S(n,"touchstart",this.onDragStart),S(n,"touchmove",this.onDrag),S(n,"touchend",this.onDragEnd),S(n,"touchcancel",this.onDragEnd))},i.onPinchStart=function(t){var e=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>e)){var n=new j(P(t));this.pinchFlag=!0,this.clientStores.splice(0,0,n),!1===this.emit("pinchStart",k({datas:this.datas,angle:n.getAngle(),touches:this.getCurrentStore().getPositions()},n.getPosition(),{inputEvent:t}))&&(this.pinchFlag=!1)}},i.onPinch=function(t,e){if(this.flag&&this.pinchFlag&&!(e.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",k({datas:this.datas,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e),{inputEvent:t}))}},i.onPinchEnd=function(t){if(this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit("pinchEnd",k({datas:this.datas,isPinch:e,touches:n.getPositions()},n.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},i.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1},i.getCurrentStore=function(){return this.clientStores[0]},i.moveClients=function(t,e,n){var r=this._getPosition(t,n);return(r.deltaX||r.deltaY)&&(this.isDrag=!0),k({datas:this.datas},r,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},i._getPosition=function(t,e){var n=this.getCurrentStore().getPosition(t,e),r=this.clientStores.slice(1).reduce(function(t,e){var n=e.getPosition();return t.distX+=n.distX,t.distY+=n.distY,t},n),i=r.distX,o=r.distY;return k({},n,{distX:i,distY:o})},r}(t);var I=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),o=-1===i?n.length:i;n[o]=t,r[o]=e},t}(),A=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),R="function"==typeof Map,N=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var L=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,s,c,e=(t=this.changedBeforeAdded,n=this.fixed,s=[],c=[],t.forEach(function(t){var e=t[0],n=t[1],r=new N;s[e]=r,c[n]=r}),s.forEach(function(t,e){t.connect(s[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],r=t[1];if(n===r)return[0,0];var i=s[n],o=c[r-1],a=i.getIndex();return i.disconnect(),o?i.connect(o,o.next):i.connect(void 0,s[0]),[a,i.getIndex()]})),u=this.changed,l=[];this.cacheOrdered=e.filter(function(t,e){var n=t[0],r=t[1],i=u[e],o=i[0],a=i[1];if(n!==r)return l.push([o,a]),!0}),this.cachePureChanged=l},t}();var W,q="function"==typeof Map?void 0:(W=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++W)});function Z(t,e){return n=t,r=e,i=q,o=R?Map:i?A:I,a=i||function(t){return t},s=[],c=[],u=[],l=n.map(a),f=r.map(a),h=new o,d=new o,p=[],v=[],g={},m=[],E=y=0,l.forEach(function(t,e){h.set(t,e)}),f.forEach(function(t,e){d.set(t,e)}),l.forEach(function(t,e){var n=d.get(t);void 0===n?(++E,c.push(e)):g[n]=E}),f.forEach(function(t,e){var n=h.get(t);void 0===n?(s.push(e),++y):(u.push([n,e]),E=g[e]||0,p.push([n-E,e-y]),v.push(e===n),n!==e&&m.push([n,e]))}),c.reverse(),new L(n,r,s,c,m,u,p,v);var n,r,i,o,a,s,c,u,l,f,h,d,p,v,g,m,y,E}var H=function(t,e){return(H=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var U=function(){return(U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function V(t){var e=t.container;return e===document.body?[e.scrollLeft||document.documentElement.scrollLeft,e.scrollTop||document.documentElement.scrollTop]:[e.scrollLeft,e.scrollTop]}var z=function(e){function t(){this.constructor=n}var n,r;function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._startRect=null,t._startPos=[],t._prevTime=0,t._timer=0,t._prevScrollPos=[0,0],t._isWait=!1,t}H(n=i,r=e),n.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return o.dragStart=function(t,e){var n=e.container,r=0,i=0,o=0,a=0;if(n===document.body)o=window.innerWidth,a=window.innerHeight;else{var s=n.getBoundingClientRect();r=s.top,i=s.left,o=s.width,a=s.height}this._startPos=[t.clientX,t.clientY],this._startRect={top:r,left:i,width:o,height:a},this._prevScrollPos=this._getScrollPosition([0,0],e)},o.drag=function(t,e){var n=t.clientX,r=t.clientY,i=e.threshold,o=void 0===i?0:i,a=this._startRect,s=this._startPos,c=[0,0];return a.top>r-o?(s[1]>a.top||r<s[1])&&(c[1]=-1):a.top+a.height<r+o&&(s[1]<a.top+a.height||r>s[1])&&(c[1]=1),a.left>n-o?(s[0]>a.left||n<s[0])&&(c[0]=-1):a.left+a.width<n+o&&(s[0]<a.left+a.width||n>s[0])&&(c[0]=1),clearTimeout(this._timer),!(!c[0]&&!c[1])&&this._continueDrag(U(U({},e),{direction:c,inputEvent:t,isDrag:!0}))},o.checkScroll=function(t){var e=this;if(this._isWait)return!1;var n=t.prevScrollPos,r=void 0===n?this._prevScrollPos:n,i=t.direction,o=t.throttleTime,a=void 0===o?0:o,s=t.inputEvent,c=t.isDrag,u=this._getScrollPosition(i||[0,0],t),l=u[0]-r[0],f=u[1]-r[1],h=i||[l?Math.abs(l)/l:0,f?Math.abs(f)/f:0];return this._prevScrollPos=u,!(!l&&!f)&&(this.trigger("move",{offsetX:h[0]?l:0,offsetY:h[1]?f:0,inputEvent:s}),a&&c&&(this._timer=window.setTimeout(function(){e._continueDrag(t)},a)),!0)},o.dragEnd=function(){clearTimeout(this._timer)},o._getScrollPosition=function(t,e){var n=e.container,r=e.getScrollPosition;return(void 0===r?V:r)({container:n,direction:t})},o._continueDrag=function(t){var e=this,n=t.container,r=t.direction,i=t.throttleTime,o=t.useScroll,a=t.isDrag,s=t.inputEvent;if(!a||!this._isWait){var c=Date.now?Date.now():(new Date).getTime(),u=Math.max(i+this._prevTime-c,0);if(0<u)return this._timer=window.setTimeout(function(){e._continueDrag(t)},u),!1;this._prevTime=c;var l=this._getScrollPosition(r,t);return this._prevScrollPos=l,a&&(this._isWait=!0),this.trigger("scroll",{container:n,direction:r,inputEvent:s}),this._isWait=!1,o||this.checkScroll(U(U({},t),{prevScrollPos:l,direction:r,inputEvent:s}))}},i}(t),$=function(t,e){return($=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function G(t){return t&&"object"==typeof t}function J(t){return Array.isArray(t)}function Q(t){return"string"==typeof t}function tt(t,e,n,r){t.addEventListener(e,n,r)}function et(t,e,n){t.removeEventListener(e,n)}var nt=function(){return(nt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};var rt=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(G(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(G(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,function(t){return t.listener===e});-1<i&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this;void 0===n&&(n={});var t=this._events[e];if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(nt({listener:e},n))},t}();var it,ot,at=(function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return a[t];var n,r=String(t);return(n=i[r.toLowerCase()])?n:(n=o[r.toLowerCase()])||(1===r.length?r.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var r;if(r=i[e.toLowerCase()])return r===n;if(r=o[e.toLowerCase()])return r===n}else if("number"==typeof e)return e===n;return!1}};var i=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},o=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(r=97;r<123;r++)i[String.fromCharCode(r)]=r-32;for(var r=48;r<58;r++)i[r-48]=r;for(r=1;r<13;r++)i["f"+r]=r+111;for(r=0;r<10;r++)i["numpad "+r]=r+96;var a=e.names=e.title={};for(r in i)a[i[r]]=r;for(var s in o)i[s]=o[s]}(it={exports:{}},it.exports),it.exports),st=(at.code,at.codes,at.aliases,at.names),ct=(at.title,{"+":"plus","left command":"meta","right command":"meta"}),ut={shift:1,ctrl:2,alt:3,meta:4};function lt(t){var e=st[t]||"";for(var n in ct)e=e.replace(n,ct[n]);return e.replace(/\s/g,"")}function ft(t,e){void 0===e&&(e=lt(t.keyCode));var n,r=[(n=t).shiftKey&&"shift",n.ctrlKey&&"ctrl",n.altKey&&"alt",n.metaKey&&"meta"].filter(Boolean);return-1===r.indexOf(e)&&r.push(e),r.filter(Boolean)}function ht(t){var e=t.slice();return e.sort(function(t,e){return(ut[t]||5)-(ut[e]||5)}),e}var dt=function(n){function t(){this.constructor=e}var e,r;function i(t){void 0===t&&(t=window);var e=n.call(this)||this;return e.container=t,e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e.clear=function(){return e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e},e.keydownEvent=function(t){e.triggerEvent("keydown",t)},e.keyupEvent=function(t){e.triggerEvent("keyup",t)},e.blur=function(){e.clear(),e.trigger("blur")},tt(t,"blur",e.blur),tt(t,"keydown",e.keydownEvent),tt(t,"keyup",e.keyupEvent),e}$(e=i,r=n),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return Object.defineProperty(i,"global",{get:function(){return ot=ot||new i},enumerable:!1,configurable:!0}),i.setGlobal=function(){return this.global},o.destroy=function(){var t=this.container;this.clear(),this.off(),et(t,"blur",this.blur),et(t,"keydown",this.keydownEvent),et(t,"keyup",this.keyupEvent)},o.keydown=function(t,e){return this.addEvent("keydown",t,e)},o.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},o.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},o.keyup=function(t,e){return this.addEvent("keyup",t,e)},o.addEvent=function(t,e,n){return J(e)?this.on(t+"."+ht(e).join("."),n):Q(e)?this.on(t+"."+e,n):this.on(t,e),this},o.removeEvent=function(t,e,n){return J(e)?this.off(t+"."+ht(e).join("."),n):Q(e)?this.off(t+"."+e,n):this.off(t,e),this},o.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=lt(e.keyCode),r={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,r),this.trigger(t+"."+n,r);var i=ft(e,n);1<i.length&&this.trigger(t+"."+i.join("."),r)},i}(rt);function pt(r){return r.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;0<=n;--n)e+=t[n];return e}(r.map(function(t,e){var n=r[e+1]||r[0];return t[0]*n[1]-n[0]*t[1]})))/2}function vt(t){var e=t.map(function(t){return t[0]}),n=t.map(function(t){return t[1]});return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,n),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,n)}}function gt(t,e,n){var i=t[0],o=t[1],r=vt(e),a=r.minX,s=r.minY,c=r.maxX,u=r.maxY,l=[[a,o],[c,o]],f=[[i,s],[i,u]],h=mt(l[0],l[1]),d=mt(f[0],f[1]),p=bt(e),v=[],g=[];return p.forEach(function(t){var e=mt(t[0],t[1]),n=Et(yt(h,e),[l,t]),r=Et(yt(d,e),[f,t]);1===n.length&&t[0][1]===o||v.push.apply(v,n),1===r.length&&t[0][0]===i||g.push.apply(g,r),e[0]||v.push.apply(v,n),e[1]||g.push.apply(g,r)}),!n&&(-1<m(v,function(t){return t[0]===i})||-1<m(g,function(t){return t[1]===o}))||!!(v.filter(function(t){return t[0]>i}).length%2&&g.filter(function(t){return t[1]>o}).length%2)}function mt(t,e){var n=t[0],r=t[1],i=e[0],o=e[1];if(n===i&&r===o)return[0,0,0];if(n===i)return[1,0,-n];if(r===o)return[0,1,-r];var a=(i-n)/(r-o);return[1,a,-n-a*r]}function yt(t,e){var n,r,i=t[0],o=t[1],a=t[2],s=e[0],c=e[1],u=e[2],l=0===i&&0===s,f=0===o&&0===c;if(l&&f)return[];if(l){var h=-a/o;return h!=-u/c?[]:[[-1/0,h],[1/0,h]]}if(f){var d=-a/i;return d!=-u/s?[]:[[d,-1/0],[d,1/0]]}return 0!==i?0!==s?0!==o?0!==c?[[n=(o*u-c*a)/(c*i-o*s),r=-(i*n+a)/o]]:[[n=-u/s,r=-(i*n+a)/o]]:[[n=-a/i,r=-(s*n+u)/c]]:[[n=-(o*(r=-u/c)+a)/i,r]]:[[n=-(c*(r=-a/o)+u)/s,r]]}function Et(t,e){var n=e.map(function(e){return[0,1].map(function(t){return[Math.min(e[0][t],e[1][t]),Math.max(e[0][t],e[1][t])]})});if(2===t.length){var r=t[0],i=r[0],o=r[1];if(i===t[1][0]){var a=Math.max.apply(Math,n.map(function(t){return t[1][0]})),s=Math.min.apply(Math,n.map(function(t){return t[1][1]}));return s<a?[]:[[i,a],[i,s]]}if(o===t[1][1]){var c=Math.max.apply(Math,n.map(function(t){return t[0][0]})),u=Math.min.apply(Math,n.map(function(t){return t[0][1]}));return u<c?[]:[[c,o],[u,o]]}}return t.filter(function(e){return n.every(function(t){return t[0][0]<=e[0]&&e[0]<=t[0][1]&&t[1][0]<=e[1]&&e[1]<=t[1][1]})})}function bt(n){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(n.slice(1),[n[0]]).map(function(t,e){return[n[e],t]})}function St(t,e,n,r,i,o){for(var a=0;a<i;++a){var s=n+a*i,c=r+a*i;t[s]+=t[c]*o,e[s]+=e[c]*o}}function Ct(t,e,n,r,i){for(var o=0;o<i;++o){var a=n+o*i,s=r+o*i,c=t[a],u=e[a];t[a]=t[s],t[s]=c,e[a]=e[s],e[s]=u}}function _t(t,e,n,r,i){for(var o=0;o<r;++o){var a=n+o*r;t[a]/=i,e[a]/=i}}function Dt(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s)for(var c=r[s*n+a]=0;c<i;++c)r[s*n+a]+=t[c*n+a]*e[s*i+c];return r}function wt(t,e){return Dt(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function kt(t,e){return Dt(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function Pt(t,e){return Dt(t,(n=e,r=4,i=Math.cos(n),o=Math.sin(n),(a=Mt(r))[0]=i,a[1]=o,a[r]=-o,a[r+1]=i,a));var n,r,i,o,a}function xt(t,e){var n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?1:i,a=e[2];return Dt(t,[r,0,0,0,0,o,0,0,0,0,void 0===a?1:a,0,0,0,0,1],4)}function Tt(t,e){var n=e[0],r=void 0===n?0:n,i=e[1],o=void 0===i?0:i,a=e[2];return Dt(t,[1,0,0,0,0,1,0,0,0,0,1,0,r,o,void 0===a?0:a,1],4)}function Ot(t,e){return Dt(t,e,4)}function Mt(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function Yt(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function Xt(t){return e=(a(n=t)?n:function(t){return i(t,"")}(n)).map(function(t){var e,n=!(e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t))||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]},r=n.prefix,i=n.value,o=null,a=r,s="";if("translate"===r||"translateX"===r||"translate3d"===r){var c=C(i).map(function(t){return parseFloat(t)}),u=c[0],l=c[1],f=void 0===l?0:l,h=c[2];o=Tt,s=[u,f,void 0===h?0:h]}else if("translateY"===r)o=Tt,s=[0,f=parseFloat(i),0];else if("translateZ"===r)o=Tt,s=[0,0,parseFloat(i)];else if("scale"===r||"scale3d"===r){var d=C(i).map(function(t){return parseFloat(t)}),p=d[0],v=d[1],g=void 0===v?p:v,m=d[2];o=xt,s=[p,g,void 0===m?1:m]}else if("scaleX"===r)o=xt,s=[p=parseFloat(i),1,1];else if("scaleY"===r)o=xt,s=[1,g=parseFloat(i),1];else if("scaleZ"===r)o=xt,s=[1,1,parseFloat(i)];else if("rotate"===r||"rotateZ"===r||"rotateX"===r||"rotateY"===r){var y=_(i),E=y.unit,b=y.value;"rotate"===r||"rotateZ"===r?(a="rotateZ",o=Pt):"rotateX"===r?o=wt:"rotateY"===r&&(o=kt),s="rad"===E?b:b*Math.PI/180}else if("matrix3d"===r)o=Ot,s=C(i).map(function(t){return parseFloat(t)});else if("matrix"===r){var S=C(i).map(function(t){return parseFloat(t)});o=Ot,s=[S[0],S[1],0,0,S[2],S[3],0,0,0,0,1,0,S[4],S[5],0,1]}else a="";return{name:r,functionName:a,value:i,matrixFunction:o,functionValue:s}}),r=Yt(),e.forEach(function(t){var e=t.matrixFunction,n=t.functionValue;e&&(r=e(r,n))}),r;var e,r,n}function Ft(t,e){var n=function(t,e,n){void 0===n&&(n=e.length);var r=Dt(t,e,n),i=r[n-1];return r.map(function(t){return t/i})}(t,[e[0],e[1]||0,e[2]||0,1],4),r=n[3]||1;return[n[0]/r,n[1]/r,n[2]/r]}function jt(t,e){void 0===e&&(e=document.body);for(var n=t,r=Yt();n;){if(r=Ot(Xt(getComputedStyle(n).transform),r),n===e)break;n=n.parentElement}return(r=function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=Mt(e),i=0;i<e;++i){var o=e*i+i;if(!d(n[o],f))for(var a=i+1;a<e;++a)if(n[e*i+a]){Ct(n,r,i,a,e);break}if(!d(n[o],f))return[];_t(n,r,i,e,n[o]);for(a=0;a<e;++a){var s=a,c=n[a+i*e];d(c,f)&&i!==a&&St(n,r,s,i,e,-c)}}return r}(r,4))[12]=0,r[13]=0,r[14]=0,r}function Kt(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,c=e||document.createElement(r);for(var u in o)c.setAttribute(u,o[u]);var l=c.children;if(i.forEach(function(t,e){Kt(t,l[e],c)}),a&&a.split(" ").forEach(function(t){var e,n,r,i;i=t,((r=c).classList?r.classList.contains(i):r.className.match(new RegExp("(\\s|^)"+i+"(\\s|$)")))||(n=t,(e=c).classList?e.classList.add(n):e.className+=" "+n)}),s){var f=c.style;for(var u in s)f[u]=s[u]}return!e&&n&&n.appendChild(c),c}function Bt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,a=i.style;return{tag:t,className:void 0===o?"":o,style:void 0===a?{}:a,attributes:function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["className","style"]),children:n}}function It(t,e,n){t!==e&&n(t,e)}function At(t,e,n){var r;void 0===n&&(n=t.datas.boundArea);var i=t.distX,o=void 0===i?0:i,a=t.distY,s=void 0===a?0:a,c=t.datas,u=c.startX,l=c.startY;if(0<e){var f=Math.sqrt((o*o+s*s)/(1+e*e));o=(0<=o?1:-1)*(e*f),s=(0<=s?1:-1)*f}var h=Math.abs(o),d=Math.abs(s);o=(0<=o?1:-1)*(h=(r=function(t,n,r,e){if(!e)return t.map(function(t,e){return g(t,n[e],r[e])});var i=t[0],o=t[1],a=y(t,n,!1),s=a[0],c=a[1],u=y(t,r,!0),l=u[0],f=u[1];return i<s||o<c?(i=s,o=c):(l<i||f<o)&&(i=l,o=f),[i,o]}([h,d],[0,0],[o<0?u-n.left:n.right-u,s<0?l-n.top:n.bottom-l],!!e))[0]),s=(0<=s?1:-1)*(d=r[1]);var p=u+Math.min(0,o),v=l+Math.min(0,s);return{left:p,top:v,right:p+h,bottom:v+d,width:h,height:d}}function Rt(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top,i=e.width,o=e.height;return{pos1:[n,r],pos2:[n+i,r],pos3:[n,r+o],pos4:[n+i,r+o]}}function Nt(t,e,n){var r=Z(t,e),i=r.list,o=r.prevList,a=r.added,s=r.removed,c=r.maintained;return u(a.map(function(t){return i[t]}),s.map(function(t){return o[t]}),n?c.map(function(t){var e=t[1];return i[e]}):[])}function Lt(t,e,n,r){var i,o,a=document.createElement("style");return a.setAttribute("type","text/css"),a.setAttribute("data-styled-id",t),n.nonce&&a.setAttribute("nonce",n.nonce),a.innerHTML=(i=t,o=e,n.original?o:o.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(t,e){var n=e.trim();return(n?C(n):[""]).map(function(t){var e=t.trim();return 0===e.indexOf("@")?e:-1<e.indexOf(":global")?e.replace(/\:global/g,""):-1<e.indexOf(":host")?""+e.replace(/\:host/g,"."+i):e?"."+i+" "+e:"."+i}).join(", ")+" {"})),(r||document.head||document.body).appendChild(a),a}var Wt,qt,Zt,Ht,Ut=(Zt="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(Wt="\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n").toString(36),Ht=0,{className:Zt,inject:function(t,e){void 0===e&&(e={});var n,r=function(t){if(t&&t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(t),i=0===Ht;return(r||i)&&(n=Lt(Zt,Wt,e,r)),i&&(qt=n),r||++Ht,{destroy:function(){r?(t.removeChild(n),n=null):(0<Ht&&--Ht,0===Ht&&qt&&(qt.parentNode.removeChild(qt),qt=null))}}}}),Vt="selecto-selection "+Ut.className,zt=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","toggleContinueSelect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition","clickBySelectEnd"],$t=u(["dragContainer","cspNonce","continueSelectWithoutDeselect"],zt),Gt={boundContainer:null,portalContainer:null,container:null,dragContainer:null,selectableTargets:Array,selectByClick:Boolean,selectFromInside:Boolean,continueSelect:Boolean,toggleContinueSelect:Array,keyContainer:null,hitRate:Number,scrollOptions:Object,checkInput:Boolean,preventDefault:Boolean,cspNonce:String,ratio:Number,getElementRect:Function,preventDragFromInside:Boolean,rootContainer:Object,dragCondition:Function,clickBySelectEnd:Boolean,continueSelectWithoutDeselect:Boolean},Jt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(function(e){function t(t){void 0===t&&(t={});var M=e.call(this)||this;return M.selectedTargets=[],M.dragScroll=new z,M._onDragStart=function(t,e){var n=t.datas,r=t.clientX,i=t.clientY,o=t.inputEvent,a=M.options,s=a.continueSelect,c=a.continueSelectWithoutDeselect,u=a.selectFromInside,l=a.selectByClick,f=a.rootContainer,h=a.boundContainer,d=a.preventDragFromInside,p=void 0===d||d,v=a.clickBySelectEnd,g=a.dragCondition;if(!g||g(t)){M.findSelectableTargets(n),n.startSelectedTargets=M.selectedTargets,n.scaleMatrix=Yt(),n.containerX=0;var m={left:-1/(n.containerY=0),top:-1/0,right:1/0,bottom:1/0};if(f){var y=M.container.getBoundingClientRect();n.containerX=y.left,n.containerY=y.top,n.scaleMatrix=jt(M.container,f)}if(h){var E=F(h)&&"element"in h?Y({left:!0,top:!0,bottom:!0,right:!0},h):{element:h,left:!0,top:!0,bottom:!0,right:!0},b=E.element;if(b){var S=(typeof b===X?document.querySelector(b):!0===b?M.container:b).getBoundingClientRect();E.left&&(m.left=S.left),E.top&&(m.top=S.top),E.right&&(m.right=S.right),E.bottom&&(m.bottom=S.bottom)}}n.boundArea=m;var C={left:r,top:i,right:r,bottom:i,width:0,height:0},_=[];if(!u||l&&!v){var D=M._findElement(e||document.elementFromPoint(r,i),n.selectableTargets);_=D?[D]:[]}var w=0<_.length,k=!u&&w;if(k&&!l)return t.stop(),!1;var P=o.type,x="mousedown"===P||"touchstart"===P;if(!(!(!t.isClick&&x)||M.emit("dragStart",Y({},t))))return t.stop(),!1;s?(_=Nt(M.selectedTargets,_,c),n.startPassedTargets=M.selectedTargets):n.startPassedTargets=[],M._select(M.selectedTargets,_,C,o,!0),n.startX=r,n.startY=i,n.selectFlag=!1,n.preventDragFromInside=!1;var T=Ft(n.scaleMatrix,[r-n.containerX,i-n.containerY]);if(n.boundsArea=M.target.style.cssText+="position: "+(f?"absolute":"fixed")+";left:0px;top:0px;transform: translate("+T[0]+"px, "+T[1]+"px)",k&&l&&!v)o.preventDefault(),p&&(M._selectEnd(n.startSelectedTargets,n.startPassedTargets,C,t),n.preventDragFromInside=!0);else{n.selectFlag=!0,"touchstart"===P&&o.preventDefault();var O=M.options.scrollOptions;O&&O.container&&M.dragScroll.dragStart(t,O),v&&(n.selectFlag=!1,t.preventDrag())}return!0}t.stop()},M._onDrag=function(t){if(t.datas.selectFlag){var e=M.scrollOptions;if((null===e||void 0===e?void 0:e.container)&&M.dragScroll.drag(t,e))return}M._checkSelected(t)},M._onDragEnd=function(t){var e=t.datas,n=t.inputEvent,r=At(t,M.options.ratio),i=e.selectFlag;if(n&&!t.isClick&&M.emit("dragEnd",Y(Y({isDouble:!!t.isDouble,isDrag:!1,isSelect:i},t),{isClick:!!t.isClick,rect:r})),M.target.style.cssText+="display: none;",i)e.selectFlag=!1,M.dragScroll.dragEnd();else if(M.selectByClick&&M.clickBySelectEnd){var o=M._findElement(document.elementFromPoint(t.clientX,t.clientY),e.selectableTargets);M._select(M.selectedTargets,o?[o]:[],r,n)}e.preventDragFromInside||M._selectEnd(e.startSelectedTargets,e.startPassedTargets,r,t)},M._onKeyDown=function(t){M._sameCombiKey(t)&&(M.continueSelect=!0,M.emit("keydown",{}))},M._onKeyUp=function(t){M._sameCombiKey(t,!0)&&(M.continueSelect=!1,M.emit("keyup",{}))},M._onBlur=function(){M.toggleContinueSelect&&M.continueSelect&&(M.continueSelect=!1,M.emit("keyup",{}))},M._onDocumentSelectStart=function(e){if(M.gesto.isFlag()){var t=M.dragContainer;t===window&&(t=document.documentElement);var n=t instanceof Element?[t]:[].slice.call(t),r=e.target;n.some(function(t){if(t===r||t.contains(r))return e.preventDefault(),!0})}},M.target=t.portalContainer,M.container=t.container||document.body,M.options=Y({portalContainer:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,clickBySelectEnd:!1,hitRate:100,continueSelect:!1,continueSelectWithoutDeselect:!1,toggleContinueSelect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,getElementRect:Rt,cspNonce:"",ratio:0},t),M.initElement(),M.initDragScroll(),M.setKeyController(),M}o(t,e);var n,r,i=t.prototype;return i.setSelectedTargets=function(t){return this.selectedTargets=t,this},i.getSelectedTargets=function(){return this.selectedTargets},i.setKeyContainer=function(t){var e=this,n=this.options;It(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},i.setToggleContinueSelect=function(t){var e=this,n=this.options;It(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},i.setPreventDefault=function(t){this.gesto.options.preventDefault=t},i.setCheckInput=function(t){this.gesto.options.checkInput=t},i.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},i.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),S(document,"selectstart",this._onDocumentSelectStart),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},i.getElementPoints=function(t){var e,n,r,i,o,a,s,c,u,l,f,h,d,p=this.getElementRect||Rt,v=p(t),g=[v.pos1,v.pos2,v.pos4,v.pos3];if(p===Rt)return g;var m=t.getBoundingClientRect();return e=g,r=(n=m).width,i=n.height,o=n.left,a=n.top,s=vt(e),c=s.minX,u=s.minY,l=s.maxX,f=s.maxY,h=r/(l-c),d=i/(f-u),e.map(function(t){return[o+(t[0]-c)*h,a+(t[1]-u)*d]})},i.getSelectableElements=function(){var e=[];return this.options.selectableTargets.forEach(function(t){F(t)?e.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){e.push(t)})}),e},i.checkScroll=function(){if(this.gesto.isFlag()){var t=this.scrollOptions;(null===t||void 0===t?void 0:t.container)&&this.dragScroll.checkScroll(Y({inputEvent:this.gesto.getCurrentEvent()},t))}},i.findSelectableTargets=function(t){var e=this;void 0===t&&(t=this.gesto.getEventDatas());var n=this.getSelectableElements(),r=n.map(function(t){return e.getElementPoints(t)});t.selectableTargets=n,t.selectablePoints=r},i.clickTarget=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0]||t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,stop:function(){return!1}};return this._onDragStart(r,e)&&this._onDragEnd(r),this},i.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect;this.keycon&&(this.keycon.destroy(),this.keycon=null),n&&(this.keycon=new dt(e||window),this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur",this._onBlur))},i.setKeyEvent=function(){this.options.toggleContinueSelect&&!this.keycon&&this.setKeyController()},i.initElement=function(){this.target=Kt(Bt("div",{className:Vt}),this.target,this.container);var t=this.target,e=this.options,n=e.dragContainer,r=e.checkInput,i=e.preventDefault;this.dragContainer="string"==typeof n?[].slice.call(document.querySelectorAll(n)):n||this.target.parentNode,this.gesto=new B(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:r,preventDefault:i}).on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd}),b(document,"selectstart",this._onDocumentSelectStart),this.injectResult=Ut.inject(t,{nonce:this.options.cspNonce})},i.hitTest=function(t,c,u,e,l){var n=this.options,f=n.hitRate,h=n.selectByClick,r=t.left,i=t.top,o=t.right,a=t.bottom,d=[[r,i],[o,i],[o,a],[r,a]];return e.filter(function(t,e){var n=l[e],r=gt([c,u],n);if(h&&r)return!0;var i=function(t,e){var n=t.slice(),s=e.slice();-1===p(n)&&n.reverse(),-1===p(s)&&s.reverse();var c=bt(n),u=bt(s),r=c.map(function(t){return mt(t[0],t[1])}),l=u.map(function(t){return mt(t[0],t[1])}),f=[];r.forEach(function(r,i){var o=c[i],a=[];l.forEach(function(t,e){var n=Et(yt(r,t),[o,u[e]]);a.push.apply(a,n.map(function(t){return{index1:i,index2:e,pos:t}}))}),a.sort(function(t,e){return v(o[0],t.pos)-v(o[0],e.pos)}),f.push.apply(f,a),gt(o[1],s)&&f.push({index1:i,index2:-1,pos:o[1]})}),u.forEach(function(t,r){if(gt(t[1],n)){var i=!1,e=m(f,function(t){return t.index2===r?!(i=!0):!!i});-1===e&&(i=!1,e=m(f,function(t){var e=t.index1,n=t.index2;return-1===e&&n+1===r?!(i=!0):!!i})),-1===e?f.push({index1:-1,index2:r,pos:t[1]}):f.splice(e,0,{index1:-1,index2:r,pos:t[1]})}});var i=f.map(function(t){return t.pos}),o={};return i.filter(function(t){var e=t[0]+"x"+t[1];return!o[e]&&(o[e]=!0)})}(d,n);if(!i.length)return!1;var o=pt(i),a=pt(n),s=_(""+f);return"px"===s.unit?o>=s.value:g(Math.round(o/a*100),0,100)>=Math.min(100,s.value)})},i.initDragScroll=function(){var s=this;this.dragScroll.on("scroll",function(t){var e=t.container,n=t.direction;s.emit("scroll",{container:e,direction:n})}).on("move",function(t){var e=t.offsetX,n=t.offsetY,r=t.inputEvent,i=s.gesto;if(i&&i.isFlag()){var o=s.gesto.getEventDatas(),a=o.boundArea;o.startX-=e,o.startY-=n,o.selectablePoints.forEach(function(t){t.forEach(function(t){t[0]-=e,t[1]-=n})}),a.left-=e,a.right-=e,a.top-=n,a.bottom-=n,s.gesto.scrollBy(e,n,r.inputEvent,!1),s._checkSelected(s.gesto.getCurrentEvent())}})},i._select=function(t,e,n,r,i){var o=Z(t,e),a=o.added,s=o.removed,c=o.prevList,u=o.list;this.selectedTargets=e,i&&this.emit("selectStart",{selected:e,added:a.map(function(t){return u[t]}),removed:s.map(function(t){return c[t]}),rect:n,inputEvent:r}),(a.length||s.length)&&this.emit("select",{selected:e,added:a.map(function(t){return u[t]}),removed:s.map(function(t){return c[t]}),rect:n,inputEvent:r})},i._selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=Z(t,this.selectedTargets),s=a.added,c=a.removed,u=a.prevList,l=a.list,f=Z(e,this.selectedTargets),h=f.added,d=f.removed,p=f.prevList,v=f.list,g=i&&i.type,m="mousedown"===g||"touchstart"===g;this.emit("selectEnd",{selected:this.selectedTargets,added:s.map(function(t){return l[t]}),removed:c.map(function(t){return u[t]}),afterAdded:h.map(function(t){return v[t]}),afterRemoved:d.map(function(t){return p[t]}),isDragStart:m,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i})},i._checkSelected=function(t,e){void 0===e&&(e=At(t,this.options.ratio));var n=t.datas,r=t.inputEvent,i=e.top,o=e.left,a=e.width,s=e.height,c=n.selectFlag,u=this.options,l=n.containerX,f=n.containerY,h=n.scaleMatrix,d=Ft(h,[o-l,i-f]),p=Ft(h,[a,s]),v=[],g=[];if(c){this.target.style.cssText+="display: block;left:0px;top:0px;transform: translate("+d[0]+"px, "+d[1]+"px);width:"+p[0]+"px;height:"+p[1]+"px;";var m=this.hitTest(e,n.startX,n.startY,n.selectableTargets,n.selectablePoints);v=this.selectedTargets,g=Nt(n.startPassedTargets,m,u.continueSelect&&u.continueSelectWithoutDeselect),this.selectedTargets=g}if(!1===this.emit("drag",Y(Y({},t),{isSelect:c,rect:e})))return this.target.style.cssText+="display: none;",void t.stop();c&&this._select(v,g,e,r)},i._sameCombiKey=function(t,e){var n=[].concat(this.options.toggleContinueSelect),r=ft(t.inputEvent,t.key),i=a(n[0])?n:[n];if(e){var o=t.key;return i.some(function(t){return t.some(function(t){return t===o})})}return i.some(function(t){return t.every(function(t){return-1<r.indexOf(t)})})},i._findElement=function(t,e){for(var n=t;n&&!(-1<e.indexOf(n));)n=n.parentElement;return n},t=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}([(n=zt,r=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=("set "+e).replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()});t[r]?n.set=function(t){this[r](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)},function(t){var e=t.prototype;n.forEach(function(t){r(e,t)})})],t)}(t)),Qt={__proto__:null,default:Jt,OPTIONS:$t,OPTION_TYPES:Gt,PROPERTIES:zt,EVENTS:["dragStart","drag","dragEnd","selectStart","select","selectEnd","keydown","keyup","scroll"],METHODS:["clickTarget","getSelectableElements","setSelectedTargets","getElementPoints","getSelectedTargets","findSelectableTargets","triggerDragStart","checkScroll"],CLASS_NAME:Vt};for(var te in Qt)Jt[te]=Qt[te];return Jt}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Selecto=e()}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var M=function(){return(M=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function u(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var e="object",n="string",_=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],l=1e-7;function O(t){return t&&typeof t===e}function s(t){return Array.isArray(t)}function Y(t){return typeof t===n}function E(t,e,n,r,i){return D(t,e,n)?n:function(i,o,t,a,s){for(var c,e=function(t){var e=o[t].trim();if(e===i.close&&!D(i,o,t))return{value:t};var n=t,r=w(s,function(t){return t.open===e});if(r&&(n=E(r,o,t,a,s)),-1===n)return c=t,"break";c=t=n},n=t;n<a;++n){var r=e(n);if(n=c,"object"==typeof r)return r.value;if("break"===r)break}return-1}(t,e,n+1,r,i)}function D(t,e,n){if(!t.ignore)return null;var r=e.slice(Math.max(n-3,0),n+3).join("");return new RegExp(t.ignore).exec(r)}function i(t,e){var n=Y(e)?{separator:e}:e,r=n.separator,s=void 0===r?",":r,c=n.isSeparateFirst,u=n.isSeparateOnlyOpenClose,i=n.isSeparateOpenClose,l=void 0===i?u:i,o=n.openCloseCharacters,f=void 0===o?_:o,a=f.map(function(t){var e=t.open,n=t.close;return e===n?e:e+"|"+n}).join("|"),h=new RegExp("(\\s*"+s+"\\s*|"+a+"|\\s+)","g"),d=t.split(h).filter(Boolean),p=d.length,v=[],g=[];function m(){return!!g.length&&(v.push(g.join("")),g=[],!0)}for(var y,C=function(t){var e,n,r=d[t].trim(),i=t,o=w(f,function(t){return t.open===r}),a=w(f,function(t){return t.close===r});if(o){if(-1!==(i=E(o,d,t,p,f))&&l)return m()&&c?(y=t,"break"):(v.push(d.slice(t,i+1).join("")),t=i,c?(y=t,"break"):(y=t,"continue"))}else{if(a&&!D(a,d,t))throw new Error("invalid format: "+a.close);if(!(e=r,(""!==(n=s)&&" "!=n||""!==e&&" "!=e)&&e!==n||u))return m(),c?(y=t,"break"):(y=t,"continue")}-1===i&&(i=p-1),g.push(d.slice(t,i+1).join("")),y=t=i},S=0;S<p;++S){var b=C(S);if(S=y,"break"===b)break}return g.length&&v.push(g.join("")),v}function k(t){return i(t,",")}function P(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var n=e[1],r=e[2];return{prefix:n,unit:e[3],value:parseFloat(r)}}function a(t){return t.replace(/[\s-_]([a-z])/g,function(t,e){return e.toUpperCase()})}function S(){return Date.now?Date.now():(new Date).getTime()}function h(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}function w(t,e,n){var r=h(t,e);return-1<r?t[r]:n}function x(t,e,n){return Math.max(e,Math.min(t,n))}function g(t,i,o,e){return void 0===e&&(e=t[0]/t[1]),[[v(i[0],l),v(i[0]/e,l)],[v(i[1]*e,l),v(i[1],l)]].filter(function(t){return t.every(function(t,e){var n=i[e],r=v(n,l);return o?t<=n||t<=r:n<=t||r<=t})})[0]||t}function c(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=Math.atan2(r,n);return 0<=i?i:i+2*Math.PI}function f(t){return[0,1].map(function(e){return function(t){for(var e=t.length,n=0,r=e-1;0<=r;--r)n+=t[r];return e?n/e:0}(t.map(function(t){return t[e]}))})}function d(t){var e=f(t),n=c(e,t[0]),r=c(e,t[1]);return n<r&&r-n<Math.PI||r<n&&r-n<-Math.PI?1:-1}function p(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function v(t,e){if(!e)return t;var n=1/e;return Math.round(t/e)/n}function b(t,e,n,r){t.addEventListener(e,n,r)}function T(t,e,n,r){t.removeEventListener(e,n,r)}var m=function(){return(m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};var t=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(O(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(O(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=h(r,function(t){return t.listener===e});-1<i&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this;void 0===n&&(n={});var t=this._events[e];if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(m({listener:e},n))},t}(),y=function(t,e){return(y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var X=function(){return(X=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function C(t){return 180*(e=[t[0].clientX,t[0].clientY],n=[t[1].clientX,t[1].clientY],r=n[0]-e[0],i=n[1]-e[1],(0<=(o=Math.atan2(i,r))?o:o+2*Math.PI)/Math.PI);var e,n,r,i,o}function F(t){return t?t.touches?function(t){for(var e=Math.min(t.length,2),n=[],r=0;r<e;++r)n.push(W(t[r]));return n}(t.touches):[W(t)]:[]}function j(t,e,n){var r=n.length,i=B(t,r),o=i.clientX,a=i.clientY,s=i.originalClientX,c=i.originalClientY,u=B(e,r),l=u.clientX,f=u.clientY,h=B(n,r);return{clientX:s,clientY:c,deltaX:o-l,deltaY:a-f,distX:o-h.clientX,distY:a-h.clientY}}function K(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function W(t){return{clientX:t.clientX,clientY:t.clientY}}function B(t,e){void 0===e&&(e=t.length);for(var n={clientX:0,clientY:0,originalClientX:0,originalClientY:0},r=0;r<e;++r){var i=t[r];n.originalClientX+="originalClientX"in i?i.originalClientX:i.clientX,n.originalClientY+="originalClientY"in i?i.originalClientY:i.clientY,n.clientX+=i.clientX,n.clientY+=i.clientY}return e?{clientX:n.clientX/e,clientY:n.clientY/e,originalClientX:n.originalClientX/e,originalClientY:n.originalClientY/e}:n}var A=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var e=t.prototype;return e.getAngle=function(t){return void 0===t&&(t=this.prevClients),C(t)},e.getRotation=function(t){return void 0===t&&(t=this.prevClients),C(t)-C(this.startClients)},e.getPosition=function(t,e){void 0===t&&(t=this.prevClients);var n=j(t||this.prevClients,this.prevClients,this.startClients),r=n.deltaX,i=n.deltaY;return this.movement+=Math.sqrt(r*r+i*i),this.prevClients=t,n},e.getPositions=function(n){void 0===n&&(n=this.prevClients);var r=this.prevClients;return this.startClients.map(function(t,e){return j([n[e]],[r[e]],[t])})},e.getMovement=function(t){var e=this.movement;if(!t)return e;var n=B(t,this.length),r=B(this.prevClients,this.length),i=n.clientX-r.clientX,o=n.clientY-r.clientY;return Math.sqrt(i*i+o*o)+e},e.getDistance=function(t){return void 0===t&&(t=this.prevClients),K(t)},e.getScale=function(t){return void 0===t&&(t=this.prevClients),K(t)/K(this.startClients)},e.move=function(e,n){this.startClients.forEach(function(t){t.clientX-=e,t.clientY-=n})},t}(),I=["textarea","input"],R=function(c){function t(){this.constructor=e}var e,n;function r(t,e){void 0===e&&(e={});var C=c.call(this)||this;C.options={},C.flag=!1,C.pinchFlag=!1,C.datas={},C.isDrag=!1,C.isPinch=!1,C.isMouse=!1,C.isTouch=!1,C.clientStores=[],C.targets=[],C.prevTime=0,C.doubleFlag=!1,C._dragFlag=!1,C.onDragStart=function(t,e){if(void 0===e&&(e=!0),C.flag||!1!==t.cancelable){var n=C.options,r=n.container,i=n.pinchOutside,o=n.preventWheelClick,a=n.preventRightClick,s=n.preventDefault,c=n.checkInput,u=C.isTouch,l=!C.flag;if(o&&(2===t.which||1===t.button)||a&&(3===t.which||2===t.button))return C.initDrag(),!1;if(l){var f=document.activeElement,h=t.target,d=h.tagName.toLowerCase(),p=-1<I.indexOf(d),v=h.isContentEditable;if(p||v){if(c||f===h)return!1;if(f&&v&&f.isContentEditable&&f.contains(h))return!1}else if((s||"touchstart"===t.type)&&f){var g=f.tagName;(f.isContentEditable||-1<I.indexOf(g))&&f.blur()}C.clientStores=[new A(F(t))],C.flag=!0,C.isDrag=!1,C._dragFlag=!0,C.datas={},C.doubleFlag=S()-C.prevTime<200,!1===C.emit("dragStart",X(X({datas:C.datas,inputEvent:t,isTrusted:e,isDouble:C.doubleFlag},C.getCurrentStore().getPosition()),{preventDefault:function(){t.preventDefault()},preventDrag:function(){C._dragFlag=!1}}))&&C.initDrag(),C.flag&&s&&t.preventDefault()}if(!C.flag)return!1;var m,y=0;if(l&&u&&i&&(y=setTimeout(function(){b(r,"touchstart",C.onDragStart,{passive:!1})})),!l&&u&&i&&T(r,"touchstart",C.onDragStart),C.flag&&((m=t).touches&&2<=m.touches.length)){if(clearTimeout(y),l&&t.touches.length!==t.changedTouches.length)return;C.pinchFlag||C.onPinchStart(t)}}},C.onDrag=function(t,e){if(C.flag){var n=F(t),r=C.moveClients(n,t,!1);if(C._dragFlag){if(C.pinchFlag||r.deltaX||r.deltaY)if(!1===C.emit("drag",X(X({},r),{isScroll:!!e,inputEvent:t})))return void C.stop();C.pinchFlag&&C.onPinch(t,n)}C.getCurrentStore().getPosition(n,!0)}},C.onDragEnd=function(t){if(C.flag){var e=C.options,n=e.pinchOutside,r=e.container;C.isTouch&&n&&T(r,"touchstart",C.onDragStart),C.pinchFlag&&C.onPinchEnd(t);var i=(null==t?void 0:t.touches)?F(t):[];0!==i.length&&C.options.keepDragging?C._addStore(new A(i)):C.flag=!1;var o=C._getPosition(),a=S(),s=!C.isDrag&&C.doubleFlag;C.prevTime=C.isDrag||s?0:a,C.flag||(C.emit("dragEnd",X({datas:C.datas,isDouble:s,isDrag:C.isDrag,isClick:!C.isDrag,inputEvent:t},o)),C.clientStores=[])}},C.onBlur=function(){C.onDragEnd()};var n=[].concat(t);C.options=X({checkInput:!1,container:1<n.length?window:n[0],preventRightClick:!0,preventWheelClick:!0,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:["touch","mouse"]},e);var r=C.options,i=r.container,o=r.events,a=r.checkWindowBlur;if(C.isTouch=-1<o.indexOf("touch"),C.isMouse=-1<o.indexOf("mouse"),C.targets=n,C.isMouse&&(n.forEach(function(t){b(t,"mousedown",C.onDragStart)}),b(i,"mousemove",C.onDrag),b(i,"mouseup",C.onDragEnd),b(i,"contextmenu",C.onDragEnd)),a&&b(window,"blur",C.onBlur),C.isTouch){var s={passive:!1};n.forEach(function(t){b(t,"touchstart",C.onDragStart,s)}),b(i,"touchmove",C.onDrag,s),b(i,"touchend",C.onDragEnd,s),b(i,"touchcancel",C.onDragEnd,s)}return C}y(e=r,n=c),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t);var i=r.prototype;return i.stop=function(){this.isDrag=!1,this.flag=!1,this.clientStores=[],this.datas={}},i.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,e){return t+e.movement},0)},i.isDragging=function(){return this.isDrag},i.isFlag=function(){return this.flag},i.isPinchFlag=function(){return this.pinchFlag},i.isDoubleFlag=function(){return this.doubleFlag},i.isPinching=function(){return this.isPinch},i.scrollBy=function(t,e,n,r){void 0===r&&(r=!0),this.flag&&(this.clientStores[0].move(t,e),r&&this.onDrag(n,!0))},i.move=function(t,e){var r=t[0],i=t[1],n=this.getCurrentStore().prevClients;return this.moveClients(n.map(function(t){var e=t.clientX,n=t.clientY;return{clientX:e+r,clientY:n+i,originalClientX:e,originalClientY:n}}),e,!0)},i.triggerDragStart=function(t){this.onDragStart(t,!1)},i.setEventDatas=function(t){var e=this.datas;for(var n in t)e[n]=t[n];return this},i.getCurrentEvent=function(t){return X(X({datas:this.datas},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:t})},i.getEventDatas=function(){return this.datas},i.unset=function(){var e=this,t=this.targets,n=this.options.container;this.off(),T(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){T(t,"mousedown",e.onDragStart)}),T(n,"mousemove",this.onDrag),T(n,"mouseup",this.onDragEnd),T(n,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){T(t,"touchstart",e.onDragStart)}),T(n,"touchstart",this.onDragStart),T(n,"touchmove",this.onDrag),T(n,"touchend",this.onDragEnd),T(n,"touchcancel",this.onDragEnd))},i.onPinchStart=function(t){var e=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>e)){var n=new A(F(t));this.pinchFlag=!0,this._addStore(n),!1===this.emit("pinchStart",X(X({datas:this.datas,angle:n.getAngle(),touches:this.getCurrentStore().getPositions()},n.getPosition()),{inputEvent:t}))&&(this.pinchFlag=!1)}},i.onPinch=function(t,e){if(this.flag&&this.pinchFlag&&!(e.length<2)){var n=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",X(X({datas:this.datas,movement:this.getMovement(e),angle:n.getAngle(e),rotation:n.getRotation(e),touches:n.getPositions(e),scale:n.getScale(e),distance:n.getDistance(e)},n.getPosition(e)),{inputEvent:t}))}},i.onPinchEnd=function(t){if(this.pinchFlag){var e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.getCurrentStore();this.emit("pinchEnd",X(X({datas:this.datas,isPinch:e,touches:n.getPositions()},n.getPosition()),{inputEvent:t}))}},i.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1},i.getCurrentStore=function(){return this.clientStores[0]},i.moveClients=function(t,e,n){var r=this._getPosition(t,n);return(r.deltaX||r.deltaY)&&(this.isDrag=!0),X(X({datas:this.datas},r),{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:e})},i._addStore=function(t){this.clientStores.splice(0,0,t)},i._getPosition=function(t,e){var n=this.getCurrentStore().getPosition(t,e),r=this.clientStores.slice(1).reduce(function(t,e){var n=e.getPosition();return t.distX+=n.distX,t.distY+=n.distY,t},n),i=r.distX,o=r.distY;return X(X({},n),{distX:i,distY:o})},r}(t);var N=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),o=-1===i?n.length:i;n[o]=t,r[o]=e},t}(),L=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),q="function"==typeof Map,G=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var H=function(){function t(t,e,n,r,i,o,a,s){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=a,this.fixed=s}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t,n,s,c,e=(t=this.changedBeforeAdded,n=this.fixed,s=[],c=[],t.forEach(function(t){var e=t[0],n=t[1],r=new G;s[e]=r,c[n]=r}),s.forEach(function(t,e){t.connect(s[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],r=t[1];if(n===r)return[0,0];var i=s[n],o=c[r-1],a=i.getIndex();return i.disconnect(),o?i.connect(o,o.next):i.connect(void 0,s[0]),[a,i.getIndex()]})),u=this.changed,l=[];this.cacheOrdered=e.filter(function(t,e){var n=t[0],r=t[1],i=u[e],o=i[0],a=i[1];if(n!==r)return l.push([o,a]),!0}),this.cachePureChanged=l},t}();var Z,U="function"==typeof Map?void 0:(Z=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++Z)});function V(t,e){return n=t,r=e,i=U,o=q?Map:i?L:N,a=i||function(t){return t},s=[],c=[],u=[],l=n.map(a),f=r.map(a),h=new o,d=new o,p=[],v=[],g={},m=[],C=y=0,l.forEach(function(t,e){h.set(t,e)}),f.forEach(function(t,e){d.set(t,e)}),l.forEach(function(t,e){var n=d.get(t);void 0===n?(++C,c.push(e)):g[n]=C}),f.forEach(function(t,e){var n=h.get(t);void 0===n?(s.push(e),++y):(u.push([n,e]),C=g[e]||0,p.push([n-C,e-y]),v.push(e===n),n!==e&&m.push([n,e]))}),c.reverse(),new H(n,r,s,c,m,u,p,v);var n,r,i,o,a,s,c,u,l,f,h,d,p,v,g,m,y,C}var z=function(t,e){return(z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var $=function(){return($=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function J(t){var e=t.container;return e===document.body?[e.scrollLeft||document.documentElement.scrollLeft,e.scrollTop||document.documentElement.scrollTop]:[e.scrollLeft,e.scrollTop]}var Q=function(e){function t(){this.constructor=n}var n,r;function i(){var t=null!==e&&e.apply(this,arguments)||this;return t._startRect=null,t._startPos=[],t._prevTime=0,t._timer=0,t._prevScrollPos=[0,0],t._isWait=!1,t}z(n=i,r=e),n.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return o.dragStart=function(t,e){var n=e.container,r=0,i=0,o=0,a=0;if(n===document.body)o=window.innerWidth,a=window.innerHeight;else{var s=n.getBoundingClientRect();r=s.top,i=s.left,o=s.width,a=s.height}this._startPos=[t.clientX,t.clientY],this._startRect={top:r,left:i,width:o,height:a},this._prevScrollPos=this._getScrollPosition([0,0],e)},o.drag=function(t,e){var n=t.clientX,r=t.clientY,i=e.threshold,o=void 0===i?0:i,a=this._startRect,s=this._startPos,c=[0,0];return a.top>r-o?(s[1]>a.top||r<s[1])&&(c[1]=-1):a.top+a.height<r+o&&(s[1]<a.top+a.height||r>s[1])&&(c[1]=1),a.left>n-o?(s[0]>a.left||n<s[0])&&(c[0]=-1):a.left+a.width<n+o&&(s[0]<a.left+a.width||n>s[0])&&(c[0]=1),clearTimeout(this._timer),!(!c[0]&&!c[1])&&this._continueDrag($($({},e),{direction:c,inputEvent:t,isDrag:!0}))},o.checkScroll=function(t){var e=this;if(this._isWait)return!1;var n=t.prevScrollPos,r=void 0===n?this._prevScrollPos:n,i=t.direction,o=t.throttleTime,a=void 0===o?0:o,s=t.inputEvent,c=t.isDrag,u=this._getScrollPosition(i||[0,0],t),l=u[0]-r[0],f=u[1]-r[1],h=i||[l?Math.abs(l)/l:0,f?Math.abs(f)/f:0];return this._prevScrollPos=u,!(!l&&!f)&&(this.trigger("move",{offsetX:h[0]?l:0,offsetY:h[1]?f:0,inputEvent:s}),a&&c&&(this._timer=window.setTimeout(function(){e._continueDrag(t)},a)),!0)},o.dragEnd=function(){clearTimeout(this._timer)},o._getScrollPosition=function(t,e){var n=e.container,r=e.getScrollPosition;return(void 0===r?J:r)({container:n,direction:t})},o._continueDrag=function(t){var e=this,n=t.container,r=t.direction,i=t.throttleTime,o=t.useScroll,a=t.isDrag,s=t.inputEvent;if(!a||!this._isWait){var c=Date.now?Date.now():(new Date).getTime(),u=Math.max(i+this._prevTime-c,0);if(0<u)return this._timer=window.setTimeout(function(){e._continueDrag(t)},u),!1;this._prevTime=c;var l=this._getScrollPosition(r,t);return this._prevScrollPos=l,a&&(this._isWait=!0),this.trigger("scroll",{container:n,direction:r,inputEvent:s}),this._isWait=!1,o||this.checkScroll($($({},t),{prevScrollPos:l,direction:r,inputEvent:s}))}},i}(t),tt=function(t,e){return(tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function et(t){return t&&"object"==typeof t}function nt(t){return Array.isArray(t)}function rt(t){return"string"==typeof t}function it(t,e,n,r){t.addEventListener(e,n,r)}function ot(t,e,n,r){t.removeEventListener(e,n,r)}var at=function(){return(at=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};var st=function(){function t(){this._events={}}var e=t.prototype;return e.on=function(t,e){if(et(t))for(var n in t)this.on(n,t[n]);else this._addEvent(t,e,{});return this},e.off=function(t,e){if(t)if(et(t))for(var n in t)this.off(n);else if(e){var r=this._events[t];if(r){var i=function(t,e,n){void 0===n&&(n=-1);for(var r=t.length,i=0;i<r;++i)if(e(t[i],i,t))return i;return n}(r,function(t){return t.listener===e});-1<i&&r.splice(i,1)}}else this._events[t]=[];else this._events={};return this},e.once=function(e,t){var n=this;return t&&this._addEvent(e,t,{once:!0}),new Promise(function(t){n._addEvent(e,t,{once:!0})})},e.emit=function(e,n){var r=this;void 0===n&&(n={});var t=this._events[e];if(!e||!t)return!0;var i=!1;return n.eventType=e,n.stop=function(){i=!0},n.currentTarget=this,function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(t).forEach(function(t){t.listener(n),t.once&&r.off(e,t.listener)}),!i},e.trigger=function(t,e){return void 0===e&&(e={}),this.emit(t,e)},e._addEvent=function(t,e,n){var r=this._events;r[t]=r[t]||[],r[t].push(at({listener:e},n))},t}();var ct,ut,lt=(function(t,e){function n(t){if(t&&"object"==typeof t){var e=t.which||t.keyCode||t.charCode;e&&(t=e)}if("number"==typeof t)return a[t];var n,r=String(t);return(n=i[r.toLowerCase()])?n:(n=o[r.toLowerCase()])||(1===r.length?r.charCodeAt(0):void 0)}n.isEventKey=function(t,e){if(t&&"object"==typeof t){var n=t.which||t.keyCode||t.charCode;if(null==n)return!1;if("string"==typeof e){var r;if(r=i[e.toLowerCase()])return r===n;if(r=o[e.toLowerCase()])return r===n}else if("number"==typeof e)return e===n;return!1}};var i=(e=t.exports=n).code=e.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},o=e.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(r=97;r<123;r++)i[String.fromCharCode(r)]=r-32;for(var r=48;r<58;r++)i[r-48]=r;for(r=1;r<13;r++)i["f"+r]=r+111;for(r=0;r<10;r++)i["numpad "+r]=r+96;var a=e.names=e.title={};for(r in i)a[i[r]]=r;for(var s in o)i[s]=o[s]}(ct={exports:{}},ct.exports),ct.exports),ft=(lt.code,lt.codes,lt.aliases,lt.names),ht=(lt.title,{"+":"plus","left command":"meta","right command":"meta"}),dt={shift:1,ctrl:2,alt:3,meta:4};function pt(t,e){var n=(ft[t]||e||"").toLowerCase();for(var r in ht)n=n.replace(r,ht[r]);return n.replace(/\s/g,"")}function vt(t,e){void 0===e&&(e=pt(t.keyCode,t.key));var n,r=[(n=t).shiftKey&&"shift",n.ctrlKey&&"ctrl",n.altKey&&"alt",n.metaKey&&"meta"].filter(Boolean);return-1===r.indexOf(e)&&r.push(e),r.filter(Boolean)}function gt(t){var e=t.slice();return e.sort(function(t,e){return(dt[t]||5)-(dt[e]||5)}),e}var mt=function(n){function t(){this.constructor=e}var e,r;function i(t){void 0===t&&(t=window);var e=n.call(this)||this;return e.container=t,e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e.clear=function(){return e.ctrlKey=!1,e.altKey=!1,e.shiftKey=!1,e.metaKey=!1,e},e.keydownEvent=function(t){e.triggerEvent("keydown",t)},e.keyupEvent=function(t){e.triggerEvent("keyup",t)},e.blur=function(){e.clear(),e.trigger("blur")},it(t,"blur",e.blur),it(t,"keydown",e.keydownEvent),it(t,"keyup",e.keyupEvent),e}tt(e=i,r=n),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t);var o=i.prototype;return Object.defineProperty(i,"global",{get:function(){return ut=ut||new i},enumerable:!1,configurable:!0}),i.setGlobal=function(){return this.global},o.destroy=function(){var t=this.container;this.clear(),this.off(),ot(t,"blur",this.blur),ot(t,"keydown",this.keydownEvent),ot(t,"keyup",this.keyupEvent)},o.keydown=function(t,e){return this.addEvent("keydown",t,e)},o.offKeydown=function(t,e){return this.removeEvent("keydown",t,e)},o.offKeyup=function(t,e){return this.removeEvent("keyup",t,e)},o.keyup=function(t,e){return this.addEvent("keyup",t,e)},o.addEvent=function(t,e,n){return nt(e)?this.on(t+"."+gt(e).join("."),n):rt(e)?this.on(t+"."+e,n):this.on(t,e),this},o.removeEvent=function(t,e,n){return nt(e)?this.off(t+"."+gt(e).join("."),n):rt(e)?this.off(t+"."+e,n):this.off(t,e),this},o.triggerEvent=function(t,e){this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey;var n=pt(e.keyCode,e.key),r={key:n,isToggle:"ctrl"===n||"shift"===n||"meta"===n||"alt"===n,inputEvent:e,keyCode:e.keyCode,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey};this.trigger(t,r),this.trigger(t+"."+n,r);var i=vt(e,n);1<i.length&&this.trigger(t+"."+i.join("."),r)},i}(st);function yt(t){return v(t,l)}function Ct(r){return r.length<3?0:Math.abs(function(t){for(var e=0,n=t.length-1;0<=n;--n)e+=t[n];return e}(r.map(function(t,e){var n=r[e+1]||r[0];return t[0]*n[1]-n[0]*t[1]})))/2}function St(t){var e=t.map(function(t){return t[0]}),n=t.map(function(t){return t[1]});return{minX:Math.min.apply(Math,e),minY:Math.min.apply(Math,n),maxX:Math.max.apply(Math,e),maxY:Math.max.apply(Math,n)}}function bt(r,t,e){var s=r[0],c=r[1],n=St(t),i=n.minX,o=n.maxX,a=[[i,c],[o,c]],u=_t(a[0],a[1]),l=kt(t),f=[];if(l.forEach(function(t){var n,e=_t(t[0],t[1]),i=t[0];(n=e,u.every(function(t,e){return 0===yt(t-n[e])}))?f.push({pos:r,line:t,type:"line"}):Dt(Et(u,e),[a,t]).forEach(function(r){t.some(function(t){return n=r,!yt((e=t)[0]-n[0])&&!yt(e[1]-n[1]);var e,n})?f.push({pos:r,line:t,type:"point"}):0!==yt(i[1]-c)&&f.push({pos:r,line:t,type:"intersection"})})}),!e&&w(f,function(t){return t[0]===s}))return!0;var h=0,d={};return f.forEach(function(t){var e=t.pos,n=t.type,r=t.line;if(!(e[0]>s))if("intersection"===n)++h;else{if("line"===n)return;if("point"===n){var i=w(r,function(t){return t[1]!==c}),o=d[e[0]],a=i[1]>c?1:-1;o?o!==a&&++h:d[e[0]]=a}}}),h%2==1}function _t(t,e){var n=t[0],r=t[1],i=e[0]-n,o=e[1]-r;Math.abs(i)<l&&(i=0),Math.abs(o)<l&&(o=0);var a=0,s=0,c=0;return i?c=o?(s=1,-(a=-o/i)*n-r):(s=1,-r):o&&(a=-1,c=n),[a,s,c]}function Et(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],a=e[1],s=e[2],c=0===n&&0===o,u=0===r&&0===a,l=[];if(c&&u)return[];if(c){var f=-i/r;return f!=-s/a?[]:[[-1/0,f],[1/0,f]]}if(u){var h=-i/n;return h!=-s/o?[]:[[h,-1/0],[h,1/0]]}if(0===n)l=[[d=-(a*(p=-i/r)+s)/o,p]];else if(0===o){l=[[d=-(r*(p=-s/a)+i)/n,p]]}else if(0===r){l=[[d=-i/n,p=-(o*d+s)/a]]}else if(0===a){l=[[d=-s/o,p=-(n*d+i)/r]]}else{var d,p;l=[[d=(r*s-a*i)/(a*n-r*o),p=-(n*d+i)/r]]}return l.map(function(t){return[t[0],t[1]]})}function Dt(t,e){var r=e.map(function(e){return[0,1].map(function(t){return[Math.min(e[0][t],e[1][t]),Math.max(e[0][t],e[1][t])]})}),n=[];if(2===t.length){var i=t[0],o=i[0],a=i[1];if(yt(o-t[1][0])){if(!yt(a-t[1][1])){var s=Math.max.apply(Math,r.map(function(t){return t[0][0]})),c=Math.min.apply(Math,r.map(function(t){return t[0][1]}));if(0<yt(s-c))return[];n=[[s,a],[c,a]]}}else{var u=Math.max.apply(Math,r.map(function(t){return t[1][0]})),l=Math.min.apply(Math,r.map(function(t){return t[1][1]}));if(0<yt(u-l))return[];n=[[o,u],[o,l]]}}return n.length||(n=t.filter(function(t){var e=t[0],n=t[1];return r.every(function(t){return 0<=yt(e-t[0][0])&&0<=yt(t[0][1]-e)&&0<=yt(n-t[1][0])&&0<=yt(t[1][1]-n)})})),n.map(function(t){return[yt(t[0]),yt(t[1])]})}function kt(n){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}(n.slice(1),[n[0]]).map(function(t,e){return[n[e],t]})}function wt(t,e){return function(t,e){var n=t.slice(),s=e.slice();-1===d(n)&&n.reverse(),-1===d(s)&&s.reverse();var c=kt(n),u=kt(s),r=c.map(function(t){return _t(t[0],t[1])}),l=u.map(function(t){return _t(t[0],t[1])}),f=[];r.forEach(function(r,i){var o=c[i],a=[];l.forEach(function(t,e){var n=Dt(Et(r,t),[o,u[e]]);a.push.apply(a,n.map(function(t){return{index1:i,index2:e,pos:t,type:"intersection"}}))}),a.sort(function(t,e){return p(o[0],t.pos)-p(o[0],e.pos)}),f.push.apply(f,a),bt(o[1],s)&&f.push({index1:i,index2:-1,pos:o[1],type:"inside"})}),u.forEach(function(t,r){if(bt(t[1],n)){var i=!1,e=h(f,function(t){return t.index2===r?!(i=!0):!!i});-1===e&&(i=!1,e=h(f,function(t){var e=t.index1,n=t.index2;return-1===e&&n+1===r?!(i=!0):!!i})),-1===e?f.push({index1:-1,index2:r,pos:t[1],type:"inside"}):f.splice(e,0,{index1:-1,index2:r,pos:t[1],type:"inside"})}});var i={};return f.filter(function(t){var e=t.pos,n=e[0]+"x"+e[1];return!i[n]&&(i[n]=!0)})}(t,e).map(function(t){return t.pos})}function Pt(t,e,n,r,i,o){for(var a=0;a<i;++a){var s=n+a*i,c=r+a*i;t[s]+=t[c]*o,e[s]+=e[c]*o}}function xt(t,e,n,r,i){for(var o=0;o<i;++o){var a=n+o*i,s=r+o*i,c=t[a],u=e[a];t[a]=t[s],t[s]=c,e[a]=e[s],e[s]=u}}function Tt(t,e,n,r,i){for(var o=0;o<r;++o){var a=n+o*r;t[a]/=i,e[a]/=i}}function Mt(t,e,n){void 0===n&&(n=Math.sqrt(t.length));var r=[],i=t.length/n,o=e.length/i;if(!i)return e;if(!o)return t;for(var a=0;a<n;++a)for(var s=0;s<o;++s)for(var c=r[s*n+a]=0;c<i;++c)r[s*n+a]+=t[c*n+a]*e[s*i+c];return r}function Ot(t,e){return Mt(t,[1,0,0,0,0,Math.cos(e),Math.sin(e),0,0,-Math.sin(e),Math.cos(e),0,0,0,0,1],4)}function Yt(t,e){return Mt(t,[Math.cos(e),0,-Math.sin(e),0,0,1,0,0,Math.sin(e),0,Math.cos(e),0,0,0,0,1],4)}function Xt(t,e){return Mt(t,(n=e,r=4,i=Math.cos(n),o=Math.sin(n),(a=Wt(r))[0]=i,a[1]=o,a[r]=-o,a[r+1]=i,a));var n,r,i,o,a}function Ft(t,e){var n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?1:i,a=e[2];return Mt(t,[r,0,0,0,0,o,0,0,0,0,void 0===a?1:a,0,0,0,0,1],4)}function jt(t,e){var n=e[0],r=void 0===n?0:n,i=e[1],o=void 0===i?0:i,a=e[2];return Mt(t,[1,0,0,0,0,1,0,0,0,0,1,0,r,o,void 0===a?0:a,1],4)}function Kt(t,e){return Mt(t,e,4)}function Wt(t){for(var e=t*t,n=[],r=0;r<e;++r)n[r]=r%(t+1)?0:1;return n}function Bt(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function At(t){return e=(s(n=t)?n:function(t){return i(t,"")}(n)).map(function(t){var e,n=!(e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t))||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]},r=n.prefix,i=n.value,o=null,a=r,s="";if("translate"===r||"translateX"===r||"translate3d"===r){var c=k(i).map(function(t){return parseFloat(t)}),u=c[0],l=c[1],f=void 0===l?0:l,h=c[2];o=jt,s=[u,f,void 0===h?0:h]}else if("translateY"===r)o=jt,s=[0,f=parseFloat(i),0];else if("translateZ"===r)o=jt,s=[0,0,parseFloat(i)];else if("scale"===r||"scale3d"===r){var d=k(i).map(function(t){return parseFloat(t)}),p=d[0],v=d[1],g=void 0===v?p:v,m=d[2];o=Ft,s=[p,g,void 0===m?1:m]}else if("scaleX"===r)o=Ft,s=[p=parseFloat(i),1,1];else if("scaleY"===r)o=Ft,s=[1,g=parseFloat(i),1];else if("scaleZ"===r)o=Ft,s=[1,1,parseFloat(i)];else if("rotate"===r||"rotateZ"===r||"rotateX"===r||"rotateY"===r){var y=P(i),C=y.unit,S=y.value;"rotate"===r||"rotateZ"===r?(a="rotateZ",o=Xt):"rotateX"===r?o=Ot:"rotateY"===r&&(o=Yt),s="rad"===C?S:S*Math.PI/180}else if("matrix3d"===r)o=Kt,s=k(i).map(function(t){return parseFloat(t)});else if("matrix"===r){var b=k(i).map(function(t){return parseFloat(t)});o=Kt,s=[b[0],b[1],0,0,b[2],b[3],0,0,0,0,1,0,b[4],b[5],0,1]}else a="";return{name:r,functionName:a,value:i,matrixFunction:o,functionValue:s}}),r=Bt(),e.forEach(function(t){var e=t.matrixFunction,n=t.functionValue;e&&(r=e(r,n))}),r;var e,r,n}function It(t,e){var n=function(t,e,n){void 0===n&&(n=e.length);var r=Mt(t,e,n),i=r[n-1];return r.map(function(t){return t/i})}(t,[e[0],e[1]||0,e[2]||0,1],4),r=n[3]||1;return[n[0]/r,n[1]/r,n[2]/r]}function Rt(t,e){void 0===e&&(e=document.body);for(var n=t,r=Bt();n;){if(r=Kt(At(getComputedStyle(n).transform),r),n===e)break;n=n.parentElement}return(r=function(t,e){void 0===e&&(e=Math.sqrt(t.length));for(var n=t.slice(),r=Wt(e),i=0;i<e;++i){var o=e*i+i;if(!v(n[o],l))for(var a=i+1;a<e;++a)if(n[e*i+a]){xt(n,r,i,a,e);break}if(!v(n[o],l))return[];Tt(n,r,i,e,n[o]);for(a=0;a<e;++a){var s=a,c=n[a+i*e];v(c,l)&&i!==a&&Pt(n,r,s,i,e,-c)}}return r}(r,4))[12]=0,r[13]=0,r[14]=0,r}function Nt(t,e){var n,r;return null!=(r=null===(n=document)||void 0===n?void 0:n.elementFromPoint(t,e))?r:null}function Lt(t,e,n){var r=t.tag,i=t.children,o=t.attributes,a=t.className,s=t.style,c=e||document.createElement(r);for(var u in o)c.setAttribute(u,o[u]);var l=c.children;if(i.forEach(function(t,e){Lt(t,l[e],c)}),a&&a.split(" ").forEach(function(t){var e,n,r,i;i=t,((r=c).classList?r.classList.contains(i):r.className.match(new RegExp("(\\s|^)"+i+"(\\s|$)")))||(n=t,(e=c).classList?e.classList.add(n):e.className+=" "+n)}),s){var f=c.style;for(var u in s)f[u]=s[u]}return!e&&n&&n.appendChild(c),c}function qt(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=e||{},o=i.className,a=i.style;return{tag:t,className:void 0===o?"":o,style:void 0===a?{}:a,attributes:function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(i,["className","style"]),children:n}}function Gt(t,e,n){t!==e&&n(t,e)}function Ht(t,e,n){var r;void 0===n&&(n=t.datas.boundArea);var i=t.distX,o=void 0===i?0:i,a=t.distY,s=void 0===a?0:a,c=t.datas,u=c.startX,l=c.startY;if(0<e){var f=Math.sqrt((o*o+s*s)/(1+e*e));o=(0<=o?1:-1)*(e*f),s=(0<=s?1:-1)*f}var h=Math.abs(o),d=Math.abs(s);o=(0<=o?1:-1)*(h=(r=function(t,n,r,e){if(!e)return t.map(function(t,e){return x(t,n[e],r[e])});var i=t[0],o=t[1],a=!0===e?i/o:e,s=g(t,n,!1,a),c=s[0],u=s[1],l=g(t,r,!0,a),f=l[0],h=l[1];return i<c||o<u?(i=c,o=u):(f<i||h<o)&&(i=f,o=h),[i,o]}([h,d],[0,0],[o<0?u-n.left:n.right-u,s<0?l-n.top:n.bottom-l],!!e))[0]),s=(0<=s?1:-1)*(d=r[1]);var p=u+Math.min(0,o),v=l+Math.min(0,s);return{left:p,top:v,right:p+h,bottom:v+d,width:h,height:d}}function Zt(t){var e=t.getBoundingClientRect(),n=e.left,r=e.top,i=e.width,o=e.height;return{pos1:[n,r],pos2:[n+i,r],pos3:[n,r+o],pos4:[n+i,r+o]}}function Ut(t,e,n){var r=V(t,e),i=r.list,o=r.prevList,a=r.added,s=r.removed,c=r.maintained;return u(a.map(function(t){return i[t]}),s.map(function(t){return o[t]}),n?c.map(function(t){var e=t[1];return i[e]}):[])}function Vt(t,e,n,r){var i,o,a=document.createElement("style");return a.setAttribute("type","text/css"),a.setAttribute("data-styled-id",t),n.nonce&&a.setAttribute("nonce",n.nonce),a.innerHTML=(i=t,o=e,n.original?o:o.replace(/([^};{\s}][^};{]*|^\s*){/gm,function(t,e){var n=e.trim();return(n?k(n):[""]).map(function(t){var e=t.trim();return 0===e.indexOf("@")?e:-1<e.indexOf(":global")?e.replace(/\:global/g,""):-1<e.indexOf(":host")?""+e.replace(/\:host/g,"."+i):e?"."+i+" "+e:"."+i}).join(", ")+" {"})),(r||document.head||document.body).appendChild(a),a}var zt,$t,Jt,Qt,te=(Jt="rCS"+function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return e>>>0}(zt="\n:host {\n position: fixed;\n display: none;\n border: 1px solid #4af;\n background: rgba(68, 170, 255, 0.5);\n pointer-events: none;\n will-change: transform;\n z-index: 100;\n}\n").toString(36),Qt=0,{className:Jt,inject:function(t,e){void 0===e&&(e={});var n,r=function(t){if(t&&t.getRootNode){var e=t.getRootNode();if(11===e.nodeType)return e}}(t),i=0===Qt;return(r||i)&&(n=Vt(Jt,zt,e,r)),i&&($t=n),r||++Qt,{destroy:function(){r?(t.removeChild(n),n=null):(0<Qt&&--Qt,0===Qt&&$t&&($t.parentNode.removeChild($t),$t=null))}}}}),ee="selecto-selection "+te.className,ne=["boundContainer","selectableTargets","selectByClick","selectFromInside","continueSelect","continueSelectWithoutDeselect","toggleContinueSelect","toggleContinueSelectWithoutDeselect","keyContainer","hitRate","scrollOptions","checkInput","preventDefault","ratio","getElementRect","preventDragFromInside","rootContainer","dragCondition","clickBySelectEnd"],re=u(["dragContainer","cspNonce"],ne),ie={boundContainer:null,portalContainer:null,container:null,dragContainer:null,selectableTargets:Array,selectByClick:Boolean,selectFromInside:Boolean,continueSelect:Boolean,toggleContinueSelect:Array,toggleContinueSelectWithoutDeselect:Array,keyContainer:null,hitRate:Number,scrollOptions:Object,checkInput:Boolean,preventDefault:Boolean,cspNonce:String,ratio:Number,getElementRect:Function,preventDragFromInside:Boolean,rootContainer:Object,dragCondition:Function,clickBySelectEnd:Boolean,continueSelectWithoutDeselect:Boolean},oe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(function(e){function t(t){void 0===t&&(t={});var T=e.call(this)||this;return T.selectedTargets=[],T.dragScroll=new Q,T._onDragStart=function(t,e){var n=t.datas,r=t.clientX,i=t.clientY,o=t.inputEvent,a=T.options,s=a.selectFromInside,c=a.selectByClick,u=a.rootContainer,l=a.boundContainer,f=a.preventDragFromInside,h=void 0===f||f,d=a.clickBySelectEnd,p=a.dragCondition;if(!p||p(t)){n.innerWidth=window.innerWidth,n.innerHeight=window.innerHeight,T.findSelectableTargets(n),n.startSelectedTargets=T.selectedTargets,n.scaleMatrix=Bt(),n.containerX=0;var v={left:-1/(n.containerY=0),top:-1/0,right:1/0,bottom:1/0};if(u){var g=T.container.getBoundingClientRect();n.containerX=g.left,n.containerY=g.top,n.scaleMatrix=Rt(T.container,u)}if(l){var m=O(l)&&"element"in l?M({left:!0,top:!0,bottom:!0,right:!0},l):{element:l,left:!0,top:!0,bottom:!0,right:!0},y=m.element;if(y){var C=(Y(y)?document.querySelector(y):!0===y?T.container:y).getBoundingClientRect();m.left&&(v.left=C.left),m.top&&(v.top=C.top),m.right&&(v.right=C.right),m.bottom&&(v.bottom=C.bottom)}}n.boundArea=v;var S={left:r,top:i,right:r,bottom:i,width:0,height:0},b=[];if(!s||c&&!d){var _=T._findElement(e||Nt(r,i),n.selectableTargets);b=_?[_]:[]}var E=0<b.length,D=!s&&E;if(D&&!c)return t.stop(),!1;var k=o.type,w="mousedown"===k||"touchstart"===k;if(!(!(!t.isClick&&w)||T.emit("dragStart",M({},t))))return t.stop(),!1;T.continueSelect?(b=Ut(T.selectedTargets,b,T.continueSelectWithoutDeselect),n.startPassedTargets=T.selectedTargets):n.startPassedTargets=[],T._select(T.selectedTargets,b,S,o,!0),n.startX=r,n.startY=i,n.selectFlag=!1,n.preventDragFromInside=!1;var P=It(n.scaleMatrix,[r-n.containerX,i-n.containerY]);if(n.boundsArea=T.target.style.cssText+="position: "+(u?"absolute":"fixed")+";left:0px;top:0px;transform: translate("+P[0]+"px, "+P[1]+"px)",D&&c&&!d)o.preventDefault(),h&&(T._selectEnd(n.startSelectedTargets,n.startPassedTargets,S,t),n.preventDragFromInside=!0);else{n.selectFlag=!0,"touchstart"===k&&o.preventDefault();var x=T.options.scrollOptions;x&&x.container&&T.dragScroll.dragStart(t,x),d&&(n.selectFlag=!1,t.preventDrag())}return!0}t.stop()},T._onDrag=function(t){if(t.datas.selectFlag){var e=T.scrollOptions;if((null===e||void 0===e?void 0:e.container)&&T.dragScroll.drag(t,e))return}T._checkSelected(t)},T._onDragEnd=function(t){var e=t.datas,n=t.inputEvent,r=Ht(t,T.options.ratio),i=e.selectFlag;if(n&&!t.isClick&&T.emit("dragEnd",M(M({isDouble:!!t.isDouble,isDrag:!1,isSelect:i},t),{isClick:!!t.isClick,rect:r})),T.target.style.cssText+="display: none;",i)e.selectFlag=!1,T.dragScroll.dragEnd();else if(T.selectByClick&&T.clickBySelectEnd){var o=T._findElement(Nt(t.clientX,t.clientY),e.selectableTargets);T._select(T.selectedTargets,o?[o]:[],r,n)}e.preventDragFromInside||T._selectEnd(e.startSelectedTargets,e.startPassedTargets,r,t)},T._onKeyDown=function(t){var e=T.options,n=!1;if(!T._keydownContinueSelect){var r=T._sameCombiKey(t,e.toggleContinueSelect);n=T._keydownContinueSelect=r}if(!T._keydownContinueSelectWithoutDeselection){r=T._sameCombiKey(t,e.toggleContinueSelectWithoutDeselect);T._keydownContinueSelectWithoutDeselection=r,n=n||r}n&&T.emit("keydown",{keydownContinueSelect:T._keydownContinueSelect,keydownContinueSelectWithoutDeselection:T._keydownContinueSelectWithoutDeselection})},T._onKeyUp=function(t){var e=T.options,n=!1;if(T._keydownContinueSelect){var r=T._sameCombiKey(t,e.toggleContinueSelect,!0);T._keydownContinueSelect=!r,n=r}if(T._keydownContinueSelectWithoutDeselection){r=T._sameCombiKey(t,e.toggleContinueSelectWithoutDeselect,!0);T._keydownContinueSelectWithoutDeselection=!r,n=n||r}n&&T.emit("keyup",{keydownContinueSelect:T._keydownContinueSelect,keydownContinueSelectWithoutDeselection:T._keydownContinueSelectWithoutDeselection})},T._onBlur=function(){(T._keydownContinueSelect||T._keydownContinueSelectWithoutDeselection)&&(T._keydownContinueSelect=!1,T._keydownContinueSelectWithoutDeselection=!1,T.emit("keyup",{keydownContinueSelect:T._keydownContinueSelect,keydownContinueSelectWithoutDeselection:T._keydownContinueSelectWithoutDeselection}))},T._onDocumentSelectStart=function(e){if(T.gesto.isFlag()){var t=T.dragContainer;t===window&&(t=document.documentElement);var n=t instanceof Element?[t]:[].slice.call(t),r=e.target;n.some(function(t){if(t===r||t.contains(r))return e.preventDefault(),!0})}},T.target=t.portalContainer,T.container=t.container||document.body,T.options=M({portalContainer:null,container:null,dragContainer:null,selectableTargets:[],selectByClick:!0,selectFromInside:!0,clickBySelectEnd:!1,hitRate:100,continueSelect:!1,continueSelectWithoutDeselect:!1,toggleContinueSelect:null,toggleContinueSelectWithoutDeselect:null,keyContainer:null,scrollOptions:void 0,checkInput:!1,preventDefault:!1,boundContainer:!1,preventDragFromInside:!0,dragCondition:null,rootContainer:null,getElementRect:Zt,cspNonce:"",ratio:0},t),T.initElement(),T.initDragScroll(),T.setKeyController(),T}o(t,e);var n,r,i=t.prototype;return i.setSelectedTargets=function(t){return this.selectedTargets=t,this},i.getSelectedTargets=function(){return this.selectedTargets},i.triggerDragStart=function(t){return this.gesto.triggerDragStart(t),this},i.destroy=function(){this.off(),this.keycon&&this.keycon.destroy(),this.gesto.unset(),this.injectResult.destroy(),T(document,"selectstart",this._onDocumentSelectStart),this.keycon=null,this.gesto=null,this.injectResult=null,this.target=null,this.container=null,this.options=null},i.getElementPoints=function(t){var e,n,r,i,o,a,s,c,u,l,f,h,d,p=this.getElementRect||Zt,v=p(t),g=[v.pos1,v.pos2,v.pos4,v.pos3];if(p===Zt)return g;var m=t.getBoundingClientRect();return e=g,r=(n=m).width,i=n.height,o=n.left,a=n.top,s=St(e),c=s.minX,u=s.minY,l=s.maxX,f=s.maxY,h=r/(l-c),d=i/(f-u),e.map(function(t){return[o+(t[0]-c)*h,a+(t[1]-u)*d]})},i.getSelectableElements=function(){var e=[];return this.options.selectableTargets.forEach(function(t){O(t)?e.push(t):[].slice.call(document.querySelectorAll(t)).forEach(function(t){e.push(t)})}),e},i.checkScroll=function(){if(this.gesto.isFlag()){var t=this.scrollOptions;(null===t||void 0===t?void 0:t.container)&&this.dragScroll.checkScroll(M({inputEvent:this.gesto.getCurrentEvent()},t))}},i.findSelectableTargets=function(t){var e=this;void 0===t&&(t=this.gesto.getEventDatas());var n=this.getSelectableElements(),r=n.map(function(t){return e.getElementPoints(t)});t.selectableTargets=n,t.selectablePoints=r,this._refreshGroups(t)},i.clickTarget=function(t,e){var n=function(t){if("touches"in t){var e=t.touches[0]||t.changedTouches[0];return{clientX:e.clientX,clientY:e.clientY}}return{clientX:t.clientX,clientY:t.clientY}}(t),r={datas:{selectFlag:!1},clientX:n.clientX,clientY:n.clientY,inputEvent:t,isClick:!0,stop:function(){return!1}};return this._onDragStart(r,e)&&this._onDragEnd(r),this},i.setKeyController=function(){var t=this.options,e=t.keyContainer,n=t.toggleContinueSelect,r=t.toggleContinueSelectWithoutDeselect;this.keycon&&(this.keycon.destroy(),this.keycon=null),(n||r)&&(this.keycon=new mt(e||window),this.keycon.keydown(this._onKeyDown).keyup(this._onKeyUp).on("blur",this._onBlur))},i.setKeyEvent=function(){var t=this.options,e=t.toggleContinueSelect,n=t.toggleContinueSelectWithoutDeselect;!e&&!n||this.keycon||this.setKeyController()},i.setKeyContainer=function(t){var e=this,n=this.options;Gt(n.keyContainer,t,function(){n.keyContainer=t,e.setKeyController()})},i.getContinueSelect=function(){var t=this.options,e=t.continueSelect;return t.toggleContinueSelect&&this._keydownContinueSelect?!e:e},i.getContinueSelectWithoutDeselect=function(){var t=this.options,e=t.continueSelectWithoutDeselect;return t.toggleContinueSelectWithoutDeselect&&this._keydownContinueSelectWithoutDeselection?!e:e},i.setToggleContinueSelect=function(t){var e=this,n=this.options;Gt(n.toggleContinueSelect,t,function(){n.toggleContinueSelect=t,e.setKeyEvent()})},i.setToggleContinueSelectWithoutDeselect=function(t){var e=this,n=this.options;Gt(n.toggleContinueSelectWithoutDeselect,t,function(){n.toggleContinueSelectWithoutDeselect=t,e.setKeyEvent()})},i.setPreventDefault=function(t){this.gesto.options.preventDefault=t},i.setCheckInput=function(t){this.gesto.options.checkInput=t},i.initElement=function(){this.target=Lt(qt("div",{className:ee}),this.target,this.container);var t=this.target,e=this.options,n=e.dragContainer,r=e.checkInput,i=e.preventDefault;this.dragContainer="string"==typeof n?[].slice.call(document.querySelectorAll(n)):n||this.target.parentNode,this.gesto=new R(this.dragContainer,{checkWindowBlur:!0,container:window,checkInput:r,preventDefault:i}).on({dragStart:this._onDragStart,drag:this._onDrag,dragEnd:this._onDragEnd}),b(document,"selectstart",this._onDocumentSelectStart),this.injectResult=te.inject(t,{nonce:this.options.cspNonce})},i.hitTest=function(t,a,s,e){function i(t){var e=bt([a,s],t);if(u&&e)return!0;var n=wt(v,t);if(!n.length)return!1;var r=Ct(n),i=Ct(t),o=P(""+c);return"px"===o.unit?r>=o.value:x(Math.round(r/i*100),0,100)>=Math.min(100,o.value)}var n=this.options,c=n.hitRate,u=n.selectByClick,r=t.left,o=t.top,l=t.right,f=t.bottom,h=e.innerGroups,d=e.innerWidth,p=e.innerHeight,v=[[r,o],[l,o],[l,f],[r,f]];if(!h){var g=e.selectableTargets,m=e.selectablePoints;return g.filter(function(t,e){return i(m[e])})}for(var y=[],C=Math.floor(r/d),S=Math.floor(l/d),b=Math.floor(o/p),_=Math.floor(f/p),E=C;E<=S;++E){var D=h[E];if(D)for(var k=function(t){var e=D[t];if(!e)return"continue";var n=e.points,r=e.targets;n.forEach(function(t,e){i(t)&&y.push(r[e])})},w=b;w<=_;++w)k(w)}return y},i.initDragScroll=function(){var s=this;this.dragScroll.on("scroll",function(t){var e=t.container,n=t.direction;s.emit("scroll",{container:e,direction:n})}).on("move",function(t){var e=t.offsetX,n=t.offsetY,r=t.inputEvent,i=s.gesto;if(i&&i.isFlag()){var o=s.gesto.getEventDatas(),a=o.boundArea;o.startX-=e,o.startY-=n,o.selectablePoints.forEach(function(t){t.forEach(function(t){t[0]-=e,t[1]-=n})}),s._refreshGroups(o),a.left-=e,a.right-=e,a.top-=n,a.bottom-=n,s.gesto.scrollBy(e,n,r.inputEvent,!1),s._checkSelected(s.gesto.getCurrentEvent())}})},i._select=function(t,e,n,r,i){var o=V(t,e),a=o.added,s=o.removed,c=o.prevList,u=o.list;this.selectedTargets=e,i&&this.emit("selectStart",{selected:e,added:a.map(function(t){return u[t]}),removed:s.map(function(t){return c[t]}),rect:n,inputEvent:r}),(a.length||s.length)&&this.emit("select",{selected:e,added:a.map(function(t){return u[t]}),removed:s.map(function(t){return c[t]}),rect:n,inputEvent:r})},i._selectEnd=function(t,e,n,r){var i=r.inputEvent,o=r.isDouble,a=V(t,this.selectedTargets),s=a.added,c=a.removed,u=a.prevList,l=a.list,f=V(e,this.selectedTargets),h=f.added,d=f.removed,p=f.prevList,v=f.list,g=i&&i.type,m="mousedown"===g||"touchstart"===g;this.emit("selectEnd",{selected:this.selectedTargets,added:s.map(function(t){return l[t]}),removed:c.map(function(t){return u[t]}),afterAdded:h.map(function(t){return v[t]}),afterRemoved:d.map(function(t){return p[t]}),isDragStart:m,isClick:!!r.isClick,isDouble:!!o,rect:n,inputEvent:i})},i._checkSelected=function(t,e){void 0===e&&(e=Ht(t,this.options.ratio));var n=t.datas,r=t.inputEvent,i=e.top,o=e.left,a=e.width,s=e.height,c=n.selectFlag,u=n.containerX,l=n.containerY,f=n.scaleMatrix,h=It(f,[o-u,i-l]),d=It(f,[a,s]),p=[],v=[];if(c){this.target.style.cssText+="display: block;left:0px;top:0px;transform: translate("+h[0]+"px, "+h[1]+"px);width:"+d[0]+"px;height:"+d[1]+"px;";var g=this.hitTest(e,n.startX,n.startY,n);p=this.selectedTargets,v=Ut(n.startPassedTargets,g,this.continueSelect&&this.continueSelectWithoutDeselect),this.selectedTargets=v}if(!1===this.emit("drag",M(M({},t),{isSelect:c,rect:e})))return this.target.style.cssText+="display: none;",void t.stop();c&&this._select(p,v,e,r)},i._sameCombiKey=function(t,e,n){if(!e)return!1;var r=vt(t.inputEvent,t.key),i=[].concat(e),o=s(i[0])?i:[i];if(n){var a=t.key;return o.some(function(t){return t.some(function(t){return t===a})})}return o.some(function(t){return t.every(function(t){return-1<r.indexOf(t)})})},i._findElement=function(t,e){for(var n=t;n&&!(-1<e.indexOf(n));)n=n.parentElement;return n},i._refreshGroups=function(t){var c=t.innerWidth,u=t.innerHeight;if(c&&u){var l=t.selectableTargets,e=t.selectablePoints,f={};e.forEach(function(t,e){var n=t[0],r=Math.floor(n[0]/c),i=Math.floor(n[1]/u);f[r]=f[r]||{},f[r][i]=f[r][i]||{points:[],targets:[]};var o=f[r][i],a=o.targets,s=o.points;a.push(l[e]),s.push(t)}),t.innerGroups=f}else t.innerGroups=null},t=function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(i=t[s])&&(a=(o<3?i(a):3<o?i(e,n,a):i(e,n))||a);return 3<o&&a&&Object.defineProperty(e,n,a),a}([(n=ne,r=function(t,e){var n={enumerable:!0,configurable:!0,get:function(){return this.options[e]}},r=a("get "+e);t[r]?n.get=function(){return this[r]()}:n.get=function(){return this.options[e]};var i=a("set "+e);t[i]?n.set=function(t){this[i](t)}:n.set=function(t){this.options[e]=t},Object.defineProperty(t,e,n)},function(t){var e=t.prototype;n.forEach(function(t){r(e,t)})})],t)}(t)),ae={__proto__:null,default:oe,OPTIONS:re,OPTION_TYPES:ie,PROPERTIES:ne,EVENTS:["dragStart","drag","dragEnd","selectStart","select","selectEnd","keydown","keyup","scroll"],METHODS:["clickTarget","getSelectableElements","setSelectedTargets","getElementPoints","getSelectedTargets","findSelectableTargets","triggerDragStart","checkScroll"],CLASS_NAME:ee};for(var se in ae)oe[se]=ae[se];return oe}); | ||
//# sourceMappingURL=selecto.min.js.map |
{ | ||
"name": "selecto", | ||
"version": "1.16.2", | ||
"version": "1.17.0", | ||
"description": "Selecto.js is a component that allows you to select elements in the drag area using the mouse or touch.", | ||
@@ -47,3 +47,3 @@ "main": "./dist/selecto.cjs.js", | ||
"dependencies": { | ||
"@daybrush/utils": "^1.4.0", | ||
"@daybrush/utils": "^1.7.1", | ||
"@egjs/children-differ": "^1.0.1", | ||
@@ -55,5 +55,5 @@ "@scena/dragscroll": "^1.1.1", | ||
"framework-utils": "^1.1.0", | ||
"gesto": "^1.7.0", | ||
"keycon": "^1.1.2", | ||
"overlap-area": "^1.0.0" | ||
"gesto": "^1.9.0", | ||
"keycon": "^1.2.0", | ||
"overlap-area": "^1.1.0" | ||
}, | ||
@@ -60,0 +60,0 @@ "devDependencies": { |
@@ -27,3 +27,5 @@ import styled from "css-styled"; | ||
"continueSelect", | ||
"continueSelectWithoutDeselect", | ||
"toggleContinueSelect", | ||
"toggleContinueSelectWithoutDeselect", | ||
"keyContainer", | ||
@@ -48,3 +50,2 @@ "hitRate", | ||
"cspNonce", | ||
"continueSelectWithoutDeselect", | ||
...PROPERTIES, | ||
@@ -63,2 +64,3 @@ ] as const; | ||
toggleContinueSelect: Array, | ||
toggleContinueSelectWithoutDeselect: Array, | ||
keyContainer: null, | ||
@@ -65,0 +67,0 @@ hitRate: Number, |
@@ -14,14 +14,2 @@ import { IObject } from "@daybrush/utils"; | ||
* @typedef | ||
* @property - | ||
* @property - | ||
* @property - | ||
* @property - | ||
* @property - | ||
* @property - | ||
* @property - C | ||
* @property - | ||
* @property - | ||
* @property - | ||
* @property - | ||
*/ | ||
@@ -80,5 +68,11 @@ export interface SelectoOptions { | ||
* Determines which key to continue selecting the next target via keydown and keyup. | ||
* The initially set `continueSelect` value is the inactive(keyup) value. | ||
*/ | ||
toggleContinueSelect: string[][] | string[] | string | null; | ||
/** | ||
* Determines which key to continue selecting the next target without deselect via keydown and keyup. | ||
* The initially set `continueSelectWithoutDeselect` value is the inactive(keyup) value. | ||
*/ | ||
toggleContinueSelectWithoutDeselect: string[][] | string[] | string | null; | ||
/** | ||
* The container for keydown and keyup events. | ||
@@ -229,2 +223,4 @@ */ | ||
export interface OnKeyEvent<T = Selecto> extends CurrentTarget<T> { | ||
keydownContinueSelect: boolean; | ||
keydownContinueSelectWithoutDeselection: boolean; | ||
} | ||
@@ -284,1 +280,7 @@ export interface OnScroll { | ||
} | ||
export interface InnerGroup { | ||
targets: Array<HTMLElement | SVGElement>; | ||
points: number[][][]; | ||
} |
import { Hypertext, Rect } from "./types"; | ||
import { IObject, addClass, hasClass, calculateBoundSize } from "@daybrush/utils"; | ||
import { diff } from "@egjs/children-differ"; | ||
import { getMinMaxs } from "overlap-area"; | ||
@@ -21,2 +22,5 @@ export function getClient(e: MouseEvent | TouchEvent) { | ||
export function elementFromPoint(clientX: number, clientY: number): HTMLElement | SVGElement | null { | ||
return document?.elementFromPoint(clientX, clientY) as any ?? null; | ||
} | ||
export function createElement( | ||
@@ -79,3 +83,35 @@ jsx: Hypertext, | ||
} | ||
export function isFastInside(point: number[], points: number[][]) { | ||
const { minX, minY, maxX, maxY } = getMinMaxs(points); | ||
const [x, y] = point; | ||
return minX <= x && x <= maxX && minY <= y && y <= maxY; | ||
} | ||
export function getFastOverlapPoints(points1: number[][], points2: number[][]) { | ||
const { | ||
minX: minX1, | ||
minY: minY1, | ||
maxX: maxX1, | ||
maxY: maxY1, | ||
} = getMinMaxs(points1); | ||
const { | ||
minX: minX2, | ||
minY: minY2, | ||
maxX: maxX2, | ||
maxY: maxY2, | ||
} = getMinMaxs(points2); | ||
if (maxX2 < minX1 || maxX1 < minX2 || maxY2 < minY1 || maxY1 < minY2) { | ||
return []; | ||
} | ||
const width = Math.min(maxX2 - minX1, maxX1 - minX2); | ||
const height = Math.min(maxY2 - minY1, maxY1 - minY2); | ||
return [ | ||
[0, 0], | ||
[width, 0], | ||
[width, height], | ||
[0, height], | ||
]; | ||
} | ||
export function getRect( | ||
@@ -82,0 +118,0 @@ e: any, ratio: number, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
713672
9936
Updated@daybrush/utils@^1.7.1
Updatedgesto@^1.9.0
Updatedkeycon@^1.2.0
Updatedoverlap-area@^1.1.0