bootstrap-table-treegrid.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = global || self, factory(global.jQuery));
  5. }(this, function ($) { 'use strict';
  6. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  7. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  8. function createCommonjsModule(fn, module) {
  9. return module = { exports: {} }, fn(module, module.exports), module.exports;
  10. }
  11. var O = 'object';
  12. var check = function (it) {
  13. return it && it.Math == Math && it;
  14. };
  15. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  16. var global_1 =
  17. // eslint-disable-next-line no-undef
  18. check(typeof globalThis == O && globalThis) ||
  19. check(typeof window == O && window) ||
  20. check(typeof self == O && self) ||
  21. check(typeof commonjsGlobal == O && commonjsGlobal) ||
  22. // eslint-disable-next-line no-new-func
  23. Function('return this')();
  24. var fails = function (exec) {
  25. try {
  26. return !!exec();
  27. } catch (error) {
  28. return true;
  29. }
  30. };
  31. // Thank's IE8 for his funny defineProperty
  32. var descriptors = !fails(function () {
  33. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  34. });
  35. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  36. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  37. // Nashorn ~ JDK8 bug
  38. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  39. // `Object.prototype.propertyIsEnumerable` method implementation
  40. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  41. var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  42. var descriptor = getOwnPropertyDescriptor(this, V);
  43. return !!descriptor && descriptor.enumerable;
  44. } : nativePropertyIsEnumerable;
  45. var objectPropertyIsEnumerable = {
  46. f: f
  47. };
  48. var createPropertyDescriptor = function (bitmap, value) {
  49. return {
  50. enumerable: !(bitmap & 1),
  51. configurable: !(bitmap & 2),
  52. writable: !(bitmap & 4),
  53. value: value
  54. };
  55. };
  56. var toString = {}.toString;
  57. var classofRaw = function (it) {
  58. return toString.call(it).slice(8, -1);
  59. };
  60. var split = ''.split;
  61. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  62. var indexedObject = fails(function () {
  63. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  64. // eslint-disable-next-line no-prototype-builtins
  65. return !Object('z').propertyIsEnumerable(0);
  66. }) ? function (it) {
  67. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  68. } : Object;
  69. // `RequireObjectCoercible` abstract operation
  70. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  71. var requireObjectCoercible = function (it) {
  72. if (it == undefined) throw TypeError("Can't call method on " + it);
  73. return it;
  74. };
  75. // toObject with fallback for non-array-like ES3 strings
  76. var toIndexedObject = function (it) {
  77. return indexedObject(requireObjectCoercible(it));
  78. };
  79. var isObject = function (it) {
  80. return typeof it === 'object' ? it !== null : typeof it === 'function';
  81. };
  82. // `ToPrimitive` abstract operation
  83. // https://tc39.github.io/ecma262/#sec-toprimitive
  84. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  85. // and the second argument - flag - preferred type is a string
  86. var toPrimitive = function (input, PREFERRED_STRING) {
  87. if (!isObject(input)) return input;
  88. var fn, val;
  89. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  90. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  91. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  92. throw TypeError("Can't convert object to primitive value");
  93. };
  94. var hasOwnProperty = {}.hasOwnProperty;
  95. var has = function (it, key) {
  96. return hasOwnProperty.call(it, key);
  97. };
  98. var document = global_1.document;
  99. // typeof document.createElement is 'object' in old IE
  100. var EXISTS = isObject(document) && isObject(document.createElement);
  101. var documentCreateElement = function (it) {
  102. return EXISTS ? document.createElement(it) : {};
  103. };
  104. // Thank's IE8 for his funny defineProperty
  105. var ie8DomDefine = !descriptors && !fails(function () {
  106. return Object.defineProperty(documentCreateElement('div'), 'a', {
  107. get: function () { return 7; }
  108. }).a != 7;
  109. });
  110. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  111. // `Object.getOwnPropertyDescriptor` method
  112. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  113. var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  114. O = toIndexedObject(O);
  115. P = toPrimitive(P, true);
  116. if (ie8DomDefine) try {
  117. return nativeGetOwnPropertyDescriptor(O, P);
  118. } catch (error) { /* empty */ }
  119. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  120. };
  121. var objectGetOwnPropertyDescriptor = {
  122. f: f$1
  123. };
  124. var anObject = function (it) {
  125. if (!isObject(it)) {
  126. throw TypeError(String(it) + ' is not an object');
  127. } return it;
  128. };
  129. var nativeDefineProperty = Object.defineProperty;
  130. // `Object.defineProperty` method
  131. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  132. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  133. anObject(O);
  134. P = toPrimitive(P, true);
  135. anObject(Attributes);
  136. if (ie8DomDefine) try {
  137. return nativeDefineProperty(O, P, Attributes);
  138. } catch (error) { /* empty */ }
  139. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  140. if ('value' in Attributes) O[P] = Attributes.value;
  141. return O;
  142. };
  143. var objectDefineProperty = {
  144. f: f$2
  145. };
  146. var hide = descriptors ? function (object, key, value) {
  147. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  148. } : function (object, key, value) {
  149. object[key] = value;
  150. return object;
  151. };
  152. var setGlobal = function (key, value) {
  153. try {
  154. hide(global_1, key, value);
  155. } catch (error) {
  156. global_1[key] = value;
  157. } return value;
  158. };
  159. var shared = createCommonjsModule(function (module) {
  160. var SHARED = '__core-js_shared__';
  161. var store = global_1[SHARED] || setGlobal(SHARED, {});
  162. (module.exports = function (key, value) {
  163. return store[key] || (store[key] = value !== undefined ? value : {});
  164. })('versions', []).push({
  165. version: '3.1.3',
  166. mode: 'global',
  167. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  168. });
  169. });
  170. var functionToString = shared('native-function-to-string', Function.toString);
  171. var WeakMap = global_1.WeakMap;
  172. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
  173. var id = 0;
  174. var postfix = Math.random();
  175. var uid = function (key) {
  176. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  177. };
  178. var keys = shared('keys');
  179. var sharedKey = function (key) {
  180. return keys[key] || (keys[key] = uid(key));
  181. };
  182. var hiddenKeys = {};
  183. var WeakMap$1 = global_1.WeakMap;
  184. var set, get, has$1;
  185. var enforce = function (it) {
  186. return has$1(it) ? get(it) : set(it, {});
  187. };
  188. var getterFor = function (TYPE) {
  189. return function (it) {
  190. var state;
  191. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  192. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  193. } return state;
  194. };
  195. };
  196. if (nativeWeakMap) {
  197. var store = new WeakMap$1();
  198. var wmget = store.get;
  199. var wmhas = store.has;
  200. var wmset = store.set;
  201. set = function (it, metadata) {
  202. wmset.call(store, it, metadata);
  203. return metadata;
  204. };
  205. get = function (it) {
  206. return wmget.call(store, it) || {};
  207. };
  208. has$1 = function (it) {
  209. return wmhas.call(store, it);
  210. };
  211. } else {
  212. var STATE = sharedKey('state');
  213. hiddenKeys[STATE] = true;
  214. set = function (it, metadata) {
  215. hide(it, STATE, metadata);
  216. return metadata;
  217. };
  218. get = function (it) {
  219. return has(it, STATE) ? it[STATE] : {};
  220. };
  221. has$1 = function (it) {
  222. return has(it, STATE);
  223. };
  224. }
  225. var internalState = {
  226. set: set,
  227. get: get,
  228. has: has$1,
  229. enforce: enforce,
  230. getterFor: getterFor
  231. };
  232. var redefine = createCommonjsModule(function (module) {
  233. var getInternalState = internalState.get;
  234. var enforceInternalState = internalState.enforce;
  235. var TEMPLATE = String(functionToString).split('toString');
  236. shared('inspectSource', function (it) {
  237. return functionToString.call(it);
  238. });
  239. (module.exports = function (O, key, value, options) {
  240. var unsafe = options ? !!options.unsafe : false;
  241. var simple = options ? !!options.enumerable : false;
  242. var noTargetGet = options ? !!options.noTargetGet : false;
  243. if (typeof value == 'function') {
  244. if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
  245. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  246. }
  247. if (O === global_1) {
  248. if (simple) O[key] = value;
  249. else setGlobal(key, value);
  250. return;
  251. } else if (!unsafe) {
  252. delete O[key];
  253. } else if (!noTargetGet && O[key]) {
  254. simple = true;
  255. }
  256. if (simple) O[key] = value;
  257. else hide(O, key, value);
  258. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  259. })(Function.prototype, 'toString', function toString() {
  260. return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
  261. });
  262. });
  263. var path = global_1;
  264. var aFunction = function (variable) {
  265. return typeof variable == 'function' ? variable : undefined;
  266. };
  267. var getBuiltIn = function (namespace, method) {
  268. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
  269. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  270. };
  271. var ceil = Math.ceil;
  272. var floor = Math.floor;
  273. // `ToInteger` abstract operation
  274. // https://tc39.github.io/ecma262/#sec-tointeger
  275. var toInteger = function (argument) {
  276. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  277. };
  278. var min = Math.min;
  279. // `ToLength` abstract operation
  280. // https://tc39.github.io/ecma262/#sec-tolength
  281. var toLength = function (argument) {
  282. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  283. };
  284. var max = Math.max;
  285. var min$1 = Math.min;
  286. // Helper for a popular repeating case of the spec:
  287. // Let integer be ? ToInteger(index).
  288. // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
  289. var toAbsoluteIndex = function (index, length) {
  290. var integer = toInteger(index);
  291. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  292. };
  293. // `Array.prototype.{ indexOf, includes }` methods implementation
  294. var createMethod = function (IS_INCLUDES) {
  295. return function ($this, el, fromIndex) {
  296. var O = toIndexedObject($this);
  297. var length = toLength(O.length);
  298. var index = toAbsoluteIndex(fromIndex, length);
  299. var value;
  300. // Array#includes uses SameValueZero equality algorithm
  301. // eslint-disable-next-line no-self-compare
  302. if (IS_INCLUDES && el != el) while (length > index) {
  303. value = O[index++];
  304. // eslint-disable-next-line no-self-compare
  305. if (value != value) return true;
  306. // Array#indexOf ignores holes, Array#includes - not
  307. } else for (;length > index; index++) {
  308. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  309. } return !IS_INCLUDES && -1;
  310. };
  311. };
  312. var arrayIncludes = {
  313. // `Array.prototype.includes` method
  314. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  315. includes: createMethod(true),
  316. // `Array.prototype.indexOf` method
  317. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  318. indexOf: createMethod(false)
  319. };
  320. var indexOf = arrayIncludes.indexOf;
  321. var objectKeysInternal = function (object, names) {
  322. var O = toIndexedObject(object);
  323. var i = 0;
  324. var result = [];
  325. var key;
  326. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  327. // Don't enum bug & hidden keys
  328. while (names.length > i) if (has(O, key = names[i++])) {
  329. ~indexOf(result, key) || result.push(key);
  330. }
  331. return result;
  332. };
  333. // IE8- don't enum bug keys
  334. var enumBugKeys = [
  335. 'constructor',
  336. 'hasOwnProperty',
  337. 'isPrototypeOf',
  338. 'propertyIsEnumerable',
  339. 'toLocaleString',
  340. 'toString',
  341. 'valueOf'
  342. ];
  343. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  344. // `Object.getOwnPropertyNames` method
  345. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  346. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  347. return objectKeysInternal(O, hiddenKeys$1);
  348. };
  349. var objectGetOwnPropertyNames = {
  350. f: f$3
  351. };
  352. var f$4 = Object.getOwnPropertySymbols;
  353. var objectGetOwnPropertySymbols = {
  354. f: f$4
  355. };
  356. // all object keys, includes non-enumerable and symbols
  357. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  358. var keys = objectGetOwnPropertyNames.f(anObject(it));
  359. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  360. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  361. };
  362. var copyConstructorProperties = function (target, source) {
  363. var keys = ownKeys(source);
  364. var defineProperty = objectDefineProperty.f;
  365. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  366. for (var i = 0; i < keys.length; i++) {
  367. var key = keys[i];
  368. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  369. }
  370. };
  371. var replacement = /#|\.prototype\./;
  372. var isForced = function (feature, detection) {
  373. var value = data[normalize(feature)];
  374. return value == POLYFILL ? true
  375. : value == NATIVE ? false
  376. : typeof detection == 'function' ? fails(detection)
  377. : !!detection;
  378. };
  379. var normalize = isForced.normalize = function (string) {
  380. return String(string).replace(replacement, '.').toLowerCase();
  381. };
  382. var data = isForced.data = {};
  383. var NATIVE = isForced.NATIVE = 'N';
  384. var POLYFILL = isForced.POLYFILL = 'P';
  385. var isForced_1 = isForced;
  386. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  387. /*
  388. options.target - name of the target object
  389. options.global - target is the global object
  390. options.stat - export as static methods of target
  391. options.proto - export as prototype methods of target
  392. options.real - real prototype method for the `pure` version
  393. options.forced - export even if the native feature is available
  394. options.bind - bind methods to the target, required for the `pure` version
  395. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  396. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  397. options.sham - add a flag to not completely full polyfills
  398. options.enumerable - export as enumerable property
  399. options.noTargetGet - prevent calling a getter on target
  400. */
  401. var _export = function (options, source) {
  402. var TARGET = options.target;
  403. var GLOBAL = options.global;
  404. var STATIC = options.stat;
  405. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  406. if (GLOBAL) {
  407. target = global_1;
  408. } else if (STATIC) {
  409. target = global_1[TARGET] || setGlobal(TARGET, {});
  410. } else {
  411. target = (global_1[TARGET] || {}).prototype;
  412. }
  413. if (target) for (key in source) {
  414. sourceProperty = source[key];
  415. if (options.noTargetGet) {
  416. descriptor = getOwnPropertyDescriptor$1(target, key);
  417. targetProperty = descriptor && descriptor.value;
  418. } else targetProperty = target[key];
  419. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  420. // contained in target
  421. if (!FORCED && targetProperty !== undefined) {
  422. if (typeof sourceProperty === typeof targetProperty) continue;
  423. copyConstructorProperties(sourceProperty, targetProperty);
  424. }
  425. // add a flag to not completely full polyfills
  426. if (options.sham || (targetProperty && targetProperty.sham)) {
  427. hide(sourceProperty, 'sham', true);
  428. }
  429. // extend global
  430. redefine(target, key, sourceProperty, options);
  431. }
  432. };
  433. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  434. // Chrome 38 Symbol has incorrect toString conversion
  435. // eslint-disable-next-line no-undef
  436. return !String(Symbol());
  437. });
  438. // `IsArray` abstract operation
  439. // https://tc39.github.io/ecma262/#sec-isarray
  440. var isArray = Array.isArray || function isArray(arg) {
  441. return classofRaw(arg) == 'Array';
  442. };
  443. // `ToObject` abstract operation
  444. // https://tc39.github.io/ecma262/#sec-toobject
  445. var toObject = function (argument) {
  446. return Object(requireObjectCoercible(argument));
  447. };
  448. // `Object.keys` method
  449. // https://tc39.github.io/ecma262/#sec-object.keys
  450. var objectKeys = Object.keys || function keys(O) {
  451. return objectKeysInternal(O, enumBugKeys);
  452. };
  453. // `Object.defineProperties` method
  454. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  455. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  456. anObject(O);
  457. var keys = objectKeys(Properties);
  458. var length = keys.length;
  459. var index = 0;
  460. var key;
  461. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  462. return O;
  463. };
  464. var html = getBuiltIn('document', 'documentElement');
  465. var IE_PROTO = sharedKey('IE_PROTO');
  466. var PROTOTYPE = 'prototype';
  467. var Empty = function () { /* empty */ };
  468. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  469. var createDict = function () {
  470. // Thrash, waste and sodomy: IE GC bug
  471. var iframe = documentCreateElement('iframe');
  472. var length = enumBugKeys.length;
  473. var lt = '<';
  474. var script = 'script';
  475. var gt = '>';
  476. var js = 'java' + script + ':';
  477. var iframeDocument;
  478. iframe.style.display = 'none';
  479. html.appendChild(iframe);
  480. iframe.src = String(js);
  481. iframeDocument = iframe.contentWindow.document;
  482. iframeDocument.open();
  483. iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
  484. iframeDocument.close();
  485. createDict = iframeDocument.F;
  486. while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
  487. return createDict();
  488. };
  489. // `Object.create` method
  490. // https://tc39.github.io/ecma262/#sec-object.create
  491. var objectCreate = Object.create || function create(O, Properties) {
  492. var result;
  493. if (O !== null) {
  494. Empty[PROTOTYPE] = anObject(O);
  495. result = new Empty();
  496. Empty[PROTOTYPE] = null;
  497. // add "__proto__" for Object.getPrototypeOf polyfill
  498. result[IE_PROTO] = O;
  499. } else result = createDict();
  500. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  501. };
  502. hiddenKeys[IE_PROTO] = true;
  503. var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
  504. var toString$1 = {}.toString;
  505. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  506. ? Object.getOwnPropertyNames(window) : [];
  507. var getWindowNames = function (it) {
  508. try {
  509. return nativeGetOwnPropertyNames(it);
  510. } catch (error) {
  511. return windowNames.slice();
  512. }
  513. };
  514. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  515. var f$5 = function getOwnPropertyNames(it) {
  516. return windowNames && toString$1.call(it) == '[object Window]'
  517. ? getWindowNames(it)
  518. : nativeGetOwnPropertyNames(toIndexedObject(it));
  519. };
  520. var objectGetOwnPropertyNamesExternal = {
  521. f: f$5
  522. };
  523. var Symbol$1 = global_1.Symbol;
  524. var store$1 = shared('wks');
  525. var wellKnownSymbol = function (name) {
  526. return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
  527. || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
  528. };
  529. var f$6 = wellKnownSymbol;
  530. var wrappedWellKnownSymbol = {
  531. f: f$6
  532. };
  533. var defineProperty = objectDefineProperty.f;
  534. var defineWellKnownSymbol = function (NAME) {
  535. var Symbol = path.Symbol || (path.Symbol = {});
  536. if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
  537. value: wrappedWellKnownSymbol.f(NAME)
  538. });
  539. };
  540. var defineProperty$1 = objectDefineProperty.f;
  541. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  542. var setToStringTag = function (it, TAG, STATIC) {
  543. if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
  544. defineProperty$1(it, TO_STRING_TAG, { configurable: true, value: TAG });
  545. }
  546. };
  547. var aFunction$1 = function (it) {
  548. if (typeof it != 'function') {
  549. throw TypeError(String(it) + ' is not a function');
  550. } return it;
  551. };
  552. // optional / simple context binding
  553. var bindContext = function (fn, that, length) {
  554. aFunction$1(fn);
  555. if (that === undefined) return fn;
  556. switch (length) {
  557. case 0: return function () {
  558. return fn.call(that);
  559. };
  560. case 1: return function (a) {
  561. return fn.call(that, a);
  562. };
  563. case 2: return function (a, b) {
  564. return fn.call(that, a, b);
  565. };
  566. case 3: return function (a, b, c) {
  567. return fn.call(that, a, b, c);
  568. };
  569. }
  570. return function (/* ...args */) {
  571. return fn.apply(that, arguments);
  572. };
  573. };
  574. var SPECIES = wellKnownSymbol('species');
  575. // `ArraySpeciesCreate` abstract operation
  576. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  577. var arraySpeciesCreate = function (originalArray, length) {
  578. var C;
  579. if (isArray(originalArray)) {
  580. C = originalArray.constructor;
  581. // cross-realm fallback
  582. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  583. else if (isObject(C)) {
  584. C = C[SPECIES];
  585. if (C === null) C = undefined;
  586. }
  587. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  588. };
  589. var push = [].push;
  590. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  591. var createMethod$1 = function (TYPE) {
  592. var IS_MAP = TYPE == 1;
  593. var IS_FILTER = TYPE == 2;
  594. var IS_SOME = TYPE == 3;
  595. var IS_EVERY = TYPE == 4;
  596. var IS_FIND_INDEX = TYPE == 6;
  597. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  598. return function ($this, callbackfn, that, specificCreate) {
  599. var O = toObject($this);
  600. var self = indexedObject(O);
  601. var boundFunction = bindContext(callbackfn, that, 3);
  602. var length = toLength(self.length);
  603. var index = 0;
  604. var create = specificCreate || arraySpeciesCreate;
  605. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  606. var value, result;
  607. for (;length > index; index++) if (NO_HOLES || index in self) {
  608. value = self[index];
  609. result = boundFunction(value, index, O);
  610. if (TYPE) {
  611. if (IS_MAP) target[index] = result; // map
  612. else if (result) switch (TYPE) {
  613. case 3: return true; // some
  614. case 5: return value; // find
  615. case 6: return index; // findIndex
  616. case 2: push.call(target, value); // filter
  617. } else if (IS_EVERY) return false; // every
  618. }
  619. }
  620. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  621. };
  622. };
  623. var arrayIteration = {
  624. // `Array.prototype.forEach` method
  625. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  626. forEach: createMethod$1(0),
  627. // `Array.prototype.map` method
  628. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  629. map: createMethod$1(1),
  630. // `Array.prototype.filter` method
  631. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  632. filter: createMethod$1(2),
  633. // `Array.prototype.some` method
  634. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  635. some: createMethod$1(3),
  636. // `Array.prototype.every` method
  637. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  638. every: createMethod$1(4),
  639. // `Array.prototype.find` method
  640. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  641. find: createMethod$1(5),
  642. // `Array.prototype.findIndex` method
  643. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  644. findIndex: createMethod$1(6)
  645. };
  646. var $forEach = arrayIteration.forEach;
  647. var HIDDEN = sharedKey('hidden');
  648. var SYMBOL = 'Symbol';
  649. var PROTOTYPE$1 = 'prototype';
  650. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  651. var setInternalState = internalState.set;
  652. var getInternalState = internalState.getterFor(SYMBOL);
  653. var ObjectPrototype = Object[PROTOTYPE$1];
  654. var $Symbol = global_1.Symbol;
  655. var JSON = global_1.JSON;
  656. var nativeJSONStringify = JSON && JSON.stringify;
  657. var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  658. var nativeDefineProperty$1 = objectDefineProperty.f;
  659. var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
  660. var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
  661. var AllSymbols = shared('symbols');
  662. var ObjectPrototypeSymbols = shared('op-symbols');
  663. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  664. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  665. var WellKnownSymbolsStore = shared('wks');
  666. var QObject = global_1.QObject;
  667. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  668. var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
  669. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  670. var setSymbolDescriptor = descriptors && fails(function () {
  671. return objectCreate(nativeDefineProperty$1({}, 'a', {
  672. get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
  673. })).a != 7;
  674. }) ? function (O, P, Attributes) {
  675. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype, P);
  676. if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  677. nativeDefineProperty$1(O, P, Attributes);
  678. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  679. nativeDefineProperty$1(ObjectPrototype, P, ObjectPrototypeDescriptor);
  680. }
  681. } : nativeDefineProperty$1;
  682. var wrap = function (tag, description) {
  683. var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
  684. setInternalState(symbol, {
  685. type: SYMBOL,
  686. tag: tag,
  687. description: description
  688. });
  689. if (!descriptors) symbol.description = description;
  690. return symbol;
  691. };
  692. var isSymbol = nativeSymbol && typeof $Symbol.iterator == 'symbol' ? function (it) {
  693. return typeof it == 'symbol';
  694. } : function (it) {
  695. return Object(it) instanceof $Symbol;
  696. };
  697. var $defineProperty = function defineProperty(O, P, Attributes) {
  698. if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  699. anObject(O);
  700. var key = toPrimitive(P, true);
  701. anObject(Attributes);
  702. if (has(AllSymbols, key)) {
  703. if (!Attributes.enumerable) {
  704. if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
  705. O[HIDDEN][key] = true;
  706. } else {
  707. if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
  708. Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  709. } return setSymbolDescriptor(O, key, Attributes);
  710. } return nativeDefineProperty$1(O, key, Attributes);
  711. };
  712. var $defineProperties = function defineProperties(O, Properties) {
  713. anObject(O);
  714. var properties = toIndexedObject(Properties);
  715. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  716. $forEach(keys, function (key) {
  717. if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
  718. });
  719. return O;
  720. };
  721. var $create = function create(O, Properties) {
  722. return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
  723. };
  724. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  725. var P = toPrimitive(V, true);
  726. var enumerable = nativePropertyIsEnumerable$1.call(this, P);
  727. if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
  728. return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
  729. };
  730. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  731. var it = toIndexedObject(O);
  732. var key = toPrimitive(P, true);
  733. if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
  734. var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
  735. if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
  736. descriptor.enumerable = true;
  737. }
  738. return descriptor;
  739. };
  740. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  741. var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
  742. var result = [];
  743. $forEach(names, function (key) {
  744. if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
  745. });
  746. return result;
  747. };
  748. var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
  749. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  750. var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  751. var result = [];
  752. $forEach(names, function (key) {
  753. if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
  754. result.push(AllSymbols[key]);
  755. }
  756. });
  757. return result;
  758. };
  759. // `Symbol` constructor
  760. // https://tc39.github.io/ecma262/#sec-symbol-constructor
  761. if (!nativeSymbol) {
  762. $Symbol = function Symbol() {
  763. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
  764. var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
  765. var tag = uid(description);
  766. var setter = function (value) {
  767. if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
  768. if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  769. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  770. };
  771. if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
  772. return wrap(tag, description);
  773. };
  774. redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
  775. return getInternalState(this).tag;
  776. });
  777. objectPropertyIsEnumerable.f = $propertyIsEnumerable;
  778. objectDefineProperty.f = $defineProperty;
  779. objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
  780. objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  781. objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
  782. if (descriptors) {
  783. // https://github.com/tc39/proposal-Symbol-description
  784. nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
  785. configurable: true,
  786. get: function description() {
  787. return getInternalState(this).description;
  788. }
  789. });
  790. {
  791. redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  792. }
  793. }
  794. wrappedWellKnownSymbol.f = function (name) {
  795. return wrap(wellKnownSymbol(name), name);
  796. };
  797. }
  798. _export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
  799. Symbol: $Symbol
  800. });
  801. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  802. defineWellKnownSymbol(name);
  803. });
  804. _export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
  805. // `Symbol.for` method
  806. // https://tc39.github.io/ecma262/#sec-symbol.for
  807. 'for': function (key) {
  808. var string = String(key);
  809. if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
  810. var symbol = $Symbol(string);
  811. StringToSymbolRegistry[string] = symbol;
  812. SymbolToStringRegistry[symbol] = string;
  813. return symbol;
  814. },
  815. // `Symbol.keyFor` method
  816. // https://tc39.github.io/ecma262/#sec-symbol.keyfor
  817. keyFor: function keyFor(sym) {
  818. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
  819. if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  820. },
  821. useSetter: function () { USE_SETTER = true; },
  822. useSimple: function () { USE_SETTER = false; }
  823. });
  824. _export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
  825. // `Object.create` method
  826. // https://tc39.github.io/ecma262/#sec-object.create
  827. create: $create,
  828. // `Object.defineProperty` method
  829. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  830. defineProperty: $defineProperty,
  831. // `Object.defineProperties` method
  832. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  833. defineProperties: $defineProperties,
  834. // `Object.getOwnPropertyDescriptor` method
  835. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptors
  836. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  837. });
  838. _export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
  839. // `Object.getOwnPropertyNames` method
  840. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  841. getOwnPropertyNames: $getOwnPropertyNames,
  842. // `Object.getOwnPropertySymbols` method
  843. // https://tc39.github.io/ecma262/#sec-object.getownpropertysymbols
  844. getOwnPropertySymbols: $getOwnPropertySymbols
  845. });
  846. // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  847. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  848. _export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
  849. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  850. return objectGetOwnPropertySymbols.f(toObject(it));
  851. }
  852. });
  853. // `JSON.stringify` method behavior with symbols
  854. // https://tc39.github.io/ecma262/#sec-json.stringify
  855. JSON && _export({ target: 'JSON', stat: true, forced: !nativeSymbol || fails(function () {
  856. var symbol = $Symbol();
  857. // MS Edge converts symbol values to JSON as {}
  858. return nativeJSONStringify([symbol]) != '[null]'
  859. // WebKit converts symbol values to JSON as null
  860. || nativeJSONStringify({ a: symbol }) != '{}'
  861. // V8 throws on boxed symbols
  862. || nativeJSONStringify(Object(symbol)) != '{}';
  863. }) }, {
  864. stringify: function stringify(it) {
  865. var args = [it];
  866. var index = 1;
  867. var replacer, $replacer;
  868. while (arguments.length > index) args.push(arguments[index++]);
  869. $replacer = replacer = args[1];
  870. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  871. if (!isArray(replacer)) replacer = function (key, value) {
  872. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  873. if (!isSymbol(value)) return value;
  874. };
  875. args[1] = replacer;
  876. return nativeJSONStringify.apply(JSON, args);
  877. }
  878. });
  879. // `Symbol.prototype[@@toPrimitive]` method
  880. // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
  881. if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) hide($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
  882. // `Symbol.prototype[@@toStringTag]` property
  883. // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@tostringtag
  884. setToStringTag($Symbol, SYMBOL);
  885. hiddenKeys[HIDDEN] = true;
  886. var defineProperty$2 = objectDefineProperty.f;
  887. var NativeSymbol = global_1.Symbol;
  888. if (descriptors && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
  889. // Safari 12 bug
  890. NativeSymbol().description !== undefined
  891. )) {
  892. var EmptyStringDescriptionStore = {};
  893. // wrap Symbol constructor for correct work with undefined description
  894. var SymbolWrapper = function Symbol() {
  895. var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
  896. var result = this instanceof SymbolWrapper
  897. ? new NativeSymbol(description)
  898. // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
  899. : description === undefined ? NativeSymbol() : NativeSymbol(description);
  900. if (description === '') EmptyStringDescriptionStore[result] = true;
  901. return result;
  902. };
  903. copyConstructorProperties(SymbolWrapper, NativeSymbol);
  904. var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
  905. symbolPrototype.constructor = SymbolWrapper;
  906. var symbolToString = symbolPrototype.toString;
  907. var native = String(NativeSymbol('test')) == 'Symbol(test)';
  908. var regexp = /^Symbol\((.*)\)[^)]+$/;
  909. defineProperty$2(symbolPrototype, 'description', {
  910. configurable: true,
  911. get: function description() {
  912. var symbol = isObject(this) ? this.valueOf() : this;
  913. var string = symbolToString.call(symbol);
  914. if (has(EmptyStringDescriptionStore, symbol)) return '';
  915. var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1');
  916. return desc === '' ? undefined : desc;
  917. }
  918. });
  919. _export({ global: true, forced: true }, {
  920. Symbol: SymbolWrapper
  921. });
  922. }
  923. // `Symbol.iterator` well-known symbol
  924. // https://tc39.github.io/ecma262/#sec-symbol.iterator
  925. defineWellKnownSymbol('iterator');
  926. var createProperty = function (object, key, value) {
  927. var propertyKey = toPrimitive(key);
  928. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  929. else object[propertyKey] = value;
  930. };
  931. var SPECIES$1 = wellKnownSymbol('species');
  932. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  933. return !fails(function () {
  934. var array = [];
  935. var constructor = array.constructor = {};
  936. constructor[SPECIES$1] = function () {
  937. return { foo: 1 };
  938. };
  939. return array[METHOD_NAME](Boolean).foo !== 1;
  940. });
  941. };
  942. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  943. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  944. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  945. var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
  946. var array = [];
  947. array[IS_CONCAT_SPREADABLE] = false;
  948. return array.concat()[0] !== array;
  949. });
  950. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  951. var isConcatSpreadable = function (O) {
  952. if (!isObject(O)) return false;
  953. var spreadable = O[IS_CONCAT_SPREADABLE];
  954. return spreadable !== undefined ? !!spreadable : isArray(O);
  955. };
  956. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  957. // `Array.prototype.concat` method
  958. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  959. // with adding support of @@isConcatSpreadable and @@species
  960. _export({ target: 'Array', proto: true, forced: FORCED }, {
  961. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  962. var O = toObject(this);
  963. var A = arraySpeciesCreate(O, 0);
  964. var n = 0;
  965. var i, k, length, len, E;
  966. for (i = -1, length = arguments.length; i < length; i++) {
  967. E = i === -1 ? O : arguments[i];
  968. if (isConcatSpreadable(E)) {
  969. len = toLength(E.length);
  970. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  971. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  972. } else {
  973. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  974. createProperty(A, n++, E);
  975. }
  976. }
  977. A.length = n;
  978. return A;
  979. }
  980. });
  981. var $filter = arrayIteration.filter;
  982. // `Array.prototype.filter` method
  983. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  984. // with adding support of @@species
  985. _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, {
  986. filter: function filter(callbackfn /* , thisArg */) {
  987. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  988. }
  989. });
  990. var UNSCOPABLES = wellKnownSymbol('unscopables');
  991. var ArrayPrototype = Array.prototype;
  992. // Array.prototype[@@unscopables]
  993. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  994. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  995. hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
  996. }
  997. // add a key to Array.prototype[@@unscopables]
  998. var addToUnscopables = function (key) {
  999. ArrayPrototype[UNSCOPABLES][key] = true;
  1000. };
  1001. var correctPrototypeGetter = !fails(function () {
  1002. function F() { /* empty */ }
  1003. F.prototype.constructor = null;
  1004. return Object.getPrototypeOf(new F()) !== F.prototype;
  1005. });
  1006. var IE_PROTO$1 = sharedKey('IE_PROTO');
  1007. var ObjectPrototype$1 = Object.prototype;
  1008. // `Object.getPrototypeOf` method
  1009. // https://tc39.github.io/ecma262/#sec-object.getprototypeof
  1010. var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
  1011. O = toObject(O);
  1012. if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
  1013. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  1014. return O.constructor.prototype;
  1015. } return O instanceof Object ? ObjectPrototype$1 : null;
  1016. };
  1017. var ITERATOR = wellKnownSymbol('iterator');
  1018. var BUGGY_SAFARI_ITERATORS = false;
  1019. var returnThis = function () { return this; };
  1020. // `%IteratorPrototype%` object
  1021. // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object
  1022. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  1023. if ([].keys) {
  1024. arrayIterator = [].keys();
  1025. // Safari 8 has buggy iterators w/o `next`
  1026. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  1027. else {
  1028. PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
  1029. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  1030. }
  1031. }
  1032. if (IteratorPrototype == undefined) IteratorPrototype = {};
  1033. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  1034. if ( !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
  1035. var iteratorsCore = {
  1036. IteratorPrototype: IteratorPrototype,
  1037. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  1038. };
  1039. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  1040. var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
  1041. var TO_STRING_TAG = NAME + ' Iterator';
  1042. IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
  1043. setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
  1044. return IteratorConstructor;
  1045. };
  1046. var aPossiblePrototype = function (it) {
  1047. if (!isObject(it) && it !== null) {
  1048. throw TypeError("Can't set " + String(it) + ' as a prototype');
  1049. } return it;
  1050. };
  1051. // `Object.setPrototypeOf` method
  1052. // https://tc39.github.io/ecma262/#sec-object.setprototypeof
  1053. // Works with __proto__ only. Old v8 can't work with null proto objects.
  1054. /* eslint-disable no-proto */
  1055. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  1056. var CORRECT_SETTER = false;
  1057. var test = {};
  1058. var setter;
  1059. try {
  1060. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  1061. setter.call(test, []);
  1062. CORRECT_SETTER = test instanceof Array;
  1063. } catch (error) { /* empty */ }
  1064. return function setPrototypeOf(O, proto) {
  1065. anObject(O);
  1066. aPossiblePrototype(proto);
  1067. if (CORRECT_SETTER) setter.call(O, proto);
  1068. else O.__proto__ = proto;
  1069. return O;
  1070. };
  1071. }() : undefined);
  1072. var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
  1073. var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
  1074. var ITERATOR$1 = wellKnownSymbol('iterator');
  1075. var KEYS = 'keys';
  1076. var VALUES = 'values';
  1077. var ENTRIES = 'entries';
  1078. var returnThis$1 = function () { return this; };
  1079. var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  1080. createIteratorConstructor(IteratorConstructor, NAME, next);
  1081. var getIterationMethod = function (KIND) {
  1082. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  1083. if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
  1084. switch (KIND) {
  1085. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  1086. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  1087. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  1088. } return function () { return new IteratorConstructor(this); };
  1089. };
  1090. var TO_STRING_TAG = NAME + ' Iterator';
  1091. var INCORRECT_VALUES_NAME = false;
  1092. var IterablePrototype = Iterable.prototype;
  1093. var nativeIterator = IterablePrototype[ITERATOR$1]
  1094. || IterablePrototype['@@iterator']
  1095. || DEFAULT && IterablePrototype[DEFAULT];
  1096. var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
  1097. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  1098. var CurrentIteratorPrototype, methods, KEY;
  1099. // fix native
  1100. if (anyNativeIterator) {
  1101. CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
  1102. if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
  1103. if ( objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
  1104. if (objectSetPrototypeOf) {
  1105. objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
  1106. } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
  1107. hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
  1108. }
  1109. }
  1110. // Set @@toStringTag to native iterators
  1111. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
  1112. }
  1113. }
  1114. // fix Array#{values, @@iterator}.name in V8 / FF
  1115. if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  1116. INCORRECT_VALUES_NAME = true;
  1117. defaultIterator = function values() { return nativeIterator.call(this); };
  1118. }
  1119. // define iterator
  1120. if ( IterablePrototype[ITERATOR$1] !== defaultIterator) {
  1121. hide(IterablePrototype, ITERATOR$1, defaultIterator);
  1122. }
  1123. // export additional methods
  1124. if (DEFAULT) {
  1125. methods = {
  1126. values: getIterationMethod(VALUES),
  1127. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  1128. entries: getIterationMethod(ENTRIES)
  1129. };
  1130. if (FORCED) for (KEY in methods) {
  1131. if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  1132. redefine(IterablePrototype, KEY, methods[KEY]);
  1133. }
  1134. } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
  1135. }
  1136. return methods;
  1137. };
  1138. var ARRAY_ITERATOR = 'Array Iterator';
  1139. var setInternalState$1 = internalState.set;
  1140. var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
  1141. // `Array.prototype.entries` method
  1142. // https://tc39.github.io/ecma262/#sec-array.prototype.entries
  1143. // `Array.prototype.keys` method
  1144. // https://tc39.github.io/ecma262/#sec-array.prototype.keys
  1145. // `Array.prototype.values` method
  1146. // https://tc39.github.io/ecma262/#sec-array.prototype.values
  1147. // `Array.prototype[@@iterator]` method
  1148. // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator
  1149. // `CreateArrayIterator` internal method
  1150. // https://tc39.github.io/ecma262/#sec-createarrayiterator
  1151. var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
  1152. setInternalState$1(this, {
  1153. type: ARRAY_ITERATOR,
  1154. target: toIndexedObject(iterated), // target
  1155. index: 0, // next index
  1156. kind: kind // kind
  1157. });
  1158. // `%ArrayIteratorPrototype%.next` method
  1159. // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next
  1160. }, function () {
  1161. var state = getInternalState$1(this);
  1162. var target = state.target;
  1163. var kind = state.kind;
  1164. var index = state.index++;
  1165. if (!target || index >= target.length) {
  1166. state.target = undefined;
  1167. return { value: undefined, done: true };
  1168. }
  1169. if (kind == 'keys') return { value: index, done: false };
  1170. if (kind == 'values') return { value: target[index], done: false };
  1171. return { value: [index, target[index]], done: false };
  1172. }, 'values');
  1173. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  1174. addToUnscopables('keys');
  1175. addToUnscopables('values');
  1176. addToUnscopables('entries');
  1177. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  1178. var method = [][METHOD_NAME];
  1179. return !method || !fails(function () {
  1180. // eslint-disable-next-line no-useless-call,no-throw-literal
  1181. method.call(null, argument || function () { throw 1; }, 1);
  1182. });
  1183. };
  1184. var nativeJoin = [].join;
  1185. var ES3_STRINGS = indexedObject != Object;
  1186. var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
  1187. // `Array.prototype.join` method
  1188. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  1189. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
  1190. join: function join(separator) {
  1191. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  1192. }
  1193. });
  1194. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  1195. // ES3 wrong here
  1196. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  1197. // fallback for IE11 Script Access Denied error
  1198. var tryGet = function (it, key) {
  1199. try {
  1200. return it[key];
  1201. } catch (error) { /* empty */ }
  1202. };
  1203. // getting tag from ES6+ `Object.prototype.toString`
  1204. var classof = function (it) {
  1205. var O, tag, result;
  1206. return it === undefined ? 'Undefined' : it === null ? 'Null'
  1207. // @@toStringTag case
  1208. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
  1209. // builtinTag case
  1210. : CORRECT_ARGUMENTS ? classofRaw(O)
  1211. // ES3 arguments fallback
  1212. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  1213. };
  1214. var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
  1215. var test = {};
  1216. test[TO_STRING_TAG$2] = 'z';
  1217. // `Object.prototype.toString` method implementation
  1218. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  1219. var objectToString = String(test) !== '[object z]' ? function toString() {
  1220. return '[object ' + classof(this) + ']';
  1221. } : test.toString;
  1222. var ObjectPrototype$2 = Object.prototype;
  1223. // `Object.prototype.toString` method
  1224. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  1225. if (objectToString !== ObjectPrototype$2.toString) {
  1226. redefine(ObjectPrototype$2, 'toString', objectToString, { unsafe: true });
  1227. }
  1228. // `String.prototype.{ codePointAt, at }` methods implementation
  1229. var createMethod$2 = function (CONVERT_TO_STRING) {
  1230. return function ($this, pos) {
  1231. var S = String(requireObjectCoercible($this));
  1232. var position = toInteger(pos);
  1233. var size = S.length;
  1234. var first, second;
  1235. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1236. first = S.charCodeAt(position);
  1237. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1238. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1239. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1240. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1241. };
  1242. };
  1243. var stringMultibyte = {
  1244. // `String.prototype.codePointAt` method
  1245. // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
  1246. codeAt: createMethod$2(false),
  1247. // `String.prototype.at` method
  1248. // https://github.com/mathiasbynens/String.prototype.at
  1249. charAt: createMethod$2(true)
  1250. };
  1251. var charAt = stringMultibyte.charAt;
  1252. var STRING_ITERATOR = 'String Iterator';
  1253. var setInternalState$2 = internalState.set;
  1254. var getInternalState$2 = internalState.getterFor(STRING_ITERATOR);
  1255. // `String.prototype[@@iterator]` method
  1256. // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator
  1257. defineIterator(String, 'String', function (iterated) {
  1258. setInternalState$2(this, {
  1259. type: STRING_ITERATOR,
  1260. string: String(iterated),
  1261. index: 0
  1262. });
  1263. // `%StringIteratorPrototype%.next` method
  1264. // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next
  1265. }, function next() {
  1266. var state = getInternalState$2(this);
  1267. var string = state.string;
  1268. var index = state.index;
  1269. var point;
  1270. if (index >= string.length) return { value: undefined, done: true };
  1271. point = charAt(string, index);
  1272. state.index += point.length;
  1273. return { value: point, done: false };
  1274. });
  1275. // iterable DOM collections
  1276. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1277. var domIterables = {
  1278. CSSRuleList: 0,
  1279. CSSStyleDeclaration: 0,
  1280. CSSValueList: 0,
  1281. ClientRectList: 0,
  1282. DOMRectList: 0,
  1283. DOMStringList: 0,
  1284. DOMTokenList: 1,
  1285. DataTransferItemList: 0,
  1286. FileList: 0,
  1287. HTMLAllCollection: 0,
  1288. HTMLCollection: 0,
  1289. HTMLFormElement: 0,
  1290. HTMLSelectElement: 0,
  1291. MediaList: 0,
  1292. MimeTypeArray: 0,
  1293. NamedNodeMap: 0,
  1294. NodeList: 1,
  1295. PaintRequestList: 0,
  1296. Plugin: 0,
  1297. PluginArray: 0,
  1298. SVGLengthList: 0,
  1299. SVGNumberList: 0,
  1300. SVGPathSegList: 0,
  1301. SVGPointList: 0,
  1302. SVGStringList: 0,
  1303. SVGTransformList: 0,
  1304. SourceBufferList: 0,
  1305. StyleSheetList: 0,
  1306. TextTrackCueList: 0,
  1307. TextTrackList: 0,
  1308. TouchList: 0
  1309. };
  1310. var ITERATOR$2 = wellKnownSymbol('iterator');
  1311. var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
  1312. var ArrayValues = es_array_iterator.values;
  1313. for (var COLLECTION_NAME in domIterables) {
  1314. var Collection = global_1[COLLECTION_NAME];
  1315. var CollectionPrototype = Collection && Collection.prototype;
  1316. if (CollectionPrototype) {
  1317. // some Chrome versions have non-configurable methods on DOMTokenList
  1318. if (CollectionPrototype[ITERATOR$2] !== ArrayValues) try {
  1319. hide(CollectionPrototype, ITERATOR$2, ArrayValues);
  1320. } catch (error) {
  1321. CollectionPrototype[ITERATOR$2] = ArrayValues;
  1322. }
  1323. if (!CollectionPrototype[TO_STRING_TAG$3]) hide(CollectionPrototype, TO_STRING_TAG$3, COLLECTION_NAME);
  1324. if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
  1325. // some Chrome versions have non-configurable methods on DOMTokenList
  1326. if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
  1327. hide(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
  1328. } catch (error) {
  1329. CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
  1330. }
  1331. }
  1332. }
  1333. }
  1334. function _classCallCheck(instance, Constructor) {
  1335. if (!(instance instanceof Constructor)) {
  1336. throw new TypeError("Cannot call a class as a function");
  1337. }
  1338. }
  1339. function _defineProperties(target, props) {
  1340. for (var i = 0; i < props.length; i++) {
  1341. var descriptor = props[i];
  1342. descriptor.enumerable = descriptor.enumerable || false;
  1343. descriptor.configurable = true;
  1344. if ("value" in descriptor) descriptor.writable = true;
  1345. Object.defineProperty(target, descriptor.key, descriptor);
  1346. }
  1347. }
  1348. function _createClass(Constructor, protoProps, staticProps) {
  1349. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1350. if (staticProps) _defineProperties(Constructor, staticProps);
  1351. return Constructor;
  1352. }
  1353. function _inherits(subClass, superClass) {
  1354. if (typeof superClass !== "function" && superClass !== null) {
  1355. throw new TypeError("Super expression must either be null or a function");
  1356. }
  1357. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1358. constructor: {
  1359. value: subClass,
  1360. writable: true,
  1361. configurable: true
  1362. }
  1363. });
  1364. if (superClass) _setPrototypeOf(subClass, superClass);
  1365. }
  1366. function _getPrototypeOf(o) {
  1367. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1368. return o.__proto__ || Object.getPrototypeOf(o);
  1369. };
  1370. return _getPrototypeOf(o);
  1371. }
  1372. function _setPrototypeOf(o, p) {
  1373. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1374. o.__proto__ = p;
  1375. return o;
  1376. };
  1377. return _setPrototypeOf(o, p);
  1378. }
  1379. function _assertThisInitialized(self) {
  1380. if (self === void 0) {
  1381. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1382. }
  1383. return self;
  1384. }
  1385. function _possibleConstructorReturn(self, call) {
  1386. if (call && (typeof call === "object" || typeof call === "function")) {
  1387. return call;
  1388. }
  1389. return _assertThisInitialized(self);
  1390. }
  1391. function _superPropBase(object, property) {
  1392. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1393. object = _getPrototypeOf(object);
  1394. if (object === null) break;
  1395. }
  1396. return object;
  1397. }
  1398. function _get(target, property, receiver) {
  1399. if (typeof Reflect !== "undefined" && Reflect.get) {
  1400. _get = Reflect.get;
  1401. } else {
  1402. _get = function _get(target, property, receiver) {
  1403. var base = _superPropBase(target, property);
  1404. if (!base) return;
  1405. var desc = Object.getOwnPropertyDescriptor(base, property);
  1406. if (desc.get) {
  1407. return desc.get.call(receiver);
  1408. }
  1409. return desc.value;
  1410. };
  1411. }
  1412. return _get(target, property, receiver || target);
  1413. }
  1414. /**
  1415. * @author: YL
  1416. * @update: zhixin wen <wenzhixin2010@gmail.com>
  1417. */
  1418. $.extend($.fn.bootstrapTable.defaults, {
  1419. treeEnable: false,
  1420. treeShowField: null,
  1421. idField: 'id',
  1422. parentIdField: 'pid',
  1423. rootParentId: null
  1424. });
  1425. $.BootstrapTable =
  1426. /*#__PURE__*/
  1427. function (_$$BootstrapTable) {
  1428. _inherits(_class, _$$BootstrapTable);
  1429. function _class() {
  1430. _classCallCheck(this, _class);
  1431. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  1432. }
  1433. _createClass(_class, [{
  1434. key: "init",
  1435. value: function init() {
  1436. var _get2;
  1437. this._rowStyle = this.options.rowStyle;
  1438. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1439. args[_key] = arguments[_key];
  1440. }
  1441. (_get2 = _get(_getPrototypeOf(_class.prototype), "init", this)).call.apply(_get2, [this].concat(args));
  1442. }
  1443. }, {
  1444. key: "initHeader",
  1445. value: function initHeader() {
  1446. var _get3;
  1447. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1448. args[_key2] = arguments[_key2];
  1449. }
  1450. (_get3 = _get(_getPrototypeOf(_class.prototype), "initHeader", this)).call.apply(_get3, [this].concat(args));
  1451. var treeShowField = this.options.treeShowField;
  1452. if (treeShowField) {
  1453. var _iteratorNormalCompletion = true;
  1454. var _didIteratorError = false;
  1455. var _iteratorError = undefined;
  1456. try {
  1457. for (var _iterator = this.header.fields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  1458. var field = _step.value;
  1459. if (treeShowField === field) {
  1460. this.treeEnable = true;
  1461. break;
  1462. }
  1463. }
  1464. } catch (err) {
  1465. _didIteratorError = true;
  1466. _iteratorError = err;
  1467. } finally {
  1468. try {
  1469. if (!_iteratorNormalCompletion && _iterator.return != null) {
  1470. _iterator.return();
  1471. }
  1472. } finally {
  1473. if (_didIteratorError) {
  1474. throw _iteratorError;
  1475. }
  1476. }
  1477. }
  1478. }
  1479. }
  1480. }, {
  1481. key: "initBody",
  1482. value: function initBody() {
  1483. var _get4;
  1484. this.options.virtualScroll = !this.treeEnable;
  1485. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  1486. args[_key3] = arguments[_key3];
  1487. }
  1488. (_get4 = _get(_getPrototypeOf(_class.prototype), "initBody", this)).call.apply(_get4, [this].concat(args));
  1489. }
  1490. }, {
  1491. key: "initTr",
  1492. value: function initTr(item, idx, data, parentDom) {
  1493. var _this = this;
  1494. var nodes = data.filter(function (it) {
  1495. return item[_this.options.idField] === it[_this.options.parentIdField];
  1496. });
  1497. parentDom.append(_get(_getPrototypeOf(_class.prototype), "initRow", this).call(this, item, idx, data, parentDom)); // init sub node
  1498. var len = nodes.length - 1;
  1499. for (var i = 0; i <= len; i++) {
  1500. var node = nodes[i];
  1501. var defaultItem = $.extend(true, {}, item);
  1502. node._level = defaultItem._level + 1;
  1503. node._parent = defaultItem;
  1504. if (i === len) {
  1505. node._last = 1;
  1506. } // jquery.treegrid.js
  1507. this.options.rowStyle = function (item, idx) {
  1508. var res = _this._rowStyle(item, idx);
  1509. var id = item[_this.options.idField] ? item[_this.options.idField] : 0;
  1510. var pid = item[_this.options.parentIdField] ? item[_this.options.parentIdField] : 0;
  1511. res.classes = [res.classes || '', "treegrid-".concat(id), "treegrid-parent-".concat(pid)].join(' ');
  1512. return res;
  1513. };
  1514. this.initTr(node, $.inArray(node, data), data, parentDom);
  1515. }
  1516. }
  1517. }, {
  1518. key: "initRow",
  1519. value: function initRow(item, idx, data, parentDom) {
  1520. var _this2 = this;
  1521. if (this.treeEnable) {
  1522. if (this.options.rootParentId === item[this.options.parentIdField] || !item[this.options.parentIdField]) {
  1523. if (item._level === undefined) {
  1524. item._level = 0;
  1525. } // jquery.treegrid.js
  1526. this.options.rowStyle = function (item, idx) {
  1527. var res = _this2._rowStyle(item, idx);
  1528. var x = item[_this2.options.idField] ? item[_this2.options.idField] : 0;
  1529. res.classes = [res.classes || '', "treegrid-".concat(x)].join(' ');
  1530. return res;
  1531. };
  1532. this.initTr(item, idx, data, parentDom);
  1533. return true;
  1534. }
  1535. return false;
  1536. }
  1537. return _get(_getPrototypeOf(_class.prototype), "initRow", this).call(this, item, idx, data, parentDom);
  1538. }
  1539. }]);
  1540. return _class;
  1541. }($.BootstrapTable);
  1542. }));