bootstrap-table-filter-control.js 99 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967
  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. $ = $ && Object.prototype.hasOwnProperty.call($, '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 FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  796. // `Object.keys` method
  797. // https://tc39.github.io/ecma262/#sec-object.keys
  798. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  799. keys: function keys(it) {
  800. return objectKeys(toObject(it));
  801. }
  802. });
  803. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  804. var test = {};
  805. test[TO_STRING_TAG] = 'z';
  806. var toStringTagSupport = String(test) === '[object z]';
  807. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  808. // ES3 wrong here
  809. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  810. // fallback for IE11 Script Access Denied error
  811. var tryGet = function (it, key) {
  812. try {
  813. return it[key];
  814. } catch (error) { /* empty */ }
  815. };
  816. // getting tag from ES6+ `Object.prototype.toString`
  817. var classof = toStringTagSupport ? classofRaw : function (it) {
  818. var O, tag, result;
  819. return it === undefined ? 'Undefined' : it === null ? 'Null'
  820. // @@toStringTag case
  821. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
  822. // builtinTag case
  823. : CORRECT_ARGUMENTS ? classofRaw(O)
  824. // ES3 arguments fallback
  825. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  826. };
  827. // `Object.prototype.toString` method implementation
  828. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  829. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  830. return '[object ' + classof(this) + ']';
  831. };
  832. // `Object.prototype.toString` method
  833. // https://tc39.github.io/ecma262/#sec-object.prototype.tostring
  834. if (!toStringTagSupport) {
  835. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  836. }
  837. // a string of all valid unicode whitespaces
  838. // eslint-disable-next-line max-len
  839. 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';
  840. var whitespace = '[' + whitespaces + ']';
  841. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  842. var rtrim = RegExp(whitespace + whitespace + '*$');
  843. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  844. var createMethod$2 = function (TYPE) {
  845. return function ($this) {
  846. var string = String(requireObjectCoercible($this));
  847. if (TYPE & 1) string = string.replace(ltrim, '');
  848. if (TYPE & 2) string = string.replace(rtrim, '');
  849. return string;
  850. };
  851. };
  852. var stringTrim = {
  853. // `String.prototype.{ trimLeft, trimStart }` methods
  854. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  855. start: createMethod$2(1),
  856. // `String.prototype.{ trimRight, trimEnd }` methods
  857. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  858. end: createMethod$2(2),
  859. // `String.prototype.trim` method
  860. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  861. trim: createMethod$2(3)
  862. };
  863. var trim = stringTrim.trim;
  864. var nativeParseInt = global_1.parseInt;
  865. var hex = /^[+-]?0[Xx]/;
  866. var FORCED$1 = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22;
  867. // `parseInt` method
  868. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  869. var _parseInt = FORCED$1 ? function parseInt(string, radix) {
  870. var S = trim(String(string));
  871. return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10));
  872. } : nativeParseInt;
  873. // `parseInt` method
  874. // https://tc39.github.io/ecma262/#sec-parseint-string-radix
  875. _export({ global: true, forced: parseInt != _parseInt }, {
  876. parseInt: _parseInt
  877. });
  878. // `RegExp.prototype.flags` getter implementation
  879. // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags
  880. var regexpFlags = function () {
  881. var that = anObject(this);
  882. var result = '';
  883. if (that.global) result += 'g';
  884. if (that.ignoreCase) result += 'i';
  885. if (that.multiline) result += 'm';
  886. if (that.dotAll) result += 's';
  887. if (that.unicode) result += 'u';
  888. if (that.sticky) result += 'y';
  889. return result;
  890. };
  891. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError,
  892. // so we use an intermediate function.
  893. function RE(s, f) {
  894. return RegExp(s, f);
  895. }
  896. var UNSUPPORTED_Y = fails(function () {
  897. // babel-minify transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  898. var re = RE('a', 'y');
  899. re.lastIndex = 2;
  900. return re.exec('abcd') != null;
  901. });
  902. var BROKEN_CARET = fails(function () {
  903. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  904. var re = RE('^r', 'gy');
  905. re.lastIndex = 2;
  906. return re.exec('str') != null;
  907. });
  908. var regexpStickyHelpers = {
  909. UNSUPPORTED_Y: UNSUPPORTED_Y,
  910. BROKEN_CARET: BROKEN_CARET
  911. };
  912. var nativeExec = RegExp.prototype.exec;
  913. // This always refers to the native implementation, because the
  914. // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
  915. // which loads this file before patching the method.
  916. var nativeReplace = String.prototype.replace;
  917. var patchedExec = nativeExec;
  918. var UPDATES_LAST_INDEX_WRONG = (function () {
  919. var re1 = /a/;
  920. var re2 = /b*/g;
  921. nativeExec.call(re1, 'a');
  922. nativeExec.call(re2, 'a');
  923. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  924. })();
  925. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y || regexpStickyHelpers.BROKEN_CARET;
  926. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  927. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  928. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$1;
  929. if (PATCH) {
  930. patchedExec = function exec(str) {
  931. var re = this;
  932. var lastIndex, reCopy, match, i;
  933. var sticky = UNSUPPORTED_Y$1 && re.sticky;
  934. var flags = regexpFlags.call(re);
  935. var source = re.source;
  936. var charsAdded = 0;
  937. var strCopy = str;
  938. if (sticky) {
  939. flags = flags.replace('y', '');
  940. if (flags.indexOf('g') === -1) {
  941. flags += 'g';
  942. }
  943. strCopy = String(str).slice(re.lastIndex);
  944. // Support anchored sticky behavior.
  945. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str[re.lastIndex - 1] !== '\n')) {
  946. source = '(?: ' + source + ')';
  947. strCopy = ' ' + strCopy;
  948. charsAdded++;
  949. }
  950. // ^(? + rx + ) is needed, in combination with some str slicing, to
  951. // simulate the 'y' flag.
  952. reCopy = new RegExp('^(?:' + source + ')', flags);
  953. }
  954. if (NPCG_INCLUDED) {
  955. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  956. }
  957. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  958. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  959. if (sticky) {
  960. if (match) {
  961. match.input = match.input.slice(charsAdded);
  962. match[0] = match[0].slice(charsAdded);
  963. match.index = re.lastIndex;
  964. re.lastIndex += match[0].length;
  965. } else re.lastIndex = 0;
  966. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  967. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  968. }
  969. if (NPCG_INCLUDED && match && match.length > 1) {
  970. // Fix browsers whose `exec` methods don't consistently return `undefined`
  971. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  972. nativeReplace.call(match[0], reCopy, function () {
  973. for (i = 1; i < arguments.length - 2; i++) {
  974. if (arguments[i] === undefined) match[i] = undefined;
  975. }
  976. });
  977. }
  978. return match;
  979. };
  980. }
  981. var regexpExec = patchedExec;
  982. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  983. exec: regexpExec
  984. });
  985. var TO_STRING = 'toString';
  986. var RegExpPrototype = RegExp.prototype;
  987. var nativeToString = RegExpPrototype[TO_STRING];
  988. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  989. // FF44- RegExp#toString has a wrong name
  990. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  991. // `RegExp.prototype.toString` method
  992. // https://tc39.github.io/ecma262/#sec-regexp.prototype.tostring
  993. if (NOT_GENERIC || INCORRECT_NAME) {
  994. redefine(RegExp.prototype, TO_STRING, function toString() {
  995. var R = anObject(this);
  996. var p = String(R.source);
  997. var rf = R.flags;
  998. var f = String(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? regexpFlags.call(R) : rf);
  999. return '/' + p + '/' + f;
  1000. }, { unsafe: true });
  1001. }
  1002. var MATCH = wellKnownSymbol('match');
  1003. // `IsRegExp` abstract operation
  1004. // https://tc39.github.io/ecma262/#sec-isregexp
  1005. var isRegexp = function (it) {
  1006. var isRegExp;
  1007. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1008. };
  1009. var notARegexp = function (it) {
  1010. if (isRegexp(it)) {
  1011. throw TypeError("The method doesn't accept regular expressions");
  1012. } return it;
  1013. };
  1014. var MATCH$1 = wellKnownSymbol('match');
  1015. var correctIsRegexpLogic = function (METHOD_NAME) {
  1016. var regexp = /./;
  1017. try {
  1018. '/./'[METHOD_NAME](regexp);
  1019. } catch (e) {
  1020. try {
  1021. regexp[MATCH$1] = false;
  1022. return '/./'[METHOD_NAME](regexp);
  1023. } catch (f) { /* empty */ }
  1024. } return false;
  1025. };
  1026. // `String.prototype.includes` method
  1027. // https://tc39.github.io/ecma262/#sec-string.prototype.includes
  1028. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  1029. includes: function includes(searchString /* , position = 0 */) {
  1030. return !!~String(requireObjectCoercible(this))
  1031. .indexOf(notARegexp(searchString), arguments.length > 1 ? arguments[1] : undefined);
  1032. }
  1033. });
  1034. var non = '\u200B\u0085\u180E';
  1035. // check that a method works with the correct list
  1036. // of whitespaces and has a correct name
  1037. var forcedStringTrimMethod = function (METHOD_NAME) {
  1038. return fails(function () {
  1039. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  1040. });
  1041. };
  1042. var $trim = stringTrim.trim;
  1043. // `String.prototype.trim` method
  1044. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  1045. _export({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
  1046. trim: function trim() {
  1047. return $trim(this);
  1048. }
  1049. });
  1050. // iterable DOM collections
  1051. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1052. var domIterables = {
  1053. CSSRuleList: 0,
  1054. CSSStyleDeclaration: 0,
  1055. CSSValueList: 0,
  1056. ClientRectList: 0,
  1057. DOMRectList: 0,
  1058. DOMStringList: 0,
  1059. DOMTokenList: 1,
  1060. DataTransferItemList: 0,
  1061. FileList: 0,
  1062. HTMLAllCollection: 0,
  1063. HTMLCollection: 0,
  1064. HTMLFormElement: 0,
  1065. HTMLSelectElement: 0,
  1066. MediaList: 0,
  1067. MimeTypeArray: 0,
  1068. NamedNodeMap: 0,
  1069. NodeList: 1,
  1070. PaintRequestList: 0,
  1071. Plugin: 0,
  1072. PluginArray: 0,
  1073. SVGLengthList: 0,
  1074. SVGNumberList: 0,
  1075. SVGPathSegList: 0,
  1076. SVGPointList: 0,
  1077. SVGStringList: 0,
  1078. SVGTransformList: 0,
  1079. SourceBufferList: 0,
  1080. StyleSheetList: 0,
  1081. TextTrackCueList: 0,
  1082. TextTrackList: 0,
  1083. TouchList: 0
  1084. };
  1085. var $forEach = arrayIteration.forEach;
  1086. // `Array.prototype.forEach` method implementation
  1087. // https://tc39.github.io/ecma262/#sec-array.prototype.foreach
  1088. var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) {
  1089. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1090. } : [].forEach;
  1091. for (var COLLECTION_NAME in domIterables) {
  1092. var Collection = global_1[COLLECTION_NAME];
  1093. var CollectionPrototype = Collection && Collection.prototype;
  1094. // some Chrome versions have non-configurable methods on DOMTokenList
  1095. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1096. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1097. } catch (error) {
  1098. CollectionPrototype.forEach = arrayForEach;
  1099. }
  1100. }
  1101. function _typeof(obj) {
  1102. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  1103. _typeof = function (obj) {
  1104. return typeof obj;
  1105. };
  1106. } else {
  1107. _typeof = function (obj) {
  1108. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  1109. };
  1110. }
  1111. return _typeof(obj);
  1112. }
  1113. function _classCallCheck(instance, Constructor) {
  1114. if (!(instance instanceof Constructor)) {
  1115. throw new TypeError("Cannot call a class as a function");
  1116. }
  1117. }
  1118. function _defineProperties(target, props) {
  1119. for (var i = 0; i < props.length; i++) {
  1120. var descriptor = props[i];
  1121. descriptor.enumerable = descriptor.enumerable || false;
  1122. descriptor.configurable = true;
  1123. if ("value" in descriptor) descriptor.writable = true;
  1124. Object.defineProperty(target, descriptor.key, descriptor);
  1125. }
  1126. }
  1127. function _createClass(Constructor, protoProps, staticProps) {
  1128. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  1129. if (staticProps) _defineProperties(Constructor, staticProps);
  1130. return Constructor;
  1131. }
  1132. function _inherits(subClass, superClass) {
  1133. if (typeof superClass !== "function" && superClass !== null) {
  1134. throw new TypeError("Super expression must either be null or a function");
  1135. }
  1136. subClass.prototype = Object.create(superClass && superClass.prototype, {
  1137. constructor: {
  1138. value: subClass,
  1139. writable: true,
  1140. configurable: true
  1141. }
  1142. });
  1143. if (superClass) _setPrototypeOf(subClass, superClass);
  1144. }
  1145. function _getPrototypeOf(o) {
  1146. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
  1147. return o.__proto__ || Object.getPrototypeOf(o);
  1148. };
  1149. return _getPrototypeOf(o);
  1150. }
  1151. function _setPrototypeOf(o, p) {
  1152. _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
  1153. o.__proto__ = p;
  1154. return o;
  1155. };
  1156. return _setPrototypeOf(o, p);
  1157. }
  1158. function _assertThisInitialized(self) {
  1159. if (self === void 0) {
  1160. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  1161. }
  1162. return self;
  1163. }
  1164. function _possibleConstructorReturn(self, call) {
  1165. if (call && (typeof call === "object" || typeof call === "function")) {
  1166. return call;
  1167. }
  1168. return _assertThisInitialized(self);
  1169. }
  1170. function _superPropBase(object, property) {
  1171. while (!Object.prototype.hasOwnProperty.call(object, property)) {
  1172. object = _getPrototypeOf(object);
  1173. if (object === null) break;
  1174. }
  1175. return object;
  1176. }
  1177. function _get(target, property, receiver) {
  1178. if (typeof Reflect !== "undefined" && Reflect.get) {
  1179. _get = Reflect.get;
  1180. } else {
  1181. _get = function _get(target, property, receiver) {
  1182. var base = _superPropBase(target, property);
  1183. if (!base) return;
  1184. var desc = Object.getOwnPropertyDescriptor(base, property);
  1185. if (desc.get) {
  1186. return desc.get.call(receiver);
  1187. }
  1188. return desc.value;
  1189. };
  1190. }
  1191. return _get(target, property, receiver || target);
  1192. }
  1193. function _toConsumableArray(arr) {
  1194. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
  1195. }
  1196. function _arrayWithoutHoles(arr) {
  1197. if (Array.isArray(arr)) {
  1198. for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
  1199. return arr2;
  1200. }
  1201. }
  1202. function _iterableToArray(iter) {
  1203. if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
  1204. }
  1205. function _nonIterableSpread() {
  1206. throw new TypeError("Invalid attempt to spread non-iterable instance");
  1207. }
  1208. var nativeJoin = [].join;
  1209. var ES3_STRINGS = indexedObject != Object;
  1210. var SLOPPY_METHOD$1 = sloppyArrayMethod('join', ',');
  1211. // `Array.prototype.join` method
  1212. // https://tc39.github.io/ecma262/#sec-array.prototype.join
  1213. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || SLOPPY_METHOD$1 }, {
  1214. join: function join(separator) {
  1215. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  1216. }
  1217. });
  1218. var test$1 = [];
  1219. var nativeSort = test$1.sort;
  1220. // IE8-
  1221. var FAILS_ON_UNDEFINED = fails(function () {
  1222. test$1.sort(undefined);
  1223. });
  1224. // V8 bug
  1225. var FAILS_ON_NULL = fails(function () {
  1226. test$1.sort(null);
  1227. });
  1228. // Old WebKit
  1229. var SLOPPY_METHOD$2 = sloppyArrayMethod('sort');
  1230. var FORCED$2 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || SLOPPY_METHOD$2;
  1231. // `Array.prototype.sort` method
  1232. // https://tc39.github.io/ecma262/#sec-array.prototype.sort
  1233. _export({ target: 'Array', proto: true, forced: FORCED$2 }, {
  1234. sort: function sort(comparefn) {
  1235. return comparefn === undefined
  1236. ? nativeSort.call(toObject(this))
  1237. : nativeSort.call(toObject(this), aFunction$1(comparefn));
  1238. }
  1239. });
  1240. var SPECIES$2 = wellKnownSymbol('species');
  1241. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  1242. // #replace needs built-in support for named groups.
  1243. // #match works fine because it just return the exec results, even if it has
  1244. // a "grops" property.
  1245. var re = /./;
  1246. re.exec = function () {
  1247. var result = [];
  1248. result.groups = { a: '7' };
  1249. return result;
  1250. };
  1251. return ''.replace(re, '$<a>') !== '7';
  1252. });
  1253. // IE <= 11 replaces $0 with the whole match, as if it was $&
  1254. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  1255. var REPLACE_KEEPS_$0 = (function () {
  1256. return 'a'.replace(/./, '$0') === '$0';
  1257. })();
  1258. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1259. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1260. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1261. var re = /(?:)/;
  1262. var originalExec = re.exec;
  1263. re.exec = function () { return originalExec.apply(this, arguments); };
  1264. var result = 'ab'.split(re);
  1265. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1266. });
  1267. var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) {
  1268. var SYMBOL = wellKnownSymbol(KEY);
  1269. var DELEGATES_TO_SYMBOL = !fails(function () {
  1270. // String methods call symbol-named RegEp methods
  1271. var O = {};
  1272. O[SYMBOL] = function () { return 7; };
  1273. return ''[KEY](O) != 7;
  1274. });
  1275. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1276. // Symbol-named RegExp methods call .exec
  1277. var execCalled = false;
  1278. var re = /a/;
  1279. if (KEY === 'split') {
  1280. // We can't use real regex here since it causes deoptimization
  1281. // and serious performance degradation in V8
  1282. // https://github.com/zloirock/core-js/issues/306
  1283. re = {};
  1284. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1285. // a new one. We need to return the patched regex when creating the new one.
  1286. re.constructor = {};
  1287. re.constructor[SPECIES$2] = function () { return re; };
  1288. re.flags = '';
  1289. re[SYMBOL] = /./[SYMBOL];
  1290. }
  1291. re.exec = function () { execCalled = true; return null; };
  1292. re[SYMBOL]('');
  1293. return !execCalled;
  1294. });
  1295. if (
  1296. !DELEGATES_TO_SYMBOL ||
  1297. !DELEGATES_TO_EXEC ||
  1298. (KEY === 'replace' && !(REPLACE_SUPPORTS_NAMED_GROUPS && REPLACE_KEEPS_$0)) ||
  1299. (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
  1300. ) {
  1301. var nativeRegExpMethod = /./[SYMBOL];
  1302. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1303. if (regexp.exec === regexpExec) {
  1304. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1305. // The native String method already delegates to @@method (this
  1306. // polyfilled function), leasing to infinite recursion.
  1307. // We avoid it by directly calling the native @@method method.
  1308. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  1309. }
  1310. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  1311. }
  1312. return { done: false };
  1313. }, { REPLACE_KEEPS_$0: REPLACE_KEEPS_$0 });
  1314. var stringMethod = methods[0];
  1315. var regexMethod = methods[1];
  1316. redefine(String.prototype, KEY, stringMethod);
  1317. redefine(RegExp.prototype, SYMBOL, length == 2
  1318. // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
  1319. // 21.2.5.11 RegExp.prototype[@@split](string, limit)
  1320. ? function (string, arg) { return regexMethod.call(string, this, arg); }
  1321. // 21.2.5.6 RegExp.prototype[@@match](string)
  1322. // 21.2.5.9 RegExp.prototype[@@search](string)
  1323. : function (string) { return regexMethod.call(string, this); }
  1324. );
  1325. }
  1326. if (sham) createNonEnumerableProperty(RegExp.prototype[SYMBOL], 'sham', true);
  1327. };
  1328. // `String.prototype.{ codePointAt, at }` methods implementation
  1329. var createMethod$3 = function (CONVERT_TO_STRING) {
  1330. return function ($this, pos) {
  1331. var S = String(requireObjectCoercible($this));
  1332. var position = toInteger(pos);
  1333. var size = S.length;
  1334. var first, second;
  1335. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1336. first = S.charCodeAt(position);
  1337. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1338. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  1339. ? CONVERT_TO_STRING ? S.charAt(position) : first
  1340. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1341. };
  1342. };
  1343. var stringMultibyte = {
  1344. // `String.prototype.codePointAt` method
  1345. // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat
  1346. codeAt: createMethod$3(false),
  1347. // `String.prototype.at` method
  1348. // https://github.com/mathiasbynens/String.prototype.at
  1349. charAt: createMethod$3(true)
  1350. };
  1351. var charAt = stringMultibyte.charAt;
  1352. // `AdvanceStringIndex` abstract operation
  1353. // https://tc39.github.io/ecma262/#sec-advancestringindex
  1354. var advanceStringIndex = function (S, index, unicode) {
  1355. return index + (unicode ? charAt(S, index).length : 1);
  1356. };
  1357. // `RegExpExec` abstract operation
  1358. // https://tc39.github.io/ecma262/#sec-regexpexec
  1359. var regexpExecAbstract = function (R, S) {
  1360. var exec = R.exec;
  1361. if (typeof exec === 'function') {
  1362. var result = exec.call(R, S);
  1363. if (typeof result !== 'object') {
  1364. throw TypeError('RegExp exec method returned something other than an Object or null');
  1365. }
  1366. return result;
  1367. }
  1368. if (classofRaw(R) !== 'RegExp') {
  1369. throw TypeError('RegExp#exec called on incompatible receiver');
  1370. }
  1371. return regexpExec.call(R, S);
  1372. };
  1373. // @@match logic
  1374. fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) {
  1375. return [
  1376. // `String.prototype.match` method
  1377. // https://tc39.github.io/ecma262/#sec-string.prototype.match
  1378. function match(regexp) {
  1379. var O = requireObjectCoercible(this);
  1380. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  1381. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
  1382. },
  1383. // `RegExp.prototype[@@match]` method
  1384. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
  1385. function (regexp) {
  1386. var res = maybeCallNative(nativeMatch, regexp, this);
  1387. if (res.done) return res.value;
  1388. var rx = anObject(regexp);
  1389. var S = String(this);
  1390. if (!rx.global) return regexpExecAbstract(rx, S);
  1391. var fullUnicode = rx.unicode;
  1392. rx.lastIndex = 0;
  1393. var A = [];
  1394. var n = 0;
  1395. var result;
  1396. while ((result = regexpExecAbstract(rx, S)) !== null) {
  1397. var matchStr = String(result[0]);
  1398. A[n] = matchStr;
  1399. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1400. n++;
  1401. }
  1402. return n === 0 ? null : A;
  1403. }
  1404. ];
  1405. });
  1406. var max$1 = Math.max;
  1407. var min$2 = Math.min;
  1408. var floor$1 = Math.floor;
  1409. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g;
  1410. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g;
  1411. var maybeToString = function (it) {
  1412. return it === undefined ? it : String(it);
  1413. };
  1414. // @@replace logic
  1415. fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative, reason) {
  1416. return [
  1417. // `String.prototype.replace` method
  1418. // https://tc39.github.io/ecma262/#sec-string.prototype.replace
  1419. function replace(searchValue, replaceValue) {
  1420. var O = requireObjectCoercible(this);
  1421. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  1422. return replacer !== undefined
  1423. ? replacer.call(searchValue, O, replaceValue)
  1424. : nativeReplace.call(String(O), searchValue, replaceValue);
  1425. },
  1426. // `RegExp.prototype[@@replace]` method
  1427. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
  1428. function (regexp, replaceValue) {
  1429. if (reason.REPLACE_KEEPS_$0 || (typeof replaceValue === 'string' && replaceValue.indexOf('$0') === -1)) {
  1430. var res = maybeCallNative(nativeReplace, regexp, this, replaceValue);
  1431. if (res.done) return res.value;
  1432. }
  1433. var rx = anObject(regexp);
  1434. var S = String(this);
  1435. var functionalReplace = typeof replaceValue === 'function';
  1436. if (!functionalReplace) replaceValue = String(replaceValue);
  1437. var global = rx.global;
  1438. if (global) {
  1439. var fullUnicode = rx.unicode;
  1440. rx.lastIndex = 0;
  1441. }
  1442. var results = [];
  1443. while (true) {
  1444. var result = regexpExecAbstract(rx, S);
  1445. if (result === null) break;
  1446. results.push(result);
  1447. if (!global) break;
  1448. var matchStr = String(result[0]);
  1449. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  1450. }
  1451. var accumulatedResult = '';
  1452. var nextSourcePosition = 0;
  1453. for (var i = 0; i < results.length; i++) {
  1454. result = results[i];
  1455. var matched = String(result[0]);
  1456. var position = max$1(min$2(toInteger(result.index), S.length), 0);
  1457. var captures = [];
  1458. // NOTE: This is equivalent to
  1459. // captures = result.slice(1).map(maybeToString)
  1460. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  1461. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  1462. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  1463. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  1464. var namedCaptures = result.groups;
  1465. if (functionalReplace) {
  1466. var replacerArgs = [matched].concat(captures, position, S);
  1467. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  1468. var replacement = String(replaceValue.apply(undefined, replacerArgs));
  1469. } else {
  1470. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  1471. }
  1472. if (position >= nextSourcePosition) {
  1473. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  1474. nextSourcePosition = position + matched.length;
  1475. }
  1476. }
  1477. return accumulatedResult + S.slice(nextSourcePosition);
  1478. }
  1479. ];
  1480. // https://tc39.github.io/ecma262/#sec-getsubstitution
  1481. function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
  1482. var tailPos = position + matched.length;
  1483. var m = captures.length;
  1484. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1485. if (namedCaptures !== undefined) {
  1486. namedCaptures = toObject(namedCaptures);
  1487. symbols = SUBSTITUTION_SYMBOLS;
  1488. }
  1489. return nativeReplace.call(replacement, symbols, function (match, ch) {
  1490. var capture;
  1491. switch (ch.charAt(0)) {
  1492. case '$': return '$';
  1493. case '&': return matched;
  1494. case '`': return str.slice(0, position);
  1495. case "'": return str.slice(tailPos);
  1496. case '<':
  1497. capture = namedCaptures[ch.slice(1, -1)];
  1498. break;
  1499. default: // \d\d?
  1500. var n = +ch;
  1501. if (n === 0) return match;
  1502. if (n > m) {
  1503. var f = floor$1(n / 10);
  1504. if (f === 0) return match;
  1505. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  1506. return match;
  1507. }
  1508. capture = captures[n - 1];
  1509. }
  1510. return capture === undefined ? '' : capture;
  1511. });
  1512. }
  1513. });
  1514. var SPECIES$3 = wellKnownSymbol('species');
  1515. // `SpeciesConstructor` abstract operation
  1516. // https://tc39.github.io/ecma262/#sec-speciesconstructor
  1517. var speciesConstructor = function (O, defaultConstructor) {
  1518. var C = anObject(O).constructor;
  1519. var S;
  1520. return C === undefined || (S = anObject(C)[SPECIES$3]) == undefined ? defaultConstructor : aFunction$1(S);
  1521. };
  1522. var arrayPush = [].push;
  1523. var min$3 = Math.min;
  1524. var MAX_UINT32 = 0xFFFFFFFF;
  1525. // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
  1526. var SUPPORTS_Y = !fails(function () { return !RegExp(MAX_UINT32, 'y'); });
  1527. // @@split logic
  1528. fixRegexpWellKnownSymbolLogic('split', 2, function (SPLIT, nativeSplit, maybeCallNative) {
  1529. var internalSplit;
  1530. if (
  1531. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1532. 'test'.split(/(?:)/, -1).length != 4 ||
  1533. 'ab'.split(/(?:ab)*/).length != 2 ||
  1534. '.'.split(/(.?)(.?)/).length != 4 ||
  1535. '.'.split(/()()/).length > 1 ||
  1536. ''.split(/.?/).length
  1537. ) {
  1538. // based on es5-shim implementation, need to rework it
  1539. internalSplit = function (separator, limit) {
  1540. var string = String(requireObjectCoercible(this));
  1541. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1542. if (lim === 0) return [];
  1543. if (separator === undefined) return [string];
  1544. // If `separator` is not a regex, use native split
  1545. if (!isRegexp(separator)) {
  1546. return nativeSplit.call(string, separator, lim);
  1547. }
  1548. var output = [];
  1549. var flags = (separator.ignoreCase ? 'i' : '') +
  1550. (separator.multiline ? 'm' : '') +
  1551. (separator.unicode ? 'u' : '') +
  1552. (separator.sticky ? 'y' : '');
  1553. var lastLastIndex = 0;
  1554. // Make `global` and avoid `lastIndex` issues by working with a copy
  1555. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1556. var match, lastIndex, lastLength;
  1557. while (match = regexpExec.call(separatorCopy, string)) {
  1558. lastIndex = separatorCopy.lastIndex;
  1559. if (lastIndex > lastLastIndex) {
  1560. output.push(string.slice(lastLastIndex, match.index));
  1561. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  1562. lastLength = match[0].length;
  1563. lastLastIndex = lastIndex;
  1564. if (output.length >= lim) break;
  1565. }
  1566. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1567. }
  1568. if (lastLastIndex === string.length) {
  1569. if (lastLength || !separatorCopy.test('')) output.push('');
  1570. } else output.push(string.slice(lastLastIndex));
  1571. return output.length > lim ? output.slice(0, lim) : output;
  1572. };
  1573. // Chakra, V8
  1574. } else if ('0'.split(undefined, 0).length) {
  1575. internalSplit = function (separator, limit) {
  1576. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  1577. };
  1578. } else internalSplit = nativeSplit;
  1579. return [
  1580. // `String.prototype.split` method
  1581. // https://tc39.github.io/ecma262/#sec-string.prototype.split
  1582. function split(separator, limit) {
  1583. var O = requireObjectCoercible(this);
  1584. var splitter = separator == undefined ? undefined : separator[SPLIT];
  1585. return splitter !== undefined
  1586. ? splitter.call(separator, O, limit)
  1587. : internalSplit.call(String(O), separator, limit);
  1588. },
  1589. // `RegExp.prototype[@@split]` method
  1590. // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
  1591. //
  1592. // NOTE: This cannot be properly polyfilled in engines that don't support
  1593. // the 'y' flag.
  1594. function (regexp, limit) {
  1595. var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== nativeSplit);
  1596. if (res.done) return res.value;
  1597. var rx = anObject(regexp);
  1598. var S = String(this);
  1599. var C = speciesConstructor(rx, RegExp);
  1600. var unicodeMatching = rx.unicode;
  1601. var flags = (rx.ignoreCase ? 'i' : '') +
  1602. (rx.multiline ? 'm' : '') +
  1603. (rx.unicode ? 'u' : '') +
  1604. (SUPPORTS_Y ? 'y' : 'g');
  1605. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1606. // simulate the 'y' flag.
  1607. var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
  1608. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1609. if (lim === 0) return [];
  1610. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1611. var p = 0;
  1612. var q = 0;
  1613. var A = [];
  1614. while (q < S.length) {
  1615. splitter.lastIndex = SUPPORTS_Y ? q : 0;
  1616. var z = regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));
  1617. var e;
  1618. if (
  1619. z === null ||
  1620. (e = min$3(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p
  1621. ) {
  1622. q = advanceStringIndex(S, q, unicodeMatching);
  1623. } else {
  1624. A.push(S.slice(p, q));
  1625. if (A.length === lim) return A;
  1626. for (var i = 1; i <= z.length - 1; i++) {
  1627. A.push(z[i]);
  1628. if (A.length === lim) return A;
  1629. }
  1630. q = p = e;
  1631. }
  1632. }
  1633. A.push(S.slice(p));
  1634. return A;
  1635. }
  1636. ];
  1637. }, !SUPPORTS_Y);
  1638. var Utils = $.fn.bootstrapTable.utils;
  1639. var searchControls = 'select, input:not([type="checkbox"]):not([type="radio"])';
  1640. function getOptionsFromSelectControl(selectControl) {
  1641. return selectControl.get(selectControl.length - 1).options;
  1642. }
  1643. function getControlContainer(that) {
  1644. if (that.options.filterControlContainer) {
  1645. return $("".concat(that.options.filterControlContainer));
  1646. }
  1647. return that.$header;
  1648. }
  1649. function getSearchControls(that) {
  1650. return getControlContainer(that).find(searchControls);
  1651. }
  1652. function hideUnusedSelectOptions(selectControl, uniqueValues) {
  1653. var options = getOptionsFromSelectControl(selectControl);
  1654. for (var i = 0; i < options.length; i++) {
  1655. if (options[i].value !== '') {
  1656. if (!uniqueValues.hasOwnProperty(options[i].value)) {
  1657. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).hide();
  1658. } else {
  1659. selectControl.find(Utils.sprintf('option[value=\'%s\']', options[i].value)).show();
  1660. }
  1661. }
  1662. }
  1663. }
  1664. function existOptionInSelectControl(selectControl, value) {
  1665. var options = getOptionsFromSelectControl(selectControl);
  1666. for (var i = 0; i < options.length; i++) {
  1667. if (options[i].value === value.toString()) {
  1668. // The value is not valid to add
  1669. return true;
  1670. }
  1671. } // If we get here, the value is valid to add
  1672. return false;
  1673. }
  1674. function addOptionToSelectControl(selectControl, _value, text, selected) {
  1675. var value = _value === undefined || _value === null ? '' : _value.toString().trim();
  1676. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1677. if (!existOptionInSelectControl(selectControl, value)) {
  1678. var option = $("<option value=\"".concat(value, "\">").concat(text, "</option>"));
  1679. if (value === selected) {
  1680. option.attr('selected', true);
  1681. }
  1682. $selectControl.append(option);
  1683. }
  1684. }
  1685. function sortSelectControl(selectControl, orderBy) {
  1686. var $selectControl = $(selectControl.get(selectControl.length - 1));
  1687. var $opts = $selectControl.find('option:gt(0)');
  1688. if (orderBy !== 'server') {
  1689. $opts.sort(function (a, b) {
  1690. return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1);
  1691. });
  1692. }
  1693. $selectControl.find('option:gt(0)').remove();
  1694. $selectControl.append($opts);
  1695. }
  1696. function fixHeaderCSS(_ref) {
  1697. var $tableHeader = _ref.$tableHeader;
  1698. $tableHeader.css('height', '89px');
  1699. }
  1700. function getElementClass($element) {
  1701. return $element.attr('class').replace('form-control', '').replace('focus-temp', '').replace('search-input', '').trim();
  1702. }
  1703. function getCursorPosition(el) {
  1704. if (Utils.isIEBrowser()) {
  1705. if ($(el).is('input[type=text]')) {
  1706. var pos = 0;
  1707. if ('selectionStart' in el) {
  1708. pos = el.selectionStart;
  1709. } else if ('selection' in document) {
  1710. el.focus();
  1711. var Sel = document.selection.createRange();
  1712. var SelLength = document.selection.createRange().text.length;
  1713. Sel.moveStart('character', -el.value.length);
  1714. pos = Sel.text.length - SelLength;
  1715. }
  1716. return pos;
  1717. }
  1718. return -1;
  1719. }
  1720. return -1;
  1721. }
  1722. function setCursorPosition(el) {
  1723. $(el).val(el.value);
  1724. }
  1725. function copyValues(that) {
  1726. var searchControls = getSearchControls(that);
  1727. that.options.valuesFilterControl = [];
  1728. searchControls.each(function () {
  1729. var $field = $(this);
  1730. if (that.options.height) {
  1731. var fieldClass = getElementClass($field);
  1732. $field = $(".fixed-table-header .".concat(fieldClass));
  1733. }
  1734. that.options.valuesFilterControl.push({
  1735. field: $field.closest('[data-field]').data('field'),
  1736. value: $field.val(),
  1737. position: getCursorPosition($field.get(0)),
  1738. hasFocus: $field.is(':focus')
  1739. });
  1740. });
  1741. }
  1742. function setValues(that) {
  1743. var field = null;
  1744. var result = [];
  1745. var searchControls = 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. var $this = $(this);
  1751. field = $this.closest('[data-field]').data('field');
  1752. result = that.options.valuesFilterControl.filter(function (valueObj) {
  1753. return valueObj.field === field;
  1754. });
  1755. if (result.length > 0) {
  1756. if ($this.is('[type=radio]')) {
  1757. return;
  1758. }
  1759. $this.val(result[0].value);
  1760. if (result[0].hasFocus && result[0].value !== '') {
  1761. // set callback if the field had the focus.
  1762. fieldToFocusCallback = function (fieldToFocus, carretPosition) {
  1763. // Closure here to capture the field and cursor position
  1764. var closedCallback = function closedCallback() {
  1765. fieldToFocus.focus();
  1766. setCursorPosition(fieldToFocus);
  1767. };
  1768. return closedCallback;
  1769. }($this.get(0), result[0].position);
  1770. }
  1771. }
  1772. }); // Callback call.
  1773. if (fieldToFocusCallback !== null) {
  1774. fieldToFocusCallback();
  1775. }
  1776. }
  1777. }
  1778. function collectBootstrapCookies() {
  1779. var cookies = [];
  1780. var foundCookies = document.cookie.match(/(?:bs.table.)(\w*)/g);
  1781. var foundLocalStorage = localStorage;
  1782. if (foundCookies) {
  1783. $.each(foundCookies, function (i, _cookie) {
  1784. var cookie = _cookie;
  1785. if (/./.test(cookie)) {
  1786. cookie = cookie.split('.').pop();
  1787. }
  1788. if ($.inArray(cookie, cookies) === -1) {
  1789. cookies.push(cookie);
  1790. }
  1791. });
  1792. }
  1793. if (foundLocalStorage) {
  1794. for (var i = 0; i < foundLocalStorage.length; i++) {
  1795. var cookie = foundLocalStorage.key(i);
  1796. if (/./.test(cookie)) {
  1797. cookie = cookie.split('.').pop();
  1798. }
  1799. if (!cookies.includes(cookie)) {
  1800. cookies.push(cookie);
  1801. }
  1802. }
  1803. }
  1804. return cookies;
  1805. }
  1806. function escapeID(id) {
  1807. // eslint-disable-next-line no-useless-escape
  1808. return String(id).replace(/([:.\[\],])/g, '\\$1');
  1809. }
  1810. function isColumnSearchableViaSelect(_ref2) {
  1811. var filterControl = _ref2.filterControl,
  1812. searchable = _ref2.searchable;
  1813. return filterControl && filterControl.toLowerCase() === 'select' && searchable;
  1814. }
  1815. function isFilterDataNotGiven(_ref3) {
  1816. var filterData = _ref3.filterData;
  1817. return filterData === undefined || filterData.toLowerCase() === 'column';
  1818. }
  1819. function hasSelectControlElement(selectControl) {
  1820. return selectControl && selectControl.length > 0;
  1821. }
  1822. function initFilterSelectControls(that) {
  1823. var data = that.data;
  1824. var z = that.options.pagination ? that.options.sidePagination === 'server' ? that.pageTo : that.options.totalRows : that.pageTo;
  1825. $.each(that.header.fields, function (j, field) {
  1826. var column = that.columns[that.fieldsColumnsIndex[field]];
  1827. var selectControl = getControlContainer(that).find("select.bootstrap-table-filter-control-".concat(escapeID(column.field)));
  1828. if (isColumnSearchableViaSelect(column) && isFilterDataNotGiven(column) && hasSelectControlElement(selectControl)) {
  1829. if (selectControl.get(selectControl.length - 1).options.length === 0) {
  1830. // Added the default option
  1831. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1832. }
  1833. var uniqueValues = {};
  1834. for (var i = 0; i < z; i++) {
  1835. // Added a new value
  1836. var fieldValue = data[i][field];
  1837. var formatter = that.options.editable && column.editable ? column._formatter : that.header.formatters[j];
  1838. var formattedValue = Utils.calculateObjectValue(that.header, formatter, [fieldValue, data[i], i], fieldValue);
  1839. if (column.filterDataCollector) {
  1840. formattedValue = Utils.calculateObjectValue(that.header, column.filterDataCollector, [fieldValue, data[i], formattedValue], formattedValue);
  1841. }
  1842. if (column.searchFormatter) {
  1843. fieldValue = formattedValue;
  1844. }
  1845. uniqueValues[formattedValue] = fieldValue;
  1846. if (_typeof(formattedValue) === 'object' && formattedValue !== null) {
  1847. formattedValue.forEach(function (value) {
  1848. addOptionToSelectControl(selectControl, value, value, column.filterDefault);
  1849. });
  1850. continue;
  1851. }
  1852. for (var key in uniqueValues) {
  1853. addOptionToSelectControl(selectControl, uniqueValues[key], key, column.filterDefault);
  1854. }
  1855. }
  1856. sortSelectControl(selectControl, column.filterOrderBy);
  1857. if (that.options.hideUnusedSelectOptions) {
  1858. hideUnusedSelectOptions(selectControl, uniqueValues);
  1859. }
  1860. }
  1861. });
  1862. }
  1863. function getFilterDataMethod(objFilterDataMethod, searchTerm) {
  1864. var keys = Object.keys(objFilterDataMethod);
  1865. for (var i = 0; i < keys.length; i++) {
  1866. if (keys[i] === searchTerm) {
  1867. return objFilterDataMethod[searchTerm];
  1868. }
  1869. }
  1870. return null;
  1871. }
  1872. function createControls(that, header) {
  1873. var addedFilterControl = false;
  1874. var html;
  1875. $.each(that.columns, function (_, column) {
  1876. html = [];
  1877. if (!column.visible) {
  1878. return;
  1879. }
  1880. if (!column.filterControl && !that.options.filterControlContainer) {
  1881. html.push('<div class="no-filter-control"></div>');
  1882. } else if (that.options.filterControlContainer) {
  1883. var $filterControls = $(".bootstrap-table-filter-control-".concat(column.field));
  1884. $.each($filterControls, function (_, filterControl) {
  1885. var $filterControl = $(filterControl);
  1886. if (!$filterControl.is('[type=radio]')) {
  1887. var placeholder = column.filterControlPlaceholder ? column.filterControlPlaceholder : '';
  1888. $filterControl.attr('placeholder', placeholder).val(column.filterDefault);
  1889. }
  1890. $filterControl.attr('data-field', column.field);
  1891. });
  1892. addedFilterControl = true;
  1893. } else {
  1894. var nameControl = column.filterControl.toLowerCase();
  1895. html.push('<div class="filter-control">');
  1896. addedFilterControl = true;
  1897. if (column.searchable && that.options.filterTemplate[nameControl]) {
  1898. html.push(that.options.filterTemplate[nameControl](that, column.field, column.filterControlPlaceholder ? column.filterControlPlaceholder : '', column.filterDefault));
  1899. }
  1900. }
  1901. if (!column.filterControl && '' !== column.filterDefault && 'undefined' !== typeof column.filterDefault) {
  1902. if ($.isEmptyObject(that.filterColumnsPartial)) {
  1903. that.filterColumnsPartial = {};
  1904. }
  1905. that.filterColumnsPartial[column.field] = column.filterDefault;
  1906. }
  1907. $.each(header.find('th'), function (i, th) {
  1908. var $th = $(th);
  1909. if ($th.data('field') === column.field) {
  1910. $th.find('.fht-cell').append(html.join(''));
  1911. return false;
  1912. }
  1913. });
  1914. if (column.filterData && column.filterData.toLowerCase() !== 'column') {
  1915. var filterDataType = getFilterDataMethod(
  1916. /* eslint-disable no-use-before-define */
  1917. filterDataMethods, column.filterData.substring(0, column.filterData.indexOf(':')));
  1918. var filterDataSource;
  1919. var selectControl;
  1920. if (filterDataType) {
  1921. filterDataSource = column.filterData.substring(column.filterData.indexOf(':') + 1, column.filterData.length);
  1922. selectControl = header.find(".bootstrap-table-filter-control-".concat(escapeID(column.field)));
  1923. addOptionToSelectControl(selectControl, '', column.filterControlPlaceholder, column.filterDefault);
  1924. filterDataType(filterDataSource, selectControl, that.options.filterOrderBy, column.filterDefault);
  1925. } else {
  1926. 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"}');
  1927. }
  1928. }
  1929. });
  1930. if (addedFilterControl) {
  1931. header.off('keyup', 'input').on('keyup', 'input', function (_ref4, obj) {
  1932. var currentTarget = _ref4.currentTarget,
  1933. keyCode = _ref4.keyCode;
  1934. syncControls(that); // Simulate enter key action from clear button
  1935. keyCode = obj ? obj.keyCode : keyCode;
  1936. if (that.options.searchOnEnterKey && keyCode !== 13) {
  1937. return;
  1938. }
  1939. if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
  1940. return;
  1941. }
  1942. var $currentTarget = $(currentTarget);
  1943. if ($currentTarget.is(':checkbox') || $currentTarget.is(':radio')) {
  1944. return;
  1945. }
  1946. clearTimeout(currentTarget.timeoutId || 0);
  1947. currentTarget.timeoutId = setTimeout(function () {
  1948. that.onColumnSearch({
  1949. currentTarget: currentTarget,
  1950. keyCode: keyCode
  1951. });
  1952. }, that.options.searchTimeOut);
  1953. });
  1954. header.off('change', 'select:not(".ms-offscreen")').on('change', 'select:not(".ms-offscreen")', function (_ref5) {
  1955. var currentTarget = _ref5.currentTarget,
  1956. keyCode = _ref5.keyCode;
  1957. syncControls(that);
  1958. var $select = $(currentTarget);
  1959. var value = $select.val();
  1960. if (value && value.length > 0 && value.trim()) {
  1961. $select.find('option[selected]').removeAttr('selected');
  1962. $select.find('option[value="' + value + '"]').attr('selected', true);
  1963. } else {
  1964. $select.find('option[selected]').removeAttr('selected');
  1965. }
  1966. clearTimeout(currentTarget.timeoutId || 0);
  1967. currentTarget.timeoutId = setTimeout(function () {
  1968. that.onColumnSearch({
  1969. currentTarget: currentTarget,
  1970. keyCode: keyCode
  1971. });
  1972. }, that.options.searchTimeOut);
  1973. });
  1974. header.off('mouseup', 'input:not([type=radio])').on('mouseup', 'input:not([type=radio])', function (_ref6) {
  1975. var currentTarget = _ref6.currentTarget,
  1976. keyCode = _ref6.keyCode;
  1977. var $input = $(currentTarget);
  1978. var oldValue = $input.val();
  1979. if (oldValue === '') {
  1980. return;
  1981. }
  1982. setTimeout(function () {
  1983. syncControls(that);
  1984. var newValue = $input.val();
  1985. if (newValue === '') {
  1986. clearTimeout(currentTarget.timeoutId || 0);
  1987. currentTarget.timeoutId = setTimeout(function () {
  1988. that.onColumnSearch({
  1989. currentTarget: currentTarget,
  1990. keyCode: keyCode
  1991. });
  1992. }, that.options.searchTimeOut);
  1993. }
  1994. }, 1);
  1995. });
  1996. header.off('change', 'input[type=radio]').on('change', 'input[type=radio]', function (_ref7) {
  1997. var currentTarget = _ref7.currentTarget,
  1998. keyCode = _ref7.keyCode;
  1999. clearTimeout(currentTarget.timeoutId || 0);
  2000. currentTarget.timeoutId = setTimeout(function () {
  2001. syncControls(that);
  2002. that.onColumnSearch({
  2003. currentTarget: currentTarget,
  2004. keyCode: keyCode
  2005. });
  2006. }, that.options.searchTimeOut);
  2007. });
  2008. if (header.find('.date-filter-control').length > 0) {
  2009. $.each(that.columns, function (i, _ref8) {
  2010. var filterControl = _ref8.filterControl,
  2011. field = _ref8.field,
  2012. filterDatepickerOptions = _ref8.filterDatepickerOptions;
  2013. if (filterControl !== undefined && filterControl.toLowerCase() === 'datepicker') {
  2014. header.find(".date-filter-control.bootstrap-table-filter-control-".concat(field)).datepicker(filterDatepickerOptions).on('changeDate', function (_ref9) {
  2015. var currentTarget = _ref9.currentTarget,
  2016. keyCode = _ref9.keyCode;
  2017. clearTimeout(currentTarget.timeoutId || 0);
  2018. currentTarget.timeoutId = setTimeout(function () {
  2019. syncControls(that);
  2020. that.onColumnSearch({
  2021. currentTarget: currentTarget,
  2022. keyCode: keyCode
  2023. });
  2024. }, that.options.searchTimeOut);
  2025. });
  2026. }
  2027. });
  2028. }
  2029. if (that.options.sidePagination !== 'server' && !that.options.height) {
  2030. that.triggerSearch();
  2031. }
  2032. if (!that.options.filterControlVisible) {
  2033. header.find('.filter-control, .no-filter-control').hide();
  2034. }
  2035. } else {
  2036. header.find('.filter-control, .no-filter-control').hide();
  2037. }
  2038. that.trigger('created-controls');
  2039. }
  2040. function getDirectionOfSelectOptions(_alignment) {
  2041. var alignment = _alignment === undefined ? 'left' : _alignment.toLowerCase();
  2042. switch (alignment) {
  2043. case 'left':
  2044. return 'ltr';
  2045. case 'right':
  2046. return 'rtl';
  2047. case 'auto':
  2048. return 'auto';
  2049. default:
  2050. return 'ltr';
  2051. }
  2052. }
  2053. function syncControls(that) {
  2054. if (that.options.height) {
  2055. var controlsTableHeader = that.$tableHeader.find(searchControls);
  2056. that.$header.find(searchControls).each(function (_, control) {
  2057. var $control = $(control);
  2058. var controlClass = getElementClass($control);
  2059. var foundControl = controlsTableHeader.filter(function (_, ele) {
  2060. var eleClass = getElementClass($(ele));
  2061. return controlClass === eleClass;
  2062. });
  2063. if (foundControl.length === 0) {
  2064. return;
  2065. }
  2066. if ($control.is('select')) {
  2067. $control.find('option:selected').removeAttr('selected');
  2068. $control.find("option[value='".concat(foundControl.val(), "']")).attr('selected', true);
  2069. } else {
  2070. $control.val(foundControl.val());
  2071. }
  2072. });
  2073. }
  2074. }
  2075. var filterDataMethods = {
  2076. func: function func(filterDataSource, selectControl, filterOrderBy, selected) {
  2077. var variableValues = window[filterDataSource].apply();
  2078. for (var key in variableValues) {
  2079. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2080. }
  2081. sortSelectControl(selectControl, filterOrderBy);
  2082. },
  2083. obj: function obj(filterDataSource, selectControl, filterOrderBy, selected) {
  2084. var objectKeys = filterDataSource.split('.');
  2085. var variableName = objectKeys.shift();
  2086. var variableValues = window[variableName];
  2087. if (objectKeys.length > 0) {
  2088. objectKeys.forEach(function (key) {
  2089. variableValues = variableValues[key];
  2090. });
  2091. }
  2092. for (var key in variableValues) {
  2093. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2094. }
  2095. sortSelectControl(selectControl, filterOrderBy);
  2096. },
  2097. var: function _var(filterDataSource, selectControl, filterOrderBy, selected) {
  2098. var variableValues = window[filterDataSource];
  2099. var isArray = Array.isArray(variableValues);
  2100. for (var key in variableValues) {
  2101. if (isArray) {
  2102. addOptionToSelectControl(selectControl, variableValues[key], variableValues[key], selected);
  2103. } else {
  2104. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2105. }
  2106. }
  2107. sortSelectControl(selectControl, filterOrderBy);
  2108. },
  2109. url: function url(filterDataSource, selectControl, filterOrderBy, selected) {
  2110. $.ajax({
  2111. url: filterDataSource,
  2112. dataType: 'json',
  2113. success: function success(data) {
  2114. for (var key in data) {
  2115. addOptionToSelectControl(selectControl, key, data[key], selected);
  2116. }
  2117. sortSelectControl(selectControl, filterOrderBy);
  2118. }
  2119. });
  2120. },
  2121. json: function json(filterDataSource, selectControl, filterOrderBy, selected) {
  2122. var variableValues = JSON.parse(filterDataSource);
  2123. for (var key in variableValues) {
  2124. addOptionToSelectControl(selectControl, key, variableValues[key], selected);
  2125. }
  2126. sortSelectControl(selectControl, filterOrderBy);
  2127. }
  2128. };
  2129. var Utils$1 = $.fn.bootstrapTable.utils;
  2130. $.extend($.fn.bootstrapTable.defaults, {
  2131. filterControl: false,
  2132. filterControlVisible: true,
  2133. onColumnSearch: function onColumnSearch(field, text) {
  2134. return false;
  2135. },
  2136. onCreatedControls: function onCreatedControls() {
  2137. return false;
  2138. },
  2139. alignmentSelectControlOptions: undefined,
  2140. filterTemplate: {
  2141. input: function input(that, field, placeholder, value) {
  2142. return Utils$1.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);
  2143. },
  2144. select: function select(_ref, field) {
  2145. var options = _ref.options;
  2146. return Utils$1.sprintf('<select class="form-control bootstrap-table-filter-control-%s" style="width: 100%;" dir="%s"></select>', field, getDirectionOfSelectOptions(options.alignmentSelectControlOptions));
  2147. },
  2148. datepicker: function datepicker(that, field, value) {
  2149. return Utils$1.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);
  2150. }
  2151. },
  2152. disableControlWhenSearch: false,
  2153. searchOnEnterKey: false,
  2154. showFilterControlSwitch: false,
  2155. // internal variables
  2156. valuesFilterControl: []
  2157. });
  2158. $.extend($.fn.bootstrapTable.columnDefaults, {
  2159. filterControl: undefined,
  2160. // input, select, datepicker
  2161. filterDataCollector: undefined,
  2162. filterData: undefined,
  2163. filterDatepickerOptions: undefined,
  2164. filterStrictSearch: false,
  2165. filterStartsWithSearch: false,
  2166. filterControlPlaceholder: '',
  2167. filterDefault: '',
  2168. filterOrderBy: 'asc' // asc || desc
  2169. });
  2170. $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
  2171. 'column-search.bs.table': 'onColumnSearch',
  2172. 'created-controls.bs.table': 'onCreatedControls'
  2173. });
  2174. $.extend($.fn.bootstrapTable.defaults.icons, {
  2175. clear: {
  2176. bootstrap3: 'glyphicon-trash icon-clear'
  2177. }[$.fn.bootstrapTable.theme] || 'fa-trash',
  2178. filterControlSwitchHide: {
  2179. bootstrap3: 'glyphicon-zoom-out icon-zoom-out',
  2180. materialize: 'zoom_out'
  2181. }[$.fn.bootstrapTable.theme] || 'fa-search-minus',
  2182. filterControlSwitchShow: {
  2183. bootstrap3: 'glyphicon-zoom-in icon-zoom-in',
  2184. materialize: 'zoom_in'
  2185. }[$.fn.bootstrapTable.theme] || 'fa-search-plus'
  2186. });
  2187. $.extend($.fn.bootstrapTable.locales, {
  2188. formatFilterControlSwitch: function formatFilterControlSwitch() {
  2189. return 'Hide/Show controls';
  2190. },
  2191. formatFilterControlSwitchHide: function formatFilterControlSwitchHide() {
  2192. return 'Hide controls';
  2193. },
  2194. formatFilterControlSwitchShow: function formatFilterControlSwitchShow() {
  2195. return 'Show controls';
  2196. }
  2197. });
  2198. $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
  2199. $.extend($.fn.bootstrapTable.defaults, {
  2200. formatClearSearch: function formatClearSearch() {
  2201. return 'Clear filters';
  2202. }
  2203. });
  2204. $.fn.bootstrapTable.methods.push('triggerSearch');
  2205. $.fn.bootstrapTable.methods.push('clearFilterControl');
  2206. $.fn.bootstrapTable.methods.push('toggleFilterControl');
  2207. $.BootstrapTable =
  2208. /*#__PURE__*/
  2209. function (_$$BootstrapTable) {
  2210. _inherits(_class, _$$BootstrapTable);
  2211. function _class() {
  2212. _classCallCheck(this, _class);
  2213. return _possibleConstructorReturn(this, _getPrototypeOf(_class).apply(this, arguments));
  2214. }
  2215. _createClass(_class, [{
  2216. key: "init",
  2217. value: function init() {
  2218. var _this = this;
  2219. // Make sure that the filterControl option is set
  2220. if (this.options.filterControl) {
  2221. // Make sure that the internal variables are set correctly
  2222. this.options.valuesFilterControl = [];
  2223. this.$el.on('reset-view.bs.table', function () {
  2224. // Create controls on $tableHeader if the height is set
  2225. if (!_this.options.height) {
  2226. return;
  2227. } // Avoid recreate the controls
  2228. var $controlContainer = getControlContainer(_this);
  2229. if ($controlContainer.find('select').length > 0 || $controlContainer.find('input:not([type="checkbox"]):not([type="radio"])').length > 0) {
  2230. return;
  2231. }
  2232. createControls(_this, $controlContainer);
  2233. }).on('post-header.bs.table', function () {
  2234. setValues(_this);
  2235. }).on('post-body.bs.table', function () {
  2236. if (_this.options.height && !_this.options.filterControlContainer) {
  2237. fixHeaderCSS(_this);
  2238. }
  2239. _this.$tableLoading.css('top', _this.$header.outerHeight() + 1);
  2240. }).on('column-switch.bs.table', function () {
  2241. setValues(_this);
  2242. }).on('load-success.bs.table', function () {
  2243. _this.enableControls(true);
  2244. }).on('load-error.bs.table', function () {
  2245. _this.enableControls(true);
  2246. });
  2247. }
  2248. _get(_getPrototypeOf(_class.prototype), "init", this).call(this);
  2249. }
  2250. }, {
  2251. key: "initHeader",
  2252. value: function initHeader() {
  2253. _get(_getPrototypeOf(_class.prototype), "initHeader", this).call(this);
  2254. if (!this.options.filterControl || this.options.height) {
  2255. return;
  2256. }
  2257. createControls(this, getControlContainer(this));
  2258. }
  2259. }, {
  2260. key: "initBody",
  2261. value: function initBody() {
  2262. _get(_getPrototypeOf(_class.prototype), "initBody", this).call(this);
  2263. syncControls(this);
  2264. initFilterSelectControls(this);
  2265. }
  2266. }, {
  2267. key: "initSearch",
  2268. value: function initSearch() {
  2269. var _this2 = this;
  2270. var that = this;
  2271. var fp = $.isEmptyObject(that.filterColumnsPartial) ? null : that.filterColumnsPartial;
  2272. _get(_getPrototypeOf(_class.prototype), "initSearch", this).call(this);
  2273. if (this.options.sidePagination === 'server' || fp === null) {
  2274. return;
  2275. } // Check partial column filter
  2276. that.data = fp ? that.data.filter(function (item, i) {
  2277. var itemIsExpected = [];
  2278. var keys1 = Object.keys(item);
  2279. var keys2 = Object.keys(fp);
  2280. var keys = keys1.concat(keys2.filter(function (item) {
  2281. return !keys1.includes(item);
  2282. }));
  2283. keys.forEach(function (key) {
  2284. var thisColumn = that.columns[that.fieldsColumnsIndex[key]];
  2285. var fval = (fp[key] || '').toLowerCase();
  2286. var value = Utils$1.getItemField(item, key, false);
  2287. var tmpItemIsExpected;
  2288. if (fval === '') {
  2289. tmpItemIsExpected = true;
  2290. } else {
  2291. // Fix #142: search use formatted data
  2292. if (thisColumn && thisColumn.searchFormatter) {
  2293. value = $.fn.bootstrapTable.utils.calculateObjectValue(that.header, that.header.formatters[$.inArray(key, that.header.fields)], [value, item, i], value);
  2294. }
  2295. if ($.inArray(key, that.header.fields) !== -1) {
  2296. if (value === undefined || value === null) {
  2297. tmpItemIsExpected = false;
  2298. } else if (_typeof(value) === 'object') {
  2299. value.forEach(function (objectValue) {
  2300. if (tmpItemIsExpected) {
  2301. return;
  2302. }
  2303. if (_this2.options.searchAccentNeutralise) {
  2304. objectValue = Utils$1.normalizeAccent(objectValue);
  2305. }
  2306. tmpItemIsExpected = that.isValueExpected(fval, objectValue, thisColumn, key);
  2307. });
  2308. } else if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
  2309. if (_this2.options.searchAccentNeutralise) {
  2310. value = Utils$1.normalizeAccent(value);
  2311. }
  2312. tmpItemIsExpected = that.isValueExpected(fval, value, thisColumn, key);
  2313. }
  2314. }
  2315. }
  2316. itemIsExpected.push(tmpItemIsExpected);
  2317. });
  2318. return !itemIsExpected.includes(false);
  2319. }) : that.data;
  2320. that.unsortedData = _toConsumableArray(that.data);
  2321. }
  2322. }, {
  2323. key: "isValueExpected",
  2324. value: function isValueExpected(searchValue, value, column, key) {
  2325. var tmpItemIsExpected = false;
  2326. if (column.filterStrictSearch) {
  2327. tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase();
  2328. } else if (column.filterStartsWithSearch) {
  2329. tmpItemIsExpected = "".concat(value).toLowerCase().indexOf(searchValue) === 0;
  2330. } else {
  2331. tmpItemIsExpected = "".concat(value).toLowerCase().includes(searchValue);
  2332. }
  2333. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  2334. var matches = largerSmallerEqualsRegex.exec(searchValue);
  2335. if (matches) {
  2336. var operator = matches[1] || "".concat(matches[5], "l");
  2337. var comparisonValue = matches[2] || matches[3];
  2338. var int = parseInt(value, 10);
  2339. var comparisonInt = parseInt(comparisonValue, 10);
  2340. switch (operator) {
  2341. case '>':
  2342. case '<l':
  2343. tmpItemIsExpected = int > comparisonInt;
  2344. break;
  2345. case '<':
  2346. case '>l':
  2347. tmpItemIsExpected = int < comparisonInt;
  2348. break;
  2349. case '<=':
  2350. case '=<':
  2351. case '>=l':
  2352. case '=>l':
  2353. tmpItemIsExpected = int <= comparisonInt;
  2354. break;
  2355. case '>=':
  2356. case '=>':
  2357. case '<=l':
  2358. case '=<l':
  2359. tmpItemIsExpected = int >= comparisonInt;
  2360. break;
  2361. }
  2362. }
  2363. if (column.filterCustomSearch) {
  2364. var customSearchResult = Utils$1.calculateObjectValue(this, column.filterCustomSearch, [searchValue, value, key, this.options.data], true);
  2365. if (customSearchResult !== null) {
  2366. tmpItemIsExpected = customSearchResult;
  2367. }
  2368. }
  2369. return tmpItemIsExpected;
  2370. }
  2371. }, {
  2372. key: "initColumnSearch",
  2373. value: function initColumnSearch(filterColumnsDefaults) {
  2374. copyValues(this);
  2375. if (filterColumnsDefaults) {
  2376. this.filterColumnsPartial = filterColumnsDefaults;
  2377. this.updatePagination();
  2378. for (var filter in filterColumnsDefaults) {
  2379. this.trigger('column-search', filter, filterColumnsDefaults[filter]);
  2380. }
  2381. }
  2382. }
  2383. }, {
  2384. key: "onColumnSearch",
  2385. value: function onColumnSearch(_ref2) {
  2386. var currentTarget = _ref2.currentTarget,
  2387. keyCode = _ref2.keyCode;
  2388. if ($.inArray(keyCode, [37, 38, 39, 40]) > -1) {
  2389. return;
  2390. }
  2391. copyValues(this);
  2392. var text = $.trim($(currentTarget).val());
  2393. var $field = $(currentTarget).closest('[data-field]').data('field');
  2394. this.trigger('column-search', $field, text);
  2395. if ($.isEmptyObject(this.filterColumnsPartial)) {
  2396. this.filterColumnsPartial = {};
  2397. }
  2398. if (text) {
  2399. this.filterColumnsPartial[$field] = text;
  2400. } else {
  2401. delete this.filterColumnsPartial[$field];
  2402. }
  2403. this.options.pageNumber = 1;
  2404. this.enableControls(false);
  2405. this.onSearch({
  2406. currentTarget: currentTarget
  2407. }, false);
  2408. }
  2409. }, {
  2410. key: "initToolbar",
  2411. value: function initToolbar() {
  2412. this.showToolbar = this.showToolbar || this.options.showFilterControlSwitch;
  2413. this.showSearchClearButton = this.options.filterControl && this.options.showSearchClearButton;
  2414. _get(_getPrototypeOf(_class.prototype), "initToolbar", this).call(this);
  2415. if (this.options.showFilterControlSwitch) {
  2416. var $btnGroup = this.$toolbar.find('>.columns');
  2417. var $btnFilterControlSwitch = $btnGroup.find('.filter-control-switch');
  2418. if (!$btnFilterControlSwitch.length) {
  2419. $btnFilterControlSwitch = $("\n <button class=\"filter-control-switch ".concat(this.constants.buttonsClass, "\"\n type=\"button\" title=\"").concat(this.options.formatFilterControlSwitch(), "\">\n ").concat(this.options.showButtonIcons ? Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow) : '', "\n ").concat(this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '', "\n </button>\n ")).appendTo($btnGroup);
  2420. $btnFilterControlSwitch.on('click', $.proxy(this.toggleFilterControl, this));
  2421. }
  2422. }
  2423. }
  2424. }, {
  2425. key: "resetSearch",
  2426. value: function resetSearch(text) {
  2427. if (this.options.filterControl && this.options.showSearchClearButton) {
  2428. this.clearFilterControl();
  2429. }
  2430. _get(_getPrototypeOf(_class.prototype), "resetSearch", this).call(this, text);
  2431. }
  2432. }, {
  2433. key: "clearFilterControl",
  2434. value: function clearFilterControl() {
  2435. if (this.options.filterControl) {
  2436. var that = this;
  2437. var cookies = collectBootstrapCookies();
  2438. var table = this.$el.closest('table');
  2439. var controls = getSearchControls(that);
  2440. var search = that.$toolbar.find('.search input');
  2441. var hasValues = false;
  2442. var timeoutId = 0;
  2443. $.each(that.options.valuesFilterControl, function (i, item) {
  2444. hasValues = hasValues ? true : item.value !== '';
  2445. item.value = '';
  2446. });
  2447. $.each(that.options.filterControls, function (i, item) {
  2448. item.text = '';
  2449. });
  2450. setValues(that); // clear cookies once the filters are clean
  2451. clearTimeout(timeoutId);
  2452. timeoutId = setTimeout(function () {
  2453. if (cookies && cookies.length > 0) {
  2454. $.each(cookies, function (i, item) {
  2455. if (that.deleteCookie !== undefined) {
  2456. that.deleteCookie(item);
  2457. }
  2458. });
  2459. }
  2460. }, that.options.searchTimeOut); // If there is not any value in the controls exit this method
  2461. if (!hasValues) {
  2462. return;
  2463. } // Clear each type of filter if it exists.
  2464. // Requires the body to reload each time a type of filter is found because we never know
  2465. // which ones are going to be present.
  2466. if (controls.length > 0) {
  2467. this.filterColumnsPartial = {};
  2468. $(controls[0]).trigger(controls[0].tagName === 'INPUT' ? 'keyup' : 'change', {
  2469. keyCode: 13
  2470. });
  2471. } else {
  2472. return;
  2473. }
  2474. if (search.length > 0) {
  2475. that.resetSearch();
  2476. } // use the default sort order if it exists. do nothing if it does not
  2477. if (that.options.sortName !== table.data('sortName') || that.options.sortOrder !== table.data('sortOrder')) {
  2478. var sorter = this.$header.find(Utils$1.sprintf('[data-field="%s"]', $(controls[0]).closest('table').data('sortName')));
  2479. if (sorter.length > 0) {
  2480. that.onSort({
  2481. type: 'keypress',
  2482. currentTarget: sorter
  2483. });
  2484. $(sorter).find('.sortable').trigger('click');
  2485. }
  2486. }
  2487. }
  2488. }
  2489. }, {
  2490. key: "triggerSearch",
  2491. value: function triggerSearch() {
  2492. var searchControls = getSearchControls(this);
  2493. searchControls.each(function () {
  2494. var el = $(this);
  2495. if (el.is('select')) {
  2496. el.change();
  2497. } else {
  2498. el.keyup();
  2499. }
  2500. });
  2501. }
  2502. }, {
  2503. key: "enableControls",
  2504. value: function enableControls(enable) {
  2505. if (this.options.disableControlWhenSearch && this.options.sidePagination === 'server') {
  2506. var searchControls = getSearchControls(this);
  2507. if (!enable) {
  2508. searchControls.prop('disabled', 'disabled');
  2509. } else {
  2510. searchControls.removeProp('disabled');
  2511. }
  2512. }
  2513. }
  2514. }, {
  2515. key: "toggleFilterControl",
  2516. value: function toggleFilterControl() {
  2517. this.options.filterControlVisible = !this.options.filterControlVisible;
  2518. var $filterControls = getControlContainer(this).find('.filter-control, .no-filter-control');
  2519. if (this.options.filterControlVisible) {
  2520. $filterControls.show();
  2521. } else {
  2522. $filterControls.hide();
  2523. this.clearFilterControl();
  2524. }
  2525. var icon = this.options.showButtonIcons ? this.options.filterControlVisible ? this.options.icons.filterControlSwitchHide : this.options.icons.filterControlSwitchShow : '';
  2526. var text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : '';
  2527. this.$toolbar.find('>.columns').find('.filter-control-switch').html(Utils$1.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) + ' ' + text);
  2528. }
  2529. }]);
  2530. return _class;
  2531. }($.BootstrapTable);
  2532. })));