From c52a604c4e21b9ccf5925faef40eeb5758099e91 Mon Sep 17 00:00:00 2001 From: toxic-johann <353904974@qq.com> Date: Sat, 5 Aug 2017 22:29:23 +0800 Subject: [PATCH] [build] 0.3.7 what: why: how: --- lib/toxic-decorators.browser.js | 336 +++++++++++++++++--------------- lib/toxic-decorators.js | 121 ++++++------ lib/toxic-decorators.min.js | 2 +- lib/toxic-decorators.mjs | 121 ++++++------ package.json | 2 +- 5 files changed, 286 insertions(+), 296 deletions(-) diff --git a/lib/toxic-decorators.browser.js b/lib/toxic-decorators.browser.js index eb678e2..6b20ec3 100644 --- a/lib/toxic-decorators.browser.js +++ b/lib/toxic-decorators.browser.js @@ -1,6 +1,6 @@ /** - * toxic-decorators v0.3.6 + * toxic-decorators v0.3.7 * (c) 2017 toxic-johann * Released under GPL-3.0 */ @@ -1355,6 +1355,125 @@ function getDeepProperty(obj, keys) { return target; } +var _typeof$1 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; +} : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; +}; + + + + + + + + + + + + + + + + + + + +var defineProperty$1 = function (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; +}; + + + + + + + + + + + + + + + + + + + + + +var slicedToArray = function () { + function sliceIterator(arr, i) { + 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"]) _i["return"](); + } finally { + if (_d) throw _e; + } + } + + return _arr; + } + + return function (arr, i) { + if (Array.isArray(arr)) { + return arr; + } else if (Symbol.iterator in Object(arr)) { + return sliceIterator(arr, i); + } else { + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + } + }; +}(); + + + + + + + + + + + + + +var toConsumableArray$1 = function (arr) { + if (Array.isArray(arr)) { + for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; + + return arr2; + } else { + return Array.from(arr); + } +}; + var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // ********************** 对象操作 ************************ /** @@ -1410,7 +1529,7 @@ function isInitializerDescriptor(desc) { * @param {string} key */ function createDefaultSetter(key) { - return function set(newValue) { + return function set$$1(newValue) { Object.defineProperty(this, key, { configurable: true, writable: true, @@ -1451,13 +1570,10 @@ function compressOneArgFnArray(fns) { * @param {anything} args */ function warn() { - var _console2, _console3; + var _console, _console2; - var _console = console, - warn = _console.warn; - - if (isFunction(warn)) return (_console2 = console).warn.apply(_console2, arguments); - (_console3 = console).log.apply(_console3, arguments); + if (isFunction(console.warn)) return (_console = console).warn.apply(_console, arguments); + (_console2 = console).log.apply(_console2, arguments); } function getOwnKeysFn() { @@ -1489,9 +1605,9 @@ function compressMultipleDecorators() { fns[_key] = arguments[_key]; } - var fnOnlyErrorMsg = 'compressMultipleDecorators only accept function'; + if (!fns.length) throw new TypeError('You must pass in decorators in compressMultipleDecorators'); fns.forEach(function (fn) { - if (!isFunction(fns[0])) throw new TypeError(fnOnlyErrorMsg); + if (!isFunction(fn)) throw new TypeError('Decorators must be a function, but not "' + fn + '" in ' + (typeof fn === 'undefined' ? 'undefined' : _typeof$1(fn))); }); if (fns.length === 1) return fns[0]; return function (obj, prop, descirptor) { @@ -1523,10 +1639,6 @@ function accessor() { configurable = _ref3$configurable === undefined ? true : _ref3$configurable, _ref3$enumerable = _ref3.enumerable, enumerable = _ref3$enumerable === undefined ? true : _ref3$enumerable; - // const configurable = descriptor ? descriptor.configurable : true; - // const enumerable = descriptor ? descriptor.enumerable : true; - // const writable = descriptor ? descriptor.w : true; - var hasGet = isFunction(get); var hasSet = isFunction(set); @@ -1544,10 +1656,10 @@ function accessor() { var hasOriginGet = isFunction(originGet); var hasOriginSet = isFunction(originSet); - if (!hasOriginGet && hasGet) { + if (process.env.NODE_ENV !== 'production' && !hasOriginGet && hasGet) { warn('You are trying to set getter via @accessor on ' + prop + ' without getter. That\'s not a good idea.'); } - if (!hasOriginSet && hasSet) { + if (process.env.NODE_ENV !== 'production' && !hasOriginSet && hasSet) { warn('You are trying to set setter via @accessor on ' + prop + ' without setter. That\'s not a good idea.'); } var getter = hasOriginGet || hasGet ? function () { @@ -1637,101 +1749,6 @@ function accessor() { }; } -var defineProperty$1 = function (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; -}; - - - - - - - - - - - - - - - - - - - - - -var slicedToArray = function () { - function sliceIterator(arr, i) { - 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"]) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError("Invalid attempt to destructure non-iterable instance"); - } - }; -}(); - - - - - - - - - - - - - -var toConsumableArray$1 = function (arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } else { - return Array.from(arr); - } -}; - function before() { for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) { fns[_key] = arguments[_key]; @@ -1739,21 +1756,19 @@ function before() { if (fns.length === 0) throw new Error("@before accept at least one parameter. If you don't need to preprocess before your function, do not add @before decorators"); if (fns.length > 2 && isDescriptor(fns[2])) { - throw new Error('You may use @before straightly, @before return decorators, you need to call it'); + throw new Error('You may use @before straightly, @before return decorators, you should call it before you set it as decorator.'); } for (var i = fns.length - 1; i > -1; i--) { if (!isFunction(fns[i])) throw new TypeError('@before only accept function parameter'); } return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@before must used on descriptor, are you using it on undefined property?'); - } - var fn = descriptor.value, - configurable = descriptor.configurable, - enumerable = descriptor.enumerable, - writable = descriptor.writable; + var _ref = descriptor || {}, + fn = _ref.value, + configurable = _ref.configurable, + enumerable = _ref.enumerable, + writable = _ref.writable; - if (!isFunction(fn)) throw new TypeError('@before can only be used on function'); + if (!isFunction(fn)) throw new TypeError('@before can only be used on function, please check the property "' + prop + '" is a method or not.'); var handler = function handler() { var _this = this; @@ -1785,19 +1800,17 @@ function after() { if (fns.length === 0) throw new Error("@after accept at least one parameter. If you don't need to preprocess after your function, do not add @after decorators"); if (fns.length > 2 && isDescriptor(fns[2])) { - throw new Error('You may use @after straightly, @after return decorators, you need to call it'); + throw new Error('You may have used @after straightly. @after return decorators. You should call it before you use it as decorators'); } var fn = compressOneArgFnArray(fns, '@after only accept function parameter'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@after must used on descriptor, are you using it on undefined property?'); - } - var value = descriptor.value, - configurable = descriptor.configurable, - enumerable = descriptor.enumerable, - writable = descriptor.writable; + var _ref = descriptor || {}, + value = _ref.value, + configurable = _ref.configurable, + enumerable = _ref.enumerable, + writable = _ref.writable; - if (!isFunction(value)) throw new TypeError('@after can only be used on function'); + if (!isFunction(value)) throw new TypeError('@after can only be used on function, please checkout your property "' + prop + '" is a method or not.'); var handler = function handler() { var ret = bind(value, this).apply(undefined, arguments); return bind(fn, this)(ret); @@ -1813,7 +1826,8 @@ function after() { function readonly(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @readonly on an undefined property. This property will become a readonly undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @readonly on an undefined property "' + prop + '". This property will become a readonly undefined forever, which is meaningless.'); return { value: undefined, writable: false, @@ -1910,9 +1924,10 @@ function setAlias(root, prop, _ref, obj, key, _ref2) { var originDesc = getOwnPropertyDescriptor$1(obj, key); if (originDesc !== undefined) { if (omit) return; - if (!force) throw new Error("@alias can't set alias on an existing attribute"); + // TODO: we should add an github link here + if (!force) throw new Error('"' + prop + '" is an existing property, if you want to override it, please set "force" true in @alias option.'); if (!originDesc.configurable) { - throw new Error("You are tring to set alias on an existing attribute which its configurable is false. That's impossible. Please check if you have set @frozen on it."); + throw new Error('property "' + prop + '" is unconfigurable.'); } } defineProperty$2(obj, key, { @@ -2090,14 +2105,13 @@ function getBoundSuper(obj, fn) { */ function autobind(obj, prop, descriptor) { if (arguments.length === 1) return autobindClass()(obj); - if (!isDescriptor(descriptor)) { - throw new Error('@autobind must used on descriptor, are you using it on undefined property?'); - } - var fn = descriptor.value, - configurable = descriptor.configurable; + + var _ref = descriptor || {}, + fn = _ref.value, + configurable = _ref.configurable; if (!isFunction(fn)) { - throw new TypeError('@autobind can only be used on functions, not: ' + fn + ')'); + throw new TypeError('@autobind can only be used on functions, not "' + fn + '" in ' + (typeof fn === 'undefined' ? 'undefined' : _typeof$1(fn)) + ' on property "' + prop + '"'); } var constructor = obj.constructor; @@ -2156,7 +2170,8 @@ var defineProperty$4 = Object.defineProperty; function frozen(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @frozen on an undefined property. This property will become a frozen undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @frozen on an undefined property. This property will become a frozen undefined forever, which is meaningless'); return { value: undefined, writable: false, @@ -2171,7 +2186,8 @@ function frozen(obj, prop, descriptor) { descriptor.set = undefined; if (!isFunction(_get)) { - warn('You are using @frozen on one accessor descriptor without getter. This property will become a frozen undefined finally.Which maybe meaningless.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @frozen on one accessor descriptor without getter. This property will become a frozen undefined finally.Which maybe meaningless.'); return; } return { @@ -2205,13 +2221,11 @@ function waituntil(key) { if (!isFunction(key) && !isPromise(key) && !isString(key)) throw new TypeError('@waitUntil only accept Function, Promise or String'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@waituntil must used on descriptor, are you using it on undefined property?'); - } - var _value = descriptor.value, - configurable = descriptor.configurable; + var _ref2 = descriptor || {}, + _value = _ref2.value, + configurable = _ref2.configurable; - if (!isFunction(_value)) throw new TypeError('@waituntil can only be used on function, but not ' + _value); + if (!isFunction(_value)) throw new TypeError('@waituntil can only be used on function, but not ' + _value + ' on property "' + prop + '"'); var binded = false; var waitingQueue = []; var canIRun = isPromise(key) ? function () { @@ -2291,7 +2305,8 @@ var defineProperty$6 = Object.defineProperty; function lazyInit(obj, prop, descriptor) { if (descriptor === undefined) throw new TypeError('@lazyInit cannot be apply on undefined property.'); if (!isFunction(descriptor.initializer)) { - warn('@lazyInit can only be used on property, but not methods and getter/setter.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('@lazyInit can only be used on property, but not propery "' + prop + '" which may be methods or getter/setter.'); // $FlowFixMe: disjoint union **** return descriptor; } @@ -2329,7 +2344,8 @@ var defineProperty$7 = Object.defineProperty; function lock(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @lock on an undefined property. This property will become a lock undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @lock on an undefined property "' + prop + '". This property will become a lock undefined forever, which is meaningless.'); return { value: undefined, writable: false, @@ -2420,7 +2436,8 @@ function applyDecorators(Class, props) { try { handler = compressMultipleDecorators.apply(undefined, toConsumableArray$1(decorators)); } catch (err) { - warn(err && err.message); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn(err && err.message); throw new Error('The decorators set on props must be Function or Array of Function'); } var descriptor = getOwnPropertyDescriptor$3(prototype, key); @@ -2578,10 +2595,6 @@ function deepObserve(value, hook, _ref2) { }; }), nonenumerable]), defineProperty$1(_operateProps2, operationPrefix + 'del', [initialize(function (method) { return function (property) { - if (getOwnKeys(value).indexOf(property) === -1) { - var _props3 = getPropertyDecorators([property]); - applyDecorators(value, _props3, { self: true, omit: true }); - } if (isFunction(method)) { bind(method, _this)(property); } else { @@ -2612,9 +2625,10 @@ function watch() { var proxy = option.proxy; - if (!Proxy) { + if (typeof Proxy !== 'function') { proxy = false; - warn('You browser do not support Proxy, we will change back into observe mode.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You browser do not support Proxy, we will fall back into observe mode.'); } if (!args.length) throw new TypeError('You must pass a function or a string to find the hanlder function.'); if (other !== undefined && isPrimitive(other)) throw new TypeError('If you want us to trigger function on the other instance, you must pass in a legal instance'); @@ -2696,7 +2710,7 @@ function watch() { var preventExtensions = Object.preventExtensions; function nonextendable(obj, prop, descriptor) { - if (descriptor === undefined) throw new Error('@nonextendable could not handle undefined'); + if (descriptor === undefined) throw new Error('@nonextendable could not handle undefined property "' + prop + '".'); return initialize(function (value) { preventExtensions(value); return value; @@ -2710,13 +2724,11 @@ function runnable(key) { if (!isFunction(key) && !isString(key)) throw new TypeError('@runnable only accept Function or String'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@runnable must used on descriptor, are you using it on undefined property?'); - } - var _value = descriptor.value, - configurable = descriptor.configurable; + var _ref2 = descriptor || {}, + _value = _ref2.value, + configurable = _ref2.configurable; - if (!isFunction(_value)) throw new TypeError('@runnable can only be used on method, but not ' + _value + ' on ' + prop); + if (!isFunction(_value)) throw new TypeError('@runnable can only be used on method, but not ' + _value + ' on property "' + prop + '".'); var canIRun = isFunction(key) ? key : function () { var keys = key.split('.'); var originTarget = isPrimitive(other) ? this : other; diff --git a/lib/toxic-decorators.js b/lib/toxic-decorators.js index c815962..c0ce8a3 100644 --- a/lib/toxic-decorators.js +++ b/lib/toxic-decorators.js @@ -1,6 +1,6 @@ /** - * toxic-decorators v0.3.6 + * toxic-decorators v0.3.7 * (c) 2017 toxic-johann * Released under GPL-3.0 */ @@ -11,6 +11,7 @@ Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } +var _typeof = _interopDefault(require('babel-runtime/helpers/typeof')); var _Object$getOwnPropertyDescriptors = _interopDefault(require('babel-runtime/core-js/object/get-own-property-descriptors')); var _Array$from = _interopDefault(require('babel-runtime/core-js/array/from')); var _Object$getOwnPropertySymbols = _interopDefault(require('babel-runtime/core-js/object/get-own-property-symbols')); @@ -124,13 +125,10 @@ function compressOneArgFnArray(fns) { * @param {anything} args */ function warn() { - var _console2, _console3; + var _console, _console2; - var _console = console, - warn = _console.warn; - - if (toxicPredicateFunctions.isFunction(warn)) return (_console2 = console).warn.apply(_console2, arguments); - (_console3 = console).log.apply(_console3, arguments); + if (toxicPredicateFunctions.isFunction(console.warn)) return (_console = console).warn.apply(_console, arguments); + (_console2 = console).log.apply(_console2, arguments); } function getOwnKeysFn() { @@ -162,9 +160,9 @@ function compressMultipleDecorators() { fns[_key] = arguments[_key]; } - var fnOnlyErrorMsg = 'compressMultipleDecorators only accept function'; + if (!fns.length) throw new TypeError('You must pass in decorators in compressMultipleDecorators'); fns.forEach(function (fn) { - if (!toxicPredicateFunctions.isFunction(fns[0])) throw new TypeError(fnOnlyErrorMsg); + if (!toxicPredicateFunctions.isFunction(fn)) throw new TypeError('Decorators must be a function, but not "' + fn + '" in ' + (typeof fn === 'undefined' ? 'undefined' : _typeof(fn))); }); if (fns.length === 1) return fns[0]; return function (obj, prop, descirptor) { @@ -196,10 +194,6 @@ function accessor() { configurable = _ref3$configurable === undefined ? true : _ref3$configurable, _ref3$enumerable = _ref3.enumerable, enumerable = _ref3$enumerable === undefined ? true : _ref3$enumerable; - // const configurable = descriptor ? descriptor.configurable : true; - // const enumerable = descriptor ? descriptor.enumerable : true; - // const writable = descriptor ? descriptor.w : true; - var hasGet = toxicPredicateFunctions.isFunction(get); var hasSet = toxicPredicateFunctions.isFunction(set); @@ -217,10 +211,10 @@ function accessor() { var hasOriginGet = toxicPredicateFunctions.isFunction(originGet); var hasOriginSet = toxicPredicateFunctions.isFunction(originSet); - if (!hasOriginGet && hasGet) { + if (process.env.NODE_ENV !== 'production' && !hasOriginGet && hasGet) { warn('You are trying to set getter via @accessor on ' + prop + ' without getter. That\'s not a good idea.'); } - if (!hasOriginSet && hasSet) { + if (process.env.NODE_ENV !== 'production' && !hasOriginSet && hasSet) { warn('You are trying to set setter via @accessor on ' + prop + ' without setter. That\'s not a good idea.'); } var getter = hasOriginGet || hasGet ? function () { @@ -317,21 +311,19 @@ function before() { if (fns.length === 0) throw new Error("@before accept at least one parameter. If you don't need to preprocess before your function, do not add @before decorators"); if (fns.length > 2 && isDescriptor(fns[2])) { - throw new Error('You may use @before straightly, @before return decorators, you need to call it'); + throw new Error('You may use @before straightly, @before return decorators, you should call it before you set it as decorator.'); } for (var i = fns.length - 1; i > -1; i--) { if (!toxicPredicateFunctions.isFunction(fns[i])) throw new TypeError('@before only accept function parameter'); } return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@before must used on descriptor, are you using it on undefined property?'); - } - var fn = descriptor.value, - configurable = descriptor.configurable, - enumerable = descriptor.enumerable, - writable = descriptor.writable; + var _ref = descriptor || {}, + fn = _ref.value, + configurable = _ref.configurable, + enumerable = _ref.enumerable, + writable = _ref.writable; - if (!toxicPredicateFunctions.isFunction(fn)) throw new TypeError('@before can only be used on function'); + if (!toxicPredicateFunctions.isFunction(fn)) throw new TypeError('@before can only be used on function, please check the property "' + prop + '" is a method or not.'); var handler = function handler() { var _this = this; @@ -363,19 +355,17 @@ function after() { if (fns.length === 0) throw new Error("@after accept at least one parameter. If you don't need to preprocess after your function, do not add @after decorators"); if (fns.length > 2 && isDescriptor(fns[2])) { - throw new Error('You may use @after straightly, @after return decorators, you need to call it'); + throw new Error('You may have used @after straightly. @after return decorators. You should call it before you use it as decorators'); } var fn = compressOneArgFnArray(fns, '@after only accept function parameter'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@after must used on descriptor, are you using it on undefined property?'); - } - var value = descriptor.value, - configurable = descriptor.configurable, - enumerable = descriptor.enumerable, - writable = descriptor.writable; + var _ref = descriptor || {}, + value = _ref.value, + configurable = _ref.configurable, + enumerable = _ref.enumerable, + writable = _ref.writable; - if (!toxicPredicateFunctions.isFunction(value)) throw new TypeError('@after can only be used on function'); + if (!toxicPredicateFunctions.isFunction(value)) throw new TypeError('@after can only be used on function, please checkout your property "' + prop + '" is a method or not.'); var handler = function handler() { var ret = toxicUtils.bind(value, this).apply(undefined, arguments); return toxicUtils.bind(fn, this)(ret); @@ -391,7 +381,8 @@ function after() { function readonly(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @readonly on an undefined property. This property will become a readonly undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @readonly on an undefined property "' + prop + '". This property will become a readonly undefined forever, which is meaningless.'); return { value: undefined, writable: false, @@ -488,9 +479,10 @@ function setAlias(root, prop, _ref, obj, key, _ref2) { var originDesc = getOwnPropertyDescriptor$1(obj, key); if (originDesc !== undefined) { if (omit) return; - if (!force) throw new Error("@alias can't set alias on an existing attribute"); + // TODO: we should add an github link here + if (!force) throw new Error('"' + prop + '" is an existing property, if you want to override it, please set "force" true in @alias option.'); if (!originDesc.configurable) { - throw new Error("You are tring to set alias on an existing attribute which its configurable is false. That's impossible. Please check if you have set @frozen on it."); + throw new Error('property "' + prop + '" is unconfigurable.'); } } defineProperty(obj, key, { @@ -668,14 +660,13 @@ function getBoundSuper(obj, fn) { */ function autobind(obj, prop, descriptor) { if (arguments.length === 1) return autobindClass()(obj); - if (!isDescriptor(descriptor)) { - throw new Error('@autobind must used on descriptor, are you using it on undefined property?'); - } - var fn = descriptor.value, - configurable = descriptor.configurable; + + var _ref = descriptor || {}, + fn = _ref.value, + configurable = _ref.configurable; if (!toxicPredicateFunctions.isFunction(fn)) { - throw new TypeError('@autobind can only be used on functions, not: ' + fn + ')'); + throw new TypeError('@autobind can only be used on functions, not "' + fn + '" in ' + (typeof fn === 'undefined' ? 'undefined' : _typeof(fn)) + ' on property "' + prop + '"'); } var constructor = obj.constructor; @@ -734,7 +725,8 @@ var defineProperty$2 = _Object$defineProperty; function frozen(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @frozen on an undefined property. This property will become a frozen undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @frozen on an undefined property. This property will become a frozen undefined forever, which is meaningless'); return { value: undefined, writable: false, @@ -749,7 +741,8 @@ function frozen(obj, prop, descriptor) { descriptor.set = undefined; if (!toxicPredicateFunctions.isFunction(_get)) { - warn('You are using @frozen on one accessor descriptor without getter. This property will become a frozen undefined finally.Which maybe meaningless.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @frozen on one accessor descriptor without getter. This property will become a frozen undefined finally.Which maybe meaningless.'); return; } return { @@ -783,13 +776,11 @@ function waituntil(key) { if (!toxicPredicateFunctions.isFunction(key) && !toxicPredicateFunctions.isPromise(key) && !toxicPredicateFunctions.isString(key)) throw new TypeError('@waitUntil only accept Function, Promise or String'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@waituntil must used on descriptor, are you using it on undefined property?'); - } - var _value = descriptor.value, - configurable = descriptor.configurable; + var _ref2 = descriptor || {}, + _value = _ref2.value, + configurable = _ref2.configurable; - if (!toxicPredicateFunctions.isFunction(_value)) throw new TypeError('@waituntil can only be used on function, but not ' + _value); + if (!toxicPredicateFunctions.isFunction(_value)) throw new TypeError('@waituntil can only be used on function, but not ' + _value + ' on property "' + prop + '"'); var binded = false; var waitingQueue = []; var canIRun = toxicPredicateFunctions.isPromise(key) ? function () { @@ -869,7 +860,8 @@ var defineProperty$4 = _Object$defineProperty; function lazyInit(obj, prop, descriptor) { if (descriptor === undefined) throw new TypeError('@lazyInit cannot be apply on undefined property.'); if (!toxicPredicateFunctions.isFunction(descriptor.initializer)) { - warn('@lazyInit can only be used on property, but not methods and getter/setter.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('@lazyInit can only be used on property, but not propery "' + prop + '" which may be methods or getter/setter.'); // $FlowFixMe: disjoint union **** return descriptor; } @@ -907,7 +899,8 @@ var defineProperty$5 = _Object$defineProperty; function lock(obj, prop, descriptor) { if (descriptor === undefined) { - warn('You are using @lock on an undefined property. This property will become a lock undefined forever, which is meaningless'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You are using @lock on an undefined property "' + prop + '". This property will become a lock undefined forever, which is meaningless.'); return { value: undefined, writable: false, @@ -998,7 +991,8 @@ function applyDecorators(Class, props) { try { handler = compressMultipleDecorators.apply(undefined, _toConsumableArray(decorators)); } catch (err) { - warn(err && err.message); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn(err && err.message); throw new Error('The decorators set on props must be Function or Array of Function'); } var descriptor = getOwnPropertyDescriptor$3(prototype, key); @@ -1156,10 +1150,6 @@ function deepObserve(value, hook, _ref2) { }; }), nonenumerable]), _defineProperty(_operateProps2, operationPrefix + 'del', [initialize(function (method) { return function (property) { - if (getOwnKeys(value).indexOf(property) === -1) { - var _props3 = getPropertyDecorators([property]); - applyDecorators(value, _props3, { self: true, omit: true }); - } if (toxicPredicateFunctions.isFunction(method)) { toxicUtils.bind(method, _this)(property); } else { @@ -1190,9 +1180,10 @@ function watch() { var proxy = option.proxy; - if (!Proxy) { + if (typeof Proxy !== 'function') { proxy = false; - warn('You browser do not support Proxy, we will change back into observe mode.'); + /* istanbul ignore else */ + if (process.env.NODE_ENV !== 'production') warn('You browser do not support Proxy, we will fall back into observe mode.'); } if (!args.length) throw new TypeError('You must pass a function or a string to find the hanlder function.'); if (other !== undefined && toxicPredicateFunctions.isPrimitive(other)) throw new TypeError('If you want us to trigger function on the other instance, you must pass in a legal instance'); @@ -1274,7 +1265,7 @@ function watch() { var preventExtensions = _Object$preventExtensions; function nonextendable(obj, prop, descriptor) { - if (descriptor === undefined) throw new Error('@nonextendable could not handle undefined'); + if (descriptor === undefined) throw new Error('@nonextendable could not handle undefined property "' + prop + '".'); return initialize(function (value) { preventExtensions(value); return value; @@ -1288,13 +1279,11 @@ function runnable(key) { if (!toxicPredicateFunctions.isFunction(key) && !toxicPredicateFunctions.isString(key)) throw new TypeError('@runnable only accept Function or String'); return function (obj, prop, descriptor) { - if (descriptor === undefined) { - throw new Error('@runnable must used on descriptor, are you using it on undefined property?'); - } - var _value = descriptor.value, - configurable = descriptor.configurable; + var _ref2 = descriptor || {}, + _value = _ref2.value, + configurable = _ref2.configurable; - if (!toxicPredicateFunctions.isFunction(_value)) throw new TypeError('@runnable can only be used on method, but not ' + _value + ' on ' + prop); + if (!toxicPredicateFunctions.isFunction(_value)) throw new TypeError('@runnable can only be used on method, but not ' + _value + ' on property "' + prop + '".'); var canIRun = toxicPredicateFunctions.isFunction(key) ? key : function () { var keys = key.split('.'); var originTarget = toxicPredicateFunctions.isPrimitive(other) ? this : other; diff --git a/lib/toxic-decorators.min.js b/lib/toxic-decorators.min.js index dca48c3..17c96be 100644 --- a/lib/toxic-decorators.min.js +++ b/lib/toxic-decorators.min.js @@ -1 +1 @@ -!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(r.toxicDecorators={})}(this,function(r){"use strict";function e(r){return r&&r.__esModule?r.default:r}function t(r,e){return e={exports:{}},r(e,e.exports),e.exports}function n(r){return void 0===r||null===r}function o(r){return Array.isArray(r)}function i(r){return"function"==typeof r}function u(r){return Object(r)===r&&"[object Object]"===String(r)&&!i(r)&&!o(r)}function a(r){return"number"==typeof r}function f(r){return"string"==typeof r||r instanceof String}function c(r){return"boolean"==typeof r}function l(r){return!!r&&("object"===(void 0===r?"undefined":et(r))||"function"==typeof r)&&"function"==typeof r.then}function s(r){return n(r)||c(r)||f(r)||a(r)}function p(r,e){return r.bind?r.bind(e):r.apply?function(){for(var t=arguments.length,n=Array(t),o=0;o2&&void 0!==arguments[2]?arguments[2]:{},i=t.throwError,u=void 0!==i&&i,a=t.backup;if(f(e)&&(e=e.split(".")),!o(e))throw new TypeError("keys of getDeepProperty must be string or Array");for(var c=[],l=r,s=0,p=e.length;s0?"."+c.join("."):" itself")+" is "+l);return a}l=l[y],c.push(y)}return l}function d(r){if(!r||!r.hasOwnProperty)return!1;for(var e=["value","initializer","get","set"],t=0,n=e.length;t1&&void 0!==arguments[1]?arguments[1]:"You must pass me an array of function";if(!o(r)||r.length<1)throw new TypeError(e);if(1===r.length){if(!i(r[0]))throw new TypeError(e);return r[0]}return r.reduce(function(r,t){if(!i(t)||!i(r))throw new TypeError(e);return function(e){return p(t,this)(p(r,this)(e))}})}function m(){var r,e;if(i(console.warn))return(r=console).warn.apply(r,arguments);(e=console).log.apply(e,arguments)}function O(){for(var r=arguments.length,e=Array(r),t=0;t0&&void 0!==arguments[0]?arguments[0]:{},e=r.get,t=r.set,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=n.preGet,a=void 0!==u&&u,f=n.preSet,c=void 0===f||f;if(!(i(e)||i(t)||o(e)&&e.length>0||o(t)&&t.length>0))throw new TypeError("@accessor need a getter or setter. If you don't need to add setter/getter. You should remove @accessor");var l="@accessor only accept function or array of function as getter/setter";return e=o(e)?w(e,l):e,t=o(t)?w(t,l):t,function(r,n,o){var u=o||{},f=u.configurable,l=void 0===f||f,s=u.enumerable,y=void 0===s||s,d=i(e),h=i(t),g=function(r){return d?p(e,this)(r):r},w=function(r){return h?p(t,this)(r):r};if(v(o)){var O=o.get,E=o.set,P=i(O),j=i(E);return!P&&d&&m("You are trying to set getter via @accessor on "+n+" without getter. That's not a good idea."),!j&&h&&m("You are trying to set setter via @accessor on "+n+" without setter. That's not a good idea."),{get:P||d?function(){var r=this,e=p(g,this),t=function(){return P?p(O,r)():void 0};return(a?[e,t]:[t,e]).reduce(function(r,e){return e(r)},void 0)}:void 0,set:j||h?function(r){var e=this,t=p(w,this),n=function(r){return j?p(E,e)(r):r};return(c?[t,n]:[n,t]).reduce(function(r,e){return e(r)},r)}:void 0,configurable:l,enumerable:y}}if(b(o)){var A=o.initializer,S=void 0,_=!1;return{get:function(){var r=p(g,this);return _?r(S):(S=p(A,this)(),_=!0,r(S))},set:function(r){var e=p(w,this);return S=c?e(r):r,_=!0,c||e(S),S},configurable:l,enumerable:y}}var T=(o||{}).value;return{get:function(){return p(g,this)(T)},set:function(r){var e=p(w,this);return T=c?e(r):r,c||e(T),T},configurable:l,enumerable:y}}}function P(){for(var r=arguments.length,e=Array(r),t=0;t2&&d(e[2]))throw new Error("You may use @before straightly, @before return decorators, you need to call it");for(var n=e.length-1;n>-1;n--)if(!i(e[n]))throw new TypeError("@before only accept function parameter");return function(r,t,n){if(void 0===n)throw new Error("@before must used on descriptor, are you using it on undefined property?");var u=n.value,a=n.configurable,f=n.enumerable,c=n.writable;if(!i(u))throw new TypeError("@before can only be used on function");return{value:function(){for(var r=this,t=arguments.length,n=Array(t),i=0;i2&&d(e[2]))throw new Error("You may use @after straightly, @after return decorators, you need to call it");var n=w(e,"@after only accept function parameter");return function(r,e,t){if(void 0===t)throw new Error("@after must used on descriptor, are you using it on undefined property?");var o=t.value,u=t.configurable,a=t.enumerable,f=t.writable;if(!i(o))throw new TypeError("@after can only be used on function");return{value:function(){var r=p(o,this).apply(void 0,arguments);return p(n,this)(r)},configurable:u,enumerable:a,writable:f}}}function A(){for(var r=arguments.length,e=Array(r),t=0;t2&&d(e[2]))throw new Error("You may use @initialize straightly, @initialize return decorators, you need to call it");var n=w(e,"@initialize only accept function parameter");return function(r,e,t){if(void 0===t)return{value:p(n,r)(),configurable:!0,writable:!0,enumerable:!0};if(v(t)){var o=!1;return E({get:function(r){return o?r:p(n,this)(r)},set:t.set?function(r){return o=!0,r}:void 0})(r,e,t)}if(b(t)){var i=t.initializer;return{initializer:function(){return p(n,this)(p(i,this)())},configurable:t.configurable,writable:t.writable,enumerable:t.enumerable}}return{value:p(n,this)(t.value),writable:t.writable,configurable:t.configurable,enumerable:t.enumerable}}}function S(r,e,t,n,o,i){var u=t.configurable,a=t.enumerable,f=i.force,c=i.omit,l=Wt(n,o);if(void 0!==l){if(c)return;if(!f)throw new Error("@alias can't set alias on an existing attribute");if(!l.configurable)throw new Error("You are tring to set alias on an existing attribute which its configurable is false. That's impossible. Please check if you have set @frozen on it.")}Rt(n,o,{get:function(){return r[e]},set:function(t){return r[e]=t,e},configurable:u,enumerable:a})}function _(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.requirement,u=e.customArgs,a=void 0!==u&&u;return function(){for(var e=arguments.length,u=Array(e>1?e-1:0),f=1;f0&&void 0!==arguments[0]?arguments[0]:{},l=c.exclude,p=void 0===l?[]:l,y=c.include,d=void 0===y?[]:y,v=c.construct,h=void 0!==v&&v,b=c.self,g=void 0!==b&&b;if(!o(p))throw new TypeError("options.exclude must be an array");if(!o(d))throw new TypeError("options.include must be an array");return function(e){var o=i(e);if(!g&&!o)throw new TypeError("@"+r.name+"Class can only be used on class");if(g&&s(e))throw new TypeError("@"+r.name+"Class must be used on non-primitive type value in 'self' mode");var f=g?e:e.prototype;if(n(f))throw new Error("The prototype of the "+e.name+" is empty, please check it");var c=Dt(f);zt(f).concat(d).forEach(function(e){var n=c[e];"constructor"===e&&!h||g&&o&&["name","length","prototype"].indexOf(e)>-1||p.indexOf(e)>-1||i(t)&&!1===t(f,e,n,{self:g})||qt(f,e,(a?r.apply(void 0,Ct(u)):r)(f,e,n))})}}}function T(r,e){if("undefined"==typeof WeakMap)throw new Error("Using @autobind on "+e.name+"() requires WeakMap support due to its use of super."+e.name+"()");Bt||(Bt=new WeakMap),!1===Bt.has(r)&&Bt.set(r,new WeakMap);var t=Bt.get(r);return!1===t.has(e)&&t.set(e,p(e,r)),t.get(e)}function x(r,e,t){if(1===arguments.length)return Lt()(r);if(!d(t))throw new Error("@autobind must used on descriptor, are you using it on undefined property?");var n=t.value,o=t.configurable;if(!i(n))throw new TypeError("@autobind can only be used on functions, not: "+n+")");var u=r.constructor;return{configurable:o,enumerable:!1,get:function(){var t=this,o=function(){for(var r=arguments.length,e=Array(r),o=0;o1&&void 0!==arguments[1]?arguments[1]:{}).other;if(!i(r)&&!l(r)&&!f(r))throw new TypeError("@waitUntil only accept Function, Promise or String");return function(t,o,u){if(void 0===u)throw new Error("@waituntil must used on descriptor, are you using it on undefined property?");var a=u.value,f=u.configurable;if(!i(a))throw new TypeError("@waituntil can only be used on function, but not "+a);var c=!1,v=[],h=l(r)?function(){return r}:i(r)?r:function(){var t=r.split("."),o=t.slice(-1),i=s(e)?this:e;if(!c){var u=y(i,t.slice(0,-1));if(n(u))return u;var a=Jt(u,o),f=function(r){if(!0===r)for(;v.length>0;)v[0](),v.shift();return r},l=d(a)?E({set:f})(u,o,a):E({set:f})(u,o,{value:void 0,configurable:!0,enumerable:!0,writable:!0});Kt(u,o,l),c=!0}return y(i,t)};return{value:function(){for(var r=this,e=arguments.length,t=Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:{},a=t.self,f=void 0!==a&&a,c=t.omit,l=void 0!==c&&c,p=i(e);if(p||o(e)){if(!i(r))throw new TypeError("If you want to decorator class, you must pass it a legal class");if(p)e(r);else for(var y=0,d=e.length;y-1)return function(){c=!0,p(l,n).apply(void 0,arguments),c=!1,e()};if(!0===f[t])return l;if(u(l)||o(l)){var s=f[t]||F(l,e,{diff:i,operationPrefix:a});return f[t]=s,s}return f[t]=!0,l},set:function(r,t,n){var l=r[t],s=u(n)||o(n)?F(n,e,{diff:i,operationPrefix:a}):n;return r[t]=s,f[t]=!0,!!(c||i&&l===s)||(e(),!0)},deleteProperty:function(r,t){return delete r[t],delete f[t],!!c||(e(),!0)}}),s=(n={},Nt(n,a+"set",[A(function(r){return function(r,e){l[r]=e}}),M]),Nt(n,a+"del",[A(function(r){return function(r){delete l[r]}}),M]),n);return I(l,s,{self:!0}),l}function z(r,e,t){function n(r){var t=void 0;return r.reduce(function(r,n){return r[n]=[E({set:function(r){return t=this[n],r}}),E({get:function(r){return s[n]?r:((u(r)||o(r))&&z(r,e,{operationPrefix:c,diff:l}),s[n]=!0,r)},set:function(r){return(u(r)||o(r))&&z(r,e,{operationPrefix:c,diff:l}),s[n]=!0,y||l&&t===r||e(),r}},{preSet:!1})],r},{})}var a,f=this,c=t.operationPrefix,l=t.diff,s={},y=!1,d=n(zt(r));if(I(r,d,{self:!0,omit:!0}),o(r)){var v=Ht.reduce(function(t,o){return t[o]=[A(function(t){return t=i(t)?t:Array.prototype[o],function(){var o=r.length;if(y=!0,p(t,r).apply(void 0,arguments),y=!1,o2&&void 0!==arguments[2]?arguments[2]:{},a=u.disable,c=u.isNewVal;if(c=c||-1===zt(r).indexOf(t),i(e)&&p(e,f)(t,o,{disable:!0,isNewVal:c}),c){var l=n([t]);I(r,l,{self:!0,omit:!0})}a||(r[t]=o)}}),M]),Nt(a,c+"del",[A(function(t){return function(o){if(-1===zt(r).indexOf(o)){var u=n([o]);I(r,u,{self:!0,omit:!0})}i(t)?p(t,f)(o):delete r[o],e()}}),M]),a);return I(r,h,{self:!0}),r}function D(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=e.other,n=e.backup;if(!i(r)&&!f(r))throw new TypeError("@runnable only accept Function or String");return function(e,o,u){if(void 0===u)throw new Error("@runnable must used on descriptor, are you using it on undefined property?");var a=u.value,f=u.configurable;if(!i(a))throw new TypeError("@runnable can only be used on method, but not "+a+" on "+o);var c=i(r)?r:function(){var e=r.split(".");return y(s(t)?this:t,e)};return n=i(n)?n:function(){},{value:function(){return!0===p(c,this).apply(void 0,arguments)?p(a,this).apply(void 0,arguments):p(n,this).apply(void 0,arguments)},enumerable:!1,configurable:f,writable:!1}}}var N=Math.ceil,Y=Math.floor,C=function(r){return isNaN(r=+r)?0:(r>0?Y:N)(r)},W=function(r){if(void 0==r)throw TypeError("Can't call method on "+r);return r},R=t(function(r){var e=r.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),q=t(function(r){var e=r.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),L=function(r){if("function"!=typeof r)throw TypeError(r+" is not a function!");return r},B=function(r,e,t){if(L(r),void 0===e)return r;switch(t){case 1:return function(t){return r.call(e,t)};case 2:return function(t,n){return r.call(e,t,n)};case 3:return function(t,n,o){return r.call(e,t,n,o)}}return function(){return r.apply(e,arguments)}},G=function(r){return"object"==typeof r?null!==r:"function"==typeof r},J=function(r){if(!G(r))throw TypeError(r+" is not an object!");return r},K=function(r){try{return!!r()}catch(r){return!0}},U=!K(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),V=R.document,Q=G(V)&&G(V.createElement),$=function(r){return Q?V.createElement(r):{}},H=!U&&!K(function(){return 7!=Object.defineProperty($("div"),"a",{get:function(){return 7}}).a}),X=function(r,e){if(!G(r))return r;var t,n;if(e&&"function"==typeof(t=r.toString)&&!G(n=t.call(r)))return n;if("function"==typeof(t=r.valueOf)&&!G(n=t.call(r)))return n;if(!e&&"function"==typeof(t=r.toString)&&!G(n=t.call(r)))return n;throw TypeError("Can't convert object to primitive value")},Z=Object.defineProperty,rr={f:U?Object.defineProperty:function(r,e,t){if(J(r),e=X(e,!0),J(t),H)try{return Z(r,e,t)}catch(r){}if("get"in t||"set"in t)throw TypeError("Accessors not supported!");return"value"in t&&(r[e]=t.value),r}},er=function(r,e){return{enumerable:!(1&r),configurable:!(2&r),writable:!(4&r),value:e}},tr=U?function(r,e,t){return rr.f(r,e,er(1,t))}:function(r,e,t){return r[e]=t,r},nr=function(r,e,t){var n,o,i,u=r&nr.F,a=r&nr.G,f=r&nr.S,c=r&nr.P,l=r&nr.B,s=r&nr.W,p=a?q:q[e]||(q[e]={}),y=p.prototype,d=a?R:f?R[e]:(R[e]||{}).prototype;a&&(t=e);for(n in t)(o=!u&&d&&void 0!==d[n])&&n in p||(i=o?d[n]:t[n],p[n]=a&&"function"!=typeof d[n]?t[n]:l&&o?B(i,R):s&&d[n]==i?function(r){var e=function(e,t,n){if(this instanceof r){switch(arguments.length){case 0:return new r;case 1:return new r(e);case 2:return new r(e,t)}return new r(e,t,n)}return r.apply(this,arguments)};return e.prototype=r.prototype,e}(i):c&&"function"==typeof i?B(Function.call,i):i,c&&((p.virtual||(p.virtual={}))[n]=i,r&nr.R&&y&&!y[n]&&tr(y,n,i)))};nr.F=1,nr.G=2,nr.S=4,nr.P=8,nr.B=16,nr.W=32,nr.U=64,nr.R=128;var or=nr,ir=tr,ur={}.hasOwnProperty,ar=function(r,e){return ur.call(r,e)},fr={},cr={}.toString,lr=function(r){return cr.call(r).slice(8,-1)},sr=Object("z").propertyIsEnumerable(0)?Object:function(r){return"String"==lr(r)?r.split(""):Object(r)},pr=function(r){return sr(W(r))},yr=Math.min,dr=function(r){return r>0?yr(C(r),9007199254740991):0},vr=Math.max,hr=Math.min,br=function(r,e){return(r=C(r))<0?vr(r+e,0):hr(r,e)},gr=R["__core-js_shared__"]||(R["__core-js_shared__"]={}),wr=function(r){return gr[r]||(gr[r]={})},mr=0,Or=Math.random(),Er=function(r){return"Symbol(".concat(void 0===r?"":r,")_",(++mr+Or).toString(36))},Pr=wr("keys"),jr=function(r){return Pr[r]||(Pr[r]=Er(r))},Ar=function(r){return function(e,t,n){var o,i=pr(e),u=dr(i.length),a=br(n,u);if(r&&t!=t){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((r||a in i)&&i[a]===t)return r||a||0;return!r&&-1}}(!1),Sr=jr("IE_PROTO"),_r=function(r,e){var t,n=pr(r),o=0,i=[];for(t in n)t!=Sr&&ar(n,t)&&i.push(t);for(;e.length>o;)ar(n,t=e[o++])&&(~Ar(i,t)||i.push(t));return i},Tr="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),xr=Object.keys||function(r){return _r(r,Tr)},kr=U?Object.defineProperties:function(r,e){J(r);for(var t,n=xr(e),o=n.length,i=0;o>i;)rr.f(r,t=n[i++],e[t]);return r},Mr=R.document&&document.documentElement,Ir=jr("IE_PROTO"),Fr=function(){},zr=function(){var r,e=$("iframe"),t=Tr.length;for(e.style.display="none",Mr.appendChild(e),e.src="javascript:",(r=e.contentWindow.document).open(),r.write("