bootstrap-table-filter-control.js 110 KB

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