bootstrap-table-filter-control.js 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831
  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 check = function (it) {
  12. return it && it.Math == Math && it;
  13. };
  14. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  15. var global_1 =
  16. // eslint-disable-next-line no-undef
  17. check(typeof globalThis == 'object' && globalThis) ||
  18. check(typeof window == 'object' && window) ||
  19. check(typeof self == 'object' && self) ||
  20. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  21. // eslint-disable-next-line no-new-func
  22. Function('return this')();
  23. var fails = function (exec) {
  24. try {
  25. return !!exec();
  26. } catch (error) {
  27. return true;
  28. }
  29. };
  30. // Thank's IE8 for his funny defineProperty
  31. var descriptors = !fails(function () {
  32. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  33. });
  34. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  35. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  36. // Nashorn ~ JDK8 bug
  37. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  38. // `Object.prototype.propertyIsEnumerable` method implementation
  39. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  40. var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  41. var descriptor = getOwnPropertyDescriptor(this, V);
  42. return !!descriptor && descriptor.enumerable;
  43. } : nativePropertyIsEnumerable;
  44. var objectPropertyIsEnumerable = {
  45. f: f
  46. };
  47. var createPropertyDescriptor = function (bitmap, value) {
  48. return {
  49. enumerable: !(bitmap & 1),
  50. configurable: !(bitmap & 2),
  51. writable: !(bitmap & 4),
  52. value: value
  53. };
  54. };
  55. var toString = {}.toString;
  56. var classofRaw = function (it) {
  57. return toString.call(it).slice(8, -1);
  58. };
  59. var split = ''.split;
  60. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  61. var indexedObject = fails(function () {
  62. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  63. // eslint-disable-next-line no-prototype-builtins
  64. return !Object('z').propertyIsEnumerable(0);
  65. }) ? function (it) {
  66. return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
  67. } : Object;
  68. // `RequireObjectCoercible` abstract operation
  69. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  70. var requireObjectCoercible = function (it) {
  71. if (it == undefined) throw TypeError("Can't call method on " + it);
  72. return it;
  73. };
  74. // toObject with fallback for non-array-like ES3 strings
  75. var toIndexedObject = function (it) {
  76. return indexedObject(requireObjectCoercible(it));
  77. };
  78. var isObject = function (it) {
  79. return typeof it === 'object' ? it !== null : typeof it === 'function';
  80. };
  81. // `ToPrimitive` abstract operation
  82. // https://tc39.github.io/ecma262/#sec-toprimitive
  83. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  84. // and the second argument - flag - preferred type is a string
  85. var toPrimitive = function (input, PREFERRED_STRING) {
  86. if (!isObject(input)) return input;
  87. var fn, val;
  88. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  89. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  90. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  91. throw TypeError("Can't convert object to primitive value");
  92. };
  93. var hasOwnProperty = {}.hasOwnProperty;
  94. var has = function (it, key) {
  95. return hasOwnProperty.call(it, key);
  96. };
  97. var document$1 = global_1.document;
  98. // typeof document.createElement is 'object' in old IE
  99. var EXISTS = isObject(document$1) && isObject(document$1.createElement);
  100. var documentCreateElement = function (it) {
  101. return EXISTS ? document$1.createElement(it) : {};
  102. };
  103. // Thank's IE8 for his funny defineProperty
  104. var ie8DomDefine = !descriptors && !fails(function () {
  105. return Object.defineProperty(documentCreateElement('div'), 'a', {
  106. get: function () { return 7; }
  107. }).a != 7;
  108. });
  109. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  110. // `Object.getOwnPropertyDescriptor` method
  111. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  112. var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  113. O = toIndexedObject(O);
  114. P = toPrimitive(P, true);
  115. if (ie8DomDefine) try {
  116. return nativeGetOwnPropertyDescriptor(O, P);
  117. } catch (error) { /* empty */ }
  118. if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
  119. };
  120. var objectGetOwnPropertyDescriptor = {
  121. f: f$1
  122. };
  123. var anObject = function (it) {
  124. if (!isObject(it)) {
  125. throw TypeError(String(it) + ' is not an object');
  126. } return it;
  127. };
  128. var nativeDefineProperty = Object.defineProperty;
  129. // `Object.defineProperty` method
  130. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  131. var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  132. anObject(O);
  133. P = toPrimitive(P, true);
  134. anObject(Attributes);
  135. if (ie8DomDefine) try {
  136. return nativeDefineProperty(O, P, Attributes);
  137. } catch (error) { /* empty */ }
  138. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  139. if ('value' in Attributes) O[P] = Attributes.value;
  140. return O;
  141. };
  142. var objectDefineProperty = {
  143. f: f$2
  144. };
  145. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  146. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  147. } : function (object, key, value) {
  148. object[key] = value;
  149. return object;
  150. };
  151. var setGlobal = function (key, value) {
  152. try {
  153. createNonEnumerableProperty(global_1, key, value);
  154. } catch (error) {
  155. global_1[key] = value;
  156. } return value;
  157. };
  158. var SHARED = '__core-js_shared__';
  159. var store = global_1[SHARED] || setGlobal(SHARED, {});
  160. var sharedStore = store;
  161. var functionToString = Function.toString;
  162. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  163. if (typeof sharedStore.inspectSource != 'function') {
  164. sharedStore.inspectSource = function (it) {
  165. return functionToString.call(it);
  166. };
  167. }
  168. var inspectSource = sharedStore.inspectSource;
  169. var WeakMap = global_1.WeakMap;
  170. var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  171. var shared = createCommonjsModule(function (module) {
  172. (module.exports = function (key, value) {
  173. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  174. })('versions', []).push({
  175. version: '3.6.0',
  176. mode: 'global',
  177. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  178. });
  179. });
  180. var id = 0;
  181. var postfix = Math.random();
  182. var uid = function (key) {
  183. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  184. };
  185. var keys = shared('keys');
  186. var sharedKey = function (key) {
  187. return keys[key] || (keys[key] = uid(key));
  188. };
  189. var hiddenKeys = {};
  190. var WeakMap$1 = global_1.WeakMap;
  191. var set, get, has$1;
  192. var enforce = function (it) {
  193. return has$1(it) ? get(it) : set(it, {});
  194. };
  195. var getterFor = function (TYPE) {
  196. return function (it) {
  197. var state;
  198. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  199. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  200. } return state;
  201. };
  202. };
  203. if (nativeWeakMap) {
  204. var store$1 = new WeakMap$1();
  205. var wmget = store$1.get;
  206. var wmhas = store$1.has;
  207. var wmset = store$1.set;
  208. set = function (it, metadata) {
  209. wmset.call(store$1, it, metadata);
  210. return metadata;
  211. };
  212. get = function (it) {
  213. return wmget.call(store$1, it) || {};
  214. };
  215. has$1 = function (it) {
  216. return wmhas.call(store$1, it);
  217. };
  218. } else {
  219. var STATE = sharedKey('state');
  220. hiddenKeys[STATE] = true;
  221. set = function (it, metadata) {
  222. createNonEnumerableProperty(it, STATE, metadata);
  223. return metadata;
  224. };
  225. get = function (it) {
  226. return has(it, STATE) ? it[STATE] : {};
  227. };
  228. has$1 = function (it) {
  229. return has(it, STATE);
  230. };
  231. }
  232. var internalState = {
  233. set: set,
  234. get: get,
  235. has: has$1,
  236. enforce: enforce,
  237. getterFor: getterFor
  238. };
  239. var redefine = createCommonjsModule(function (module) {
  240. var getInternalState = internalState.get;
  241. var enforceInternalState = internalState.enforce;
  242. var TEMPLATE = String(String).split('String');
  243. (module.exports = function (O, key, value, options) {
  244. var unsafe = options ? !!options.unsafe : false;
  245. var simple = options ? !!options.enumerable : false;
  246. var noTargetGet = options ? !!options.noTargetGet : false;
  247. if (typeof value == 'function') {
  248. if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
  249. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  250. }
  251. if (O === global_1) {
  252. if (simple) O[key] = value;
  253. else setGlobal(key, value);
  254. return;
  255. } else if (!unsafe) {
  256. delete O[key];
  257. } else if (!noTargetGet && O[key]) {
  258. simple = true;
  259. }
  260. if (simple) O[key] = value;
  261. else createNonEnumerableProperty(O, key, value);
  262. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  263. })(Function.prototype, 'toString', function toString() {
  264. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  265. });
  266. });
  267. var path = global_1;
  268. var aFunction = function (variable) {
  269. return typeof variable == 'function' ? variable : undefined;
  270. };
  271. var getBuiltIn = function (namespace, method) {
  272. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace])
  273. : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
  274. };
  275. var ceil = Math.ceil;
  276. var floor = Math.floor;
  277. // `ToInteger` abstract operation
  278. // https://tc39.github.io/ecma262/#sec-tointeger
  279. var toInteger = function (argument) {
  280. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  281. };
  282. var min = Math.min;
  283. // `ToLength` abstract operation
  284. // https://tc39.github.io/ecma262/#sec-tolength
  285. var toLength = function (argument) {
  286. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  287. };
  288. var max = Math.max;
  289. var min$1 = Math.min;
  290. // Helper for a popular repeating case of the spec:
  291. // Let integer be ? ToInteger(index).
  292. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  293. var toAbsoluteIndex = function (index, length) {
  294. var integer = toInteger(index);
  295. return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
  296. };
  297. // `Array.prototype.{ indexOf, includes }` methods implementation
  298. var createMethod = function (IS_INCLUDES) {
  299. return function ($this, el, fromIndex) {
  300. var O = toIndexedObject($this);
  301. var length = toLength(O.length);
  302. var index = toAbsoluteIndex(fromIndex, length);
  303. var value;
  304. // Array#includes uses SameValueZero equality algorithm
  305. // eslint-disable-next-line no-self-compare
  306. if (IS_INCLUDES && el != el) while (length > index) {
  307. value = O[index++];
  308. // eslint-disable-next-line no-self-compare
  309. if (value != value) return true;
  310. // Array#indexOf ignores holes, Array#includes - not
  311. } else for (;length > index; index++) {
  312. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  313. } return !IS_INCLUDES && -1;
  314. };
  315. };
  316. var arrayIncludes = {
  317. // `Array.prototype.includes` method
  318. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  319. includes: createMethod(true),
  320. // `Array.prototype.indexOf` method
  321. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  322. indexOf: createMethod(false)
  323. };
  324. var indexOf = arrayIncludes.indexOf;
  325. var objectKeysInternal = function (object, names) {
  326. var O = toIndexedObject(object);
  327. var i = 0;
  328. var result = [];
  329. var key;
  330. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  331. // Don't enum bug & hidden keys
  332. while (names.length > i) if (has(O, key = names[i++])) {
  333. ~indexOf(result, key) || result.push(key);
  334. }
  335. return result;
  336. };
  337. // IE8- don't enum bug keys
  338. var enumBugKeys = [
  339. 'constructor',
  340. 'hasOwnProperty',
  341. 'isPrototypeOf',
  342. 'propertyIsEnumerable',
  343. 'toLocaleString',
  344. 'toString',
  345. 'valueOf'
  346. ];
  347. var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
  348. // `Object.getOwnPropertyNames` method
  349. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  350. var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  351. return objectKeysInternal(O, hiddenKeys$1);
  352. };
  353. var objectGetOwnPropertyNames = {
  354. f: f$3
  355. };
  356. var f$4 = Object.getOwnPropertySymbols;
  357. var objectGetOwnPropertySymbols = {
  358. f: f$4
  359. };
  360. // all object keys, includes non-enumerable and symbols
  361. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  362. var keys = objectGetOwnPropertyNames.f(anObject(it));
  363. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  364. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  365. };
  366. var copyConstructorProperties = function (target, source) {
  367. var keys = ownKeys(source);
  368. var defineProperty = objectDefineProperty.f;
  369. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  370. for (var i = 0; i < keys.length; i++) {
  371. var key = keys[i];
  372. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  373. }
  374. };
  375. var replacement = /#|\.prototype\./;
  376. var isForced = function (feature, detection) {
  377. var value = data[normalize(feature)];
  378. return value == POLYFILL ? true
  379. : value == NATIVE ? false
  380. : typeof detection == 'function' ? fails(detection)
  381. : !!detection;
  382. };
  383. var normalize = isForced.normalize = function (string) {
  384. return String(string).replace(replacement, '.').toLowerCase();
  385. };
  386. var data = isForced.data = {};
  387. var NATIVE = isForced.NATIVE = 'N';
  388. var POLYFILL = isForced.POLYFILL = 'P';
  389. var isForced_1 = isForced;
  390. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  391. /*
  392. options.target - name of the target object
  393. options.global - target is the global object
  394. options.stat - export as static methods of target
  395. options.proto - export as prototype methods of target
  396. options.real - real prototype method for the `pure` version
  397. options.forced - export even if the native feature is available
  398. options.bind - bind methods to the target, required for the `pure` version
  399. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  400. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  401. options.sham - add a flag to not completely full polyfills
  402. options.enumerable - export as enumerable property
  403. options.noTargetGet - prevent calling a getter on target
  404. */
  405. var _export = function (options, source) {
  406. var TARGET = options.target;
  407. var GLOBAL = options.global;
  408. var STATIC = options.stat;
  409. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  410. if (GLOBAL) {
  411. target = global_1;
  412. } else if (STATIC) {
  413. target = global_1[TARGET] || setGlobal(TARGET, {});
  414. } else {
  415. target = (global_1[TARGET] || {}).prototype;
  416. }
  417. if (target) for (key in source) {
  418. sourceProperty = source[key];
  419. if (options.noTargetGet) {
  420. descriptor = getOwnPropertyDescriptor$1(target, key);
  421. targetProperty = descriptor && descriptor.value;
  422. } else targetProperty = target[key];
  423. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  424. // contained in target
  425. if (!FORCED && targetProperty !== undefined) {
  426. if (typeof sourceProperty === typeof targetProperty) continue;
  427. copyConstructorProperties(sourceProperty, targetProperty);
  428. }
  429. // add a flag to not completely full polyfills
  430. if (options.sham || (targetProperty && targetProperty.sham)) {
  431. createNonEnumerableProperty(sourceProperty, 'sham', true);
  432. }
  433. // extend global
  434. redefine(target, key, sourceProperty, options);
  435. }
  436. };
  437. // `IsArray` abstract operation
  438. // https://tc39.github.io/ecma262/#sec-isarray
  439. var isArray = Array.isArray || function isArray(arg) {
  440. return classofRaw(arg) == 'Array';
  441. };
  442. // `ToObject` abstract operation
  443. // https://tc39.github.io/ecma262/#sec-toobject
  444. var toObject = function (argument) {
  445. return Object(requireObjectCoercible(argument));
  446. };
  447. var createProperty = function (object, key, value) {
  448. var propertyKey = toPrimitive(key);
  449. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  450. else object[propertyKey] = value;
  451. };
  452. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  453. // Chrome 38 Symbol has incorrect toString conversion
  454. // eslint-disable-next-line no-undef
  455. return !String(Symbol());
  456. });
  457. var useSymbolAsUid = nativeSymbol
  458. // eslint-disable-next-line no-undef
  459. && !Symbol.sham
  460. // eslint-disable-next-line no-undef
  461. && typeof Symbol() == 'symbol';
  462. var WellKnownSymbolsStore = shared('wks');
  463. var Symbol$1 = global_1.Symbol;
  464. var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : uid;
  465. var wellKnownSymbol = function (name) {
  466. if (!has(WellKnownSymbolsStore, name)) {
  467. if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
  468. else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  469. } return WellKnownSymbolsStore[name];
  470. };
  471. var SPECIES = wellKnownSymbol('species');
  472. // `ArraySpeciesCreate` abstract operation
  473. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  474. var arraySpeciesCreate = function (originalArray, length) {
  475. var C;
  476. if (isArray(originalArray)) {
  477. C = originalArray.constructor;
  478. // cross-realm fallback
  479. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  480. else if (isObject(C)) {
  481. C = C[SPECIES];
  482. if (C === null) C = undefined;
  483. }
  484. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  485. };
  486. var userAgent = getBuiltIn('navigator', 'userAgent') || '';
  487. var process = global_1.process;
  488. var versions = process && process.versions;
  489. var v8 = versions && versions.v8;
  490. var match, version;
  491. if (v8) {
  492. match = v8.split('.');
  493. version = match[0] + match[1];
  494. } else if (userAgent) {
  495. match = userAgent.match(/Edge\/(\d+)/);
  496. if (!match || match[1] >= 74) {
  497. match = userAgent.match(/Chrome\/(\d+)/);
  498. if (match) version = match[1];
  499. }
  500. }
  501. var v8Version = version && +version;
  502. var SPECIES$1 = wellKnownSymbol('species');
  503. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  504. // We can't use this feature detection in V8 since it causes
  505. // deoptimization and serious performance degradation
  506. // https://github.com/zloirock/core-js/issues/677
  507. return v8Version >= 51 || !fails(function () {
  508. var array = [];
  509. var constructor = array.constructor = {};
  510. constructor[SPECIES$1] = function () {
  511. return { foo: 1 };
  512. };
  513. return array[METHOD_NAME](Boolean).foo !== 1;
  514. });
  515. };
  516. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  517. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  518. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  519. // We can't use this feature detection in V8 since it causes
  520. // deoptimization and serious performance degradation
  521. // https://github.com/zloirock/core-js/issues/679
  522. var IS_CONCAT_SPREADABLE_SUPPORT = v8Version >= 51 || !fails(function () {
  523. var array = [];
  524. array[IS_CONCAT_SPREADABLE] = false;
  525. return array.concat()[0] !== array;
  526. });
  527. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  528. var isConcatSpreadable = function (O) {
  529. if (!isObject(O)) return false;
  530. var spreadable = O[IS_CONCAT_SPREADABLE];
  531. return spreadable !== undefined ? !!spreadable : isArray(O);
  532. };
  533. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  534. // `Array.prototype.concat` method
  535. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  536. // with adding support of @@isConcatSpreadable and @@species
  537. _export({ target: 'Array', proto: true, forced: FORCED }, {
  538. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  539. var O = toObject(this);
  540. var A = arraySpeciesCreate(O, 0);
  541. var n = 0;
  542. var i, k, length, len, E;
  543. for (i = -1, length = arguments.length; i < length; i++) {
  544. E = i === -1 ? O : arguments[i];
  545. if (isConcatSpreadable(E)) {
  546. len = toLength(E.length);
  547. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  548. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  549. } else {
  550. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  551. createProperty(A, n++, E);
  552. }
  553. }
  554. A.length = n;
  555. return A;
  556. }
  557. });
  558. var aFunction$1 = function (it) {
  559. if (typeof it != 'function') {
  560. throw TypeError(String(it) + ' is not a function');
  561. } return it;
  562. };
  563. // optional / simple context binding
  564. var bindContext = function (fn, that, length) {
  565. aFunction$1(fn);
  566. if (that === undefined) return fn;
  567. switch (length) {
  568. case 0: return function () {
  569. return fn.call(that);
  570. };
  571. case 1: return function (a) {
  572. return fn.call(that, a);
  573. };
  574. case 2: return function (a, b) {
  575. return fn.call(that, a, b);
  576. };
  577. case 3: return function (a, b, c) {
  578. return fn.call(that, a, b, c);
  579. };
  580. }
  581. return function (/* ...args */) {
  582. return fn.apply(that, arguments);
  583. };
  584. };
  585. var push = [].push;
  586. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation
  587. var createMethod$1 = function (TYPE) {
  588. var IS_MAP = TYPE == 1;
  589. var IS_FILTER = TYPE == 2;
  590. var IS_SOME = TYPE == 3;
  591. var IS_EVERY = TYPE == 4;
  592. var IS_FIND_INDEX = TYPE == 6;
  593. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  594. return function ($this, callbackfn, that, specificCreate) {
  595. var O = toObject($this);
  596. var self = indexedObject(O);
  597. var boundFunction = bindContext(callbackfn, that, 3);
  598. var length = toLength(self.length);
  599. var index = 0;
  600. var create = specificCreate || arraySpeciesCreate;
  601. var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  602. var value, result;
  603. for (;length > index; index++) if (NO_HOLES || index in self) {
  604. value = self[index];
  605. result = boundFunction(value, index, O);
  606. if (TYPE) {
  607. if (IS_MAP) target[index] = result; // map
  608. else if (result) switch (TYPE) {
  609. case 3: return true; // some
  610. case 5: return value; // find
  611. case 6: return index; // findIndex
  612. case 2: push.call(target, value); // filter
  613. } else if (IS_EVERY) return false; // every
  614. }
  615. }
  616. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  617. };
  618. };
  619. var arrayIteration = {
  620. // `Array.prototype.forEach` method
  621. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  622. forEach: createMethod$1(0),
  623. // `Array.prototype.map` method
  624. // https://tc39.github.io/ecma262/#sec-array.prototype.map
  625. map: createMethod$1(1),
  626. // `Array.prototype.filter` method
  627. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  628. filter: createMethod$1(2),
  629. // `Array.prototype.some` method
  630. // https://tc39.github.io/ecma262/#sec-array.prototype.some
  631. some: createMethod$1(3),
  632. // `Array.prototype.every` method
  633. // https://tc39.github.io/ecma262/#sec-array.prototype.every
  634. every: createMethod$1(4),
  635. // `Array.prototype.find` method
  636. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  637. find: createMethod$1(5),
  638. // `Array.prototype.findIndex` method
  639. // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex
  640. findIndex: createMethod$1(6)
  641. };
  642. var $filter = arrayIteration.filter;
  643. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  644. // Edge 14- issue
  645. var USES_TO_LENGTH = HAS_SPECIES_SUPPORT && !fails(function () {
  646. [].filter.call({ length: -1, 0: 1 }, function (it) { throw it; });
  647. });
  648. // `Array.prototype.filter` method
  649. // https://tc39.github.io/ecma262/#sec-array.prototype.filter
  650. // with adding support of @@species
  651. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
  652. filter: function filter(callbackfn /* , thisArg */) {
  653. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  654. }
  655. });
  656. // `Object.keys` method
  657. // https://tc39.github.io/ecma262/#sec-object.keys
  658. var objectKeys = Object.keys || function keys(O) {
  659. return objectKeysInternal(O, enumBugKeys);
  660. };
  661. // `Object.defineProperties` method
  662. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  663. var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
  664. anObject(O);
  665. var keys = objectKeys(Properties);
  666. var length = keys.length;
  667. var index = 0;
  668. var key;
  669. while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
  670. return O;
  671. };
  672. var html = getBuiltIn('document', 'documentElement');
  673. var GT = '>';
  674. var LT = '<';
  675. var PROTOTYPE = 'prototype';
  676. var SCRIPT = 'script';
  677. var IE_PROTO = sharedKey('IE_PROTO');
  678. var EmptyConstructor = function () { /* empty */ };
  679. var scriptTag = function (content) {
  680. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  681. };
  682. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  683. var NullProtoObjectViaActiveX = function (activeXDocument) {
  684. activeXDocument.write(scriptTag(''));
  685. activeXDocument.close();
  686. var temp = activeXDocument.parentWindow.Object;
  687. activeXDocument = null; // avoid memory leak
  688. return temp;
  689. };
  690. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  691. var NullProtoObjectViaIFrame = function () {
  692. // Thrash, waste and sodomy: IE GC bug
  693. var iframe = documentCreateElement('iframe');
  694. var JS = 'java' + SCRIPT + ':';
  695. var iframeDocument;
  696. iframe.style.display = 'none';
  697. html.appendChild(iframe);
  698. // https://github.com/zloirock/core-js/issues/475
  699. iframe.src = String(JS);
  700. iframeDocument = iframe.contentWindow.document;
  701. iframeDocument.open();
  702. iframeDocument.write(scriptTag('document.F=Object'));
  703. iframeDocument.close();
  704. return iframeDocument.F;
  705. };
  706. // Check for document.domain and active x support
  707. // No need to use active x approach when document.domain is not set
  708. // see https://github.com/es-shims/es5-shim/issues/150
  709. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  710. // avoid IE GC bug
  711. var activeXDocument;
  712. var NullProtoObject = function () {
  713. try {
  714. /* global ActiveXObject */
  715. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  716. } catch (error) { /* ignore */ }
  717. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  718. var length = enumBugKeys.length;
  719. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  720. return NullProtoObject();
  721. };
  722. hiddenKeys[IE_PROTO] = true;
  723. // `Object.create` method
  724. // https://tc39.github.io/ecma262/#sec-object.create
  725. var objectCreate = Object.create || function create(O, Properties) {
  726. var result;
  727. if (O !== null) {
  728. EmptyConstructor[PROTOTYPE] = anObject(O);
  729. result = new EmptyConstructor();
  730. EmptyConstructor[PROTOTYPE] = null;
  731. // add "__proto__" for Object.getPrototypeOf polyfill
  732. result[IE_PROTO] = O;
  733. } else result = NullProtoObject();
  734. return Properties === undefined ? result : objectDefineProperties(result, Properties);
  735. };
  736. var UNSCOPABLES = wellKnownSymbol('unscopables');
  737. var ArrayPrototype = Array.prototype;
  738. // Array.prototype[@@unscopables]
  739. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  740. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  741. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  742. configurable: true,
  743. value: objectCreate(null)
  744. });
  745. }
  746. // add a key to Array.prototype[@@unscopables]
  747. var addToUnscopables = function (key) {
  748. ArrayPrototype[UNSCOPABLES][key] = true;
  749. };
  750. var $find = arrayIteration.find;
  751. var FIND = 'find';
  752. var SKIPS_HOLES = true;
  753. // Shouldn't skip holes
  754. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  755. // `Array.prototype.find` method
  756. // https://tc39.github.io/ecma262/#sec-array.prototype.find
  757. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  758. find: function find(callbackfn /* , that = undefined */) {
  759. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  760. }
  761. });
  762. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  763. addToUnscopables(FIND);
  764. var $includes = arrayIncludes.includes;
  765. // `Array.prototype.includes` method
  766. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  767. _export({ target: 'Array', proto: true }, {
  768. includes: function includes(el /* , fromIndex = 0 */) {
  769. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  770. }
  771. });
  772. // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables
  773. addToUnscopables('includes');
  774. var sloppyArrayMethod = function (METHOD_NAME, argument) {
  775. var method = [][METHOD_NAME];
  776. return !method || !fails(function () {
  777. // eslint-disable-next-line no-useless-call,no-throw-literal
  778. method.call(null, argument || function () { throw 1; }, 1);
  779. });
  780. };
  781. var $indexOf = arrayIncludes.indexOf;
  782. var nativeIndexOf = [].indexOf;
  783. var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
  784. var SLOPPY_METHOD = sloppyArrayMethod('indexOf');
  785. // `Array.prototype.indexOf` method
  786. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  787. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || SLOPPY_METHOD }, {
  788. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  789. return NEGATIVE_ZERO
  790. // convert -0 to +0
  791. ? nativeIndexOf.apply(this, arguments) || 0
  792. : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
  793. }
  794. });
  795. var nativeJoin = [].join;
  796. var ES3_STRINGS = indexedObject != Object;
  797. var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
  798. // `Array.prototype.join` method
  799. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  800. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
  801. join: function join(separator) {
  802. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  803. }
  804. });
  805. var test = [];
  806. var nativeSort = test.sort;
  807. // IE8-
  808. var FAILS_ON_UNDEFINED = fails(function () {
  809. test.sort(undefined);
  810. });
  811. // V8 bug
  812. var FAILS_ON_NULL = fails(function () {
  813. test.sort(null);
  814. });
  815. // Old WebKit
  816. var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
  817. var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
  818. // `Array.prototype.sort` method
  819. // https://tc39.github.io/ecma262/#sec-array.prototype.sort
  820. _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
  821. sort: function sort(comparefn) {
  822. return comparefn === undefined
  823. ? nativeSort.call(toObject(this))
  824. : nativeSort.call(toObject(this), aFunction$1(comparefn));
  825. }
  826. });
  827. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  828. // `Object.keys` method
  829. // https://tc39.github.io/ecma262/#sec-object.keys
  830. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  831. keys: function keys(it) {
  832. return objectKeys(toObject(it));
  833. }
  834. });
  835. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  836. var test$1 = {};
  837. test$1[TO_STRING_TAG] = 'z';
  838. var toStringTagSupport = String(test$1) === '[object z]';
  839. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  840. // ES3 wrong here
  841. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  842. // fallback for IE11 Script Access Denied error
  843. var tryGet = function (it, key) {
  844. try {
  845. return it[key];
  846. } catch (error) { /* empty */ }
  847. };
  848. // getting tag from ES6+ `Object.prototype.toString`
  849. var classof = toStringTagSupport ? classofRaw : function (it) {
  850. var O, tag, result;
  851. return it === undefined ? 'Undefined' : it === null ? 'Null'
  852. // @@toStringTag case
  853. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
  854. // builtinTag case
  855. : CORRECT_ARGUMENTS ? classofRaw(O)
  856. // ES3 arguments fallback
  857. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  858. };
  859. // `Object.prototype.toString` method implementation
  860. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  861. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  862. return '[object ' + classof(this) + ']';
  863. };
  864. // `Object.prototype.toString` method
  865. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  866. if (!toStringTagSupport) {
  867. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  868. }
  869. // a string of all valid unicode whitespaces
  870. // eslint-disable-next-line max-len
  871. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  872. var whitespace = '[' + whitespaces + ']';
  873. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  874. var rtrim = RegExp(whitespace + whitespace + '*$');
  875. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  876. var createMethod$2 = function (TYPE) {
  877. return function ($this) {
  878. var string = String(requireObjectCoercible($this));
  879. if (TYPE & 1) string = string.replace(ltrim, '');
  880. if (TYPE & 2) string = string.replace(rtrim, '');
  881. return string;
  882. };
  883. };
  884. var stringTrim = {
  885. // `String.prototype.{ trimLeft, trimStart }` methods
  886. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  887. start: createMethod$2(1),
  888. // `String.prototype.{ trimRight, trimEnd }` methods
  889. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  890. end: createMethod$2(2),
  891. // `String.prototype.trim` method
  892. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  893. trim: createMethod$2(3)
  894. };
  895. var trim = stringTrim.trim;
  896. var nativeParseInt = global_1.parseInt;
  897. var hex = /^[+-]?0[Xx]/;
  898. var FORCED$2 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
  899. // `parseInt` method
  900. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  901. var _parseInt = FORCED$2 ? function parseInt(string, radix) {
  902. var S = trim(String(string));
  903. return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  904. } : nativeParseInt;
  905. // `parseInt` method
  906. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  907. _export({ global: true, forced: parseInt != _parseInt }, {
  908. parseInt: _parseInt
  909. });
  910. // `RegExp.prototype.flags` getter implementation
  911. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  912. var regexpFlags = function () {
  913. var that = anObject(this);
  914. var result = '';
  915. if (that.global) result += 'g';
  916. if (that.ignoreCase) result += 'i';
  917. if (that.multiline) result += 'm';
  918. if (that.dotAll) result += 's';
  919. if (that.unicode) result += 'u';
  920. if (that.sticky) result += 'y';
  921. return result;
  922. };
  923. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  924. // so we use an intermediate function.
  925. function RE(s, f) {
  926. return RegExp(s, f);
  927. }
  928. var UNSUPPORTED_Y = fails(function () {
  929. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  930. var re = RE('a', 'y');
  931. re.lastIndex = 2;
  932. return re.exec('abcd') != null;
  933. });
  934. var BROKEN_CARET = fails(function () {
  935. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  936. var re = RE('^r', 'gy');
  937. re.lastIndex = 2;
  938. return re.exec('str') != null;
  939. });
  940. var regexpStickyHelpers = {
  941. UNSUPPORTED_Y: UNSUPPORTED_Y,
  942. BROKEN_CARET: BROKEN_CARET
  943. };
  944. var nativeExec = RegExp.prototype.exec;
  945. // This always refers to the native implementation, because the
  946. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  947. // which loads this file before patching the method.
  948. var nativeReplace = String.prototype.replace;
  949. var patchedExec = nativeExec;
  950. var UPDATES_LAST_INDEX_WRONG = (function () {
  951. var re1 = /a/;
  952. var re2 = /b*/g;
  953. nativeExec.call(re1, 'a');
  954. nativeExec.call(re2, 'a');
  955. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  956. })();
  957. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  958. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  959. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  960. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
  961. if (PATCH) {
  962. patchedExec = function exec(str) {
  963. var re = this;
  964. var lastIndex, reCopy, match, i;
  965. var sticky = UNSUPPORTED_Y$1 && re.sticky;
  966. var flags = regexpFlags.call(re);
  967. var source = re.source;
  968. var charsAdded = 0;
  969. var strCopy = str;
  970. if (sticky) {
  971. flags = flags.replace('y', '');
  972. if (flags.indexOf('g') === -1) {
  973. flags += 'g';
  974. }
  975. strCopy = String(str).slice(re.lastIndex);
  976. // Support anchored sticky behavior.
  977. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  978. source = '(?: ' + source + ')';
  979. strCopy = ' ' + strCopy;
  980. charsAdded++;
  981. }
  982. // ^(? + rx + ) is needed, in combination with some str slicing, to
  983. // simulate the 'y' flag.
  984. reCopy = new RegExp('^(?:' + source + ')', flags);
  985. }
  986. if (NPCG_INCLUDED) {
  987. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  988. }
  989. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  990. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  991. if (sticky) {
  992. if (match) {
  993. match.input = match.input.slice(charsAdded);
  994. match[0] = match[0].slice(charsAdded);
  995. match.index = re.lastIndex;
  996. re.lastIndex += match[0].length;
  997. } else re.lastIndex = 0;
  998. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  999. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  1000. }
  1001. if (NPCG_INCLUDED && match && match.length > 1) {
  1002. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1003. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1004. nativeReplace.call(match[0], reCopy, function () {
  1005. for (i = 1; i < arguments.length - 2; i++) {
  1006. if (arguments[i] === undefined) match[i] = undefined;
  1007. }
  1008. });
  1009. }
  1010. return match;
  1011. };
  1012. }
  1013. var regexpExec = patchedExec;
  1014. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  1015. exec: regexpExec
  1016. });
  1017. var TO_STRING = 'toString';
  1018. var RegExpPrototype = RegExp.prototype;
  1019. var nativeToString = RegExpPrototype[TO_STRING];
  1020. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  1021. // FF44- RegExp#toString has a wrong name
  1022. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  1023. // `RegExp.prototype.toString` method
  1024. // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
  1025. if (NOT_GENERIC || INCORRECT_NAME) {
  1026. redefine(RegExp.prototype, TO_STRING, function toString() {
  1027. var R = anObject(this);
  1028. var p = String(R.source);
  1029. var rf = R.flags;
  1030. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  1031. return '/' + p + '/' + f;
  1032. }, { unsafe: true });
  1033. }
  1034. var MATCH = wellKnownSymbol('match');
  1035. // `IsRegExp` abstract operation
  1036. // https://tc39.github.io/ecma262/#sec-isregexp
  1037. var isRegexp = function (it) {
  1038. var isRegExp;
  1039. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1040. };
  1041. var notARegexp = function (it) {
  1042. if (isRegexp(it)) {
  1043. throw TypeError("The method doesn't accept regular expressions");
  1044. } return it;
  1045. };
  1046. var MATCH$1 = wellKnownSymbol('match');
  1047. var correctIsRegexpLogic = function (METHOD_NAME) {
  1048. var regexp = /./;
  1049. try {
  1050. '/./'[METHOD_NAME](regexp);
  1051. } catch (e) {
  1052. try {
  1053. regexp[MATCH$1] = false;
  1054. return '/./'[METHOD_NAME](regexp);
  1055. } catch (f) { /* empty */ }
  1056. } return false;
  1057. };
  1058. // `String.prototype.includes` method
  1059. // https://tc39.github.io/ecma262/#sec-string.prototype.includes
  1060. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  1061. includes: function includes(searchString /* , position = 0 */) {
  1062. return !!~String(requireObjectCoercible(this))
  1063. .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  1064. }
  1065. });
  1066. var SPECIES$2 = wellKnownSymbol('species');
  1067. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  1068. // #replace needs built-in support for named groups.
  1069. // #match works fine because it just return the exec results, even if it has
  1070. // a "grops" property.
  1071. var re = /./;
  1072. re.exec = function () {
  1073. var result = [];
  1074. result.groups = { a: '7' };
  1075. return result;
  1076. };
  1077. return ''.replace(re, '$<a>') !== '7';
  1078. });
  1079. // IE <= 11 replaces $0 with the whole match, as if it was $&
  1080. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  1081. var REPLACE_KEEPS_$0 = (function () {
  1082. return 'a'.replace(/./, '$0') === '$0';
  1083. })();
  1084. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1085. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1086. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1087. var re = /(?:)/;
  1088. var originalExec = re.exec;
  1089. re.exec = function () { return originalExec.apply(this, arguments); };
  1090. var result = 'ab'.split(re);
  1091. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1092. });
  1093. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  1094. var SYMBOL = wellKnownSymbol(KEY);
  1095. var DELEGATES_TO_SYMBOL = !fails(function () {
  1096. // String methods call symbol-named RegEp methods
  1097. var O = {};
  1098. O[SYMBOL] = function () { return 7; };
  1099. return ''[KEY](O) != 7;
  1100. });
  1101. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1102. // Symbol-named RegExp methods call .exec
  1103. var execCalled = false;
  1104. var re = /a/;
  1105. if (KEY === 'split') {
  1106. // We can't use real regex here since it causes deoptimization
  1107. // and serious performance degradation in V8
  1108. // https://github.com/zloirock/core-js/issues/306
  1109. re = {};
  1110. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1111. // a new one. We need to return the patched regex when creating the new one.
  1112. re.constructor = {};
  1113. re.constructor[SPECIES$2] = function () { return re; };
  1114. re.flags = '';
  1115. re[SYMBOL] = /./[SYMBOL];
  1116. }
  1117. re.exec = function () { execCalled = true; return null; };
  1118. re[SYMBOL]('');
  1119. return !execCalled;
  1120. });
  1121. if (
  1122. !DELEGATES_TO_SYMBOL ||
  1123. !DELEGATES_TO_EXEC ||
  1124. (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
  1125. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  1126. ) {
  1127. var nativeRegExpMethod = /./[SYMBOL];
  1128. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1129. if (regexp.exec === regexpExec) {
  1130. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1131. // The native String method already delegates to @@method (this
  1132. // polyfilled function), leasing to infinite recursion.
  1133. // We avoid it by directly calling the native @@method method.
  1134. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  1135. }
  1136. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  1137. }
  1138. return { done: false };
  1139. }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
  1140. var stringMethod = methods[0];
  1141. var regexMethod = methods[1];
  1142. redefine(String.prototype, KEY, stringMethod);
  1143. redefine(RegExp.prototype, SYMBOL, length == 2
  1144. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  1145. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  1146. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  1147. // 21.2.5.6 RegExp.prototype[@@match](string)
  1148. // 21.2.5.9 RegExp.prototype[@@search](string)
  1149. : function (string) { return regexMethod.call(string, this); }
  1150. );
  1151. }
  1152. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  1153. };
  1154. // `String.prototype.{ codePointAt, at }` methods implementation
  1155. var createMethod$3 = function (CONVERT_TO_STRING) {
  1156. return function ($this, pos) {
  1157. var S = String(requireObjectCoercible($this));
  1158. var position = toInteger(pos);
  1159. var size = S.length;
  1160. var first, second;
  1161. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1162. first = S.charCodeAt(position);
  1163. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1164. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1165. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1166. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1167. };
  1168. };
  1169. var stringMultibyte = {
  1170. // `String.prototype.codePointAt` method
  1171. // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
  1172. codeAt: createMethod$3(false),
  1173. // `String.prototype.at` method
  1174. // https://github.com/mathiasbynens/String.prototype.at
  1175. charAt: createMethod$3(true)
  1176. };
  1177. var charAt = stringMultibyte.charAt;
  1178. // `AdvanceStringIndex` abstract operation
  1179. // https://tc39.github.io/ecma262/#sec-advancestringindex
  1180. var advanceStringIndex = function (S, index, unicode) {
  1181. return index + (unicode ? charAt(S, index).length : 1);
  1182. };
  1183. // `RegExpExec` abstract operation
  1184. // https://tc39.github.io/ecma262/#sec-regexpexec
  1185. var regexpExecAbstract = function (R, S) {
  1186. var exec = R.exec;
  1187. if (typeof exec === 'function') {
  1188. var result = exec.call(R, S);
  1189. if (typeof result !== 'object') {
  1190. throw TypeError('RegExp exec method returned something other than an Object or null');
  1191. }
  1192. return result;
  1193. }
  1194. if (classofRaw(R) !== 'RegExp') {
  1195. throw TypeError('RegExp#exec called on incompatible receiver');
  1196. }
  1197. return regexpExec.call(R, S);
  1198. };
  1199. // @@match logic
  1200. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  1201. return [
  1202. // `String.prototype.match` method
  1203. // https://tc39.github.io/ecma262/#sec-string.prototype.match
  1204. function match(regexp) {
  1205. var O = requireObjectCoercible(this);
  1206. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  1207. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  1208. },
  1209. // `RegExp.prototype[@@match]` method
  1210. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
  1211. function (regexp) {
  1212. var res = maybeCallNative(nativeMatch, regexp, this);
  1213. if (res.done) return res.value;
  1214. var rx = anObject(regexp);
  1215. var S = String(this);
  1216. if (!rx.global) return regexpExecAbstract(rx, S);
  1217. var fullUnicode = rx.unicode;
  1218. rx.lastIndex = 0;
  1219. var A = [];
  1220. var n = 0;
  1221. var result;
  1222. while ((result = regexpExecAbstract(rx, S)) !== null) {
  1223. var matchStr = String(result[0]);
  1224. A[n] = matchStr;
  1225. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1226. n++;
  1227. }
  1228. return n === 0 ? null : A;
  1229. }
  1230. ];
  1231. });
  1232. var max$1 = Math.max;
  1233. var min$2 = Math.min;
  1234. var floor$1 = Math.floor;
  1235. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
  1236. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
  1237. var maybeToString = function (it) {
  1238. return it === undefined ? it : String(it);
  1239. };
  1240. // @@replace logic
  1241. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1242. return [
  1243. // `String.prototype.replace` method
  1244. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  1245. function replace(searchValue, replaceValue) {
  1246. var O = requireObjectCoercible(this);
  1247. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1248. return replacer !== undefined
  1249. ? replacer.call(searchValue, O, replaceValue)
  1250. : nativeReplace.call(String(O), searchValue, replaceValue);
  1251. },
  1252. // `RegExp.prototype[@@replace]` method
  1253. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  1254. function (regexp, replaceValue) {
  1255. if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
  1256. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1257. if (res.done) return res.value;
  1258. }
  1259. var rx = anObject(regexp);
  1260. var S = String(this);
  1261. var functionalReplace = typeof replaceValue === 'function';
  1262. if (!functionalReplace) replaceValue = String(replaceValue);
  1263. var global = rx.global;
  1264. if (global) {
  1265. var fullUnicode = rx.unicode;
  1266. rx.lastIndex = 0;
  1267. }
  1268. var results = [];
  1269. while (true) {
  1270. var result = regexpExecAbstract(rx, S);
  1271. if (result === null) break;
  1272. results.push(result);
  1273. if (!global) break;
  1274. var matchStr = String(result[0]);
  1275. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1276. }
  1277. var accumulatedResult = '';
  1278. var nextSourcePosition = 0;
  1279. for (var i = 0; i < results.length; i++) {
  1280. result = results[i];
  1281. var matched = String(result[0]);
  1282. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  1283. var captures = [];
  1284. // NOTE: This is equivalent to
  1285. // captures = result.slice(1).map(maybeToString)
  1286. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1287. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1288. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1289. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1290. var namedCaptures = result.groups;
  1291. if (functionalReplace) {
  1292. var replacerArgs = [matched].concat(captures, position, S);
  1293. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1294. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1295. } else {
  1296. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1297. }
  1298. if (position >= nextSourcePosition) {
  1299. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1300. nextSourcePosition = position + matched.length;
  1301. }
  1302. }
  1303. return accumulatedResult + S.slice(nextSourcePosition);
  1304. }
  1305. ];
  1306. // https://tc39.github.io/ecma262/#sec-getsubstitution
  1307. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  1308. var tailPos = position + matched.length;
  1309. var m = captures.length;
  1310. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1311. if (namedCaptures !== undefined) {
  1312. namedCaptures = toObject(namedCaptures);
  1313. symbols = SUBSTITUTION_SYMBOLS;
  1314. }
  1315. return nativeReplace.call(replacement, symbols, function (match, ch) {
  1316. var capture;
  1317. switch (ch.charAt(0)) {
  1318. case '$': return '$';
  1319. case '&': return matched;
  1320. case '`': return str.slice(0, position);
  1321. case "'": return str.slice(tailPos);
  1322. case '<':
  1323. capture = namedCaptures[ch.slice(1, -1)];
  1324. break;
  1325. default: // \d\d?
  1326. var n = +ch;
  1327. if (n === 0) return match;
  1328. if (n > m) {
  1329. var f = floor$1(n / 10);
  1330. if (f === 0) return match;
  1331. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1332. return match;
  1333. }
  1334. capture = captures[n - 1];
  1335. }
  1336. return capture === undefined ? '' : capture;
  1337. });
  1338. }
  1339. });
  1340. var SPECIES$3 = wellKnownSymbol('species');
  1341. // `SpeciesConstructor` abstract operation
  1342. // https://tc39.github.io/ecma262/#sec-speciesconstructor
  1343. var speciesConstructor = function (O, defaultConstructor) {
  1344. var C = anObject(O).constructor;
  1345. var S;
  1346. return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction$1(S);
  1347. };
  1348. var arrayPush = [].push;
  1349. var min$3 = Math.min;
  1350. var MAX_UINT32 = 0xFFFFFFFF;
  1351. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1352. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1353. // @@split logic
  1354. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  1355. var internalSplit;
  1356. if (
  1357. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1358. 'test'.split(/(?:)/, -1).length != 4 ||
  1359. 'ab'.split(/(?:ab)*/).length != 2 ||
  1360. '.'.split(/(.?)(.?)/).length != 4 ||
  1361. '.'.split(/()()/).length > 1 ||
  1362. ''.split(/.?/).length
  1363. ) {
  1364. // based on es5-shim implementation, need to rework it
  1365. internalSplit = function (separator, limit) {
  1366. var string = String(requireObjectCoercible(this));
  1367. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1368. if (lim === 0) return [];
  1369. if (separator === undefined) return [string];
  1370. // If `separator` is not a regex, use native split
  1371. if (!isRegexp(separator)) {
  1372. return nativeSplit.call(string, separator, lim);
  1373. }
  1374. var output = [];
  1375. var flags = (separator.ignoreCase ? 'i' : '') +
  1376. (separator.multiline ? 'm' : '') +
  1377. (separator.unicode ? 'u' : '') +
  1378. (separator.sticky ? 'y' : '');
  1379. var lastLastIndex = 0;
  1380. // Make `global` and avoid `lastIndex` issues by working with a copy
  1381. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1382. var match, lastIndex, lastLength;
  1383. while (match = regexpExec.call(separatorCopy, string)) {
  1384. lastIndex = separatorCopy.lastIndex;
  1385. if (lastIndex > lastLastIndex) {
  1386. output.push(string.slice(lastLastIndex, match.index));
  1387. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1388. lastLength = match[0].length;
  1389. lastLastIndex = lastIndex;
  1390. if (output.length >= lim) break;
  1391. }
  1392. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1393. }
  1394. if (lastLastIndex === string.length) {
  1395. if (lastLength || !separatorCopy.test('')) output.push('');
  1396. } else output.push(string.slice(lastLastIndex));
  1397. return output.length > lim ? output.slice(0, lim) : output;
  1398. };
  1399. // Chakra, V8
  1400. } else if ('0'.split(undefined, 0).length) {
  1401. internalSplit = function (separator, limit) {
  1402. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1403. };
  1404. } else internalSplit = nativeSplit;
  1405. return [
  1406. // `String.prototype.split` method
  1407. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  1408. function split(separator, limit) {
  1409. var O = requireObjectCoercible(this);
  1410. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1411. return splitter !== undefined
  1412. ? splitter.call(separator, O, limit)
  1413. : internalSplit.call(String(O), separator, limit);
  1414. },
  1415. // `RegExp.prototype[@@split]` method
  1416. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  1417. //
  1418. // NOTE: This cannot be properly polyfilled in engines that don't support
  1419. // the 'y' flag.
  1420. function (regexp, limit) {
  1421. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1422. if (res.done) return res.value;
  1423. var rx = anObject(regexp);
  1424. var S = String(this);
  1425. var C = speciesConstructor(rx, RegExp);
  1426. var unicodeMatching = rx.unicode;
  1427. var flags = (rx.ignoreCase ? 'i' : '') +
  1428. (rx.multiline ? 'm' : '') +
  1429. (rx.unicode ? 'u' : '') +
  1430. (SUPPORTS_Y ? 'y' : 'g');
  1431. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1432. // simulate the 'y' flag.
  1433. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1434. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1435. if (lim === 0) return [];
  1436. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1437. var p = 0;
  1438. var q = 0;
  1439. var A = [];
  1440. while (q < S.length) {
  1441. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1442. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1443. var e;
  1444. if (
  1445. z === null ||
  1446. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1447. ) {
  1448. q = advanceStringIndex(S, q, unicodeMatching);
  1449. } else {
  1450. A.push(S.slice(p, q));
  1451. if (A.length === lim) return A;
  1452. for (var i = 1; i <= z.length - 1; i++) {
  1453. A.push(z[i]);
  1454. if (A.length === lim) return A;
  1455. }
  1456. q = p = e;
  1457. }
  1458. }
  1459. A.push(S.slice(p));
  1460. return A;
  1461. }
  1462. ];
  1463. }, !SUPPORTS_Y);
  1464. var non = '\u200B\u0085\u180E';
  1465. // check that a method works with the correct list
  1466. // of whitespaces and has a correct name
  1467. var forcedStringTrimMethod = function (METHOD_NAME) {
  1468. return fails(function () {
  1469. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  1470. });
  1471. };
  1472. var $trim = stringTrim.trim;
  1473. // `String.prototype.trim` method
  1474. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  1475. _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
  1476. trim: function trim() {
  1477. return $trim(this);
  1478. }
  1479. });
  1480. // iterable DOM collections
  1481. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1482. var domIterables = {
  1483. CSSRuleList: 0,
  1484. CSSStyleDeclaration: 0,
  1485. CSSValueList: 0,
  1486. ClientRectList: 0,
  1487. DOMRectList: 0,
  1488. DOMStringList: 0,
  1489. DOMTokenList: 1,
  1490. DataTransferItemList: 0,
  1491. FileList: 0,
  1492. HTMLAllCollection: 0,
  1493. HTMLCollection: 0,
  1494. HTMLFormElement: 0,
  1495. HTMLSelectElement: 0,
  1496. MediaList: 0,
  1497. MimeTypeArray: 0,
  1498. NamedNodeMap: 0,
  1499. NodeList: 1,
  1500. PaintRequestList: 0,
  1501. Plugin: 0,
  1502. PluginArray: 0,
  1503. SVGLengthList: 0,
  1504. SVGNumberList: 0,
  1505. SVGPathSegList: 0,
  1506. SVGPointList: 0,
  1507. SVGStringList: 0,
  1508. SVGTransformList: 0,
  1509. SourceBufferList: 0,
  1510. StyleSheetList: 0,
  1511. TextTrackCueList: 0,
  1512. TextTrackList: 0,
  1513. TouchList: 0
  1514. };
  1515. var $forEach = arrayIteration.forEach;
  1516. // `Array.prototype.forEach` method implementation
  1517. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  1518. var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
  1519. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1520. } : [].forEach;
  1521. for (var COLLECTION_NAME in domIterables) {
  1522. var Collection = global_1[COLLECTION_NAME];
  1523. var CollectionPrototype = Collection && Collection.prototype;
  1524. // some Chrome versions have non-configurable methods on DOMTokenList
  1525. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1526. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1527. } catch (error) {
  1528. CollectionPrototype.forEach = arrayForEach;
  1529. }
  1530. }
  1531. function _typeof(obj) {
  1532. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  1533. _typeof = function (obj) {
  1534. return typeof obj;
  1535. };
  1536. } else {
  1537. _typeof = function (obj) {
  1538. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  1539. };
  1540. }
  1541. return _typeof(obj);
  1542. }
  1543. function _classCallCheck(instance, Constructor) {
  1544. if (!(instance instanceof Constructor)) {
  1545. throw new TypeError("Cannot call a class as a function");
  1546. }
  1547. }
  1548. function _defineProperties(target, props) {
  1549. for (var i = 0; i < props.length; i++) {
  1550. var descriptor = props[i];
  1551. descriptor.enumerable = descriptor.enumerable || false;
  1552. descriptor.configurable = true;
  1553. if ("value" in descriptor) descriptor.writable = true;
  1554. Object.defineProperty(target, descriptor.key, descriptor);
  1555. }
  1556. }
  1557. function _createClass(Constructor, protoProps, staticProps) {
  1558. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1559. if (staticProps) _defineProperties(Constructor, staticProps);
  1560. return Constructor;
  1561. }
  1562. function _inherits(subClass, superClass) {
  1563. if (typeof superClass !== "function" && superClass !== null) {
  1564. throw new TypeError("Super expression must either be null or a function");
  1565. }
  1566. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1567. constructor: {
  1568. value: subClass,
  1569. writable: true,
  1570. configurable: true
  1571. }
  1572. });
  1573. if (superClass) _setPrototypeOf(subClass, superClass);
  1574. }
  1575. function _getPrototypeOf(o) {
  1576. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1577. return o.__proto__ || Object.getPrototypeOf(o);
  1578. };
  1579. return _getPrototypeOf(o);
  1580. }
  1581. function _setPrototypeOf(o, p) {
  1582. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1583. o.__proto__ = p;
  1584. return o;
  1585. };
  1586. return _setPrototypeOf(o, p);
  1587. }
  1588. function _assertThisInitialized(self) {
  1589. if (self === void 0) {
  1590. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1591. }
  1592. return self;
  1593. }
  1594. function _possibleConstructorReturn(self, call) {
  1595. if (call && (typeof call === "object" || typeof call === "function")) {
  1596. return call;
  1597. }
  1598. return _assertThisInitialized(self);
  1599. }
  1600. function _superPropBase(object, property) {
  1601. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1602. object = _getPrototypeOf(object);
  1603. if (object === null) break;
  1604. }
  1605. return object;
  1606. }
  1607. function _get(target, property, receiver) {
  1608. if (typeof Reflect !== "undefined" && Reflect.get) {
  1609. _get = Reflect.get;
  1610. } else {
  1611. _get = function _get(target, property, receiver) {
  1612. var base = _superPropBase(target, property);
  1613. if (!base) return;
  1614. var desc = Object.getOwnPropertyDescriptor(base, property);
  1615. if (desc.get) {
  1616. return desc.get.call(receiver);
  1617. }
  1618. return desc.value;
  1619. };
  1620. }
  1621. return _get(target, property, receiver || target);
  1622. }
  1623. /**
  1624. * @author: Dennis Hernández
  1625. * @webSite: http://djhvscf.github.io/Blog
  1626. * @version: v2.2.0
  1627. */
  1628. var Utils = $.fn.bootstrapTable.utils;
  1629. var UtilsFilterControl = {
  1630. getOptionsFromSelectControl: function getOptionsFromSelectControl(selectControl) {
  1631. return selectControl.get(selectControl.length - 1).options;
  1632. },
  1633. getControlContainer: function getControlContainer() {
  1634. if (UtilsFilterControl.bootstrapTableInstance.options.filterControlContainer) {
  1635. return $("".concat(UtilsFilterControl.bootstrapTableInstance.options.filterControlContainer));
  1636. }
  1637. return UtilsFilterControl.getCurrentHeader(UtilsFilterControl.bootstrapTableInstance);
  1638. },
  1639. getSearchControls: function getSearchControls(scope) {
  1640. var header = UtilsFilterControl.getControlContainer();
  1641. var searchControls = UtilsFilterControl.getCurrentSearchControls(scope);
  1642. return header.find(searchControls);
  1643. },
  1644. hideUnusedSelectOptions: function hideUnusedSelectOptions(selectControl, uniqueValues) {
  1645. var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
  1646. for (var i = 0; i < options.length; i++) {
  1647. if (options[i].value !== '') {
  1648. if (!uniqueValues.hasOwnProperty(options[i].value)) {
  1649. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
  1650. } else {
  1651. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
  1652. }
  1653. }
  1654. }
  1655. },
  1656. addOptionToSelectControl: function addOptionToSelectControl(selectControl, _value, text, selected) {
  1657. var value = $.trim(_value);
  1658. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1659. if (!UtilsFilterControl.existOptionInSelectControl(selectControl, value)) {
  1660. var option = $("<option value=\"".concat(value, "\">").concat(text, "</option>"));
  1661. if (value === selected) {
  1662. option.attr('selected', true);
  1663. }
  1664. $selectControl.append(option);
  1665. }
  1666. },
  1667. sortSelectControl: function sortSelectControl(selectControl, orderBy) {
  1668. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1669. var $opts = $selectControl.find('option:gt(0)');
  1670. $opts.sort(function (a, b) {
  1671. return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
  1672. });
  1673. $selectControl.find('option:gt(0)').remove();
  1674. $selectControl.append($opts);
  1675. },
  1676. existOptionInSelectControl: function existOptionInSelectControl(selectControl, value) {
  1677. var options = UtilsFilterControl.getOptionsFromSelectControl(selectControl);
  1678. for (var i = 0; i < options.length; i++) {
  1679. if (options[i].value === value.toString()) {
  1680. // The value is not valid to add
  1681. return true;
  1682. }
  1683. } // If we get here, the value is valid to add
  1684. return false;
  1685. },
  1686. fixHeaderCSS: function fixHeaderCSS(_ref) {
  1687. var $tableHeader = _ref.$tableHeader;
  1688. $tableHeader.css('height', '77px');
  1689. },
  1690. getCurrentHeader: function getCurrentHeader(_ref2) {
  1691. var $header = _ref2.$header,
  1692. options = _ref2.options,
  1693. $tableHeader = _ref2.$tableHeader;
  1694. var header = $header;
  1695. if (options.height) {
  1696. header = $tableHeader;
  1697. }
  1698. return header;
  1699. },
  1700. getCurrentSearchControls: function getCurrentSearchControls(_ref3) {
  1701. var options = _ref3.options;
  1702. var searchControls = 'select, input';
  1703. if (options.height) {
  1704. searchControls = 'table select, table input';
  1705. }
  1706. return searchControls;
  1707. },
  1708. getCursorPosition: function getCursorPosition(el) {
  1709. if (Utils.isIEBrowser()) {
  1710. if ($(el).is('input[type=text]')) {
  1711. var pos = 0;
  1712. if ('selectionStart' in el) {
  1713. pos = el.selectionStart;
  1714. } else if ('selection' in document) {
  1715. el.focus();
  1716. var Sel = document.selection.createRange();
  1717. var SelLength = document.selection.createRange().text.length;
  1718. Sel.moveStart('character', -el.value.length);
  1719. pos = Sel.text.length - SelLength;
  1720. }
  1721. return pos;
  1722. }
  1723. return -1;
  1724. }
  1725. return -1;
  1726. },
  1727. setCursorPosition: function setCursorPosition(el) {
  1728. $(el).val(el.value);
  1729. },
  1730. copyValues: function copyValues(that) {
  1731. var searchControls = UtilsFilterControl.getSearchControls(that);
  1732. that.options.valuesFilterControl = [];
  1733. searchControls.each(function () {
  1734. that.options.valuesFilterControl.push({
  1735. field: $(this).closest('[data-field]').data('field'),
  1736. value: $(this).val(),
  1737. position: UtilsFilterControl.getCursorPosition($(this).get(0)),
  1738. hasFocus: $(this).is(':focus')
  1739. });
  1740. });
  1741. },
  1742. setValues: function setValues(that) {
  1743. var field = null;
  1744. var result = [];
  1745. var searchControls = UtilsFilterControl.getSearchControls(that);
  1746. if (that.options.valuesFilterControl.length > 0) {
  1747. // Callback to apply after settings fields values
  1748. var fieldToFocusCallback = null;
  1749. searchControls.each(function (index, ele) {
  1750. field = $(this).closest('[data-field]').data('field');
  1751. result = that.options.valuesFilterControl.filter(function (valueObj) {
  1752. return valueObj.field === field;
  1753. });
  1754. if (result.length > 0) {
  1755. $(this).val(result[0].value);
  1756. if (result[0].hasFocus && result[0].value !== '') {
  1757. // set callback if the field had the focus.
  1758. fieldToFocusCallback = function (fieldToFocus, carretPosition) {
  1759. // Closure here to capture the field and cursor position
  1760. var closedCallback = function closedCallback() {
  1761. fieldToFocus.focus();
  1762. UtilsFilterControl.setCursorPosition(fieldToFocus, carretPosition);
  1763. };
  1764. return closedCallback;
  1765. }($(this).get(0), result[0].position);
  1766. }
  1767. }
  1768. }); // Callback call.
  1769. if (fieldToFocusCallback !== null) {
  1770. fieldToFocusCallback();
  1771. }
  1772. }
  1773. },
  1774. collectBootstrapCookies: function collectBootstrapCookies() {
  1775. var cookies = [];
  1776. var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
  1777. var foundLocalStorage = localStorage;
  1778. if (foundCookies) {
  1779. $.each(foundCookies, function (i, _cookie) {
  1780. var cookie = _cookie;
  1781. if (/./.test(cookie)) {
  1782. cookie = cookie.split('.').pop();
  1783. }
  1784. if ($.inArray(cookie, cookies) === -1) {
  1785. cookies.push(cookie);
  1786. }
  1787. });
  1788. }
  1789. if (foundLocalStorage) {
  1790. for (var i = 0; i < foundLocalStorage.length; i++) {
  1791. var cookie = foundLocalStorage.key(i);
  1792. if (/./.test(cookie)) {
  1793. cookie = cookie.split('.').pop();
  1794. }
  1795. if (!cookies.includes(cookie)) {
  1796. cookies.push(cookie);
  1797. }
  1798. }
  1799. }
  1800. return cookies;
  1801. },
  1802. escapeID: function escapeID(id) {
  1803. // eslint-disable-next-line no-useless-escape
  1804. return String(id).replace(/([:.\[\],])/g, '\\$1');
  1805. },
  1806. isColumnSearchableViaSelect: function isColumnSearchableViaSelect(_ref4) {
  1807. var filterControl = _ref4.filterControl,
  1808. searchable = _ref4.searchable;
  1809. return filterControl && filterControl.toLowerCase() === 'select' && searchable;
  1810. },
  1811. isFilterDataNotGiven: function isFilterDataNotGiven(_ref5) {
  1812. var filterData = _ref5.filterData;
  1813. return filterData === undefined || filterData.toLowerCase() === 'column';
  1814. },
  1815. hasSelectControlElement: function hasSelectControlElement(selectControl) {
  1816. return selectControl && selectControl.length > 0;
  1817. },
  1818. initFilterSelectControls: function initFilterSelectControls(that) {
  1819. var data = that.data;
  1820. var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
  1821. $.each(that.header.fields, function (j, field) {
  1822. var column = that.columns[that.fieldsColumnsIndex[field]];
  1823. var selectControl = UtilsFilterControl.getControlContainer().find(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
  1824. if (UtilsFilterControl.isColumnSearchableViaSelect(column) && UtilsFilterControl.isFilterDataNotGiven(column) && UtilsFilterControl.hasSelectControlElement(selectControl)) {
  1825. if (selectControl.get(selectControl.length - 1).options.length === 0) {
  1826. // Added the default option
  1827. UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1828. }
  1829. var uniqueValues = {};
  1830. for (var i = 0; i < z; i++) {
  1831. // Added a new value
  1832. var fieldValue = data[i][field];
  1833. var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
  1834. var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
  1835. if (column.filterDataCollector) {
  1836. formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
  1837. }
  1838. uniqueValues[formattedValue] = fieldValue;
  1839. if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
  1840. formattedValue.forEach(function (value) {
  1841. UtilsFilterControl.addOptionToSelectControl(selectControl, value, value, column.filterDefault);
  1842. });
  1843. continue;
  1844. }
  1845. UtilsFilterControl.addOptionToSelectControl(selectControl, formattedValue, formattedValue, column.filterDefault);
  1846. }
  1847. UtilsFilterControl.sortSelectControl(selectControl, column.filterOrderBy);
  1848. if (that.options.hideUnusedSelectOptions) {
  1849. UtilsFilterControl.hideUnusedSelectOptions(selectControl, uniqueValues);
  1850. }
  1851. }
  1852. });
  1853. that.trigger('created-controls');
  1854. },
  1855. getFilterDataMethod: function getFilterDataMethod(objFilterDataMethod, searchTerm) {
  1856. var keys = Object.keys(objFilterDataMethod);
  1857. for (var i = 0; i < keys.length; i++) {
  1858. if (keys[i] === searchTerm) {
  1859. return objFilterDataMethod[searchTerm];
  1860. }
  1861. }
  1862. return null;
  1863. },
  1864. createControls: function createControls(that, header) {
  1865. var addedFilterControl = false;
  1866. var html;
  1867. $.each(that.columns, function (i, column) {
  1868. html = [];
  1869. if (!column.visible) {
  1870. return;
  1871. }
  1872. if (!column.filterControl && !that.options.filterControlContainer) {
  1873. html.push('<div class="no-filter-control"></div>');
  1874. } else if (that.options.filterControlContainer) {
  1875. var $filterControl = $(".bootstrap-table-filter-control-".concat(column.field));
  1876. var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
  1877. $filterControl.attr('placeholder', placeholder);
  1878. $filterControl.val(column.filterDefault);
  1879. $filterControl.attr('data-field', column.field);
  1880. addedFilterControl = true;
  1881. } else {
  1882. var nameControl = column.filterControl.toLowerCase();
  1883. html.push('<div class="filter-control">');
  1884. addedFilterControl = true;
  1885. if (column.searchable && that.options.filterTemplate[nameControl]) {
  1886. html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
  1887. }
  1888. }
  1889. if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
  1890. if ($.isEmptyObject(that.filterColumnsPartial)) {
  1891. that.filterColumnsPartial = {};
  1892. }
  1893. that.filterColumnsPartial[column.field] = column.filterDefault;
  1894. }
  1895. $.each(header.children().children(), function (i, tr) {
  1896. var $tr = $(tr);
  1897. if ($tr.data('field') === column.field) {
  1898. $tr.find('.fht-cell').append(html.join(''));
  1899. return false;
  1900. }
  1901. });
  1902. if (column.filterData !== undefined && column.filterData.toLowerCase() !== 'column') {
  1903. var filterDataType = UtilsFilterControl.getFilterDataMethod(
  1904. /* eslint-disable no-use-before-define */
  1905. filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
  1906. var filterDataSource;
  1907. var selectControl;
  1908. if (filterDataType !== null) {
  1909. filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
  1910. selectControl = UtilsFilterControl.getControlContainer().find(".bootstrap-table-filter-control-".concat(UtilsFilterControl.escapeID(column.field)));
  1911. UtilsFilterControl.addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1912. filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
  1913. } else {
  1914. throw new SyntaxError('Error. You should use any of these allowed filter data methods: var, obj, json, url, func.' + ' Use like this: var: {key: "value"}');
  1915. }
  1916. }
  1917. });
  1918. if (addedFilterControl) {
  1919. UtilsFilterControl.getControlContainer().off('keyup', 'input').on('keyup', 'input', function (_ref6, obj) {
  1920. var currentTarget = _ref6.currentTarget,
  1921. keyCode = _ref6.keyCode;
  1922. // Simulate enter key action from clear button
  1923. keyCode = obj ? obj.keyCode : keyCode;
  1924. if (that.options.searchOnEnterKey && keyCode !== 13) {
  1925. return;
  1926. }
  1927. if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
  1928. return;
  1929. }
  1930. var $currentTarget = $(currentTarget);
  1931. if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
  1932. return;
  1933. }
  1934. clearTimeout(currentTarget.timeoutId || 0);
  1935. currentTarget.timeoutId = setTimeout(function () {
  1936. that.onColumnSearch({
  1937. currentTarget: currentTarget,
  1938. keyCode: keyCode
  1939. });
  1940. }, that.options.searchTimeOut);
  1941. });
  1942. UtilsFilterControl.getControlContainer().off('change', 'select').on('change', 'select', function (_ref7) {
  1943. var currentTarget = _ref7.currentTarget,
  1944. keyCode = _ref7.keyCode;
  1945. if (that.options.searchOnEnterKey && keyCode !== 13) {
  1946. return;
  1947. }
  1948. if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
  1949. return;
  1950. }
  1951. var $select = $(currentTarget);
  1952. var value = $select.val();
  1953. if ($.trim(value)) {
  1954. $select.find('option[selected]').removeAttr('selected');
  1955. $select.find('option[value="' + value + '"]').attr('selected', true);
  1956. } else {
  1957. $select.find('option[selected]').removeAttr('selected');
  1958. }
  1959. clearTimeout(currentTarget.timeoutId || 0);
  1960. currentTarget.timeoutId = setTimeout(function () {
  1961. that.onColumnSearch({
  1962. currentTarget: currentTarget,
  1963. keyCode: keyCode
  1964. });
  1965. }, that.options.searchTimeOut);
  1966. });
  1967. header.off('mouseup', 'input').on('mouseup', 'input', function (_ref8) {
  1968. var currentTarget = _ref8.currentTarget,
  1969. keyCode = _ref8.keyCode;
  1970. var $input = $(currentTarget);
  1971. var oldValue = $input.val();
  1972. if (oldValue === '') {
  1973. return;
  1974. }
  1975. setTimeout(function () {
  1976. var newValue = $input.val();
  1977. if (newValue === '') {
  1978. clearTimeout(currentTarget.timeoutId || 0);
  1979. currentTarget.timeoutId = setTimeout(function () {
  1980. that.onColumnSearch({
  1981. currentTarget: currentTarget,
  1982. keyCode: keyCode
  1983. });
  1984. }, that.options.searchTimeOut);
  1985. }
  1986. }, 1);
  1987. });
  1988. if (UtilsFilterControl.getControlContainer().find('.date-filter-control').length > 0) {
  1989. $.each(that.columns, function (i, _ref9) {
  1990. var filterControl = _ref9.filterControl,
  1991. field = _ref9.field,
  1992. filterDatepickerOptions = _ref9.filterDatepickerOptions;
  1993. if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
  1994. UtilsFilterControl.getControlContainer().find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (_ref10) {
  1995. var currentTarget = _ref10.currentTarget,
  1996. keyCode = _ref10.keyCode;
  1997. clearTimeout(currentTarget.timeoutId || 0);
  1998. currentTarget.timeoutId = setTimeout(function () {
  1999. that.onColumnSearch({
  2000. currentTarget: currentTarget,
  2001. keyCode: keyCode
  2002. });
  2003. }, that.options.searchTimeOut);
  2004. });
  2005. }
  2006. });
  2007. }
  2008. if (that.options.sidePagination !== 'server') {
  2009. that.triggerSearch();
  2010. }
  2011. } else {
  2012. UtilsFilterControl.getControlContainer().find('.filterControl').hide();
  2013. }
  2014. },
  2015. getDirectionOfSelectOptions: function getDirectionOfSelectOptions(_alignment) {
  2016. var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
  2017. switch (alignment) {
  2018. case 'left':
  2019. return 'ltr';
  2020. case 'right':
  2021. return 'rtl';
  2022. case 'auto':
  2023. return 'auto';
  2024. default:
  2025. return 'ltr';
  2026. }
  2027. }
  2028. };
  2029. var filterDataMethods = {
  2030. func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
  2031. var variableValues = window[filterDataSource].apply();
  2032. for (var key in variableValues) {
  2033. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2034. }
  2035. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  2036. },
  2037. obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
  2038. var objectKeys = filterDataSource.split('.');
  2039. var variableName = objectKeys.shift();
  2040. var variableValues = window[variableName];
  2041. if (objectKeys.length > 0) {
  2042. objectKeys.forEach(function (key) {
  2043. variableValues = variableValues[key];
  2044. });
  2045. }
  2046. for (var key in variableValues) {
  2047. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2048. }
  2049. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  2050. },
  2051. var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
  2052. var variableValues = window[filterDataSource];
  2053. for (var key in variableValues) {
  2054. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2055. }
  2056. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  2057. },
  2058. url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
  2059. $.ajax({
  2060. url: filterDataSource,
  2061. dataType: 'json',
  2062. success: function success(data) {
  2063. for (var key in data) {
  2064. UtilsFilterControl.addOptionToSelectControl(selectControl, key, data[key], selected);
  2065. }
  2066. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  2067. }
  2068. });
  2069. },
  2070. json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
  2071. var variableValues = JSON.parse(filterDataSource);
  2072. for (var key in variableValues) {
  2073. UtilsFilterControl.addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2074. }
  2075. UtilsFilterControl.sortSelectControl(selectControl, filterOrderBy);
  2076. }
  2077. };
  2078. $.extend($.fn.bootstrapTable.defaults, {
  2079. filterControl: false,
  2080. onColumnSearch: function onColumnSearch(field, text) {
  2081. return false;
  2082. },
  2083. onCreatedControls: function onCreatedControls() {
  2084. return true;
  2085. },
  2086. alignmentSelectControlOptions: undefined,
  2087. filterTemplate: {
  2088. input: function input(that, field, placeholder, value) {
  2089. return Utils.sprintf('<input type="text" class="form-control bootstrap-table-filter-control-%s search-input" style="width: 100%;" placeholder="%s" value="%s">', field, 'undefined' === typeof placeholder ? '' : placeholder, 'undefined' === typeof value ? '' : value);
  2090. },
  2091. select: function select(_ref11, field) {
  2092. var options = _ref11.options;
  2093. return Utils.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, UtilsFilterControl.getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
  2094. },
  2095. datepicker: function datepicker(that, field, value) {
  2096. return Utils.sprintf('<input type="text" class="form-control date-filter-control bootstrap-table-filter-control-%s" style="width: 100%;" value="%s">', field, 'undefined' === typeof value ? '' : value);
  2097. }
  2098. },
  2099. disableControlWhenSearch: false,
  2100. searchOnEnterKey: false,
  2101. // internal variables
  2102. valuesFilterControl: []
  2103. });
  2104. $.extend($.fn.bootstrapTable.columnDefaults, {
  2105. filterControl: undefined,
  2106. filterDataCollector: undefined,
  2107. filterData: undefined,
  2108. filterDatepickerOptions: undefined,
  2109. filterStrictSearch: false,
  2110. filterStartsWithSearch: false,
  2111. filterControlPlaceholder: '',
  2112. filterDefault: '',
  2113. filterOrderBy: 'asc' // asc || desc
  2114. });
  2115. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  2116. 'column-search.bs.table': 'onColumnSearch',
  2117. 'created-controls.bs.table': 'onCreatedControls'
  2118. });
  2119. $.extend($.fn.bootstrapTable.defaults.icons, {
  2120. clear: {
  2121. bootstrap3: 'glyphicon-trash icon-clear'
  2122. }[$.fn.bootstrapTable.theme] || 'fa-trash'
  2123. });
  2124. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  2125. $.extend($.fn.bootstrapTable.defaults, {
  2126. formatClearSearch: function formatClearSearch() {
  2127. return 'Clear filters';
  2128. }
  2129. });
  2130. $.fn.bootstrapTable.methods.push('triggerSearch');
  2131. $.fn.bootstrapTable.methods.push('clearFilterControl');
  2132. $.BootstrapTable =
  2133. /*#__PURE__*/
  2134. function (_$$BootstrapTable) {
  2135. _inherits(_class, _$$BootstrapTable);
  2136. function _class() {
  2137. _classCallCheck(this, _class);
  2138. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  2139. }
  2140. _createClass(_class, [{
  2141. key: "init",
  2142. value: function init() {
  2143. var _this = this;
  2144. UtilsFilterControl.bootstrapTableInstance = this; // Make sure that the filterControl option is set
  2145. if (this.options.filterControl) {
  2146. var that = this; // Make sure that the internal variables are set correctly
  2147. this.options.valuesFilterControl = [];
  2148. this.$el.on('reset-view.bs.table', function () {
  2149. // Create controls on $tableHeader if the height is set
  2150. if (!that.options.height) {
  2151. return;
  2152. } // Avoid recreate the controls
  2153. if (UtilsFilterControl.getControlContainer().find('select').length > 0 || UtilsFilterControl.getControlContainer().find('input').length > 0) {
  2154. return;
  2155. }
  2156. UtilsFilterControl.createControls(that, UtilsFilterControl.getControlContainer());
  2157. }).on('post-header.bs.table', function () {
  2158. UtilsFilterControl.setValues(that);
  2159. }).on('post-body.bs.table', function () {
  2160. if (that.options.height && !that.options.filterControlContainer) {
  2161. UtilsFilterControl.fixHeaderCSS(that);
  2162. }
  2163. _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
  2164. }).on('column-switch.bs.table', function () {
  2165. UtilsFilterControl.setValues(that);
  2166. }).on('load-success.bs.table', function () {
  2167. that.enableControls(true);
  2168. }).on('load-error.bs.table', function () {
  2169. that.enableControls(true);
  2170. });
  2171. }
  2172. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  2173. }
  2174. }, {
  2175. key: "initHeader",
  2176. value: function initHeader() {
  2177. _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
  2178. if (!this.options.filterControl) {
  2179. return;
  2180. }
  2181. UtilsFilterControl.createControls(this, UtilsFilterControl.getControlContainer());
  2182. }
  2183. }, {
  2184. key: "initBody",
  2185. value: function initBody() {
  2186. _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
  2187. UtilsFilterControl.initFilterSelectControls(this);
  2188. }
  2189. }, {
  2190. key: "initSearch",
  2191. value: function initSearch() {
  2192. var that = this;
  2193. var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
  2194. if (fp === null || Object.keys(fp).length <= 1) {
  2195. _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
  2196. }
  2197. if (this.options.sidePagination === 'server') {
  2198. return;
  2199. }
  2200. if (fp === null) {
  2201. return;
  2202. } // Check partial column filter
  2203. that.data = fp ? that.options.data.filter(function (item, i) {
  2204. var itemIsExpected = [];
  2205. var keys1 = Object.keys(item);
  2206. var keys2 = Object.keys(fp);
  2207. var keys = keys1.concat(keys2.filter(function (item) {
  2208. return !keys1.includes(item);
  2209. }));
  2210. keys.forEach(function (key) {
  2211. var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
  2212. var fval = (fp[key] || '').toLowerCase();
  2213. var value = Utils.getItemField(item, key, false);
  2214. var tmpItemIsExpected;
  2215. if (fval === '') {
  2216. tmpItemIsExpected = true;
  2217. } else {
  2218. // Fix #142: search use formatted data
  2219. if (thisColumn && thisColumn.searchFormatter) {
  2220. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
  2221. }
  2222. if ($.inArray(key, that.header.fields) !== -1) {
  2223. if (value === undefined || value === null) {
  2224. tmpItemIsExpected = false;
  2225. } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  2226. if (thisColumn.filterStrictSearch) {
  2227. tmpItemIsExpected = value.toString().toLowerCase() === fval.toString().toLowerCase();
  2228. } else if (thisColumn.filterStartsWithSearch) {
  2229. tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(fval) === 0;
  2230. } else {
  2231. tmpItemIsExpected = "".concat(value).toLowerCase().includes(fval);
  2232. }
  2233. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  2234. var matches = largerSmallerEqualsRegex.exec(fval);
  2235. if (matches) {
  2236. var operator = matches[1] || "".concat(matches[5], "l");
  2237. var comparisonValue = matches[2] || matches[3];
  2238. var int = parseInt(value, 10);
  2239. var comparisonInt = parseInt(comparisonValue, 10);
  2240. switch (operator) {
  2241. case '>':
  2242. case '<l':
  2243. tmpItemIsExpected = int > comparisonInt;
  2244. break;
  2245. case '<':
  2246. case '>l':
  2247. tmpItemIsExpected = int < comparisonInt;
  2248. break;
  2249. case '<=':
  2250. case '=<':
  2251. case '>=l':
  2252. case '=>l':
  2253. tmpItemIsExpected = int <= comparisonInt;
  2254. break;
  2255. case '>=':
  2256. case '=>':
  2257. case '<=l':
  2258. case '=<l':
  2259. tmpItemIsExpected = int >= comparisonInt;
  2260. break;
  2261. }
  2262. }
  2263. if (thisColumn.filterCustomSearch) {
  2264. var customSearchResult = Utils.calculateObjectValue(that, thisColumn.filterCustomSearch, [fval, value, key, that.options.data], true);
  2265. if (customSearchResult !== null) {
  2266. tmpItemIsExpected = customSearchResult;
  2267. }
  2268. }
  2269. }
  2270. }
  2271. }
  2272. itemIsExpected.push(tmpItemIsExpected);
  2273. });
  2274. return !itemIsExpected.includes(false);
  2275. }) : that.data;
  2276. }
  2277. }, {
  2278. key: "initColumnSearch",
  2279. value: function initColumnSearch(filterColumnsDefaults) {
  2280. UtilsFilterControl.copyValues(this);
  2281. if (filterColumnsDefaults) {
  2282. this.filterColumnsPartial = filterColumnsDefaults;
  2283. this.updatePagination();
  2284. for (var filter in filterColumnsDefaults) {
  2285. this.trigger('column-search', filter, filterColumnsDefaults[filter]);
  2286. }
  2287. }
  2288. }
  2289. }, {
  2290. key: "onColumnSearch",
  2291. value: function onColumnSearch(_ref12) {
  2292. var currentTarget = _ref12.currentTarget,
  2293. keyCode = _ref12.keyCode;
  2294. if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
  2295. return;
  2296. }
  2297. UtilsFilterControl.copyValues(this);
  2298. var text = $.trim($(currentTarget).val());
  2299. var $field = $(currentTarget).closest('[data-field]').data('field');
  2300. if ($.isEmptyObject(this.filterColumnsPartial)) {
  2301. this.filterColumnsPartial = {};
  2302. }
  2303. if (text) {
  2304. this.filterColumnsPartial[$field] = text;
  2305. } else {
  2306. delete this.filterColumnsPartial[$field];
  2307. }
  2308. this.options.pageNumber = 1;
  2309. this.enableControls(false);
  2310. this.onSearch({
  2311. currentTarget: currentTarget
  2312. }, false);
  2313. this.trigger('column-search', $field, text);
  2314. }
  2315. }, {
  2316. key: "initToolbar",
  2317. value: function initToolbar() {
  2318. this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
  2319. _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
  2320. }
  2321. }, {
  2322. key: "resetSearch",
  2323. value: function resetSearch(text) {
  2324. if (this.options.filterControl && this.options.showSearchClearButton) {
  2325. this.clearFilterControl();
  2326. }
  2327. _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
  2328. }
  2329. }, {
  2330. key: "clearFilterControl",
  2331. value: function clearFilterControl() {
  2332. if (this.options.filterControl) {
  2333. var that = this;
  2334. var cookies = UtilsFilterControl.collectBootstrapCookies();
  2335. var header = UtilsFilterControl.getCurrentHeader(that);
  2336. var table = header.closest('table');
  2337. var controls = header.find(UtilsFilterControl.getCurrentSearchControls(that));
  2338. var search = that.$toolbar.find('.search input');
  2339. var hasValues = false;
  2340. var timeoutId = 0;
  2341. $.each(that.options.valuesFilterControl, function (i, item) {
  2342. hasValues = hasValues ? true : item.value !== '';
  2343. item.value = '';
  2344. });
  2345. $.each(that.options.filterControls, function (i, item) {
  2346. item.text = '';
  2347. });
  2348. UtilsFilterControl.setValues(that); // clear cookies once the filters are clean
  2349. clearTimeout(timeoutId);
  2350. timeoutId = setTimeout(function () {
  2351. if (cookies && cookies.length > 0) {
  2352. $.each(cookies, function (i, item) {
  2353. if (that.deleteCookie !== undefined) {
  2354. that.deleteCookie(item);
  2355. }
  2356. });
  2357. }
  2358. }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
  2359. if (!hasValues) {
  2360. return;
  2361. } // Clear each type of filter if it exists.
  2362. // Requires the body to reload each time a type of filter is found because we never know
  2363. // which ones are going to be present.
  2364. if (controls.length > 0) {
  2365. this.filterColumnsPartial = {};
  2366. $(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
  2367. keyCode: 13
  2368. });
  2369. } else {
  2370. return;
  2371. }
  2372. if (search.length > 0) {
  2373. that.resetSearch();
  2374. } // use the default sort order if it exists. do nothing if it does not
  2375. if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
  2376. var sorter = header.find(Utils.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
  2377. if (sorter.length > 0) {
  2378. that.onSort({
  2379. type: 'keypress',
  2380. currentTarget: sorter
  2381. });
  2382. $(sorter).find('.sortable').trigger('click');
  2383. }
  2384. }
  2385. }
  2386. }
  2387. }, {
  2388. key: "triggerSearch",
  2389. value: function triggerSearch() {
  2390. var searchControls = UtilsFilterControl.getSearchControls(this);
  2391. searchControls.each(function () {
  2392. var el = $(this);
  2393. if (el.is('select')) {
  2394. el.change();
  2395. } else {
  2396. el.keyup();
  2397. }
  2398. });
  2399. }
  2400. }, {
  2401. key: "enableControls",
  2402. value: function enableControls(enable) {
  2403. if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
  2404. var searchControls = UtilsFilterControl.getSearchControls(this);
  2405. if (!enable) {
  2406. searchControls.prop('disabled', 'disabled');
  2407. } else {
  2408. searchControls.removeProp('disabled');
  2409. }
  2410. }
  2411. }
  2412. }]);
  2413. return _class;
  2414. }($.BootstrapTable);
  2415. })));