1994 lines
64 KiB
JavaScript
1994 lines
64 KiB
JavaScript
function _typeof(obj) {
|
|
"@babel/helpers - typeof";
|
|
|
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
_typeof = function (obj) {
|
|
return typeof obj;
|
|
};
|
|
} else {
|
|
_typeof = function (obj) {
|
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
};
|
|
}
|
|
|
|
return _typeof(obj);
|
|
}
|
|
|
|
var REACT_ELEMENT_TYPE;
|
|
|
|
function _jsx(type, props, key, children) {
|
|
if (!REACT_ELEMENT_TYPE) {
|
|
REACT_ELEMENT_TYPE = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
|
|
}
|
|
|
|
var defaultProps = type && type.defaultProps;
|
|
var childrenLength = arguments.length - 3;
|
|
|
|
if (!props && childrenLength !== 0) {
|
|
props = {
|
|
children: void 0
|
|
};
|
|
}
|
|
|
|
if (childrenLength === 1) {
|
|
props.children = children;
|
|
} else if (childrenLength > 1) {
|
|
var childArray = new Array(childrenLength);
|
|
|
|
for (var i = 0; i < childrenLength; i++) {
|
|
childArray[i] = arguments[i + 3];
|
|
}
|
|
|
|
props.children = childArray;
|
|
}
|
|
|
|
if (props && defaultProps) {
|
|
for (var propName in defaultProps) {
|
|
if (props[propName] === void 0) {
|
|
props[propName] = defaultProps[propName];
|
|
}
|
|
}
|
|
} else if (!props) {
|
|
props = defaultProps || {};
|
|
}
|
|
|
|
return {
|
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
type: type,
|
|
key: key === undefined ? null : '' + key,
|
|
ref: null,
|
|
props: props,
|
|
_owner: null
|
|
};
|
|
}
|
|
|
|
function _asyncIterator(iterable) {
|
|
var method;
|
|
|
|
if (typeof Symbol !== "undefined") {
|
|
if (Symbol.asyncIterator) {
|
|
method = iterable[Symbol.asyncIterator];
|
|
if (method != null) return method.call(iterable);
|
|
}
|
|
|
|
if (Symbol.iterator) {
|
|
method = iterable[Symbol.iterator];
|
|
if (method != null) return method.call(iterable);
|
|
}
|
|
}
|
|
|
|
throw new TypeError("Object is not async iterable");
|
|
}
|
|
|
|
function _AwaitValue(value) {
|
|
this.wrapped = value;
|
|
}
|
|
|
|
function _AsyncGenerator(gen) {
|
|
var front, back;
|
|
|
|
function send(key, arg) {
|
|
return new Promise(function (resolve, reject) {
|
|
var request = {
|
|
key: key,
|
|
arg: arg,
|
|
resolve: resolve,
|
|
reject: reject,
|
|
next: null
|
|
};
|
|
|
|
if (back) {
|
|
back = back.next = request;
|
|
} else {
|
|
front = back = request;
|
|
resume(key, arg);
|
|
}
|
|
});
|
|
}
|
|
|
|
function resume(key, arg) {
|
|
try {
|
|
var result = gen[key](arg);
|
|
var value = result.value;
|
|
var wrappedAwait = value instanceof _AwaitValue;
|
|
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
|
|
if (wrappedAwait) {
|
|
resume(key === "return" ? "return" : "next", arg);
|
|
return;
|
|
}
|
|
|
|
settle(result.done ? "return" : "normal", arg);
|
|
}, function (err) {
|
|
resume("throw", err);
|
|
});
|
|
} catch (err) {
|
|
settle("throw", err);
|
|
}
|
|
}
|
|
|
|
function settle(type, value) {
|
|
switch (type) {
|
|
case "return":
|
|
front.resolve({
|
|
value: value,
|
|
done: true
|
|
});
|
|
break;
|
|
|
|
case "throw":
|
|
front.reject(value);
|
|
break;
|
|
|
|
default:
|
|
front.resolve({
|
|
value: value,
|
|
done: false
|
|
});
|
|
break;
|
|
}
|
|
|
|
front = front.next;
|
|
|
|
if (front) {
|
|
resume(front.key, front.arg);
|
|
} else {
|
|
back = null;
|
|
}
|
|
}
|
|
|
|
this._invoke = send;
|
|
|
|
if (typeof gen.return !== "function") {
|
|
this.return = undefined;
|
|
}
|
|
}
|
|
|
|
if (typeof Symbol === "function" && Symbol.asyncIterator) {
|
|
_AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
|
|
return this;
|
|
};
|
|
}
|
|
|
|
_AsyncGenerator.prototype.next = function (arg) {
|
|
return this._invoke("next", arg);
|
|
};
|
|
|
|
_AsyncGenerator.prototype.throw = function (arg) {
|
|
return this._invoke("throw", arg);
|
|
};
|
|
|
|
_AsyncGenerator.prototype.return = function (arg) {
|
|
return this._invoke("return", arg);
|
|
};
|
|
|
|
function _wrapAsyncGenerator(fn) {
|
|
return function () {
|
|
return new _AsyncGenerator(fn.apply(this, arguments));
|
|
};
|
|
}
|
|
|
|
function _awaitAsyncGenerator(value) {
|
|
return new _AwaitValue(value);
|
|
}
|
|
|
|
function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
var iter = {},
|
|
waiting = false;
|
|
|
|
function pump(key, value) {
|
|
waiting = true;
|
|
value = new Promise(function (resolve) {
|
|
resolve(inner[key](value));
|
|
});
|
|
return {
|
|
done: false,
|
|
value: awaitWrap(value)
|
|
};
|
|
}
|
|
|
|
;
|
|
|
|
if (typeof Symbol === "function" && Symbol.iterator) {
|
|
iter[Symbol.iterator] = function () {
|
|
return this;
|
|
};
|
|
}
|
|
|
|
iter.next = function (value) {
|
|
if (waiting) {
|
|
waiting = false;
|
|
return value;
|
|
}
|
|
|
|
return pump("next", value);
|
|
};
|
|
|
|
if (typeof inner.throw === "function") {
|
|
iter.throw = function (value) {
|
|
if (waiting) {
|
|
waiting = false;
|
|
throw value;
|
|
}
|
|
|
|
return pump("throw", value);
|
|
};
|
|
}
|
|
|
|
if (typeof inner.return === "function") {
|
|
iter.return = function (value) {
|
|
if (waiting) {
|
|
waiting = false;
|
|
return value;
|
|
}
|
|
|
|
return pump("return", value);
|
|
};
|
|
}
|
|
|
|
return iter;
|
|
}
|
|
|
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
try {
|
|
var info = gen[key](arg);
|
|
var value = info.value;
|
|
} catch (error) {
|
|
reject(error);
|
|
return;
|
|
}
|
|
|
|
if (info.done) {
|
|
resolve(value);
|
|
} else {
|
|
Promise.resolve(value).then(_next, _throw);
|
|
}
|
|
}
|
|
|
|
function _asyncToGenerator(fn) {
|
|
return function () {
|
|
var self = this,
|
|
args = arguments;
|
|
return new Promise(function (resolve, reject) {
|
|
var gen = fn.apply(self, args);
|
|
|
|
function _next(value) {
|
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
}
|
|
|
|
function _throw(err) {
|
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
}
|
|
|
|
_next(undefined);
|
|
});
|
|
};
|
|
}
|
|
|
|
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
|
|
function _defineProperties(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor) descriptor.writable = true;
|
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
|
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
return Constructor;
|
|
}
|
|
|
|
function _defineEnumerableProperties(obj, descs) {
|
|
for (var key in descs) {
|
|
var desc = descs[key];
|
|
desc.configurable = desc.enumerable = true;
|
|
if ("value" in desc) desc.writable = true;
|
|
Object.defineProperty(obj, key, desc);
|
|
}
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
var objectSymbols = Object.getOwnPropertySymbols(descs);
|
|
|
|
for (var i = 0; i < objectSymbols.length; i++) {
|
|
var sym = objectSymbols[i];
|
|
var desc = descs[sym];
|
|
desc.configurable = desc.enumerable = true;
|
|
if ("value" in desc) desc.writable = true;
|
|
Object.defineProperty(obj, sym, desc);
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
function _defaults(obj, defaults) {
|
|
var keys = Object.getOwnPropertyNames(defaults);
|
|
|
|
for (var i = 0; i < keys.length; i++) {
|
|
var key = keys[i];
|
|
var value = Object.getOwnPropertyDescriptor(defaults, key);
|
|
|
|
if (value && value.configurable && obj[key] === undefined) {
|
|
Object.defineProperty(obj, key, value);
|
|
}
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
function _defineProperty(obj, key, value) {
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value: value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
|
|
return obj;
|
|
}
|
|
|
|
function _extends() {
|
|
_extends = Object.assign || function (target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = arguments[i];
|
|
|
|
for (var key in source) {
|
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
return target;
|
|
};
|
|
|
|
return _extends.apply(this, arguments);
|
|
}
|
|
|
|
function _objectSpread(target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
var ownKeys = Object.keys(source);
|
|
|
|
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
}));
|
|
}
|
|
|
|
ownKeys.forEach(function (key) {
|
|
_defineProperty(target, key, source[key]);
|
|
});
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
function ownKeys(object, enumerableOnly) {
|
|
var keys = Object.keys(object);
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
});
|
|
keys.push.apply(keys, symbols);
|
|
}
|
|
|
|
return keys;
|
|
}
|
|
|
|
function _objectSpread2(target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
|
|
if (i % 2) {
|
|
ownKeys(Object(source), true).forEach(function (key) {
|
|
_defineProperty(target, key, source[key]);
|
|
});
|
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
} else {
|
|
ownKeys(Object(source)).forEach(function (key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
function _inherits(subClass, superClass) {
|
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
throw new TypeError("Super expression must either be null or a function");
|
|
}
|
|
|
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
}
|
|
|
|
function _inheritsLoose(subClass, superClass) {
|
|
subClass.prototype = Object.create(superClass.prototype);
|
|
subClass.prototype.constructor = subClass;
|
|
subClass.__proto__ = superClass;
|
|
}
|
|
|
|
function _getPrototypeOf(o) {
|
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
};
|
|
return _getPrototypeOf(o);
|
|
}
|
|
|
|
function _setPrototypeOf(o, p) {
|
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
o.__proto__ = p;
|
|
return o;
|
|
};
|
|
|
|
return _setPrototypeOf(o, p);
|
|
}
|
|
|
|
function _isNativeReflectConstruct() {
|
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
if (Reflect.construct.sham) return false;
|
|
if (typeof Proxy === "function") return true;
|
|
|
|
try {
|
|
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function _construct(Parent, args, Class) {
|
|
if (_isNativeReflectConstruct()) {
|
|
_construct = Reflect.construct;
|
|
} else {
|
|
_construct = function _construct(Parent, args, Class) {
|
|
var a = [null];
|
|
a.push.apply(a, args);
|
|
var Constructor = Function.bind.apply(Parent, a);
|
|
var instance = new Constructor();
|
|
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
return instance;
|
|
};
|
|
}
|
|
|
|
return _construct.apply(null, arguments);
|
|
}
|
|
|
|
function _isNativeFunction(fn) {
|
|
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
}
|
|
|
|
function _wrapNativeSuper(Class) {
|
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
|
|
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
|
|
if (typeof Class !== "function") {
|
|
throw new TypeError("Super expression must either be null or a function");
|
|
}
|
|
|
|
if (typeof _cache !== "undefined") {
|
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
|
|
_cache.set(Class, Wrapper);
|
|
}
|
|
|
|
function Wrapper() {
|
|
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
}
|
|
|
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
constructor: {
|
|
value: Wrapper,
|
|
enumerable: false,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
return _setPrototypeOf(Wrapper, Class);
|
|
};
|
|
|
|
return _wrapNativeSuper(Class);
|
|
}
|
|
|
|
function _instanceof(left, right) {
|
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
return !!right[Symbol.hasInstance](left);
|
|
} else {
|
|
return left instanceof right;
|
|
}
|
|
}
|
|
|
|
function _interopRequireDefault(obj) {
|
|
return obj && obj.__esModule ? obj : {
|
|
default: obj
|
|
};
|
|
}
|
|
|
|
function _getRequireWildcardCache() {
|
|
if (typeof WeakMap !== "function") return null;
|
|
var cache = new WeakMap();
|
|
|
|
_getRequireWildcardCache = function () {
|
|
return cache;
|
|
};
|
|
|
|
return cache;
|
|
}
|
|
|
|
function _interopRequireWildcard(obj) {
|
|
if (obj && obj.__esModule) {
|
|
return obj;
|
|
}
|
|
|
|
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
return {
|
|
default: obj
|
|
};
|
|
}
|
|
|
|
var cache = _getRequireWildcardCache();
|
|
|
|
if (cache && cache.has(obj)) {
|
|
return cache.get(obj);
|
|
}
|
|
|
|
var newObj = {};
|
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
|
|
for (var key in obj) {
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
|
|
if (desc && (desc.get || desc.set)) {
|
|
Object.defineProperty(newObj, key, desc);
|
|
} else {
|
|
newObj[key] = obj[key];
|
|
}
|
|
}
|
|
}
|
|
|
|
newObj.default = obj;
|
|
|
|
if (cache) {
|
|
cache.set(obj, newObj);
|
|
}
|
|
|
|
return newObj;
|
|
}
|
|
|
|
function _newArrowCheck(innerThis, boundThis) {
|
|
if (innerThis !== boundThis) {
|
|
throw new TypeError("Cannot instantiate an arrow function");
|
|
}
|
|
}
|
|
|
|
function _objectDestructuringEmpty(obj) {
|
|
if (obj == null) throw new TypeError("Cannot destructure undefined");
|
|
}
|
|
|
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
if (source == null) return {};
|
|
var target = {};
|
|
var sourceKeys = Object.keys(source);
|
|
var key, i;
|
|
|
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
key = sourceKeys[i];
|
|
if (excluded.indexOf(key) >= 0) continue;
|
|
target[key] = source[key];
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
function _objectWithoutProperties(source, excluded) {
|
|
if (source == null) return {};
|
|
|
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
|
|
var key, i;
|
|
|
|
if (Object.getOwnPropertySymbols) {
|
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
|
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
key = sourceSymbolKeys[i];
|
|
if (excluded.indexOf(key) >= 0) continue;
|
|
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
function _assertThisInitialized(self) {
|
|
if (self === void 0) {
|
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
function _possibleConstructorReturn(self, call) {
|
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
return call;
|
|
}
|
|
|
|
return _assertThisInitialized(self);
|
|
}
|
|
|
|
function _createSuper(Derived) {
|
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
|
|
return function _createSuperInternal() {
|
|
var Super = _getPrototypeOf(Derived),
|
|
result;
|
|
|
|
if (hasNativeReflectConstruct) {
|
|
var NewTarget = _getPrototypeOf(this).constructor;
|
|
|
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
} else {
|
|
result = Super.apply(this, arguments);
|
|
}
|
|
|
|
return _possibleConstructorReturn(this, result);
|
|
};
|
|
}
|
|
|
|
function _superPropBase(object, property) {
|
|
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
object = _getPrototypeOf(object);
|
|
if (object === null) break;
|
|
}
|
|
|
|
return object;
|
|
}
|
|
|
|
function _get(target, property, receiver) {
|
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
_get = Reflect.get;
|
|
} else {
|
|
_get = function _get(target, property, receiver) {
|
|
var base = _superPropBase(target, property);
|
|
|
|
if (!base) return;
|
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
|
|
if (desc.get) {
|
|
return desc.get.call(receiver);
|
|
}
|
|
|
|
return desc.value;
|
|
};
|
|
}
|
|
|
|
return _get(target, property, receiver || target);
|
|
}
|
|
|
|
function set(target, property, value, receiver) {
|
|
if (typeof Reflect !== "undefined" && Reflect.set) {
|
|
set = Reflect.set;
|
|
} else {
|
|
set = function set(target, property, value, receiver) {
|
|
var base = _superPropBase(target, property);
|
|
|
|
var desc;
|
|
|
|
if (base) {
|
|
desc = Object.getOwnPropertyDescriptor(base, property);
|
|
|
|
if (desc.set) {
|
|
desc.set.call(receiver, value);
|
|
return true;
|
|
} else if (!desc.writable) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
desc = Object.getOwnPropertyDescriptor(receiver, property);
|
|
|
|
if (desc) {
|
|
if (!desc.writable) {
|
|
return false;
|
|
}
|
|
|
|
desc.value = value;
|
|
Object.defineProperty(receiver, property, desc);
|
|
} else {
|
|
_defineProperty(receiver, property, value);
|
|
}
|
|
|
|
return true;
|
|
};
|
|
}
|
|
|
|
return set(target, property, value, receiver);
|
|
}
|
|
|
|
function _set(target, property, value, receiver, isStrict) {
|
|
var s = set(target, property, value, receiver || target);
|
|
|
|
if (!s && isStrict) {
|
|
throw new Error('failed to set property');
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function _taggedTemplateLiteral(strings, raw) {
|
|
if (!raw) {
|
|
raw = strings.slice(0);
|
|
}
|
|
|
|
return Object.freeze(Object.defineProperties(strings, {
|
|
raw: {
|
|
value: Object.freeze(raw)
|
|
}
|
|
}));
|
|
}
|
|
|
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
if (!raw) {
|
|
raw = strings.slice(0);
|
|
}
|
|
|
|
strings.raw = raw;
|
|
return strings;
|
|
}
|
|
|
|
function _readOnlyError(name) {
|
|
throw new Error("\"" + name + "\" is read-only");
|
|
}
|
|
|
|
function _classNameTDZError(name) {
|
|
throw new Error("Class \"" + name + "\" cannot be referenced in computed property keys.");
|
|
}
|
|
|
|
function _temporalUndefined() {}
|
|
|
|
function _tdz(name) {
|
|
throw new ReferenceError(name + " is not defined - temporal dead zone");
|
|
}
|
|
|
|
function _temporalRef(val, name) {
|
|
return val === _temporalUndefined ? _tdz(name) : val;
|
|
}
|
|
|
|
function _slicedToArray(arr, i) {
|
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
}
|
|
|
|
function _slicedToArrayLoose(arr, i) {
|
|
return _arrayWithHoles(arr) || _iterableToArrayLimitLoose(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
}
|
|
|
|
function _toArray(arr) {
|
|
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
}
|
|
|
|
function _toConsumableArray(arr) {
|
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
}
|
|
|
|
function _arrayWithoutHoles(arr) {
|
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
}
|
|
|
|
function _arrayWithHoles(arr) {
|
|
if (Array.isArray(arr)) return arr;
|
|
}
|
|
|
|
function _maybeArrayLike(next, arr, i) {
|
|
if (arr && !Array.isArray(arr) && typeof arr.length === "number") {
|
|
var len = arr.length;
|
|
return _arrayLikeToArray(arr, i !== void 0 && i < len ? i : len);
|
|
}
|
|
|
|
return next(arr, i);
|
|
}
|
|
|
|
function _iterableToArray(iter) {
|
|
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
|
}
|
|
|
|
function _iterableToArrayLimit(arr, i) {
|
|
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
var _arr = [];
|
|
var _n = true;
|
|
var _d = false;
|
|
var _e = undefined;
|
|
|
|
try {
|
|
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
_arr.push(_s.value);
|
|
|
|
if (i && _arr.length === i) break;
|
|
}
|
|
} catch (err) {
|
|
_d = true;
|
|
_e = err;
|
|
} finally {
|
|
try {
|
|
if (!_n && _i["return"] != null) _i["return"]();
|
|
} finally {
|
|
if (_d) throw _e;
|
|
}
|
|
}
|
|
|
|
return _arr;
|
|
}
|
|
|
|
function _iterableToArrayLimitLoose(arr, i) {
|
|
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
var _arr = [];
|
|
|
|
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
|
_arr.push(_step.value);
|
|
|
|
if (i && _arr.length === i) break;
|
|
}
|
|
|
|
return _arr;
|
|
}
|
|
|
|
function _unsupportedIterableToArray(o, minLen) {
|
|
if (!o) return;
|
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
}
|
|
|
|
function _arrayLikeToArray(arr, len) {
|
|
if (len == null || len > arr.length) len = arr.length;
|
|
|
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
|
|
return arr2;
|
|
}
|
|
|
|
function _nonIterableSpread() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
function _nonIterableRest() {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
var it;
|
|
|
|
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
if (it) o = it;
|
|
var i = 0;
|
|
|
|
var F = function () {};
|
|
|
|
return {
|
|
s: F,
|
|
n: function () {
|
|
if (i >= o.length) return {
|
|
done: true
|
|
};
|
|
return {
|
|
done: false,
|
|
value: o[i++]
|
|
};
|
|
},
|
|
e: function (e) {
|
|
throw e;
|
|
},
|
|
f: F
|
|
};
|
|
}
|
|
|
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
var normalCompletion = true,
|
|
didErr = false,
|
|
err;
|
|
return {
|
|
s: function () {
|
|
it = o[Symbol.iterator]();
|
|
},
|
|
n: function () {
|
|
var step = it.next();
|
|
normalCompletion = step.done;
|
|
return step;
|
|
},
|
|
e: function (e) {
|
|
didErr = true;
|
|
err = e;
|
|
},
|
|
f: function () {
|
|
try {
|
|
if (!normalCompletion && it.return != null) it.return();
|
|
} finally {
|
|
if (didErr) throw err;
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
var it;
|
|
|
|
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
if (it) o = it;
|
|
var i = 0;
|
|
return function () {
|
|
if (i >= o.length) return {
|
|
done: true
|
|
};
|
|
return {
|
|
done: false,
|
|
value: o[i++]
|
|
};
|
|
};
|
|
}
|
|
|
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
|
|
it = o[Symbol.iterator]();
|
|
return it.next.bind(it);
|
|
}
|
|
|
|
function _skipFirstGeneratorNext(fn) {
|
|
return function () {
|
|
var it = fn.apply(this, arguments);
|
|
it.next();
|
|
return it;
|
|
};
|
|
}
|
|
|
|
function _toPrimitive(input, hint) {
|
|
if (typeof input !== "object" || input === null) return input;
|
|
var prim = input[Symbol.toPrimitive];
|
|
|
|
if (prim !== undefined) {
|
|
var res = prim.call(input, hint || "default");
|
|
if (typeof res !== "object") return res;
|
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
}
|
|
|
|
return (hint === "string" ? String : Number)(input);
|
|
}
|
|
|
|
function _toPropertyKey(arg) {
|
|
var key = _toPrimitive(arg, "string");
|
|
|
|
return typeof key === "symbol" ? key : String(key);
|
|
}
|
|
|
|
function _initializerWarningHelper(descriptor, context) {
|
|
throw new Error('Decorating class property failed. Please ensure that ' + 'proposal-class-properties is enabled and runs after the decorators transform.');
|
|
}
|
|
|
|
function _initializerDefineProperty(target, property, descriptor, context) {
|
|
if (!descriptor) return;
|
|
Object.defineProperty(target, property, {
|
|
enumerable: descriptor.enumerable,
|
|
configurable: descriptor.configurable,
|
|
writable: descriptor.writable,
|
|
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
|
|
});
|
|
}
|
|
|
|
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
|
|
var desc = {};
|
|
Object.keys(descriptor).forEach(function (key) {
|
|
desc[key] = descriptor[key];
|
|
});
|
|
desc.enumerable = !!desc.enumerable;
|
|
desc.configurable = !!desc.configurable;
|
|
|
|
if ('value' in desc || desc.initializer) {
|
|
desc.writable = true;
|
|
}
|
|
|
|
desc = decorators.slice().reverse().reduce(function (desc, decorator) {
|
|
return decorator(target, property, desc) || desc;
|
|
}, desc);
|
|
|
|
if (context && desc.initializer !== void 0) {
|
|
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
|
|
desc.initializer = undefined;
|
|
}
|
|
|
|
if (desc.initializer === void 0) {
|
|
Object.defineProperty(target, property, desc);
|
|
desc = null;
|
|
}
|
|
|
|
return desc;
|
|
}
|
|
|
|
var id = 0;
|
|
|
|
function _classPrivateFieldLooseKey(name) {
|
|
return "__private_" + id++ + "_" + name;
|
|
}
|
|
|
|
function _classPrivateFieldLooseBase(receiver, privateKey) {
|
|
if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) {
|
|
throw new TypeError("attempted to use private field on non-instance");
|
|
}
|
|
|
|
return receiver;
|
|
}
|
|
|
|
function _classPrivateFieldGet(receiver, privateMap) {
|
|
var descriptor = privateMap.get(receiver);
|
|
|
|
if (!descriptor) {
|
|
throw new TypeError("attempted to get private field on non-instance");
|
|
}
|
|
|
|
if (descriptor.get) {
|
|
return descriptor.get.call(receiver);
|
|
}
|
|
|
|
return descriptor.value;
|
|
}
|
|
|
|
function _classPrivateFieldSet(receiver, privateMap, value) {
|
|
var descriptor = privateMap.get(receiver);
|
|
|
|
if (!descriptor) {
|
|
throw new TypeError("attempted to set private field on non-instance");
|
|
}
|
|
|
|
if (descriptor.set) {
|
|
descriptor.set.call(receiver, value);
|
|
} else {
|
|
if (!descriptor.writable) {
|
|
throw new TypeError("attempted to set read only private field");
|
|
}
|
|
|
|
descriptor.value = value;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function _classPrivateFieldDestructureSet(receiver, privateMap) {
|
|
if (!privateMap.has(receiver)) {
|
|
throw new TypeError("attempted to set private field on non-instance");
|
|
}
|
|
|
|
var descriptor = privateMap.get(receiver);
|
|
|
|
if (descriptor.set) {
|
|
if (!("__destrObj" in descriptor)) {
|
|
descriptor.__destrObj = {
|
|
set value(v) {
|
|
descriptor.set.call(receiver, v);
|
|
}
|
|
|
|
};
|
|
}
|
|
|
|
return descriptor.__destrObj;
|
|
} else {
|
|
if (!descriptor.writable) {
|
|
throw new TypeError("attempted to set read only private field");
|
|
}
|
|
|
|
return descriptor;
|
|
}
|
|
}
|
|
|
|
function _classStaticPrivateFieldSpecGet(receiver, classConstructor, descriptor) {
|
|
if (receiver !== classConstructor) {
|
|
throw new TypeError("Private static access of wrong provenance");
|
|
}
|
|
|
|
if (descriptor.get) {
|
|
return descriptor.get.call(receiver);
|
|
}
|
|
|
|
return descriptor.value;
|
|
}
|
|
|
|
function _classStaticPrivateFieldSpecSet(receiver, classConstructor, descriptor, value) {
|
|
if (receiver !== classConstructor) {
|
|
throw new TypeError("Private static access of wrong provenance");
|
|
}
|
|
|
|
if (descriptor.set) {
|
|
descriptor.set.call(receiver, value);
|
|
} else {
|
|
if (!descriptor.writable) {
|
|
throw new TypeError("attempted to set read only private field");
|
|
}
|
|
|
|
descriptor.value = value;
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function _classStaticPrivateMethodGet(receiver, classConstructor, method) {
|
|
if (receiver !== classConstructor) {
|
|
throw new TypeError("Private static access of wrong provenance");
|
|
}
|
|
|
|
return method;
|
|
}
|
|
|
|
function _classStaticPrivateMethodSet() {
|
|
throw new TypeError("attempted to set read only static private field");
|
|
}
|
|
|
|
function _decorate(decorators, factory, superClass, mixins) {
|
|
var api = _getDecoratorsApi();
|
|
|
|
if (mixins) {
|
|
for (var i = 0; i < mixins.length; i++) {
|
|
api = mixins[i](api);
|
|
}
|
|
}
|
|
|
|
var r = factory(function initialize(O) {
|
|
api.initializeInstanceElements(O, decorated.elements);
|
|
}, superClass);
|
|
var decorated = api.decorateClass(_coalesceClassElements(r.d.map(_createElementDescriptor)), decorators);
|
|
api.initializeClassElements(r.F, decorated.elements);
|
|
return api.runClassFinishers(r.F, decorated.finishers);
|
|
}
|
|
|
|
function _getDecoratorsApi() {
|
|
_getDecoratorsApi = function () {
|
|
return api;
|
|
};
|
|
|
|
var api = {
|
|
elementsDefinitionOrder: [["method"], ["field"]],
|
|
initializeInstanceElements: function (O, elements) {
|
|
["method", "field"].forEach(function (kind) {
|
|
elements.forEach(function (element) {
|
|
if (element.kind === kind && element.placement === "own") {
|
|
this.defineClassElement(O, element);
|
|
}
|
|
}, this);
|
|
}, this);
|
|
},
|
|
initializeClassElements: function (F, elements) {
|
|
var proto = F.prototype;
|
|
["method", "field"].forEach(function (kind) {
|
|
elements.forEach(function (element) {
|
|
var placement = element.placement;
|
|
|
|
if (element.kind === kind && (placement === "static" || placement === "prototype")) {
|
|
var receiver = placement === "static" ? F : proto;
|
|
this.defineClassElement(receiver, element);
|
|
}
|
|
}, this);
|
|
}, this);
|
|
},
|
|
defineClassElement: function (receiver, element) {
|
|
var descriptor = element.descriptor;
|
|
|
|
if (element.kind === "field") {
|
|
var initializer = element.initializer;
|
|
descriptor = {
|
|
enumerable: descriptor.enumerable,
|
|
writable: descriptor.writable,
|
|
configurable: descriptor.configurable,
|
|
value: initializer === void 0 ? void 0 : initializer.call(receiver)
|
|
};
|
|
}
|
|
|
|
Object.defineProperty(receiver, element.key, descriptor);
|
|
},
|
|
decorateClass: function (elements, decorators) {
|
|
var newElements = [];
|
|
var finishers = [];
|
|
var placements = {
|
|
static: [],
|
|
prototype: [],
|
|
own: []
|
|
};
|
|
elements.forEach(function (element) {
|
|
this.addElementPlacement(element, placements);
|
|
}, this);
|
|
elements.forEach(function (element) {
|
|
if (!_hasDecorators(element)) return newElements.push(element);
|
|
var elementFinishersExtras = this.decorateElement(element, placements);
|
|
newElements.push(elementFinishersExtras.element);
|
|
newElements.push.apply(newElements, elementFinishersExtras.extras);
|
|
finishers.push.apply(finishers, elementFinishersExtras.finishers);
|
|
}, this);
|
|
|
|
if (!decorators) {
|
|
return {
|
|
elements: newElements,
|
|
finishers: finishers
|
|
};
|
|
}
|
|
|
|
var result = this.decorateConstructor(newElements, decorators);
|
|
finishers.push.apply(finishers, result.finishers);
|
|
result.finishers = finishers;
|
|
return result;
|
|
},
|
|
addElementPlacement: function (element, placements, silent) {
|
|
var keys = placements[element.placement];
|
|
|
|
if (!silent && keys.indexOf(element.key) !== -1) {
|
|
throw new TypeError("Duplicated element (" + element.key + ")");
|
|
}
|
|
|
|
keys.push(element.key);
|
|
},
|
|
decorateElement: function (element, placements) {
|
|
var extras = [];
|
|
var finishers = [];
|
|
|
|
for (var decorators = element.decorators, i = decorators.length - 1; i >= 0; i--) {
|
|
var keys = placements[element.placement];
|
|
keys.splice(keys.indexOf(element.key), 1);
|
|
var elementObject = this.fromElementDescriptor(element);
|
|
var elementFinisherExtras = this.toElementFinisherExtras((0, decorators[i])(elementObject) || elementObject);
|
|
element = elementFinisherExtras.element;
|
|
this.addElementPlacement(element, placements);
|
|
|
|
if (elementFinisherExtras.finisher) {
|
|
finishers.push(elementFinisherExtras.finisher);
|
|
}
|
|
|
|
var newExtras = elementFinisherExtras.extras;
|
|
|
|
if (newExtras) {
|
|
for (var j = 0; j < newExtras.length; j++) {
|
|
this.addElementPlacement(newExtras[j], placements);
|
|
}
|
|
|
|
extras.push.apply(extras, newExtras);
|
|
}
|
|
}
|
|
|
|
return {
|
|
element: element,
|
|
finishers: finishers,
|
|
extras: extras
|
|
};
|
|
},
|
|
decorateConstructor: function (elements, decorators) {
|
|
var finishers = [];
|
|
|
|
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
var obj = this.fromClassDescriptor(elements);
|
|
var elementsAndFinisher = this.toClassDescriptor((0, decorators[i])(obj) || obj);
|
|
|
|
if (elementsAndFinisher.finisher !== undefined) {
|
|
finishers.push(elementsAndFinisher.finisher);
|
|
}
|
|
|
|
if (elementsAndFinisher.elements !== undefined) {
|
|
elements = elementsAndFinisher.elements;
|
|
|
|
for (var j = 0; j < elements.length - 1; j++) {
|
|
for (var k = j + 1; k < elements.length; k++) {
|
|
if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
|
|
throw new TypeError("Duplicated element (" + elements[j].key + ")");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return {
|
|
elements: elements,
|
|
finishers: finishers
|
|
};
|
|
},
|
|
fromElementDescriptor: function (element) {
|
|
var obj = {
|
|
kind: element.kind,
|
|
key: element.key,
|
|
placement: element.placement,
|
|
descriptor: element.descriptor
|
|
};
|
|
var desc = {
|
|
value: "Descriptor",
|
|
configurable: true
|
|
};
|
|
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
if (element.kind === "field") obj.initializer = element.initializer;
|
|
return obj;
|
|
},
|
|
toElementDescriptors: function (elementObjects) {
|
|
if (elementObjects === undefined) return;
|
|
return _toArray(elementObjects).map(function (elementObject) {
|
|
var element = this.toElementDescriptor(elementObject);
|
|
this.disallowProperty(elementObject, "finisher", "An element descriptor");
|
|
this.disallowProperty(elementObject, "extras", "An element descriptor");
|
|
return element;
|
|
}, this);
|
|
},
|
|
toElementDescriptor: function (elementObject) {
|
|
var kind = String(elementObject.kind);
|
|
|
|
if (kind !== "method" && kind !== "field") {
|
|
throw new TypeError('An element descriptor\'s .kind property must be either "method" or' + ' "field", but a decorator created an element descriptor with' + ' .kind "' + kind + '"');
|
|
}
|
|
|
|
var key = _toPropertyKey(elementObject.key);
|
|
|
|
var placement = String(elementObject.placement);
|
|
|
|
if (placement !== "static" && placement !== "prototype" && placement !== "own") {
|
|
throw new TypeError('An element descriptor\'s .placement property must be one of "static",' + ' "prototype" or "own", but a decorator created an element descriptor' + ' with .placement "' + placement + '"');
|
|
}
|
|
|
|
var descriptor = elementObject.descriptor;
|
|
this.disallowProperty(elementObject, "elements", "An element descriptor");
|
|
var element = {
|
|
kind: kind,
|
|
key: key,
|
|
placement: placement,
|
|
descriptor: Object.assign({}, descriptor)
|
|
};
|
|
|
|
if (kind !== "field") {
|
|
this.disallowProperty(elementObject, "initializer", "A method descriptor");
|
|
} else {
|
|
this.disallowProperty(descriptor, "get", "The property descriptor of a field descriptor");
|
|
this.disallowProperty(descriptor, "set", "The property descriptor of a field descriptor");
|
|
this.disallowProperty(descriptor, "value", "The property descriptor of a field descriptor");
|
|
element.initializer = elementObject.initializer;
|
|
}
|
|
|
|
return element;
|
|
},
|
|
toElementFinisherExtras: function (elementObject) {
|
|
var element = this.toElementDescriptor(elementObject);
|
|
|
|
var finisher = _optionalCallableProperty(elementObject, "finisher");
|
|
|
|
var extras = this.toElementDescriptors(elementObject.extras);
|
|
return {
|
|
element: element,
|
|
finisher: finisher,
|
|
extras: extras
|
|
};
|
|
},
|
|
fromClassDescriptor: function (elements) {
|
|
var obj = {
|
|
kind: "class",
|
|
elements: elements.map(this.fromElementDescriptor, this)
|
|
};
|
|
var desc = {
|
|
value: "Descriptor",
|
|
configurable: true
|
|
};
|
|
Object.defineProperty(obj, Symbol.toStringTag, desc);
|
|
return obj;
|
|
},
|
|
toClassDescriptor: function (obj) {
|
|
var kind = String(obj.kind);
|
|
|
|
if (kind !== "class") {
|
|
throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator' + ' created a class descriptor with .kind "' + kind + '"');
|
|
}
|
|
|
|
this.disallowProperty(obj, "key", "A class descriptor");
|
|
this.disallowProperty(obj, "placement", "A class descriptor");
|
|
this.disallowProperty(obj, "descriptor", "A class descriptor");
|
|
this.disallowProperty(obj, "initializer", "A class descriptor");
|
|
this.disallowProperty(obj, "extras", "A class descriptor");
|
|
|
|
var finisher = _optionalCallableProperty(obj, "finisher");
|
|
|
|
var elements = this.toElementDescriptors(obj.elements);
|
|
return {
|
|
elements: elements,
|
|
finisher: finisher
|
|
};
|
|
},
|
|
runClassFinishers: function (constructor, finishers) {
|
|
for (var i = 0; i < finishers.length; i++) {
|
|
var newConstructor = (0, finishers[i])(constructor);
|
|
|
|
if (newConstructor !== undefined) {
|
|
if (typeof newConstructor !== "function") {
|
|
throw new TypeError("Finishers must return a constructor.");
|
|
}
|
|
|
|
constructor = newConstructor;
|
|
}
|
|
}
|
|
|
|
return constructor;
|
|
},
|
|
disallowProperty: function (obj, name, objectType) {
|
|
if (obj[name] !== undefined) {
|
|
throw new TypeError(objectType + " can't have a ." + name + " property.");
|
|
}
|
|
}
|
|
};
|
|
return api;
|
|
}
|
|
|
|
function _createElementDescriptor(def) {
|
|
var key = _toPropertyKey(def.key);
|
|
|
|
var descriptor;
|
|
|
|
if (def.kind === "method") {
|
|
descriptor = {
|
|
value: def.value,
|
|
writable: true,
|
|
configurable: true,
|
|
enumerable: false
|
|
};
|
|
} else if (def.kind === "get") {
|
|
descriptor = {
|
|
get: def.value,
|
|
configurable: true,
|
|
enumerable: false
|
|
};
|
|
} else if (def.kind === "set") {
|
|
descriptor = {
|
|
set: def.value,
|
|
configurable: true,
|
|
enumerable: false
|
|
};
|
|
} else if (def.kind === "field") {
|
|
descriptor = {
|
|
configurable: true,
|
|
writable: true,
|
|
enumerable: true
|
|
};
|
|
}
|
|
|
|
var element = {
|
|
kind: def.kind === "field" ? "field" : "method",
|
|
key: key,
|
|
placement: def.static ? "static" : def.kind === "field" ? "own" : "prototype",
|
|
descriptor: descriptor
|
|
};
|
|
if (def.decorators) element.decorators = def.decorators;
|
|
if (def.kind === "field") element.initializer = def.value;
|
|
return element;
|
|
}
|
|
|
|
function _coalesceGetterSetter(element, other) {
|
|
if (element.descriptor.get !== undefined) {
|
|
other.descriptor.get = element.descriptor.get;
|
|
} else {
|
|
other.descriptor.set = element.descriptor.set;
|
|
}
|
|
}
|
|
|
|
function _coalesceClassElements(elements) {
|
|
var newElements = [];
|
|
|
|
var isSameElement = function (other) {
|
|
return other.kind === "method" && other.key === element.key && other.placement === element.placement;
|
|
};
|
|
|
|
for (var i = 0; i < elements.length; i++) {
|
|
var element = elements[i];
|
|
var other;
|
|
|
|
if (element.kind === "method" && (other = newElements.find(isSameElement))) {
|
|
if (_isDataDescriptor(element.descriptor) || _isDataDescriptor(other.descriptor)) {
|
|
if (_hasDecorators(element) || _hasDecorators(other)) {
|
|
throw new ReferenceError("Duplicated methods (" + element.key + ") can't be decorated.");
|
|
}
|
|
|
|
other.descriptor = element.descriptor;
|
|
} else {
|
|
if (_hasDecorators(element)) {
|
|
if (_hasDecorators(other)) {
|
|
throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
|
|
}
|
|
|
|
other.decorators = element.decorators;
|
|
}
|
|
|
|
_coalesceGetterSetter(element, other);
|
|
}
|
|
} else {
|
|
newElements.push(element);
|
|
}
|
|
}
|
|
|
|
return newElements;
|
|
}
|
|
|
|
function _hasDecorators(element) {
|
|
return element.decorators && element.decorators.length;
|
|
}
|
|
|
|
function _isDataDescriptor(desc) {
|
|
return desc !== undefined && !(desc.value === undefined && desc.writable === undefined);
|
|
}
|
|
|
|
function _optionalCallableProperty(obj, name) {
|
|
var value = obj[name];
|
|
|
|
if (value !== undefined && typeof value !== "function") {
|
|
throw new TypeError("Expected '" + name + "' to be a function");
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
function _classPrivateMethodGet(receiver, privateSet, fn) {
|
|
if (!privateSet.has(receiver)) {
|
|
throw new TypeError("attempted to get private field on non-instance");
|
|
}
|
|
|
|
return fn;
|
|
}
|
|
|
|
function _classPrivateMethodSet() {
|
|
throw new TypeError("attempted to reassign private method");
|
|
}
|
|
|
|
function _wrapRegExp(re, groups) {
|
|
_wrapRegExp = function (re, groups) {
|
|
return new BabelRegExp(re, undefined, groups);
|
|
};
|
|
|
|
var _RegExp = _wrapNativeSuper(RegExp);
|
|
|
|
var _super = RegExp.prototype;
|
|
|
|
var _groups = new WeakMap();
|
|
|
|
function BabelRegExp(re, flags, groups) {
|
|
var _this = _RegExp.call(this, re, flags);
|
|
|
|
_groups.set(_this, groups || _groups.get(re));
|
|
|
|
return _this;
|
|
}
|
|
|
|
_inherits(BabelRegExp, _RegExp);
|
|
|
|
BabelRegExp.prototype.exec = function (str) {
|
|
var result = _super.exec.call(this, str);
|
|
|
|
if (result) result.groups = buildGroups(result, this);
|
|
return result;
|
|
};
|
|
|
|
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
if (typeof substitution === "string") {
|
|
var groups = _groups.get(this);
|
|
|
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
return "$" + groups[name];
|
|
}));
|
|
} else if (typeof substitution === "function") {
|
|
var _this = this;
|
|
|
|
return _super[Symbol.replace].call(this, str, function () {
|
|
var args = [];
|
|
args.push.apply(args, arguments);
|
|
|
|
if (typeof args[args.length - 1] !== "object") {
|
|
args.push(buildGroups(args, _this));
|
|
}
|
|
|
|
return substitution.apply(this, args);
|
|
});
|
|
} else {
|
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
}
|
|
};
|
|
|
|
function buildGroups(result, re) {
|
|
var g = _groups.get(re);
|
|
|
|
return Object.keys(g).reduce(function (groups, name) {
|
|
groups[name] = result[g[name]];
|
|
return groups;
|
|
}, Object.create(null));
|
|
}
|
|
|
|
return _wrapRegExp.apply(this, arguments);
|
|
}
|
|
|
|
/**
|
|
* @file ext-shapes.js
|
|
*
|
|
* @license MIT
|
|
*
|
|
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
|
|
*
|
|
*/
|
|
var extShapes = {
|
|
name: 'shapes',
|
|
init: function init(_ref) {
|
|
var _this = this;
|
|
|
|
return _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
var $, importLocale, strings, svgEditor, canv, svgroot, lastBBox, categories, library, modeId, startClientPos, currentD, curShapeId, curShape, startX, startY, curLib, loadIcons, makeButtons, loadLibrary, buttons;
|
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
loadLibrary = function _loadLibrary(catId) {
|
|
var lib = library[catId];
|
|
|
|
if (!lib) {
|
|
$('#shape_buttons').html(strings.loading);
|
|
$.getJSON('./shapelib/' + catId + '.json', function (result) {
|
|
curLib = library[catId] = {
|
|
data: result.data,
|
|
size: result.size,
|
|
fill: result.fill
|
|
};
|
|
makeButtons(catId, result);
|
|
loadIcons();
|
|
});
|
|
return;
|
|
}
|
|
|
|
curLib = lib;
|
|
|
|
if (!lib.buttons.length) {
|
|
makeButtons(catId, lib);
|
|
}
|
|
|
|
loadIcons();
|
|
};
|
|
|
|
makeButtons = function _makeButtons(cat, shapes) {
|
|
var size = curLib.size || 300;
|
|
var fill = curLib.fill || false;
|
|
var off = size * 0.05;
|
|
var vb = [-off, -off, size + off * 2, size + off * 2].join(' ');
|
|
var stroke = fill ? 0 : size / 30;
|
|
var shapeIcon = new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg">' + '<svg viewBox="' + vb + '">' + '<path fill="' + (fill ? '#333' : 'none') + '" stroke="#000" stroke-width="' + stroke + '" /></svg></svg>', 'text/xml');
|
|
var width = 24;
|
|
var height = 24;
|
|
shapeIcon.documentElement.setAttribute('width', width);
|
|
shapeIcon.documentElement.setAttribute('height', height);
|
|
var svgElem = $(document.importNode(shapeIcon.documentElement, true));
|
|
var data = shapes.data;
|
|
curLib.buttons = Object.entries(data).map(function (_ref2) {
|
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
id = _ref3[0],
|
|
pathD = _ref3[1];
|
|
|
|
var icon = svgElem.clone();
|
|
icon.find('path').attr('d', pathD);
|
|
var iconBtn = icon.wrap('<div class="tool_button">').parent().attr({
|
|
id: modeId + '_' + id,
|
|
title: id
|
|
}); // Store for later use
|
|
|
|
return iconBtn[0];
|
|
});
|
|
};
|
|
|
|
loadIcons = function _loadIcons() {
|
|
$('#shape_buttons').empty().append(curLib.buttons);
|
|
};
|
|
|
|
$ = _ref.$, importLocale = _ref.importLocale;
|
|
_context.next = 6;
|
|
return importLocale();
|
|
|
|
case 6:
|
|
strings = _context.sent;
|
|
svgEditor = _this;
|
|
canv = svgEditor.canvas;
|
|
svgroot = canv.getRootElem();
|
|
lastBBox = {}; // This populates the category list
|
|
|
|
categories = strings.categories;
|
|
/* eslint-disable max-len */
|
|
|
|
library = {
|
|
basic: {
|
|
data: {
|
|
heart: 'm150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z',
|
|
frame: 'm0,0l300,0l0,300l-300,0zm35,-265l0,230l230,0l0,-230z',
|
|
donut: 'm1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z',
|
|
triangle: 'm1,280.375l149,-260.75l149,260.75z',
|
|
right_triangle: 'm1,299l0,-298l298,298z',
|
|
diamond: 'm1,150l149,-149l149,149l-149,149l-149,-149z',
|
|
pentagon: 'm1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z',
|
|
hexagon: 'm1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z',
|
|
septagon1: 'm0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z',
|
|
heptagon: 'm1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z',
|
|
decagon: 'm1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z',
|
|
dodecagon: 'm1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z',
|
|
star_points_5: 'm1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z',
|
|
trapezoid: 'm1,299l55.875,-298l186.25001,0l55.87498,298z',
|
|
arrow_up: 'm1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z',
|
|
vertical_scrool: 'm37.375,261.625l0,-242.9375l0,0c0,-10.32083 8.36669,-18.6875 18.6875,-18.6875l224.25,0c10.32083,0 18.6875,8.36667 18.6875,18.6875c0,10.32081 -8.36667,18.6875 -18.6875,18.6875l-18.6875,0l0,242.9375c0,10.32083 -8.36668,18.6875 -18.6875,18.6875l-224.25,0l0,0c-10.32083,0 -18.6875,-8.36667 -18.6875,-18.6875c0,-10.32083 8.36667,-18.6875 18.6875,-18.6875zm37.375,-261.625l0,0c10.32081,0 18.6875,8.36667 18.6875,18.6875c0,10.32081 -8.36669,18.6875 -18.6875,18.6875c-5.1604,0 -9.34375,-4.18335 -9.34375,-9.34375c0,-5.16041 4.18335,-9.34375 9.34375,-9.34375l18.6875,0m186.875,18.6875l-205.5625,0m-37.375,224.25l0,0c5.1604,0 9.34375,4.18335 9.34375,9.34375c0,5.1604 -4.18335,9.34375 -9.34375,9.34375l18.6875,0m-18.6875,18.6875l0,0c10.32081,0 18.6875,-8.36667 18.6875,-18.6875l0,-18.6875',
|
|
smiley: 'm68.49886,214.78838q81.06408,55.67332 161.93891,0m-144.36983,-109.9558c0,-8.60432 6.97517,-15.57949 15.57948,-15.57949c8.60431,0 15.57948,6.97517 15.57948,15.57949c0,8.60431 -6.97517,15.57947 -15.57948,15.57947c-8.60431,0 -15.57948,-6.97516 -15.57948,-15.57947m95.83109,0c0,-8.60432 6.97517,-15.57949 15.57948,-15.57949c8.60431,0 15.57947,6.97517 15.57947,15.57949c0,8.60431 -6.97516,15.57947 -15.57947,15.57947c-8.60429,0 -15.57948,-6.97516 -15.57948,-15.57947m-181.89903,44.73038l0,0c0,-82.60133 66.96162,-149.56296 149.56296,-149.56296c82.60135,0 149.56296,66.96162 149.56296,149.56296c0,82.60135 -66.96161,149.56296 -149.56296,149.56296c-82.60133,0 -149.56296,-66.96161 -149.56296,-149.56296zm0,0l0,0c0,-82.60133 66.96162,-149.56296 149.56296,-149.56296c82.60135,0 149.56296,66.96162 149.56296,149.56296c0,82.60135 -66.96161,149.56296 -149.56296,149.56296c-82.60133,0 -149.56296,-66.96161 -149.56296,-149.56296z',
|
|
left_braket: 'm174.24565,298.5c-13.39009,0 -24.24489,-1.80908 -24.24489,-4.04065l0,-140.4187c0,-2.23158 -10.85481,-4.04065 -24.2449,-4.04065l0,0c13.39009,0 24.2449,-1.80907 24.2449,-4.04065l0,-140.4187l0,0c0,-2.23159 10.8548,-4.04066 24.24489,-4.04066',
|
|
uml_actor: 'm40.5,100l219,0m-108.99991,94.00006l107,105m-107.00009,-106.00006l-100,106m99.5,-231l0,125m33.24219,-158.75781c0,18.35916 -14.88303,33.24219 -33.24219,33.24219c-18.35916,0 -33.2422,-14.88303 -33.2422,-33.24219c0.00002,-18.35915 14.88304,-33.24219 33.2422,-33.24219c18.35916,0 33.24219,14.88304 33.24219,33.24219z',
|
|
dialog_balloon_1: 'm0.99786,35.96579l0,0c0,-19.31077 15.28761,-34.96524 34.14583,-34.96524l15.52084,0l0,0l74.50001,0l139.68748,0c9.05606,0 17.74118,3.68382 24.14478,10.24108c6.40356,6.55726 10.00107,15.45081 10.00107,24.72416l0,87.41311l0,0l0,52.44785l0,0c0,19.31078 -15.2876,34.96524 -34.14584,34.96524l-139.68748,0l-97.32507,88.90848l22.82506,-88.90848l-15.52084,0c-18.85822,0 -34.14583,-15.65446 -34.14583,-34.96524l0,0l0,-52.44785l0,0z',
|
|
cloud: 'm182.05086,34.31005c-0.64743,0.02048 -1.27309,0.07504 -1.92319,0.13979c-10.40161,1.03605 -19.58215,7.63722 -24.24597,17.4734l-2.47269,7.44367c0.53346,-2.57959 1.35258,-5.08134 2.47269,-7.44367c-8.31731,-8.61741 -19.99149,-12.59487 -31.52664,-10.72866c-11.53516,1.8662 -21.55294,9.3505 -27.02773,20.19925c-15.45544,-9.51897 -34.72095,-8.94245 -49.62526,1.50272c-14.90431,10.44516 -22.84828,28.93916 -20.43393,47.59753l1.57977,7.58346c-0.71388,-2.48442 -1.24701,-5.01186 -1.57977,-7.58346l-0.2404,0.69894c-12.95573,1.4119 -23.58103,11.46413 -26.34088,24.91708c-2.75985,13.45294 2.9789,27.25658 14.21789,34.21291l17.54914,4.26352c-6.1277,0.50439 -12.24542,-0.9808 -17.54914,-4.26352c-8.66903,9.71078 -10.6639,24.08736 -4.94535,35.96027c5.71854,11.87289 17.93128,18.70935 30.53069,17.15887l7.65843,-2.02692c-2.46413,1.0314 -5.02329,1.70264 -7.65843,2.02692c7.15259,13.16728 19.01251,22.77237 32.93468,26.5945c13.92217,3.82214 28.70987,1.56322 41.03957,-6.25546c10.05858,15.86252 27.91113,24.19412 45.81322,21.38742c17.90208,-2.8067 32.66954,-16.26563 37.91438,-34.52742l1.82016,-10.20447c-0.27254,3.46677 -0.86394,6.87508 -1.82016,10.20447c12.31329,8.07489 27.80199,8.52994 40.52443,1.18819c12.72244,-7.34175 20.6609,-21.34155 20.77736,-36.58929l-4.56108,-22.7823l-17.96776,-15.41455c13.89359,8.70317 22.6528,21.96329 22.52884,38.19685c16.5202,0.17313 30.55292,-13.98268 36.84976,-30.22897c6.29684,-16.24631 3.91486,-34.76801 -6.2504,-48.68089c4.21637,-10.35873 3.96622,-22.14172 -0.68683,-32.29084c-4.65308,-10.14912 -13.23602,-17.69244 -23.55914,-20.65356c-2.31018,-13.45141 -11.83276,-24.27162 -24.41768,-27.81765c-12.58492,-3.54603 -25.98557,0.82654 -34.41142,11.25287l-5.11707,8.63186c1.30753,-3.12148 3.01521,-6.03101 5.11707,-8.63186c-5.93959,-8.19432 -15.2556,-12.8181 -24.96718,-12.51096z',
|
|
cylinder: 'm299.0007,83.77844c0,18.28676 -66.70958,33.11111 -149.00002,33.11111m149.00002,-33.11111l0,0c0,18.28676 -66.70958,33.11111 -149.00002,33.11111c-82.29041,0 -148.99997,-14.82432 -148.99997,-33.11111m0,0l0,0c0,-18.28674 66.70956,-33.1111 148.99997,-33.1111c82.29044,0 149.00002,14.82436 149.00002,33.1111l0,132.44449c0,18.28674 -66.70958,33.11105 -149.00002,33.11105c-82.29041,0 -148.99997,-14.82431 -148.99997,-33.11105z',
|
|
arrow_u_turn: 'm1.00059,299.00055l0,-167.62497l0,0c0,-72.00411 58.37087,-130.37499 130.375,-130.37499l0,0l0,0c34.57759,0 67.73898,13.7359 92.18906,38.18595c24.45006,24.45005 38.18593,57.61144 38.18593,92.18904l0,18.625l37.24997,0l-74.49995,74.50002l-74.50002,-74.50002l37.25,0l0,-18.625c0,-30.8589 -25.0161,-55.87498 -55.87498,-55.87498l0,0l0,0c-30.85892,0 -55.875,25.01608 -55.875,55.87498l0,167.62497z',
|
|
arrow_left_up: 'm0.99865,224.5l74.50004,-74.5l0,37.25l111.74991,0l0,-111.75l-37.25,0l74.5,-74.5l74.5,74.5l-37.25,0l0,186.25l-186.24989,0l0,37.25l-74.50005,-74.5z',
|
|
maximize: 'm1.00037,150.34581l55.30305,-55.30267l0,27.65093l22.17356,0l0,-44.21833l44.21825,0l0,-22.17357l-27.65095,0l55.30267,-55.30292l55.3035,55.30292l-27.65175,0l0,22.17357l44.21835,0l0,44.21833l22.17357,0l0,-27.65093l55.30345,55.30267l-55.30345,55.3035l0,-27.65175l-22.17357,0l0,44.21834l-44.21835,0l0,22.17355l27.65175,0l-55.3035,55.30348l-55.30267,-55.30348l27.65095,0l0,-22.17355l-44.21825,0l0,-44.21834l-22.17356,0l0,27.65175l-55.30305,-55.3035z',
|
|
cross: 'm0.99844,99.71339l98.71494,0l0,-98.71495l101.26279,0l0,98.71495l98.71495,0l0,101.2628l-98.71495,0l0,98.71494l-101.26279,0l0,-98.71494l-98.71494,0z',
|
|
plaque: 'm-0.00197,49.94376l0,0c27.5829,0 49.94327,-22.36036 49.94327,-49.94327l199.76709,0l0,0c0,27.5829 22.36037,49.94327 49.94325,49.94327l0,199.7671l0,0c-27.58289,0 -49.94325,22.36034 -49.94325,49.94325l-199.76709,0c0,-27.58292 -22.36037,-49.94325 -49.94327,-49.94325z',
|
|
page: 'm249.3298,298.99744l9.9335,-39.73413l39.73413,-9.93355l-49.66763,49.66768l-248.33237,0l0,-298.00001l298.00001,0l0,248.33234'
|
|
},
|
|
buttons: []
|
|
}
|
|
};
|
|
/* eslint-enable max-len */
|
|
|
|
modeId = 'shapelib';
|
|
startClientPos = {};
|
|
curLib = library.basic;
|
|
/**
|
|
*
|
|
* @returns {void}
|
|
*/
|
|
|
|
buttons = [{
|
|
id: 'tool_shapelib',
|
|
icon: 'shapes.png',
|
|
type: 'mode_flyout',
|
|
// _flyout
|
|
position: 6,
|
|
events: {
|
|
click: function click() {
|
|
canv.setMode(modeId);
|
|
}
|
|
}
|
|
}];
|
|
return _context.abrupt("return", {
|
|
svgicons: 'ext-shapes.xml',
|
|
buttons: strings.buttons.map(function (button, i) {
|
|
return Object.assign(buttons[i], button);
|
|
}),
|
|
callback: function callback() {
|
|
$('<style>').text("\n #shape_buttons {\n overflow: auto;\n width: 180px;\n max-height: 300px;\n display: table-cell;\n vertical-align: middle;\n }\n #shape_cats {\n min-width: 110px;\n display: table-cell;\n vertical-align: middle;\n height: 300px;\n }\n #shape_cats > div {\n line-height: 1em;\n padding: .5em;\n border:1px solid #B0B0B0;\n background: #E8E8E8;\n margin-bottom: -1px;\n }\n #shape_cats div:hover {\n background: #FFFFCC;\n }\n #shape_cats div.current {\n font-weight: bold;\n }\n ").appendTo('head');
|
|
var btnDiv = $('<div id="shape_buttons">');
|
|
$('#tools_shapelib > *').wrapAll(btnDiv);
|
|
var shower = $('#tools_shapelib_show');
|
|
loadLibrary('basic'); // Do mouseup on parent element rather than each button
|
|
|
|
$('#shape_buttons').mouseup(function (evt) {
|
|
var btn = $(evt.target).closest('div.tool_button');
|
|
|
|
if (!btn.length) {
|
|
return;
|
|
}
|
|
|
|
var copy = btn.children().clone();
|
|
shower.children(':not(.flyout_arrow_horiz)').remove();
|
|
shower.append(copy).attr('data-curopt', '#' + btn[0].id) // This sets the current mode
|
|
.mouseup();
|
|
canv.setMode(modeId);
|
|
curShapeId = btn[0].id.substr((modeId + '_').length);
|
|
currentD = curLib.data[curShapeId];
|
|
$('.tools_flyout').fadeOut();
|
|
});
|
|
var shapeCats = $('<div id="shape_cats">');
|
|
var catStr = '';
|
|
$.each(categories, function (id, label) {
|
|
catStr += '<div data-cat=' + id + '>' + label + '</div>';
|
|
});
|
|
shapeCats.html(catStr).children().bind('mouseup', function () {
|
|
var catlink = $(this);
|
|
catlink.siblings().removeClass('current');
|
|
catlink.addClass('current');
|
|
loadLibrary(catlink.attr('data-cat')); // Get stuff
|
|
|
|
return false;
|
|
});
|
|
shapeCats.children().eq(0).addClass('current');
|
|
$('#tools_shapelib').append(shapeCats);
|
|
shower.mouseup(function () {
|
|
canv.setMode(currentD ? modeId : 'select');
|
|
});
|
|
$('#tool_shapelib').remove();
|
|
var h = $('#tools_shapelib').height();
|
|
$('#tools_shapelib').css({
|
|
'margin-top': -(h / 2 - 15),
|
|
'margin-left': 3
|
|
}); // Now add shape categories from locale
|
|
|
|
var cats = {};
|
|
Object.entries(categories).forEach(function (_ref4) {
|
|
var _ref5 = _slicedToArray(_ref4, 2),
|
|
o = _ref5[0],
|
|
categoryName = _ref5[1];
|
|
|
|
cats['#shape_cats [data-cat="' + o + '"]'] = categoryName;
|
|
});
|
|
this.setStrings('content', cats);
|
|
},
|
|
mouseDown: function mouseDown(opts) {
|
|
var mode = canv.getMode();
|
|
|
|
if (mode !== modeId) {
|
|
return undefined;
|
|
}
|
|
|
|
startX = opts.start_x;
|
|
var x = startX;
|
|
startY = opts.start_y;
|
|
var y = startY;
|
|
var curStyle = canv.getStyle();
|
|
startClientPos.x = opts.event.clientX;
|
|
startClientPos.y = opts.event.clientY;
|
|
curShape = canv.addSVGElementFromJson({
|
|
element: 'path',
|
|
curStyles: true,
|
|
attr: {
|
|
d: currentD,
|
|
id: canv.getNextId(),
|
|
opacity: curStyle.opacity / 2,
|
|
style: 'pointer-events:none'
|
|
}
|
|
}); // Make sure shape uses absolute values
|
|
|
|
if (/[a-z]/.test(currentD)) {
|
|
currentD = curLib.data[curShapeId] = canv.pathActions.convertPath(curShape);
|
|
curShape.setAttribute('d', currentD);
|
|
canv.pathActions.fixEnd(curShape);
|
|
}
|
|
|
|
curShape.setAttribute('transform', 'translate(' + x + ',' + y + ') scale(0.005) translate(' + -x + ',' + -y + ')');
|
|
canv.recalculateDimensions(curShape);
|
|
/* const tlist = */
|
|
|
|
canv.getTransformList(curShape);
|
|
lastBBox = curShape.getBBox();
|
|
return {
|
|
started: true
|
|
};
|
|
},
|
|
mouseMove: function mouseMove(opts) {
|
|
var mode = canv.getMode();
|
|
|
|
if (mode !== modeId) {
|
|
return;
|
|
}
|
|
|
|
var zoom = canv.getZoom();
|
|
var evt = opts.event;
|
|
var x = opts.mouse_x / zoom;
|
|
var y = opts.mouse_y / zoom;
|
|
var tlist = canv.getTransformList(curShape),
|
|
box = curShape.getBBox(),
|
|
left = box.x,
|
|
top = box.y; // {width, height} = box,
|
|
// const dx = (x - startX), dy = (y - startY);
|
|
|
|
var newbox = {
|
|
x: Math.min(startX, x),
|
|
y: Math.min(startY, y),
|
|
width: Math.abs(x - startX),
|
|
height: Math.abs(y - startY)
|
|
};
|
|
/*
|
|
// This is currently serving no purpose, so commenting out
|
|
let sy = height ? (height + dy) / height : 1,
|
|
sx = width ? (width + dx) / width : 1;
|
|
*/
|
|
|
|
var sx = newbox.width / lastBBox.width || 1;
|
|
var sy = newbox.height / lastBBox.height || 1; // Not perfect, but mostly works...
|
|
|
|
var tx = 0;
|
|
|
|
if (x < startX) {
|
|
tx = lastBBox.width;
|
|
}
|
|
|
|
var ty = 0;
|
|
|
|
if (y < startY) {
|
|
ty = lastBBox.height;
|
|
} // update the transform list with translate,scale,translate
|
|
|
|
|
|
var translateOrigin = svgroot.createSVGTransform(),
|
|
scale = svgroot.createSVGTransform(),
|
|
translateBack = svgroot.createSVGTransform();
|
|
translateOrigin.setTranslate(-(left + tx), -(top + ty));
|
|
|
|
if (!evt.shiftKey) {
|
|
var max = Math.min(Math.abs(sx), Math.abs(sy));
|
|
sx = max * (sx < 0 ? -1 : 1);
|
|
sy = max * (sy < 0 ? -1 : 1);
|
|
}
|
|
|
|
scale.setScale(sx, sy);
|
|
translateBack.setTranslate(left + tx, top + ty);
|
|
tlist.appendItem(translateBack);
|
|
tlist.appendItem(scale);
|
|
tlist.appendItem(translateOrigin);
|
|
canv.recalculateDimensions(curShape);
|
|
lastBBox = curShape.getBBox();
|
|
},
|
|
mouseUp: function mouseUp(opts) {
|
|
var mode = canv.getMode();
|
|
|
|
if (mode !== modeId) {
|
|
return undefined;
|
|
}
|
|
|
|
var keepObject = opts.event.clientX !== startClientPos.x && opts.event.clientY !== startClientPos.y;
|
|
return {
|
|
keep: keepObject,
|
|
element: curShape,
|
|
started: false
|
|
};
|
|
}
|
|
});
|
|
|
|
case 18:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}, _callee);
|
|
}))();
|
|
}
|
|
};
|
|
|
|
export default extShapes;
|
|
//# sourceMappingURL=ext-shapes.js.map
|