bootstrap-table-cookie.js 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900
  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 toString = {}.toString;
  8. var classofRaw = function (it) {
  9. return toString.call(it).slice(8, -1);
  10. };
  11. // `IsArray` abstract operation
  12. // https://tc39.github.io/ecma262/#sec-isarray
  13. var isArray = Array.isArray || function isArray(arg) {
  14. return classofRaw(arg) == 'Array';
  15. };
  16. var isObject = function (it) {
  17. return typeof it === 'object' ? it !== null : typeof it === 'function';
  18. };
  19. // `RequireObjectCoercible` abstract operation
  20. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  21. var requireObjectCoercible = function (it) {
  22. if (it == undefined) throw TypeError("Can't call method on " + it);
  23. return it;
  24. };
  25. // `ToObject` abstract operation
  26. // https://tc39.github.io/ecma262/#sec-toobject
  27. var toObject = function (argument) {
  28. return Object(requireObjectCoercible(argument));
  29. };
  30. var ceil = Math.ceil;
  31. var floor = Math.floor;
  32. // `ToInteger` abstract operation
  33. // https://tc39.github.io/ecma262/#sec-tointeger
  34. var toInteger = function (argument) {
  35. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  36. };
  37. var min = Math.min;
  38. // `ToLength` abstract operation
  39. // https://tc39.github.io/ecma262/#sec-tolength
  40. var toLength = function (argument) {
  41. return argument > 0 ? min(toInteger(argument), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  42. };
  43. // 7.1.1 ToPrimitive(input [, PreferredType])
  44. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  45. // and the second argument - flag - preferred type is a string
  46. var toPrimitive = function (it, S) {
  47. if (!isObject(it)) return it;
  48. var fn, val;
  49. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  50. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  51. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  52. throw TypeError("Can't convert object to primitive value");
  53. };
  54. var fails = function (exec) {
  55. try {
  56. return !!exec();
  57. } catch (e) {
  58. return true;
  59. }
  60. };
  61. // Thank's IE8 for his funny defineProperty
  62. var descriptors = !fails(function () {
  63. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  64. });
  65. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  66. var global = typeof window == 'object' && window && window.Math == Math ? window
  67. : typeof self == 'object' && self && self.Math == Math ? self
  68. // eslint-disable-next-line no-new-func
  69. : Function('return this')();
  70. var document$1 = global.document;
  71. // typeof document.createElement is 'object' in old IE
  72. var exist = isObject(document$1) && isObject(document$1.createElement);
  73. var documentCreateElement = function (it) {
  74. return exist ? document$1.createElement(it) : {};
  75. };
  76. // Thank's IE8 for his funny defineProperty
  77. var ie8DomDefine = !descriptors && !fails(function () {
  78. return Object.defineProperty(documentCreateElement('div'), 'a', {
  79. get: function () { return 7; }
  80. }).a != 7;
  81. });
  82. var anObject = function (it) {
  83. if (!isObject(it)) {
  84. throw TypeError(String(it) + ' is not an object');
  85. } return it;
  86. };
  87. var nativeDefineProperty = Object.defineProperty;
  88. var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  89. anObject(O);
  90. P = toPrimitive(P, true);
  91. anObject(Attributes);
  92. if (ie8DomDefine) try {
  93. return nativeDefineProperty(O, P, Attributes);
  94. } catch (e) { /* empty */ }
  95. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  96. if ('value' in Attributes) O[P] = Attributes.value;
  97. return O;
  98. };
  99. var objectDefineProperty = {
  100. f: f
  101. };
  102. var createPropertyDescriptor = function (bitmap, value) {
  103. return {
  104. enumerable: !(bitmap & 1),
  105. configurable: !(bitmap & 2),
  106. writable: !(bitmap & 4),
  107. value: value
  108. };
  109. };
  110. var createProperty = function (object, key, value) {
  111. var propertyKey = toPrimitive(key);
  112. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  113. else object[propertyKey] = value;
  114. };
  115. function createCommonjsModule(fn, module) {
  116. return module = { exports: {} }, fn(module, module.exports), module.exports;
  117. }
  118. var hide = descriptors ? function (object, key, value) {
  119. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  120. } : function (object, key, value) {
  121. object[key] = value;
  122. return object;
  123. };
  124. var setGlobal = function (key, value) {
  125. try {
  126. hide(global, key, value);
  127. } catch (e) {
  128. global[key] = value;
  129. } return value;
  130. };
  131. var shared = createCommonjsModule(function (module) {
  132. var SHARED = '__core-js_shared__';
  133. var store = global[SHARED] || setGlobal(SHARED, {});
  134. (module.exports = function (key, value) {
  135. return store[key] || (store[key] = value !== undefined ? value : {});
  136. })('versions', []).push({
  137. version: '3.0.0',
  138. mode: 'global',
  139. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  140. });
  141. });
  142. var id = 0;
  143. var postfix = Math.random();
  144. var uid = function (key) {
  145. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
  146. };
  147. // Chrome 38 Symbol has incorrect toString conversion
  148. var nativeSymbol = !fails(function () {
  149. });
  150. var store = shared('wks');
  151. var Symbol = global.Symbol;
  152. var wellKnownSymbol = function (name) {
  153. return store[name] || (store[name] = nativeSymbol && Symbol[name]
  154. || (nativeSymbol ? Symbol : uid)('Symbol.' + name));
  155. };
  156. var SPECIES = wellKnownSymbol('species');
  157. // `ArraySpeciesCreate` abstract operation
  158. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  159. var arraySpeciesCreate = function (originalArray, length) {
  160. var C;
  161. if (isArray(originalArray)) {
  162. C = originalArray.constructor;
  163. // cross-realm fallback
  164. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  165. else if (isObject(C)) {
  166. C = C[SPECIES];
  167. if (C === null) C = undefined;
  168. }
  169. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  170. };
  171. var SPECIES$1 = wellKnownSymbol('species');
  172. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  173. return !fails(function () {
  174. var array = [];
  175. var constructor = array.constructor = {};
  176. constructor[SPECIES$1] = function () {
  177. return { foo: 1 };
  178. };
  179. return array[METHOD_NAME](Boolean).foo !== 1;
  180. });
  181. };
  182. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  183. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  184. // Nashorn ~ JDK8 bug
  185. var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  186. var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  187. var descriptor = nativeGetOwnPropertyDescriptor(this, V);
  188. return !!descriptor && descriptor.enumerable;
  189. } : nativePropertyIsEnumerable;
  190. var objectPropertyIsEnumerable = {
  191. f: f$1
  192. };
  193. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  194. var split = ''.split;
  195. var indexedObject = fails(function () {
  196. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  197. // eslint-disable-next-line no-prototype-builtins
  198. return !Object('z').propertyIsEnumerable(0);
  199. }) ? function (it) {
  200. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  201. } : Object;
  202. // toObject with fallback for non-array-like ES3 strings
  203. var toIndexedObject = function (it) {
  204. return indexedObject(requireObjectCoercible(it));
  205. };
  206. var hasOwnProperty = {}.hasOwnProperty;
  207. var has = function (it, key) {
  208. return hasOwnProperty.call(it, key);
  209. };
  210. var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  211. var f$2 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
  212. O = toIndexedObject(O);
  213. P = toPrimitive(P, true);
  214. if (ie8DomDefine) try {
  215. return nativeGetOwnPropertyDescriptor$1(O, P);
  216. } catch (e) { /* empty */ }
  217. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  218. };
  219. var objectGetOwnPropertyDescriptor = {
  220. f: f$2
  221. };
  222. var functionToString = shared('native-function-to-string', Function.toString);
  223. var WeakMap = global.WeakMap;
  224. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
  225. var shared$1 = shared('keys');
  226. var sharedKey = function (key) {
  227. return shared$1[key] || (shared$1[key] = uid(key));
  228. };
  229. var hiddenKeys = {};
  230. var WeakMap$1 = global.WeakMap;
  231. var set, get, has$1;
  232. var enforce = function (it) {
  233. return has$1(it) ? get(it) : set(it, {});
  234. };
  235. var getterFor = function (TYPE) {
  236. return function (it) {
  237. var state;
  238. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  239. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  240. } return state;
  241. };
  242. };
  243. if (nativeWeakMap) {
  244. var store$1 = new WeakMap$1();
  245. var wmget = store$1.get;
  246. var wmhas = store$1.has;
  247. var wmset = store$1.set;
  248. set = function (it, metadata) {
  249. wmset.call(store$1, it, metadata);
  250. return metadata;
  251. };
  252. get = function (it) {
  253. return wmget.call(store$1, it) || {};
  254. };
  255. has$1 = function (it) {
  256. return wmhas.call(store$1, it);
  257. };
  258. } else {
  259. var STATE = sharedKey('state');
  260. hiddenKeys[STATE] = true;
  261. set = function (it, metadata) {
  262. hide(it, STATE, metadata);
  263. return metadata;
  264. };
  265. get = function (it) {
  266. return has(it, STATE) ? it[STATE] : {};
  267. };
  268. has$1 = function (it) {
  269. return has(it, STATE);
  270. };
  271. }
  272. var internalState = {
  273. set: set,
  274. get: get,
  275. has: has$1,
  276. enforce: enforce,
  277. getterFor: getterFor
  278. };
  279. var redefine = createCommonjsModule(function (module) {
  280. var getInternalState = internalState.get;
  281. var enforceInternalState = internalState.enforce;
  282. var TEMPLATE = String(functionToString).split('toString');
  283. shared('inspectSource', function (it) {
  284. return functionToString.call(it);
  285. });
  286. (module.exports = function (O, key, value, options) {
  287. var unsafe = options ? !!options.unsafe : false;
  288. var simple = options ? !!options.enumerable : false;
  289. var noTargetGet = options ? !!options.noTargetGet : false;
  290. if (typeof value == 'function') {
  291. if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
  292. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  293. }
  294. if (O === global) {
  295. if (simple) O[key] = value;
  296. else setGlobal(key, value);
  297. return;
  298. } else if (!unsafe) {
  299. delete O[key];
  300. } else if (!noTargetGet && O[key]) {
  301. simple = true;
  302. }
  303. if (simple) O[key] = value;
  304. else hide(O, key, value);
  305. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  306. })(Function.prototype, 'toString', function toString() {
  307. return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
  308. });
  309. });
  310. var max = Math.max;
  311. var min$1 = Math.min;
  312. // Helper for a popular repeating case of the spec:
  313. // Let integer be ? ToInteger(index).
  314. // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
  315. var toAbsoluteIndex = function (index, length) {
  316. var integer = toInteger(index);
  317. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  318. };
  319. // `Array.prototype.{ indexOf, includes }` methods implementation
  320. // false -> Array#indexOf
  321. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  322. // true -> Array#includes
  323. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  324. var arrayIncludes = function (IS_INCLUDES) {
  325. return function ($this, el, fromIndex) {
  326. var O = toIndexedObject($this);
  327. var length = toLength(O.length);
  328. var index = toAbsoluteIndex(fromIndex, length);
  329. var value;
  330. // Array#includes uses SameValueZero equality algorithm
  331. // eslint-disable-next-line no-self-compare
  332. if (IS_INCLUDES && el != el) while (length > index) {
  333. value = O[index++];
  334. // eslint-disable-next-line no-self-compare
  335. if (value != value) return true;
  336. // Array#indexOf ignores holes, Array#includes - not
  337. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  338. if (O[index] === el) return IS_INCLUDES || index || 0;
  339. } return !IS_INCLUDES && -1;
  340. };
  341. };
  342. var arrayIndexOf = arrayIncludes(false);
  343. var objectKeysInternal = function (object, names) {
  344. var O = toIndexedObject(object);
  345. var i = 0;
  346. var result = [];
  347. var key;
  348. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  349. // Don't enum bug & hidden keys
  350. while (names.length > i) if (has(O, key = names[i++])) {
  351. ~arrayIndexOf(result, key) || result.push(key);
  352. }
  353. return result;
  354. };
  355. // IE8- don't enum bug keys
  356. var enumBugKeys = [
  357. 'constructor',
  358. 'hasOwnProperty',
  359. 'isPrototypeOf',
  360. 'propertyIsEnumerable',
  361. 'toLocaleString',
  362. 'toString',
  363. 'valueOf'
  364. ];
  365. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  366. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  367. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  368. return objectKeysInternal(O, hiddenKeys$1);
  369. };
  370. var objectGetOwnPropertyNames = {
  371. f: f$3
  372. };
  373. var f$4 = Object.getOwnPropertySymbols;
  374. var objectGetOwnPropertySymbols = {
  375. f: f$4
  376. };
  377. var Reflect$1 = global.Reflect;
  378. // all object keys, includes non-enumerable and symbols
  379. var ownKeys = Reflect$1 && Reflect$1.ownKeys || function ownKeys(it) {
  380. var keys = objectGetOwnPropertyNames.f(anObject(it));
  381. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  382. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  383. };
  384. var copyConstructorProperties = function (target, source) {
  385. var keys = ownKeys(source);
  386. var defineProperty = objectDefineProperty.f;
  387. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  388. for (var i = 0; i < keys.length; i++) {
  389. var key = keys[i];
  390. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  391. }
  392. };
  393. var replacement = /#|\.prototype\./;
  394. var isForced = function (feature, detection) {
  395. var value = data[normalize(feature)];
  396. return value == POLYFILL ? true
  397. : value == NATIVE ? false
  398. : typeof detection == 'function' ? fails(detection)
  399. : !!detection;
  400. };
  401. var normalize = isForced.normalize = function (string) {
  402. return String(string).replace(replacement, '.').toLowerCase();
  403. };
  404. var data = isForced.data = {};
  405. var NATIVE = isForced.NATIVE = 'N';
  406. var POLYFILL = isForced.POLYFILL = 'P';
  407. var isForced_1 = isForced;
  408. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  409. /*
  410. options.target - name of the target object
  411. options.global - target is the global object
  412. options.stat - export as static methods of target
  413. options.proto - export as prototype methods of target
  414. options.real - real prototype method for the `pure` version
  415. options.forced - export even if the native feature is available
  416. options.bind - bind methods to the target, required for the `pure` version
  417. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  418. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  419. options.sham - add a flag to not completely full polyfills
  420. options.enumerable - export as enumerable property
  421. options.noTargetGet - prevent calling a getter on target
  422. */
  423. var _export = function (options, source) {
  424. var TARGET = options.target;
  425. var GLOBAL = options.global;
  426. var STATIC = options.stat;
  427. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  428. if (GLOBAL) {
  429. target = global;
  430. } else if (STATIC) {
  431. target = global[TARGET] || setGlobal(TARGET, {});
  432. } else {
  433. target = (global[TARGET] || {}).prototype;
  434. }
  435. if (target) for (key in source) {
  436. sourceProperty = source[key];
  437. if (options.noTargetGet) {
  438. descriptor = getOwnPropertyDescriptor(target, key);
  439. targetProperty = descriptor && descriptor.value;
  440. } else targetProperty = target[key];
  441. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  442. // contained in target
  443. if (!FORCED && targetProperty !== undefined) {
  444. if (typeof sourceProperty === typeof targetProperty) continue;
  445. copyConstructorProperties(sourceProperty, targetProperty);
  446. }
  447. // add a flag to not completely full polyfills
  448. if (options.sham || (targetProperty && targetProperty.sham)) {
  449. hide(sourceProperty, 'sham', true);
  450. }
  451. // extend global
  452. redefine(target, key, sourceProperty, options);
  453. }
  454. };
  455. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  456. var MAX_SAFE_INTEGER = 0x1fffffffffffff;
  457. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  458. var IS_CONCAT_SPREADABLE_SUPPORT = !fails(function () {
  459. var array = [];
  460. array[IS_CONCAT_SPREADABLE] = false;
  461. return array.concat()[0] !== array;
  462. });
  463. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  464. var isConcatSpreadable = function (O) {
  465. if (!isObject(O)) return false;
  466. var spreadable = O[IS_CONCAT_SPREADABLE];
  467. return spreadable !== undefined ? !!spreadable : isArray(O);
  468. };
  469. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  470. // `Array.prototype.concat` method
  471. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  472. // with adding support of @@isConcatSpreadable and @@species
  473. _export({ target: 'Array', proto: true, forced: FORCED }, {
  474. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  475. var O = toObject(this);
  476. var A = arraySpeciesCreate(O, 0);
  477. var n = 0;
  478. var i, k, length, len, E;
  479. for (i = -1, length = arguments.length; i < length; i++) {
  480. E = i === -1 ? O : arguments[i];
  481. if (isConcatSpreadable(E)) {
  482. len = toLength(E.length);
  483. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  484. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  485. } else {
  486. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  487. createProperty(A, n++, E);
  488. }
  489. }
  490. A.length = n;
  491. return A;
  492. }
  493. });
  494. var aFunction = function (it) {
  495. if (typeof it != 'function') {
  496. throw TypeError(String(it) + ' is not a function');
  497. } return it;
  498. };
  499. // optional / simple context binding
  500. var bindContext = function (fn, that, length) {
  501. aFunction(fn);
  502. if (that === undefined) return fn;
  503. switch (length) {
  504. case 0: return function () {
  505. return fn.call(that);
  506. };
  507. case 1: return function (a) {
  508. return fn.call(that, a);
  509. };
  510. case 2: return function (a, b) {
  511. return fn.call(that, a, b);
  512. };
  513. case 3: return function (a, b, c) {
  514. return fn.call(that, a, b, c);
  515. };
  516. }
  517. return function (/* ...args */) {
  518. return fn.apply(that, arguments);
  519. };
  520. };
  521. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  522. // 0 -> Array#forEach
  523. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  524. // 1 -> Array#map
  525. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  526. // 2 -> Array#filter
  527. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  528. // 3 -> Array#some
  529. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  530. // 4 -> Array#every
  531. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  532. // 5 -> Array#find
  533. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  534. // 6 -> Array#findIndex
  535. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  536. var arrayMethods = function (TYPE, specificCreate) {
  537. var IS_MAP = TYPE == 1;
  538. var IS_FILTER = TYPE == 2;
  539. var IS_SOME = TYPE == 3;
  540. var IS_EVERY = TYPE == 4;
  541. var IS_FIND_INDEX = TYPE == 6;
  542. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  543. var create = specificCreate || arraySpeciesCreate;
  544. return function ($this, callbackfn, that) {
  545. var O = toObject($this);
  546. var self = indexedObject(O);
  547. var boundFunction = bindContext(callbackfn, that, 3);
  548. var length = toLength(self.length);
  549. var index = 0;
  550. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  551. var value, result;
  552. for (;length > index; index++) if (NO_HOLES || index in self) {
  553. value = self[index];
  554. result = boundFunction(value, index, O);
  555. if (TYPE) {
  556. if (IS_MAP) target[index] = result; // map
  557. else if (result) switch (TYPE) {
  558. case 3: return true; // some
  559. case 5: return value; // find
  560. case 6: return index; // findIndex
  561. case 2: target.push(value); // filter
  562. } else if (IS_EVERY) return false; // every
  563. }
  564. }
  565. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  566. };
  567. };
  568. var internalFilter = arrayMethods(2);
  569. var SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('filter');
  570. // `Array.prototype.filter` method
  571. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  572. // with adding support of @@species
  573. _export({ target: 'Array', proto: true, forced: !SPECIES_SUPPORT$1 }, {
  574. filter: function filter(callbackfn /* , thisArg */) {
  575. return internalFilter(this, callbackfn, arguments[1]);
  576. }
  577. });
  578. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  579. var objectKeys = Object.keys || function keys(O) {
  580. return objectKeysInternal(O, enumBugKeys);
  581. };
  582. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  583. anObject(O);
  584. var keys = objectKeys(Properties);
  585. var length = keys.length;
  586. var i = 0;
  587. var key;
  588. while (length > i) objectDefineProperty.f(O, key = keys[i++], Properties[key]);
  589. return O;
  590. };
  591. var document$2 = global.document;
  592. var html = document$2 && document$2.documentElement;
  593. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  594. var IE_PROTO = sharedKey('IE_PROTO');
  595. var PROTOTYPE = 'prototype';
  596. var Empty = function () { /* empty */ };
  597. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  598. var createDict = function () {
  599. // Thrash, waste and sodomy: IE GC bug
  600. var iframe = documentCreateElement('iframe');
  601. var length = enumBugKeys.length;
  602. var lt = '<';
  603. var script = 'script';
  604. var gt = '>';
  605. var js = 'java' + script + ':';
  606. var iframeDocument;
  607. iframe.style.display = 'none';
  608. html.appendChild(iframe);
  609. iframe.src = String(js);
  610. iframeDocument = iframe.contentWindow.document;
  611. iframeDocument.open();
  612. iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
  613. iframeDocument.close();
  614. createDict = iframeDocument.F;
  615. while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
  616. return createDict();
  617. };
  618. var objectCreate = Object.create || function create(O, Properties) {
  619. var result;
  620. if (O !== null) {
  621. Empty[PROTOTYPE] = anObject(O);
  622. result = new Empty();
  623. Empty[PROTOTYPE] = null;
  624. // add "__proto__" for Object.getPrototypeOf polyfill
  625. result[IE_PROTO] = O;
  626. } else result = createDict();
  627. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  628. };
  629. hiddenKeys[IE_PROTO] = true;
  630. var UNSCOPABLES = wellKnownSymbol('unscopables');
  631. var ArrayPrototype = Array.prototype;
  632. // Array.prototype[@@unscopables]
  633. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  634. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  635. hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
  636. }
  637. // add a key to Array.prototype[@@unscopables]
  638. var addToUnscopables = function (key) {
  639. ArrayPrototype[UNSCOPABLES][key] = true;
  640. };
  641. var internalFind = arrayMethods(5);
  642. var FIND = 'find';
  643. var SKIPS_HOLES = true;
  644. // Shouldn't skip holes
  645. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  646. // `Array.prototype.find` method
  647. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  648. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  649. find: function find(callbackfn /* , that = undefined */) {
  650. return internalFind(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  651. }
  652. });
  653. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  654. addToUnscopables(FIND);
  655. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  656. var method = [][METHOD_NAME];
  657. return !method || !fails(function () {
  658. // eslint-disable-next-line no-useless-call
  659. method.call(null, argument || function () { throw Error(); }, 1);
  660. });
  661. };
  662. var nativeJoin = [].join;
  663. var ES3_STRINGS = indexedObject != Object;
  664. var SLOPPY_METHOD = sloppyArrayMethod('join', ',');
  665. // `Array.prototype.join` method
  666. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  667. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD }, {
  668. join: function join(separator) {
  669. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  670. }
  671. });
  672. // CONVERT_TO_STRING: true -> String#at
  673. // CONVERT_TO_STRING: false -> String#codePointAt
  674. var stringAt = function (that, pos, CONVERT_TO_STRING) {
  675. var S = String(requireObjectCoercible(that));
  676. var position = toInteger(pos);
  677. var size = S.length;
  678. var first, second;
  679. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  680. first = S.charCodeAt(position);
  681. return first < 0xd800 || first > 0xdbff || position + 1 === size
  682. || (second = S.charCodeAt(position + 1)) < 0xdc00 || second > 0xdfff
  683. ? CONVERT_TO_STRING ? S.charAt(position) : first
  684. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xd800 << 10) + (second - 0xdc00) + 0x10000;
  685. };
  686. // `AdvanceStringIndex` abstract operation
  687. // https://tc39.github.io/ecma262/#sec-advancestringindex
  688. var advanceStringIndex = function (S, index, unicode) {
  689. return index + (unicode ? stringAt(S, index, true).length : 1);
  690. };
  691. // `RegExp.prototype.flags` getter implementation
  692. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  693. var regexpFlags = function () {
  694. var that = anObject(this);
  695. var result = '';
  696. if (that.global) result += 'g';
  697. if (that.ignoreCase) result += 'i';
  698. if (that.multiline) result += 'm';
  699. if (that.unicode) result += 'u';
  700. if (that.sticky) result += 'y';
  701. return result;
  702. };
  703. var nativeExec = RegExp.prototype.exec;
  704. // This always refers to the native implementation, because the
  705. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  706. // which loads this file before patching the method.
  707. var nativeReplace = String.prototype.replace;
  708. var patchedExec = nativeExec;
  709. var UPDATES_LAST_INDEX_WRONG = (function () {
  710. var re1 = /a/;
  711. var re2 = /b*/g;
  712. nativeExec.call(re1, 'a');
  713. nativeExec.call(re2, 'a');
  714. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  715. })();
  716. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  717. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  718. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
  719. if (PATCH) {
  720. patchedExec = function exec(str) {
  721. var re = this;
  722. var lastIndex, reCopy, match, i;
  723. if (NPCG_INCLUDED) {
  724. reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
  725. }
  726. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  727. match = nativeExec.call(re, str);
  728. if (UPDATES_LAST_INDEX_WRONG && match) {
  729. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  730. }
  731. if (NPCG_INCLUDED && match && match.length > 1) {
  732. // Fix browsers whose `exec` methods don't consistently return `undefined`
  733. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  734. nativeReplace.call(match[0], reCopy, function () {
  735. for (i = 1; i < arguments.length - 2; i++) {
  736. if (arguments[i] === undefined) match[i] = undefined;
  737. }
  738. });
  739. }
  740. return match;
  741. };
  742. }
  743. var regexpExec = patchedExec;
  744. // `RegExpExec` abstract operation
  745. // https://tc39.github.io/ecma262/#sec-regexpexec
  746. var regexpExecAbstract = function (R, S) {
  747. var exec = R.exec;
  748. if (typeof exec === 'function') {
  749. var result = exec.call(R, S);
  750. if (typeof result !== 'object') {
  751. throw TypeError('RegExp exec method returned something other than an Object or null');
  752. }
  753. return result;
  754. }
  755. if (classofRaw(R) !== 'RegExp') {
  756. throw TypeError('RegExp#exec called on incompatible receiver');
  757. }
  758. return regexpExec.call(R, S);
  759. };
  760. var SPECIES$2 = wellKnownSymbol('species');
  761. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  762. // #replace needs built-in support for named groups.
  763. // #match works fine because it just return the exec results, even if it has
  764. // a "grops" property.
  765. var re = /./;
  766. re.exec = function () {
  767. var result = [];
  768. result.groups = { a: '7' };
  769. return result;
  770. };
  771. return ''.replace(re, '$<a>') !== '7';
  772. });
  773. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  774. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  775. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  776. var re = /(?:)/;
  777. var originalExec = re.exec;
  778. re.exec = function () { return originalExec.apply(this, arguments); };
  779. var result = 'ab'.split(re);
  780. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  781. });
  782. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  783. var SYMBOL = wellKnownSymbol(KEY);
  784. var DELEGATES_TO_SYMBOL = !fails(function () {
  785. // String methods call symbol-named RegEp methods
  786. var O = {};
  787. O[SYMBOL] = function () { return 7; };
  788. return ''[KEY](O) != 7;
  789. });
  790. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  791. // Symbol-named RegExp methods call .exec
  792. var execCalled = false;
  793. var re = /a/;
  794. re.exec = function () { execCalled = true; return null; };
  795. if (KEY === 'split') {
  796. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  797. // a new one. We need to return the patched regex when creating the new one.
  798. re.constructor = {};
  799. re.constructor[SPECIES$2] = function () { return re; };
  800. }
  801. re[SYMBOL]('');
  802. return !execCalled;
  803. });
  804. if (
  805. !DELEGATES_TO_SYMBOL ||
  806. !DELEGATES_TO_EXEC ||
  807. (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||
  808. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  809. ) {
  810. var nativeRegExpMethod = /./[SYMBOL];
  811. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  812. if (regexp.exec === regexpExec) {
  813. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  814. // The native String method already delegates to @@method (this
  815. // polyfilled function), leasing to infinite recursion.
  816. // We avoid it by directly calling the native @@method method.
  817. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  818. }
  819. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  820. }
  821. return { done: false };
  822. });
  823. var stringMethod = methods[0];
  824. var regexMethod = methods[1];
  825. redefine(String.prototype, KEY, stringMethod);
  826. redefine(RegExp.prototype, SYMBOL, length == 2
  827. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  828. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  829. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  830. // 21.2.5.6 RegExp.prototype[@@match](string)
  831. // 21.2.5.9 RegExp.prototype[@@search](string)
  832. : function (string) { return regexMethod.call(string, this); }
  833. );
  834. if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true);
  835. }
  836. };
  837. var max$1 = Math.max;
  838. var min$2 = Math.min;
  839. var floor$1 = Math.floor;
  840. var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
  841. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
  842. var maybeToString = function (it) {
  843. return it === undefined ? it : String(it);
  844. };
  845. // @@replace logic
  846. fixRegexpWellKnownSymbolLogic(
  847. 'replace',
  848. 2,
  849. function (REPLACE, nativeReplace, maybeCallNative) {
  850. return [
  851. // `String.prototype.replace` method
  852. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  853. function replace(searchValue, replaceValue) {
  854. var O = requireObjectCoercible(this);
  855. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  856. return replacer !== undefined
  857. ? replacer.call(searchValue, O, replaceValue)
  858. : nativeReplace.call(String(O), searchValue, replaceValue);
  859. },
  860. // `RegExp.prototype[@@replace]` method
  861. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  862. function (regexp, replaceValue) {
  863. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  864. if (res.done) return res.value;
  865. var rx = anObject(regexp);
  866. var S = String(this);
  867. var functionalReplace = typeof replaceValue === 'function';
  868. if (!functionalReplace) replaceValue = String(replaceValue);
  869. var global = rx.global;
  870. if (global) {
  871. var fullUnicode = rx.unicode;
  872. rx.lastIndex = 0;
  873. }
  874. var results = [];
  875. while (true) {
  876. var result = regexpExecAbstract(rx, S);
  877. if (result === null) break;
  878. results.push(result);
  879. if (!global) break;
  880. var matchStr = String(result[0]);
  881. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  882. }
  883. var accumulatedResult = '';
  884. var nextSourcePosition = 0;
  885. for (var i = 0; i < results.length; i++) {
  886. result = results[i];
  887. var matched = String(result[0]);
  888. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  889. var captures = [];
  890. // NOTE: This is equivalent to
  891. // captures = result.slice(1).map(maybeToString)
  892. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  893. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  894. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  895. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  896. var namedCaptures = result.groups;
  897. if (functionalReplace) {
  898. var replacerArgs = [matched].concat(captures, position, S);
  899. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  900. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  901. } else {
  902. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  903. }
  904. if (position >= nextSourcePosition) {
  905. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  906. nextSourcePosition = position + matched.length;
  907. }
  908. }
  909. return accumulatedResult + S.slice(nextSourcePosition);
  910. }
  911. ];
  912. // https://tc39.github.io/ecma262/#sec-getsubstitution
  913. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  914. var tailPos = position + matched.length;
  915. var m = captures.length;
  916. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  917. if (namedCaptures !== undefined) {
  918. namedCaptures = toObject(namedCaptures);
  919. symbols = SUBSTITUTION_SYMBOLS;
  920. }
  921. return nativeReplace.call(replacement, symbols, function (match, ch) {
  922. var capture;
  923. switch (ch.charAt(0)) {
  924. case '$': return '$';
  925. case '&': return matched;
  926. case '`': return str.slice(0, position);
  927. case "'": return str.slice(tailPos);
  928. case '<':
  929. capture = namedCaptures[ch.slice(1, -1)];
  930. break;
  931. default: // \d\d?
  932. var n = +ch;
  933. if (n === 0) return match;
  934. if (n > m) {
  935. var f = floor$1(n / 10);
  936. if (f === 0) return match;
  937. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  938. return match;
  939. }
  940. capture = captures[n - 1];
  941. }
  942. return capture === undefined ? '' : capture;
  943. });
  944. }
  945. }
  946. );
  947. // `SameValue` abstract operation
  948. // https://tc39.github.io/ecma262/#sec-samevalue
  949. var sameValue = Object.is || function is(x, y) {
  950. // eslint-disable-next-line no-self-compare
  951. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  952. };
  953. // @@search logic
  954. fixRegexpWellKnownSymbolLogic(
  955. 'search',
  956. 1,
  957. function (SEARCH, nativeSearch, maybeCallNative) {
  958. return [
  959. // `String.prototype.search` method
  960. // https://tc39.github.io/ecma262/#sec-string.prototype.search
  961. function search(regexp) {
  962. var O = requireObjectCoercible(this);
  963. var searcher = regexp == undefined ? undefined : regexp[SEARCH];
  964. return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
  965. },
  966. // `RegExp.prototype[@@search]` method
  967. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
  968. function (regexp) {
  969. var res = maybeCallNative(nativeSearch, regexp, this);
  970. if (res.done) return res.value;
  971. var rx = anObject(regexp);
  972. var S = String(this);
  973. var previousLastIndex = rx.lastIndex;
  974. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  975. var result = regexpExecAbstract(rx, S);
  976. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  977. return result === null ? -1 : result.index;
  978. }
  979. ];
  980. }
  981. );
  982. var MATCH = wellKnownSymbol('match');
  983. // `IsRegExp` abstract operation
  984. // https://tc39.github.io/ecma262/#sec-isregexp
  985. var isRegexp = function (it) {
  986. var isRegExp;
  987. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  988. };
  989. var SPECIES$3 = wellKnownSymbol('species');
  990. // `SpeciesConstructor` abstract operation
  991. // https://tc39.github.io/ecma262/#sec-speciesconstructor
  992. var speciesConstructor = function (O, defaultConstructor) {
  993. var C = anObject(O).constructor;
  994. var S;
  995. return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction(S);
  996. };
  997. var arrayPush = [].push;
  998. var min$3 = Math.min;
  999. var MAX_UINT32 = 0xffffffff;
  1000. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1001. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1002. // @@split logic
  1003. fixRegexpWellKnownSymbolLogic(
  1004. 'split',
  1005. 2,
  1006. function (SPLIT, nativeSplit, maybeCallNative) {
  1007. var internalSplit;
  1008. if (
  1009. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1010. 'test'.split(/(?:)/, -1).length != 4 ||
  1011. 'ab'.split(/(?:ab)*/).length != 2 ||
  1012. '.'.split(/(.?)(.?)/).length != 4 ||
  1013. '.'.split(/()()/).length > 1 ||
  1014. ''.split(/.?/).length
  1015. ) {
  1016. // based on es5-shim implementation, need to rework it
  1017. internalSplit = function (separator, limit) {
  1018. var string = String(requireObjectCoercible(this));
  1019. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1020. if (lim === 0) return [];
  1021. if (separator === undefined) return [string];
  1022. // If `separator` is not a regex, use native split
  1023. if (!isRegexp(separator)) {
  1024. return nativeSplit.call(string, separator, lim);
  1025. }
  1026. var output = [];
  1027. var flags = (separator.ignoreCase ? 'i' : '') +
  1028. (separator.multiline ? 'm' : '') +
  1029. (separator.unicode ? 'u' : '') +
  1030. (separator.sticky ? 'y' : '');
  1031. var lastLastIndex = 0;
  1032. // Make `global` and avoid `lastIndex` issues by working with a copy
  1033. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1034. var match, lastIndex, lastLength;
  1035. while (match = regexpExec.call(separatorCopy, string)) {
  1036. lastIndex = separatorCopy.lastIndex;
  1037. if (lastIndex > lastLastIndex) {
  1038. output.push(string.slice(lastLastIndex, match.index));
  1039. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1040. lastLength = match[0].length;
  1041. lastLastIndex = lastIndex;
  1042. if (output.length >= lim) break;
  1043. }
  1044. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1045. }
  1046. if (lastLastIndex === string.length) {
  1047. if (lastLength || !separatorCopy.test('')) output.push('');
  1048. } else output.push(string.slice(lastLastIndex));
  1049. return output.length > lim ? output.slice(0, lim) : output;
  1050. };
  1051. // Chakra, V8
  1052. } else if ('0'.split(undefined, 0).length) {
  1053. internalSplit = function (separator, limit) {
  1054. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1055. };
  1056. } else internalSplit = nativeSplit;
  1057. return [
  1058. // `String.prototype.split` method
  1059. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  1060. function split(separator, limit) {
  1061. var O = requireObjectCoercible(this);
  1062. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1063. return splitter !== undefined
  1064. ? splitter.call(separator, O, limit)
  1065. : internalSplit.call(String(O), separator, limit);
  1066. },
  1067. // `RegExp.prototype[@@split]` method
  1068. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  1069. //
  1070. // NOTE: This cannot be properly polyfilled in engines that don't support
  1071. // the 'y' flag.
  1072. function (regexp, limit) {
  1073. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1074. if (res.done) return res.value;
  1075. var rx = anObject(regexp);
  1076. var S = String(this);
  1077. var C = speciesConstructor(rx, RegExp);
  1078. var unicodeMatching = rx.unicode;
  1079. var flags = (rx.ignoreCase ? 'i' : '') +
  1080. (rx.multiline ? 'm' : '') +
  1081. (rx.unicode ? 'u' : '') +
  1082. (SUPPORTS_Y ? 'y' : 'g');
  1083. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1084. // simulate the 'y' flag.
  1085. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1086. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1087. if (lim === 0) return [];
  1088. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1089. var p = 0;
  1090. var q = 0;
  1091. var A = [];
  1092. while (q < S.length) {
  1093. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1094. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1095. var e;
  1096. if (
  1097. z === null ||
  1098. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1099. ) {
  1100. q = advanceStringIndex(S, q, unicodeMatching);
  1101. } else {
  1102. A.push(S.slice(p, q));
  1103. if (A.length === lim) return A;
  1104. for (var i = 1; i <= z.length - 1; i++) {
  1105. A.push(z[i]);
  1106. if (A.length === lim) return A;
  1107. }
  1108. q = p = e;
  1109. }
  1110. }
  1111. A.push(S.slice(p));
  1112. return A;
  1113. }
  1114. ];
  1115. },
  1116. !SUPPORTS_Y
  1117. );
  1118. function _classCallCheck(instance, Constructor) {
  1119. if (!(instance instanceof Constructor)) {
  1120. throw new TypeError("Cannot call a class as a function");
  1121. }
  1122. }
  1123. function _defineProperties(target, props) {
  1124. for (var i = 0; i < props.length; i++) {
  1125. var descriptor = props[i];
  1126. descriptor.enumerable = descriptor.enumerable || false;
  1127. descriptor.configurable = true;
  1128. if ("value" in descriptor) descriptor.writable = true;
  1129. Object.defineProperty(target, descriptor.key, descriptor);
  1130. }
  1131. }
  1132. function _createClass(Constructor, protoProps, staticProps) {
  1133. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1134. if (staticProps) _defineProperties(Constructor, staticProps);
  1135. return Constructor;
  1136. }
  1137. function _inherits(subClass, superClass) {
  1138. if (typeof superClass !== "function" && superClass !== null) {
  1139. throw new TypeError("Super expression must either be null or a function");
  1140. }
  1141. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1142. constructor: {
  1143. value: subClass,
  1144. writable: true,
  1145. configurable: true
  1146. }
  1147. });
  1148. if (superClass) _setPrototypeOf(subClass, superClass);
  1149. }
  1150. function _getPrototypeOf(o) {
  1151. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1152. return o.__proto__ || Object.getPrototypeOf(o);
  1153. };
  1154. return _getPrototypeOf(o);
  1155. }
  1156. function _setPrototypeOf(o, p) {
  1157. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1158. o.__proto__ = p;
  1159. return o;
  1160. };
  1161. return _setPrototypeOf(o, p);
  1162. }
  1163. function _assertThisInitialized(self) {
  1164. if (self === void 0) {
  1165. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1166. }
  1167. return self;
  1168. }
  1169. function _possibleConstructorReturn(self, call) {
  1170. if (call && (typeof call === "object" || typeof call === "function")) {
  1171. return call;
  1172. }
  1173. return _assertThisInitialized(self);
  1174. }
  1175. function _superPropBase(object, property) {
  1176. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1177. object = _getPrototypeOf(object);
  1178. if (object === null) break;
  1179. }
  1180. return object;
  1181. }
  1182. function _get(target, property, receiver) {
  1183. if (typeof Reflect !== "undefined" && Reflect.get) {
  1184. _get = Reflect.get;
  1185. } else {
  1186. _get = function _get(target, property, receiver) {
  1187. var base = _superPropBase(target, property);
  1188. if (!base) return;
  1189. var desc = Object.getOwnPropertyDescriptor(base, property);
  1190. if (desc.get) {
  1191. return desc.get.call(receiver);
  1192. }
  1193. return desc.value;
  1194. };
  1195. }
  1196. return _get(target, property, receiver || target);
  1197. }
  1198. /**
  1199. * @author: Dennis Hernández
  1200. * @webSite: http://djhvscf.github.io/Blog
  1201. * @update zhixin wen <wenzhixin2010@gmail.com>
  1202. */
  1203. var UtilsCookie = {
  1204. cookieIds: {
  1205. sortOrder: 'bs.table.sortOrder',
  1206. sortName: 'bs.table.sortName',
  1207. pageNumber: 'bs.table.pageNumber',
  1208. pageList: 'bs.table.pageList',
  1209. columns: 'bs.table.columns',
  1210. searchText: 'bs.table.searchText',
  1211. filterControl: 'bs.table.filterControl',
  1212. filterBy: 'bs.table.filterBy'
  1213. },
  1214. getCurrentHeader: function getCurrentHeader(that) {
  1215. var header = that.$header;
  1216. if (that.options.height) {
  1217. header = that.$tableHeader;
  1218. }
  1219. return header;
  1220. },
  1221. getCurrentSearchControls: function getCurrentSearchControls(that) {
  1222. var searchControls = 'select, input';
  1223. if (that.options.height) {
  1224. searchControls = 'table select, table input';
  1225. }
  1226. return searchControls;
  1227. },
  1228. cookieEnabled: function cookieEnabled() {
  1229. return !!navigator.cookieEnabled;
  1230. },
  1231. inArrayCookiesEnabled: function inArrayCookiesEnabled(cookieName, cookiesEnabled) {
  1232. var index = -1;
  1233. for (var i = 0; i < cookiesEnabled.length; i++) {
  1234. if (cookieName.toLowerCase() === cookiesEnabled[i].toLowerCase()) {
  1235. index = i;
  1236. break;
  1237. }
  1238. }
  1239. return index;
  1240. },
  1241. setCookie: function setCookie(that, cookieName, cookieValue) {
  1242. if (!that.options.cookie || !UtilsCookie.cookieEnabled() || that.options.cookieIdTable === '') {
  1243. return;
  1244. }
  1245. if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
  1246. return;
  1247. }
  1248. cookieName = "".concat(that.options.cookieIdTable, ".").concat(cookieName);
  1249. switch (that.options.cookieStorage) {
  1250. case 'cookieStorage':
  1251. document.cookie = [cookieName, '=', encodeURIComponent(cookieValue), "; expires=".concat(UtilsCookie.calculateExpiration(that.options.cookieExpire)), that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : '', that.options.cookieSecure ? '; secure' : ''].join('');
  1252. break;
  1253. case 'localStorage':
  1254. localStorage.setItem(cookieName, cookieValue);
  1255. break;
  1256. case 'sessionStorage':
  1257. sessionStorage.setItem(cookieName, cookieValue);
  1258. break;
  1259. default:
  1260. return false;
  1261. }
  1262. return true;
  1263. },
  1264. getCookie: function getCookie(that, tableName, cookieName) {
  1265. if (!cookieName) {
  1266. return null;
  1267. }
  1268. if (UtilsCookie.inArrayCookiesEnabled(cookieName, that.options.cookiesEnabled) === -1) {
  1269. return null;
  1270. }
  1271. cookieName = "".concat(tableName, ".").concat(cookieName);
  1272. switch (that.options.cookieStorage) {
  1273. case 'cookieStorage':
  1274. var value = "; ".concat(document.cookie);
  1275. var parts = value.split("; ".concat(cookieName, "="));
  1276. return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null;
  1277. case 'localStorage':
  1278. return localStorage.getItem(cookieName);
  1279. case 'sessionStorage':
  1280. return sessionStorage.getItem(cookieName);
  1281. default:
  1282. return null;
  1283. }
  1284. },
  1285. deleteCookie: function deleteCookie(that, tableName, cookieName) {
  1286. cookieName = "".concat(tableName, ".").concat(cookieName);
  1287. switch (that.options.cookieStorage) {
  1288. case 'cookieStorage':
  1289. document.cookie = [encodeURIComponent(cookieName), '=', '; expires=Thu, 01 Jan 1970 00:00:00 GMT', that.options.cookiePath ? "; path=".concat(that.options.cookiePath) : '', that.options.cookieDomain ? "; domain=".concat(that.options.cookieDomain) : ''].join('');
  1290. break;
  1291. case 'localStorage':
  1292. localStorage.removeItem(cookieName);
  1293. break;
  1294. case 'sessionStorage':
  1295. sessionStorage.removeItem(cookieName);
  1296. break;
  1297. default:
  1298. return false;
  1299. }
  1300. return true;
  1301. },
  1302. calculateExpiration: function calculateExpiration(cookieExpire) {
  1303. var time = cookieExpire.replace(/[0-9]*/, ''); // s,mi,h,d,m,y
  1304. cookieExpire = cookieExpire.replace(/[A-Za-z]{1,2}/, ''); // number
  1305. switch (time.toLowerCase()) {
  1306. case 's':
  1307. cookieExpire = +cookieExpire;
  1308. break;
  1309. case 'mi':
  1310. cookieExpire *= 60;
  1311. break;
  1312. case 'h':
  1313. cookieExpire = cookieExpire * 60 * 60;
  1314. break;
  1315. case 'd':
  1316. cookieExpire = cookieExpire * 24 * 60 * 60;
  1317. break;
  1318. case 'm':
  1319. cookieExpire = cookieExpire * 30 * 24 * 60 * 60;
  1320. break;
  1321. case 'y':
  1322. cookieExpire = cookieExpire * 365 * 24 * 60 * 60;
  1323. break;
  1324. default:
  1325. cookieExpire = undefined;
  1326. break;
  1327. }
  1328. if (!cookieExpire) {
  1329. return '';
  1330. }
  1331. var d = new Date();
  1332. d.setTime(d.getTime() + cookieExpire * 1000);
  1333. return d.toGMTString();
  1334. },
  1335. initCookieFilters: function initCookieFilters(bootstrapTable) {
  1336. setTimeout(function () {
  1337. var parsedCookieFilters = JSON.parse(UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
  1338. if (!bootstrapTable.options.filterControlValuesLoaded && parsedCookieFilters) {
  1339. var cachedFilters = {};
  1340. var header = UtilsCookie.getCurrentHeader(bootstrapTable);
  1341. var searchControls = UtilsCookie.getCurrentSearchControls(bootstrapTable);
  1342. var applyCookieFilters = function applyCookieFilters(element, filteredCookies) {
  1343. $(filteredCookies).each(function (i, cookie) {
  1344. if (cookie.text !== '') {
  1345. $(element).val(cookie.text);
  1346. cachedFilters[cookie.field] = cookie.text;
  1347. }
  1348. });
  1349. };
  1350. header.find(searchControls).each(function () {
  1351. var field = $(this).closest('[data-field]').data('field');
  1352. var filteredCookies = parsedCookieFilters.filter(function (cookie) {
  1353. return cookie.field === field;
  1354. });
  1355. applyCookieFilters(this, filteredCookies);
  1356. });
  1357. bootstrapTable.initColumnSearch(cachedFilters);
  1358. bootstrapTable.options.filterControlValuesLoaded = true;
  1359. bootstrapTable.initServer();
  1360. }
  1361. }, 250);
  1362. }
  1363. };
  1364. $.extend($.fn.bootstrapTable.defaults, {
  1365. cookie: false,
  1366. cookieExpire: '2h',
  1367. cookiePath: null,
  1368. cookieDomain: null,
  1369. cookieSecure: null,
  1370. cookieIdTable: '',
  1371. cookiesEnabled: ['bs.table.sortOrder', 'bs.table.sortName', 'bs.table.pageNumber', 'bs.table.pageList', 'bs.table.columns', 'bs.table.searchText', 'bs.table.filterControl', 'bs.table.filterBy'],
  1372. cookieStorage: 'cookieStorage',
  1373. // localStorage, sessionStorage
  1374. // internal variable
  1375. filterControls: [],
  1376. filterControlValuesLoaded: false
  1377. });
  1378. $.fn.bootstrapTable.methods.push('getCookies');
  1379. $.fn.bootstrapTable.methods.push('deleteCookie');
  1380. $.extend($.fn.bootstrapTable.utils, {
  1381. setCookie: UtilsCookie.setCookie,
  1382. getCookie: UtilsCookie.getCookie
  1383. });
  1384. $.BootstrapTable =
  1385. /*#__PURE__*/
  1386. function (_$$BootstrapTable) {
  1387. _inherits(_class, _$$BootstrapTable);
  1388. function _class() {
  1389. _classCallCheck(this, _class);
  1390. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  1391. }
  1392. _createClass(_class, [{
  1393. key: "init",
  1394. value: function init() {
  1395. // FilterBy logic
  1396. var filterByCookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterBy));
  1397. this.filterColumns = filterByCookie ? filterByCookie : {}; // FilterControl logic
  1398. this.options.filterControls = [];
  1399. this.options.filterControlValuesLoaded = false;
  1400. this.options.cookiesEnabled = typeof this.options.cookiesEnabled === 'string' ? this.options.cookiesEnabled.replace('[', '').replace(']', '').replace(/ /g, '').toLowerCase().split(',') : this.options.cookiesEnabled;
  1401. if (this.options.filterControl) {
  1402. var that = this;
  1403. this.$el.on('column-search.bs.table', function (e, field, text) {
  1404. var isNewField = true;
  1405. for (var i = 0; i < that.options.filterControls.length; i++) {
  1406. if (that.options.filterControls[i].field === field) {
  1407. that.options.filterControls[i].text = text;
  1408. isNewField = false;
  1409. break;
  1410. }
  1411. }
  1412. if (isNewField) {
  1413. that.options.filterControls.push({
  1414. field: field,
  1415. text: text
  1416. });
  1417. }
  1418. UtilsCookie.setCookie(that, UtilsCookie.cookieIds.filterControl, JSON.stringify(that.options.filterControls));
  1419. }).on('created-controls.bs.table', UtilsCookie.initCookieFilters(that));
  1420. }
  1421. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  1422. }
  1423. }, {
  1424. key: "initServer",
  1425. value: function initServer() {
  1426. var _get2;
  1427. if (this.options.cookie && this.options.filterControl && !this.options.filterControlValuesLoaded) {
  1428. var cookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.filterControl));
  1429. if (cookie) {
  1430. return;
  1431. }
  1432. }
  1433. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  1434. args[_key] = arguments[_key];
  1435. }
  1436. (_get2 = _get(_getPrototypeOf(_class.prototype), "initServer", this)).call.apply(_get2, [this].concat(args));
  1437. }
  1438. }, {
  1439. key: "initTable",
  1440. value: function initTable() {
  1441. var _get3;
  1442. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  1443. args[_key2] = arguments[_key2];
  1444. }
  1445. (_get3 = _get(_getPrototypeOf(_class.prototype), "initTable", this)).call.apply(_get3, [this].concat(args));
  1446. this.initCookie();
  1447. }
  1448. }, {
  1449. key: "onSort",
  1450. value: function onSort() {
  1451. var _get4;
  1452. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  1453. args[_key3] = arguments[_key3];
  1454. }
  1455. (_get4 = _get(_getPrototypeOf(_class.prototype), "onSort", this)).call.apply(_get4, [this].concat(args));
  1456. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortOrder, this.options.sortOrder);
  1457. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.sortName, this.options.sortName);
  1458. }
  1459. }, {
  1460. key: "onPageNumber",
  1461. value: function onPageNumber() {
  1462. var _get5;
  1463. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  1464. args[_key4] = arguments[_key4];
  1465. }
  1466. (_get5 = _get(_getPrototypeOf(_class.prototype), "onPageNumber", this)).call.apply(_get5, [this].concat(args));
  1467. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1468. }
  1469. }, {
  1470. key: "onPageListChange",
  1471. value: function onPageListChange() {
  1472. var _get6;
  1473. for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  1474. args[_key5] = arguments[_key5];
  1475. }
  1476. (_get6 = _get(_getPrototypeOf(_class.prototype), "onPageListChange", this)).call.apply(_get6, [this].concat(args));
  1477. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageList, this.options.pageSize);
  1478. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1479. }
  1480. }, {
  1481. key: "onPagePre",
  1482. value: function onPagePre() {
  1483. var _get7;
  1484. for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  1485. args[_key6] = arguments[_key6];
  1486. }
  1487. (_get7 = _get(_getPrototypeOf(_class.prototype), "onPagePre", this)).call.apply(_get7, [this].concat(args));
  1488. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1489. }
  1490. }, {
  1491. key: "onPageNext",
  1492. value: function onPageNext() {
  1493. var _get8;
  1494. for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  1495. args[_key7] = arguments[_key7];
  1496. }
  1497. (_get8 = _get(_getPrototypeOf(_class.prototype), "onPageNext", this)).call.apply(_get8, [this].concat(args));
  1498. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1499. }
  1500. }, {
  1501. key: "toggleColumn",
  1502. value: function toggleColumn() {
  1503. var _get9;
  1504. for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  1505. args[_key8] = arguments[_key8];
  1506. }
  1507. (_get9 = _get(_getPrototypeOf(_class.prototype), "toggleColumn", this)).call.apply(_get9, [this].concat(args));
  1508. var visibleColumns = [];
  1509. $.each(this.columns, function (i, column) {
  1510. if (column.visible) {
  1511. visibleColumns.push(column.field);
  1512. }
  1513. });
  1514. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns, JSON.stringify(visibleColumns));
  1515. }
  1516. }, {
  1517. key: "selectPage",
  1518. value: function selectPage(page) {
  1519. _get(_getPrototypeOf(_class.prototype), "selectPage", this).call(this, page);
  1520. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, page);
  1521. }
  1522. }, {
  1523. key: "onSearch",
  1524. value: function onSearch(event) {
  1525. _get(_getPrototypeOf(_class.prototype), "onSearch", this).call(this, event);
  1526. if (this.options.search) {
  1527. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.searchText, this.searchText);
  1528. }
  1529. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber);
  1530. }
  1531. }, {
  1532. key: "filterBy",
  1533. value: function filterBy() {
  1534. var _get10;
  1535. for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
  1536. args[_key9] = arguments[_key9];
  1537. }
  1538. (_get10 = _get(_getPrototypeOf(_class.prototype), "filterBy", this)).call.apply(_get10, [this].concat(args));
  1539. UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterBy, JSON.stringify(this.filterColumns));
  1540. }
  1541. }, {
  1542. key: "initCookie",
  1543. value: function initCookie() {
  1544. if (!this.options.cookie) {
  1545. return;
  1546. }
  1547. if (this.options.cookieIdTable === '' || this.options.cookieExpire === '' || !UtilsCookie.cookieEnabled()) {
  1548. console.error('Configuration error. Please review the cookieIdTable and the cookieExpire property. If the properties are correct, then this browser does not support cookies.');
  1549. this.options.cookie = false; // Make sure that the cookie extension is disabled
  1550. return;
  1551. }
  1552. var sortOrderCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortOrder);
  1553. var sortOrderNameCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.sortName);
  1554. var pageNumberCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageNumber);
  1555. var pageListCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.pageList);
  1556. var columnsCookie = JSON.parse(UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.columns));
  1557. var searchTextCookie = UtilsCookie.getCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds.searchText); // sortOrder
  1558. this.options.sortOrder = sortOrderCookie ? sortOrderCookie : this.options.sortOrder; // sortName
  1559. this.options.sortName = sortOrderNameCookie ? sortOrderNameCookie : this.options.sortName; // pageNumber
  1560. this.options.pageNumber = pageNumberCookie ? +pageNumberCookie : this.options.pageNumber; // pageSize
  1561. this.options.pageSize = pageListCookie ? pageListCookie === this.options.formatAllRows() ? pageListCookie : +pageListCookie : this.options.pageSize; // searchText
  1562. this.options.searchText = searchTextCookie ? searchTextCookie : '';
  1563. if (columnsCookie) {
  1564. $.each(this.columns, function (i, column) {
  1565. column.visible = $.inArray(column.field, columnsCookie) !== -1;
  1566. });
  1567. }
  1568. }
  1569. }, {
  1570. key: "getCookies",
  1571. value: function getCookies() {
  1572. var bootstrapTable = this;
  1573. var cookies = {};
  1574. $.each(UtilsCookie.cookieIds, function (key, value) {
  1575. cookies[key] = UtilsCookie.getCookie(bootstrapTable, bootstrapTable.options.cookieIdTable, value);
  1576. if (key === 'columns') {
  1577. cookies[key] = JSON.parse(cookies[key]);
  1578. }
  1579. });
  1580. return cookies;
  1581. }
  1582. }, {
  1583. key: "deleteCookie",
  1584. value: function deleteCookie(cookieName) {
  1585. if (cookieName === '' || !UtilsCookie.cookieEnabled()) {
  1586. return;
  1587. }
  1588. UtilsCookie.deleteCookie(this, this.options.cookieIdTable, UtilsCookie.cookieIds[cookieName]);
  1589. }
  1590. }]);
  1591. return _class;
  1592. }($.BootstrapTable);
  1593. }));