bootstrap-table.js 290 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery')) :
  3. typeof define === 'function' && define.amd ? define(['jquery'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.BootstrapTable = 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. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
  11. return typeof obj;
  12. } : function (obj) {
  13. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  14. }, _typeof(obj);
  15. }
  16. function _classCallCheck(instance, Constructor) {
  17. if (!(instance instanceof Constructor)) {
  18. throw new TypeError("Cannot call a class as a function");
  19. }
  20. }
  21. function _defineProperties(target, props) {
  22. for (var i = 0; i < props.length; i++) {
  23. var descriptor = props[i];
  24. descriptor.enumerable = descriptor.enumerable || false;
  25. descriptor.configurable = true;
  26. if ("value" in descriptor) descriptor.writable = true;
  27. Object.defineProperty(target, descriptor.key, descriptor);
  28. }
  29. }
  30. function _createClass(Constructor, protoProps, staticProps) {
  31. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  32. if (staticProps) _defineProperties(Constructor, staticProps);
  33. Object.defineProperty(Constructor, "prototype", {
  34. writable: false
  35. });
  36. return Constructor;
  37. }
  38. function _slicedToArray(arr, i) {
  39. return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
  40. }
  41. function _toConsumableArray(arr) {
  42. return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
  43. }
  44. function _arrayWithoutHoles(arr) {
  45. if (Array.isArray(arr)) return _arrayLikeToArray(arr);
  46. }
  47. function _arrayWithHoles(arr) {
  48. if (Array.isArray(arr)) return arr;
  49. }
  50. function _iterableToArray(iter) {
  51. if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  52. }
  53. function _iterableToArrayLimit(arr, i) {
  54. var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
  55. if (_i == null) return;
  56. var _arr = [];
  57. var _n = true;
  58. var _d = false;
  59. var _s, _e;
  60. try {
  61. for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
  62. _arr.push(_s.value);
  63. if (i && _arr.length === i) break;
  64. }
  65. } catch (err) {
  66. _d = true;
  67. _e = err;
  68. } finally {
  69. try {
  70. if (!_n && _i["return"] != null) _i["return"]();
  71. } finally {
  72. if (_d) throw _e;
  73. }
  74. }
  75. return _arr;
  76. }
  77. function _unsupportedIterableToArray(o, minLen) {
  78. if (!o) return;
  79. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  80. var n = Object.prototype.toString.call(o).slice(8, -1);
  81. if (n === "Object" && o.constructor) n = o.constructor.name;
  82. if (n === "Map" || n === "Set") return Array.from(o);
  83. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  84. }
  85. function _arrayLikeToArray(arr, len) {
  86. if (len == null || len > arr.length) len = arr.length;
  87. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  88. return arr2;
  89. }
  90. function _nonIterableSpread() {
  91. throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  92. }
  93. function _nonIterableRest() {
  94. throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  95. }
  96. function _createForOfIteratorHelper(o, allowArrayLike) {
  97. var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
  98. if (!it) {
  99. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  100. if (it) o = it;
  101. var i = 0;
  102. var F = function () {};
  103. return {
  104. s: F,
  105. n: function () {
  106. if (i >= o.length) return {
  107. done: true
  108. };
  109. return {
  110. done: false,
  111. value: o[i++]
  112. };
  113. },
  114. e: function (e) {
  115. throw e;
  116. },
  117. f: F
  118. };
  119. }
  120. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  121. }
  122. var normalCompletion = true,
  123. didErr = false,
  124. err;
  125. return {
  126. s: function () {
  127. it = it.call(o);
  128. },
  129. n: function () {
  130. var step = it.next();
  131. normalCompletion = step.done;
  132. return step;
  133. },
  134. e: function (e) {
  135. didErr = true;
  136. err = e;
  137. },
  138. f: function () {
  139. try {
  140. if (!normalCompletion && it.return != null) it.return();
  141. } finally {
  142. if (didErr) throw err;
  143. }
  144. }
  145. };
  146. }
  147. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  148. function createCommonjsModule(fn, module) {
  149. return module = { exports: {} }, fn(module, module.exports), module.exports;
  150. }
  151. var check = function (it) {
  152. return it && it.Math == Math && it;
  153. };
  154. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  155. var global_1 =
  156. // eslint-disable-next-line es/no-global-this -- safe
  157. check(typeof globalThis == 'object' && globalThis) ||
  158. check(typeof window == 'object' && window) ||
  159. // eslint-disable-next-line no-restricted-globals -- safe
  160. check(typeof self == 'object' && self) ||
  161. check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
  162. // eslint-disable-next-line no-new-func -- fallback
  163. (function () { return this; })() || Function('return this')();
  164. var fails = function (exec) {
  165. try {
  166. return !!exec();
  167. } catch (error) {
  168. return true;
  169. }
  170. };
  171. // Detect IE8's incomplete defineProperty implementation
  172. var descriptors = !fails(function () {
  173. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  174. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  175. });
  176. var functionBindNative = !fails(function () {
  177. var test = (function () { /* empty */ }).bind();
  178. // eslint-disable-next-line no-prototype-builtins -- safe
  179. return typeof test != 'function' || test.hasOwnProperty('prototype');
  180. });
  181. var call$2 = Function.prototype.call;
  182. var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
  183. return call$2.apply(call$2, arguments);
  184. };
  185. var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
  186. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  187. var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
  188. // Nashorn ~ JDK8 bug
  189. var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
  190. // `Object.prototype.propertyIsEnumerable` method implementation
  191. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  192. var f$5 = NASHORN_BUG ? function propertyIsEnumerable(V) {
  193. var descriptor = getOwnPropertyDescriptor$4(this, V);
  194. return !!descriptor && descriptor.enumerable;
  195. } : $propertyIsEnumerable$1;
  196. var objectPropertyIsEnumerable = {
  197. f: f$5
  198. };
  199. var createPropertyDescriptor = function (bitmap, value) {
  200. return {
  201. enumerable: !(bitmap & 1),
  202. configurable: !(bitmap & 2),
  203. writable: !(bitmap & 4),
  204. value: value
  205. };
  206. };
  207. var FunctionPrototype$2 = Function.prototype;
  208. var bind$1 = FunctionPrototype$2.bind;
  209. var call$1 = FunctionPrototype$2.call;
  210. var uncurryThis = functionBindNative && bind$1.bind(call$1, call$1);
  211. var functionUncurryThis = functionBindNative ? function (fn) {
  212. return fn && uncurryThis(fn);
  213. } : function (fn) {
  214. return fn && function () {
  215. return call$1.apply(fn, arguments);
  216. };
  217. };
  218. var toString$1 = functionUncurryThis({}.toString);
  219. var stringSlice$7 = functionUncurryThis(''.slice);
  220. var classofRaw = function (it) {
  221. return stringSlice$7(toString$1(it), 8, -1);
  222. };
  223. var Object$5 = global_1.Object;
  224. var split = functionUncurryThis(''.split);
  225. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  226. var indexedObject = fails(function () {
  227. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  228. // eslint-disable-next-line no-prototype-builtins -- safe
  229. return !Object$5('z').propertyIsEnumerable(0);
  230. }) ? function (it) {
  231. return classofRaw(it) == 'String' ? split(it, '') : Object$5(it);
  232. } : Object$5;
  233. var TypeError$e = global_1.TypeError;
  234. // `RequireObjectCoercible` abstract operation
  235. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  236. var requireObjectCoercible = function (it) {
  237. if (it == undefined) throw TypeError$e("Can't call method on " + it);
  238. return it;
  239. };
  240. // toObject with fallback for non-array-like ES3 strings
  241. var toIndexedObject = function (it) {
  242. return indexedObject(requireObjectCoercible(it));
  243. };
  244. // `IsCallable` abstract operation
  245. // https://tc39.es/ecma262/#sec-iscallable
  246. var isCallable = function (argument) {
  247. return typeof argument == 'function';
  248. };
  249. var isObject = function (it) {
  250. return typeof it == 'object' ? it !== null : isCallable(it);
  251. };
  252. var aFunction = function (argument) {
  253. return isCallable(argument) ? argument : undefined;
  254. };
  255. var getBuiltIn = function (namespace, method) {
  256. return arguments.length < 2 ? aFunction(global_1[namespace]) : global_1[namespace] && global_1[namespace][method];
  257. };
  258. var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
  259. var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
  260. var process = global_1.process;
  261. var Deno = global_1.Deno;
  262. var versions = process && process.versions || Deno && Deno.version;
  263. var v8 = versions && versions.v8;
  264. var match, version;
  265. if (v8) {
  266. match = v8.split('.');
  267. // in old Chrome, versions of V8 isn't V8 = Chrome / 10
  268. // but their correct versions are not interesting for us
  269. version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);
  270. }
  271. // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
  272. // so check `userAgent` even if `.v8` exists, but 0
  273. if (!version && engineUserAgent) {
  274. match = engineUserAgent.match(/Edge\/(\d+)/);
  275. if (!match || match[1] >= 74) {
  276. match = engineUserAgent.match(/Chrome\/(\d+)/);
  277. if (match) version = +match[1];
  278. }
  279. }
  280. var engineV8Version = version;
  281. /* eslint-disable es/no-symbol -- required for testing */
  282. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  283. var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
  284. var symbol = Symbol();
  285. // Chrome 38 Symbol has incorrect toString conversion
  286. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  287. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  288. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  289. !Symbol.sham && engineV8Version && engineV8Version < 41;
  290. });
  291. /* eslint-disable es/no-symbol -- required for testing */
  292. var useSymbolAsUid = nativeSymbol
  293. && !Symbol.sham
  294. && typeof Symbol.iterator == 'symbol';
  295. var Object$4 = global_1.Object;
  296. var isSymbol = useSymbolAsUid ? function (it) {
  297. return typeof it == 'symbol';
  298. } : function (it) {
  299. var $Symbol = getBuiltIn('Symbol');
  300. return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, Object$4(it));
  301. };
  302. var String$4 = global_1.String;
  303. var tryToString = function (argument) {
  304. try {
  305. return String$4(argument);
  306. } catch (error) {
  307. return 'Object';
  308. }
  309. };
  310. var TypeError$d = global_1.TypeError;
  311. // `Assert: IsCallable(argument) is true`
  312. var aCallable = function (argument) {
  313. if (isCallable(argument)) return argument;
  314. throw TypeError$d(tryToString(argument) + ' is not a function');
  315. };
  316. // `GetMethod` abstract operation
  317. // https://tc39.es/ecma262/#sec-getmethod
  318. var getMethod = function (V, P) {
  319. var func = V[P];
  320. return func == null ? undefined : aCallable(func);
  321. };
  322. var TypeError$c = global_1.TypeError;
  323. // `OrdinaryToPrimitive` abstract operation
  324. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  325. var ordinaryToPrimitive = function (input, pref) {
  326. var fn, val;
  327. if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
  328. if (isCallable(fn = input.valueOf) && !isObject(val = functionCall(fn, input))) return val;
  329. if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = functionCall(fn, input))) return val;
  330. throw TypeError$c("Can't convert object to primitive value");
  331. };
  332. // eslint-disable-next-line es/no-object-defineproperty -- safe
  333. var defineProperty$5 = Object.defineProperty;
  334. var setGlobal = function (key, value) {
  335. try {
  336. defineProperty$5(global_1, key, { value: value, configurable: true, writable: true });
  337. } catch (error) {
  338. global_1[key] = value;
  339. } return value;
  340. };
  341. var SHARED = '__core-js_shared__';
  342. var store$1 = global_1[SHARED] || setGlobal(SHARED, {});
  343. var sharedStore = store$1;
  344. var shared = createCommonjsModule(function (module) {
  345. (module.exports = function (key, value) {
  346. return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
  347. })('versions', []).push({
  348. version: '3.21.1',
  349. mode: 'global',
  350. copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
  351. license: 'https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE',
  352. source: 'https://github.com/zloirock/core-js'
  353. });
  354. });
  355. var Object$3 = global_1.Object;
  356. // `ToObject` abstract operation
  357. // https://tc39.es/ecma262/#sec-toobject
  358. var toObject = function (argument) {
  359. return Object$3(requireObjectCoercible(argument));
  360. };
  361. var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
  362. // `HasOwnProperty` abstract operation
  363. // https://tc39.es/ecma262/#sec-hasownproperty
  364. var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
  365. return hasOwnProperty(toObject(it), key);
  366. };
  367. var id = 0;
  368. var postfix = Math.random();
  369. var toString = functionUncurryThis(1.0.toString);
  370. var uid = function (key) {
  371. return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
  372. };
  373. var WellKnownSymbolsStore = shared('wks');
  374. var Symbol$3 = global_1.Symbol;
  375. var symbolFor = Symbol$3 && Symbol$3['for'];
  376. var createWellKnownSymbol = useSymbolAsUid ? Symbol$3 : Symbol$3 && Symbol$3.withoutSetter || uid;
  377. var wellKnownSymbol = function (name) {
  378. if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(nativeSymbol || typeof WellKnownSymbolsStore[name] == 'string')) {
  379. var description = 'Symbol.' + name;
  380. if (nativeSymbol && hasOwnProperty_1(Symbol$3, name)) {
  381. WellKnownSymbolsStore[name] = Symbol$3[name];
  382. } else if (useSymbolAsUid && symbolFor) {
  383. WellKnownSymbolsStore[name] = symbolFor(description);
  384. } else {
  385. WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
  386. }
  387. } return WellKnownSymbolsStore[name];
  388. };
  389. var TypeError$b = global_1.TypeError;
  390. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  391. // `ToPrimitive` abstract operation
  392. // https://tc39.es/ecma262/#sec-toprimitive
  393. var toPrimitive = function (input, pref) {
  394. if (!isObject(input) || isSymbol(input)) return input;
  395. var exoticToPrim = getMethod(input, TO_PRIMITIVE);
  396. var result;
  397. if (exoticToPrim) {
  398. if (pref === undefined) pref = 'default';
  399. result = functionCall(exoticToPrim, input, pref);
  400. if (!isObject(result) || isSymbol(result)) return result;
  401. throw TypeError$b("Can't convert object to primitive value");
  402. }
  403. if (pref === undefined) pref = 'number';
  404. return ordinaryToPrimitive(input, pref);
  405. };
  406. // `ToPropertyKey` abstract operation
  407. // https://tc39.es/ecma262/#sec-topropertykey
  408. var toPropertyKey = function (argument) {
  409. var key = toPrimitive(argument, 'string');
  410. return isSymbol(key) ? key : key + '';
  411. };
  412. var document$1 = global_1.document;
  413. // typeof document.createElement is 'object' in old IE
  414. var EXISTS$1 = isObject(document$1) && isObject(document$1.createElement);
  415. var documentCreateElement = function (it) {
  416. return EXISTS$1 ? document$1.createElement(it) : {};
  417. };
  418. // Thanks to IE8 for its funny defineProperty
  419. var ie8DomDefine = !descriptors && !fails(function () {
  420. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  421. return Object.defineProperty(documentCreateElement('div'), 'a', {
  422. get: function () { return 7; }
  423. }).a != 7;
  424. });
  425. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  426. var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
  427. // `Object.getOwnPropertyDescriptor` method
  428. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  429. var f$4 = descriptors ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
  430. O = toIndexedObject(O);
  431. P = toPropertyKey(P);
  432. if (ie8DomDefine) try {
  433. return $getOwnPropertyDescriptor$1(O, P);
  434. } catch (error) { /* empty */ }
  435. if (hasOwnProperty_1(O, P)) return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f, O, P), O[P]);
  436. };
  437. var objectGetOwnPropertyDescriptor = {
  438. f: f$4
  439. };
  440. // V8 ~ Chrome 36-
  441. // https://bugs.chromium.org/p/v8/issues/detail?id=3334
  442. var v8PrototypeDefineBug = descriptors && fails(function () {
  443. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  444. return Object.defineProperty(function () { /* empty */ }, 'prototype', {
  445. value: 42,
  446. writable: false
  447. }).prototype != 42;
  448. });
  449. var String$3 = global_1.String;
  450. var TypeError$a = global_1.TypeError;
  451. // `Assert: Type(argument) is Object`
  452. var anObject = function (argument) {
  453. if (isObject(argument)) return argument;
  454. throw TypeError$a(String$3(argument) + ' is not an object');
  455. };
  456. var TypeError$9 = global_1.TypeError;
  457. // eslint-disable-next-line es/no-object-defineproperty -- safe
  458. var $defineProperty = Object.defineProperty;
  459. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  460. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  461. var ENUMERABLE = 'enumerable';
  462. var CONFIGURABLE$1 = 'configurable';
  463. var WRITABLE = 'writable';
  464. // `Object.defineProperty` method
  465. // https://tc39.es/ecma262/#sec-object.defineproperty
  466. var f$3 = descriptors ? v8PrototypeDefineBug ? function defineProperty(O, P, Attributes) {
  467. anObject(O);
  468. P = toPropertyKey(P);
  469. anObject(Attributes);
  470. if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
  471. var current = $getOwnPropertyDescriptor(O, P);
  472. if (current && current[WRITABLE]) {
  473. O[P] = Attributes.value;
  474. Attributes = {
  475. configurable: CONFIGURABLE$1 in Attributes ? Attributes[CONFIGURABLE$1] : current[CONFIGURABLE$1],
  476. enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],
  477. writable: false
  478. };
  479. }
  480. } return $defineProperty(O, P, Attributes);
  481. } : $defineProperty : function defineProperty(O, P, Attributes) {
  482. anObject(O);
  483. P = toPropertyKey(P);
  484. anObject(Attributes);
  485. if (ie8DomDefine) try {
  486. return $defineProperty(O, P, Attributes);
  487. } catch (error) { /* empty */ }
  488. if ('get' in Attributes || 'set' in Attributes) throw TypeError$9('Accessors not supported');
  489. if ('value' in Attributes) O[P] = Attributes.value;
  490. return O;
  491. };
  492. var objectDefineProperty = {
  493. f: f$3
  494. };
  495. var createNonEnumerableProperty = descriptors ? function (object, key, value) {
  496. return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
  497. } : function (object, key, value) {
  498. object[key] = value;
  499. return object;
  500. };
  501. var functionToString = functionUncurryThis(Function.toString);
  502. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  503. if (!isCallable(sharedStore.inspectSource)) {
  504. sharedStore.inspectSource = function (it) {
  505. return functionToString(it);
  506. };
  507. }
  508. var inspectSource = sharedStore.inspectSource;
  509. var WeakMap$1 = global_1.WeakMap;
  510. var nativeWeakMap = isCallable(WeakMap$1) && /native code/.test(inspectSource(WeakMap$1));
  511. var keys$2 = shared('keys');
  512. var sharedKey = function (key) {
  513. return keys$2[key] || (keys$2[key] = uid(key));
  514. };
  515. var hiddenKeys$1 = {};
  516. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  517. var TypeError$8 = global_1.TypeError;
  518. var WeakMap = global_1.WeakMap;
  519. var set, get, has;
  520. var enforce = function (it) {
  521. return has(it) ? get(it) : set(it, {});
  522. };
  523. var getterFor = function (TYPE) {
  524. return function (it) {
  525. var state;
  526. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  527. throw TypeError$8('Incompatible receiver, ' + TYPE + ' required');
  528. } return state;
  529. };
  530. };
  531. if (nativeWeakMap || sharedStore.state) {
  532. var store = sharedStore.state || (sharedStore.state = new WeakMap());
  533. var wmget = functionUncurryThis(store.get);
  534. var wmhas = functionUncurryThis(store.has);
  535. var wmset = functionUncurryThis(store.set);
  536. set = function (it, metadata) {
  537. if (wmhas(store, it)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
  538. metadata.facade = it;
  539. wmset(store, it, metadata);
  540. return metadata;
  541. };
  542. get = function (it) {
  543. return wmget(store, it) || {};
  544. };
  545. has = function (it) {
  546. return wmhas(store, it);
  547. };
  548. } else {
  549. var STATE = sharedKey('state');
  550. hiddenKeys$1[STATE] = true;
  551. set = function (it, metadata) {
  552. if (hasOwnProperty_1(it, STATE)) throw new TypeError$8(OBJECT_ALREADY_INITIALIZED);
  553. metadata.facade = it;
  554. createNonEnumerableProperty(it, STATE, metadata);
  555. return metadata;
  556. };
  557. get = function (it) {
  558. return hasOwnProperty_1(it, STATE) ? it[STATE] : {};
  559. };
  560. has = function (it) {
  561. return hasOwnProperty_1(it, STATE);
  562. };
  563. }
  564. var internalState = {
  565. set: set,
  566. get: get,
  567. has: has,
  568. enforce: enforce,
  569. getterFor: getterFor
  570. };
  571. var FunctionPrototype$1 = Function.prototype;
  572. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  573. var getDescriptor = descriptors && Object.getOwnPropertyDescriptor;
  574. var EXISTS = hasOwnProperty_1(FunctionPrototype$1, 'name');
  575. // additional protection from minified / mangled / dropped function names
  576. var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
  577. var CONFIGURABLE = EXISTS && (!descriptors || (descriptors && getDescriptor(FunctionPrototype$1, 'name').configurable));
  578. var functionName = {
  579. EXISTS: EXISTS,
  580. PROPER: PROPER,
  581. CONFIGURABLE: CONFIGURABLE
  582. };
  583. var redefine = createCommonjsModule(function (module) {
  584. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  585. var getInternalState = internalState.get;
  586. var enforceInternalState = internalState.enforce;
  587. var TEMPLATE = String(String).split('String');
  588. (module.exports = function (O, key, value, options) {
  589. var unsafe = options ? !!options.unsafe : false;
  590. var simple = options ? !!options.enumerable : false;
  591. var noTargetGet = options ? !!options.noTargetGet : false;
  592. var name = options && options.name !== undefined ? options.name : key;
  593. var state;
  594. if (isCallable(value)) {
  595. if (String(name).slice(0, 7) === 'Symbol(') {
  596. name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
  597. }
  598. if (!hasOwnProperty_1(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
  599. createNonEnumerableProperty(value, 'name', name);
  600. }
  601. state = enforceInternalState(value);
  602. if (!state.source) {
  603. state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
  604. }
  605. }
  606. if (O === global_1) {
  607. if (simple) O[key] = value;
  608. else setGlobal(key, value);
  609. return;
  610. } else if (!unsafe) {
  611. delete O[key];
  612. } else if (!noTargetGet && O[key]) {
  613. simple = true;
  614. }
  615. if (simple) O[key] = value;
  616. else createNonEnumerableProperty(O, key, value);
  617. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  618. })(Function.prototype, 'toString', function toString() {
  619. return isCallable(this) && getInternalState(this).source || inspectSource(this);
  620. });
  621. });
  622. var ceil = Math.ceil;
  623. var floor$2 = Math.floor;
  624. // `ToIntegerOrInfinity` abstract operation
  625. // https://tc39.es/ecma262/#sec-tointegerorinfinity
  626. var toIntegerOrInfinity = function (argument) {
  627. var number = +argument;
  628. // eslint-disable-next-line no-self-compare -- safe
  629. return number !== number || number === 0 ? 0 : (number > 0 ? floor$2 : ceil)(number);
  630. };
  631. var max$4 = Math.max;
  632. var min$6 = Math.min;
  633. // Helper for a popular repeating case of the spec:
  634. // Let integer be ? ToInteger(index).
  635. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  636. var toAbsoluteIndex = function (index, length) {
  637. var integer = toIntegerOrInfinity(index);
  638. return integer < 0 ? max$4(integer + length, 0) : min$6(integer, length);
  639. };
  640. var min$5 = Math.min;
  641. // `ToLength` abstract operation
  642. // https://tc39.es/ecma262/#sec-tolength
  643. var toLength = function (argument) {
  644. return argument > 0 ? min$5(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  645. };
  646. // `LengthOfArrayLike` abstract operation
  647. // https://tc39.es/ecma262/#sec-lengthofarraylike
  648. var lengthOfArrayLike = function (obj) {
  649. return toLength(obj.length);
  650. };
  651. // `Array.prototype.{ indexOf, includes }` methods implementation
  652. var createMethod$4 = function (IS_INCLUDES) {
  653. return function ($this, el, fromIndex) {
  654. var O = toIndexedObject($this);
  655. var length = lengthOfArrayLike(O);
  656. var index = toAbsoluteIndex(fromIndex, length);
  657. var value;
  658. // Array#includes uses SameValueZero equality algorithm
  659. // eslint-disable-next-line no-self-compare -- NaN check
  660. if (IS_INCLUDES && el != el) while (length > index) {
  661. value = O[index++];
  662. // eslint-disable-next-line no-self-compare -- NaN check
  663. if (value != value) return true;
  664. // Array#indexOf ignores holes, Array#includes - not
  665. } else for (;length > index; index++) {
  666. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  667. } return !IS_INCLUDES && -1;
  668. };
  669. };
  670. var arrayIncludes = {
  671. // `Array.prototype.includes` method
  672. // https://tc39.es/ecma262/#sec-array.prototype.includes
  673. includes: createMethod$4(true),
  674. // `Array.prototype.indexOf` method
  675. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  676. indexOf: createMethod$4(false)
  677. };
  678. var indexOf$1 = arrayIncludes.indexOf;
  679. var push$5 = functionUncurryThis([].push);
  680. var objectKeysInternal = function (object, names) {
  681. var O = toIndexedObject(object);
  682. var i = 0;
  683. var result = [];
  684. var key;
  685. for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$5(result, key);
  686. // Don't enum bug & hidden keys
  687. while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
  688. ~indexOf$1(result, key) || push$5(result, key);
  689. }
  690. return result;
  691. };
  692. // IE8- don't enum bug keys
  693. var enumBugKeys = [
  694. 'constructor',
  695. 'hasOwnProperty',
  696. 'isPrototypeOf',
  697. 'propertyIsEnumerable',
  698. 'toLocaleString',
  699. 'toString',
  700. 'valueOf'
  701. ];
  702. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  703. // `Object.getOwnPropertyNames` method
  704. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  705. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  706. var f$2 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  707. return objectKeysInternal(O, hiddenKeys);
  708. };
  709. var objectGetOwnPropertyNames = {
  710. f: f$2
  711. };
  712. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  713. var f$1 = Object.getOwnPropertySymbols;
  714. var objectGetOwnPropertySymbols = {
  715. f: f$1
  716. };
  717. var concat$2 = functionUncurryThis([].concat);
  718. // all object keys, includes non-enumerable and symbols
  719. var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  720. var keys = objectGetOwnPropertyNames.f(anObject(it));
  721. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  722. return getOwnPropertySymbols ? concat$2(keys, getOwnPropertySymbols(it)) : keys;
  723. };
  724. var copyConstructorProperties = function (target, source, exceptions) {
  725. var keys = ownKeys(source);
  726. var defineProperty = objectDefineProperty.f;
  727. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  728. for (var i = 0; i < keys.length; i++) {
  729. var key = keys[i];
  730. if (!hasOwnProperty_1(target, key) && !(exceptions && hasOwnProperty_1(exceptions, key))) {
  731. defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  732. }
  733. }
  734. };
  735. var replacement = /#|\.prototype\./;
  736. var isForced = function (feature, detection) {
  737. var value = data[normalize(feature)];
  738. return value == POLYFILL ? true
  739. : value == NATIVE ? false
  740. : isCallable(detection) ? fails(detection)
  741. : !!detection;
  742. };
  743. var normalize = isForced.normalize = function (string) {
  744. return String(string).replace(replacement, '.').toLowerCase();
  745. };
  746. var data = isForced.data = {};
  747. var NATIVE = isForced.NATIVE = 'N';
  748. var POLYFILL = isForced.POLYFILL = 'P';
  749. var isForced_1 = isForced;
  750. var getOwnPropertyDescriptor$3 = objectGetOwnPropertyDescriptor.f;
  751. /*
  752. options.target - name of the target object
  753. options.global - target is the global object
  754. options.stat - export as static methods of target
  755. options.proto - export as prototype methods of target
  756. options.real - real prototype method for the `pure` version
  757. options.forced - export even if the native feature is available
  758. options.bind - bind methods to the target, required for the `pure` version
  759. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  760. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  761. options.sham - add a flag to not completely full polyfills
  762. options.enumerable - export as enumerable property
  763. options.noTargetGet - prevent calling a getter on target
  764. options.name - the .name of the function if it does not match the key
  765. */
  766. var _export = function (options, source) {
  767. var TARGET = options.target;
  768. var GLOBAL = options.global;
  769. var STATIC = options.stat;
  770. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  771. if (GLOBAL) {
  772. target = global_1;
  773. } else if (STATIC) {
  774. target = global_1[TARGET] || setGlobal(TARGET, {});
  775. } else {
  776. target = (global_1[TARGET] || {}).prototype;
  777. }
  778. if (target) for (key in source) {
  779. sourceProperty = source[key];
  780. if (options.noTargetGet) {
  781. descriptor = getOwnPropertyDescriptor$3(target, key);
  782. targetProperty = descriptor && descriptor.value;
  783. } else targetProperty = target[key];
  784. FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  785. // contained in target
  786. if (!FORCED && targetProperty !== undefined) {
  787. if (typeof sourceProperty == typeof targetProperty) continue;
  788. copyConstructorProperties(sourceProperty, targetProperty);
  789. }
  790. // add a flag to not completely full polyfills
  791. if (options.sham || (targetProperty && targetProperty.sham)) {
  792. createNonEnumerableProperty(sourceProperty, 'sham', true);
  793. }
  794. // extend global
  795. redefine(target, key, sourceProperty, options);
  796. }
  797. };
  798. // `Object.keys` method
  799. // https://tc39.es/ecma262/#sec-object.keys
  800. // eslint-disable-next-line es/no-object-keys -- safe
  801. var objectKeys = Object.keys || function keys(O) {
  802. return objectKeysInternal(O, enumBugKeys);
  803. };
  804. // eslint-disable-next-line es/no-object-assign -- safe
  805. var $assign = Object.assign;
  806. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  807. var defineProperty$4 = Object.defineProperty;
  808. var concat$1 = functionUncurryThis([].concat);
  809. // `Object.assign` method
  810. // https://tc39.es/ecma262/#sec-object.assign
  811. var objectAssign = !$assign || fails(function () {
  812. // should have correct order of operations (Edge bug)
  813. if (descriptors && $assign({ b: 1 }, $assign(defineProperty$4({}, 'a', {
  814. enumerable: true,
  815. get: function () {
  816. defineProperty$4(this, 'b', {
  817. value: 3,
  818. enumerable: false
  819. });
  820. }
  821. }), { b: 2 })).b !== 1) return true;
  822. // should work with symbols and should have deterministic property order (V8 bug)
  823. var A = {};
  824. var B = {};
  825. // eslint-disable-next-line es/no-symbol -- safe
  826. var symbol = Symbol();
  827. var alphabet = 'abcdefghijklmnopqrst';
  828. A[symbol] = 7;
  829. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  830. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  831. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  832. var T = toObject(target);
  833. var argumentsLength = arguments.length;
  834. var index = 1;
  835. var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
  836. var propertyIsEnumerable = objectPropertyIsEnumerable.f;
  837. while (argumentsLength > index) {
  838. var S = indexedObject(arguments[index++]);
  839. var keys = getOwnPropertySymbols ? concat$1(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);
  840. var length = keys.length;
  841. var j = 0;
  842. var key;
  843. while (length > j) {
  844. key = keys[j++];
  845. if (!descriptors || functionCall(propertyIsEnumerable, S, key)) T[key] = S[key];
  846. }
  847. } return T;
  848. } : $assign;
  849. // `Object.assign` method
  850. // https://tc39.es/ecma262/#sec-object.assign
  851. // eslint-disable-next-line es/no-object-assign -- required for testing
  852. _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, {
  853. assign: objectAssign
  854. });
  855. var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
  856. var test$2 = {};
  857. test$2[TO_STRING_TAG$3] = 'z';
  858. var toStringTagSupport = String(test$2) === '[object z]';
  859. var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
  860. var Object$2 = global_1.Object;
  861. // ES3 wrong here
  862. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  863. // fallback for IE11 Script Access Denied error
  864. var tryGet = function (it, key) {
  865. try {
  866. return it[key];
  867. } catch (error) { /* empty */ }
  868. };
  869. // getting tag from ES6+ `Object.prototype.toString`
  870. var classof = toStringTagSupport ? classofRaw : function (it) {
  871. var O, tag, result;
  872. return it === undefined ? 'Undefined' : it === null ? 'Null'
  873. // @@toStringTag case
  874. : typeof (tag = tryGet(O = Object$2(it), TO_STRING_TAG$2)) == 'string' ? tag
  875. // builtinTag case
  876. : CORRECT_ARGUMENTS ? classofRaw(O)
  877. // ES3 arguments fallback
  878. : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;
  879. };
  880. var String$2 = global_1.String;
  881. var toString_1 = function (argument) {
  882. if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');
  883. return String$2(argument);
  884. };
  885. // a string of all valid unicode whitespaces
  886. var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  887. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  888. var replace$3 = functionUncurryThis(''.replace);
  889. var whitespace = '[' + whitespaces + ']';
  890. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  891. var rtrim = RegExp(whitespace + whitespace + '*$');
  892. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  893. var createMethod$3 = function (TYPE) {
  894. return function ($this) {
  895. var string = toString_1(requireObjectCoercible($this));
  896. if (TYPE & 1) string = replace$3(string, ltrim, '');
  897. if (TYPE & 2) string = replace$3(string, rtrim, '');
  898. return string;
  899. };
  900. };
  901. var stringTrim = {
  902. // `String.prototype.{ trimLeft, trimStart }` methods
  903. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  904. start: createMethod$3(1),
  905. // `String.prototype.{ trimRight, trimEnd }` methods
  906. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  907. end: createMethod$3(2),
  908. // `String.prototype.trim` method
  909. // https://tc39.es/ecma262/#sec-string.prototype.trim
  910. trim: createMethod$3(3)
  911. };
  912. var PROPER_FUNCTION_NAME$2 = functionName.PROPER;
  913. var non = '\u200B\u0085\u180E';
  914. // check that a method works with the correct list
  915. // of whitespaces and has a correct name
  916. var stringTrimForced = function (METHOD_NAME) {
  917. return fails(function () {
  918. return !!whitespaces[METHOD_NAME]()
  919. || non[METHOD_NAME]() !== non
  920. || (PROPER_FUNCTION_NAME$2 && whitespaces[METHOD_NAME].name !== METHOD_NAME);
  921. });
  922. };
  923. var $trim = stringTrim.trim;
  924. // `String.prototype.trim` method
  925. // https://tc39.es/ecma262/#sec-string.prototype.trim
  926. _export({ target: 'String', proto: true, forced: stringTrimForced('trim') }, {
  927. trim: function trim() {
  928. return $trim(this);
  929. }
  930. });
  931. var arrayMethodIsStrict = function (METHOD_NAME, argument) {
  932. var method = [][METHOD_NAME];
  933. return !!method && fails(function () {
  934. // eslint-disable-next-line no-useless-call -- required for testing
  935. method.call(null, argument || function () { return 1; }, 1);
  936. });
  937. };
  938. var un$Join = functionUncurryThis([].join);
  939. var ES3_STRINGS = indexedObject != Object;
  940. var STRICT_METHOD$3 = arrayMethodIsStrict('join', ',');
  941. // `Array.prototype.join` method
  942. // https://tc39.es/ecma262/#sec-array.prototype.join
  943. _export({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD$3 }, {
  944. join: function join(separator) {
  945. return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
  946. }
  947. });
  948. // `RegExp.prototype.flags` getter implementation
  949. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  950. var regexpFlags = function () {
  951. var that = anObject(this);
  952. var result = '';
  953. if (that.global) result += 'g';
  954. if (that.ignoreCase) result += 'i';
  955. if (that.multiline) result += 'm';
  956. if (that.dotAll) result += 's';
  957. if (that.unicode) result += 'u';
  958. if (that.sticky) result += 'y';
  959. return result;
  960. };
  961. // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  962. var $RegExp$2 = global_1.RegExp;
  963. var UNSUPPORTED_Y$3 = fails(function () {
  964. var re = $RegExp$2('a', 'y');
  965. re.lastIndex = 2;
  966. return re.exec('abcd') != null;
  967. });
  968. // UC Browser bug
  969. // https://github.com/zloirock/core-js/issues/1008
  970. var MISSED_STICKY$1 = UNSUPPORTED_Y$3 || fails(function () {
  971. return !$RegExp$2('a', 'y').sticky;
  972. });
  973. var BROKEN_CARET = UNSUPPORTED_Y$3 || fails(function () {
  974. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  975. var re = $RegExp$2('^r', 'gy');
  976. re.lastIndex = 2;
  977. return re.exec('str') != null;
  978. });
  979. var regexpStickyHelpers = {
  980. BROKEN_CARET: BROKEN_CARET,
  981. MISSED_STICKY: MISSED_STICKY$1,
  982. UNSUPPORTED_Y: UNSUPPORTED_Y$3
  983. };
  984. // `Object.defineProperties` method
  985. // https://tc39.es/ecma262/#sec-object.defineproperties
  986. // eslint-disable-next-line es/no-object-defineproperties -- safe
  987. var f = descriptors && !v8PrototypeDefineBug ? Object.defineProperties : function defineProperties(O, Properties) {
  988. anObject(O);
  989. var props = toIndexedObject(Properties);
  990. var keys = objectKeys(Properties);
  991. var length = keys.length;
  992. var index = 0;
  993. var key;
  994. while (length > index) objectDefineProperty.f(O, key = keys[index++], props[key]);
  995. return O;
  996. };
  997. var objectDefineProperties = {
  998. f: f
  999. };
  1000. var html = getBuiltIn('document', 'documentElement');
  1001. /* global ActiveXObject -- old IE, WSH */
  1002. var GT = '>';
  1003. var LT = '<';
  1004. var PROTOTYPE = 'prototype';
  1005. var SCRIPT = 'script';
  1006. var IE_PROTO$1 = sharedKey('IE_PROTO');
  1007. var EmptyConstructor = function () { /* empty */ };
  1008. var scriptTag = function (content) {
  1009. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  1010. };
  1011. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  1012. var NullProtoObjectViaActiveX = function (activeXDocument) {
  1013. activeXDocument.write(scriptTag(''));
  1014. activeXDocument.close();
  1015. var temp = activeXDocument.parentWindow.Object;
  1016. activeXDocument = null; // avoid memory leak
  1017. return temp;
  1018. };
  1019. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  1020. var NullProtoObjectViaIFrame = function () {
  1021. // Thrash, waste and sodomy: IE GC bug
  1022. var iframe = documentCreateElement('iframe');
  1023. var JS = 'java' + SCRIPT + ':';
  1024. var iframeDocument;
  1025. iframe.style.display = 'none';
  1026. html.appendChild(iframe);
  1027. // https://github.com/zloirock/core-js/issues/475
  1028. iframe.src = String(JS);
  1029. iframeDocument = iframe.contentWindow.document;
  1030. iframeDocument.open();
  1031. iframeDocument.write(scriptTag('document.F=Object'));
  1032. iframeDocument.close();
  1033. return iframeDocument.F;
  1034. };
  1035. // Check for document.domain and active x support
  1036. // No need to use active x approach when document.domain is not set
  1037. // see https://github.com/es-shims/es5-shim/issues/150
  1038. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  1039. // avoid IE GC bug
  1040. var activeXDocument;
  1041. var NullProtoObject = function () {
  1042. try {
  1043. activeXDocument = new ActiveXObject('htmlfile');
  1044. } catch (error) { /* ignore */ }
  1045. NullProtoObject = typeof document != 'undefined'
  1046. ? document.domain && activeXDocument
  1047. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  1048. : NullProtoObjectViaIFrame()
  1049. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  1050. var length = enumBugKeys.length;
  1051. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  1052. return NullProtoObject();
  1053. };
  1054. hiddenKeys$1[IE_PROTO$1] = true;
  1055. // `Object.create` method
  1056. // https://tc39.es/ecma262/#sec-object.create
  1057. var objectCreate = Object.create || function create(O, Properties) {
  1058. var result;
  1059. if (O !== null) {
  1060. EmptyConstructor[PROTOTYPE] = anObject(O);
  1061. result = new EmptyConstructor();
  1062. EmptyConstructor[PROTOTYPE] = null;
  1063. // add "__proto__" for Object.getPrototypeOf polyfill
  1064. result[IE_PROTO$1] = O;
  1065. } else result = NullProtoObject();
  1066. return Properties === undefined ? result : objectDefineProperties.f(result, Properties);
  1067. };
  1068. // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
  1069. var $RegExp$1 = global_1.RegExp;
  1070. var regexpUnsupportedDotAll = fails(function () {
  1071. var re = $RegExp$1('.', 's');
  1072. return !(re.dotAll && re.exec('\n') && re.flags === 's');
  1073. });
  1074. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  1075. var $RegExp = global_1.RegExp;
  1076. var regexpUnsupportedNcg = fails(function () {
  1077. var re = $RegExp('(?<a>b)', 'g');
  1078. return re.exec('b').groups.a !== 'b' ||
  1079. 'b'.replace(re, '$<a>c') !== 'bc';
  1080. });
  1081. /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
  1082. /* eslint-disable regexp/no-useless-quantifier -- testing */
  1083. var getInternalState$1 = internalState.get;
  1084. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  1085. var nativeExec = RegExp.prototype.exec;
  1086. var patchedExec = nativeExec;
  1087. var charAt$5 = functionUncurryThis(''.charAt);
  1088. var indexOf = functionUncurryThis(''.indexOf);
  1089. var replace$2 = functionUncurryThis(''.replace);
  1090. var stringSlice$6 = functionUncurryThis(''.slice);
  1091. var UPDATES_LAST_INDEX_WRONG = (function () {
  1092. var re1 = /a/;
  1093. var re2 = /b*/g;
  1094. functionCall(nativeExec, re1, 'a');
  1095. functionCall(nativeExec, re2, 'a');
  1096. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  1097. })();
  1098. var UNSUPPORTED_Y$2 = regexpStickyHelpers.BROKEN_CARET;
  1099. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  1100. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  1101. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y$2 || regexpUnsupportedDotAll || regexpUnsupportedNcg;
  1102. if (PATCH) {
  1103. patchedExec = function exec(string) {
  1104. var re = this;
  1105. var state = getInternalState$1(re);
  1106. var str = toString_1(string);
  1107. var raw = state.raw;
  1108. var result, reCopy, lastIndex, match, i, object, group;
  1109. if (raw) {
  1110. raw.lastIndex = re.lastIndex;
  1111. result = functionCall(patchedExec, raw, str);
  1112. re.lastIndex = raw.lastIndex;
  1113. return result;
  1114. }
  1115. var groups = state.groups;
  1116. var sticky = UNSUPPORTED_Y$2 && re.sticky;
  1117. var flags = functionCall(regexpFlags, re);
  1118. var source = re.source;
  1119. var charsAdded = 0;
  1120. var strCopy = str;
  1121. if (sticky) {
  1122. flags = replace$2(flags, 'y', '');
  1123. if (indexOf(flags, 'g') === -1) {
  1124. flags += 'g';
  1125. }
  1126. strCopy = stringSlice$6(str, re.lastIndex);
  1127. // Support anchored sticky behavior.
  1128. if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt$5(str, re.lastIndex - 1) !== '\n')) {
  1129. source = '(?: ' + source + ')';
  1130. strCopy = ' ' + strCopy;
  1131. charsAdded++;
  1132. }
  1133. // ^(? + rx + ) is needed, in combination with some str slicing, to
  1134. // simulate the 'y' flag.
  1135. reCopy = new RegExp('^(?:' + source + ')', flags);
  1136. }
  1137. if (NPCG_INCLUDED) {
  1138. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  1139. }
  1140. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  1141. match = functionCall(nativeExec, sticky ? reCopy : re, strCopy);
  1142. if (sticky) {
  1143. if (match) {
  1144. match.input = stringSlice$6(match.input, charsAdded);
  1145. match[0] = stringSlice$6(match[0], charsAdded);
  1146. match.index = re.lastIndex;
  1147. re.lastIndex += match[0].length;
  1148. } else re.lastIndex = 0;
  1149. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  1150. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  1151. }
  1152. if (NPCG_INCLUDED && match && match.length > 1) {
  1153. // Fix browsers whose `exec` methods don't consistently return `undefined`
  1154. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  1155. functionCall(nativeReplace, match[0], reCopy, function () {
  1156. for (i = 1; i < arguments.length - 2; i++) {
  1157. if (arguments[i] === undefined) match[i] = undefined;
  1158. }
  1159. });
  1160. }
  1161. if (match && groups) {
  1162. match.groups = object = objectCreate(null);
  1163. for (i = 0; i < groups.length; i++) {
  1164. group = groups[i];
  1165. object[group[0]] = match[group[1]];
  1166. }
  1167. }
  1168. return match;
  1169. };
  1170. }
  1171. var regexpExec = patchedExec;
  1172. // `RegExp.prototype.exec` method
  1173. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  1174. _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, {
  1175. exec: regexpExec
  1176. });
  1177. var FunctionPrototype = Function.prototype;
  1178. var apply = FunctionPrototype.apply;
  1179. var call = FunctionPrototype.call;
  1180. // eslint-disable-next-line es/no-reflect -- safe
  1181. var functionApply = typeof Reflect == 'object' && Reflect.apply || (functionBindNative ? call.bind(apply) : function () {
  1182. return call.apply(apply, arguments);
  1183. });
  1184. // TODO: Remove from `core-js@4` since it's moved to entry points
  1185. var SPECIES$5 = wellKnownSymbol('species');
  1186. var RegExpPrototype$2 = RegExp.prototype;
  1187. var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) {
  1188. var SYMBOL = wellKnownSymbol(KEY);
  1189. var DELEGATES_TO_SYMBOL = !fails(function () {
  1190. // String methods call symbol-named RegEp methods
  1191. var O = {};
  1192. O[SYMBOL] = function () { return 7; };
  1193. return ''[KEY](O) != 7;
  1194. });
  1195. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  1196. // Symbol-named RegExp methods call .exec
  1197. var execCalled = false;
  1198. var re = /a/;
  1199. if (KEY === 'split') {
  1200. // We can't use real regex here since it causes deoptimization
  1201. // and serious performance degradation in V8
  1202. // https://github.com/zloirock/core-js/issues/306
  1203. re = {};
  1204. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  1205. // a new one. We need to return the patched regex when creating the new one.
  1206. re.constructor = {};
  1207. re.constructor[SPECIES$5] = function () { return re; };
  1208. re.flags = '';
  1209. re[SYMBOL] = /./[SYMBOL];
  1210. }
  1211. re.exec = function () { execCalled = true; return null; };
  1212. re[SYMBOL]('');
  1213. return !execCalled;
  1214. });
  1215. if (
  1216. !DELEGATES_TO_SYMBOL ||
  1217. !DELEGATES_TO_EXEC ||
  1218. FORCED
  1219. ) {
  1220. var uncurriedNativeRegExpMethod = functionUncurryThis(/./[SYMBOL]);
  1221. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  1222. var uncurriedNativeMethod = functionUncurryThis(nativeMethod);
  1223. var $exec = regexp.exec;
  1224. if ($exec === regexpExec || $exec === RegExpPrototype$2.exec) {
  1225. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  1226. // The native String method already delegates to @@method (this
  1227. // polyfilled function), leasing to infinite recursion.
  1228. // We avoid it by directly calling the native @@method method.
  1229. return { done: true, value: uncurriedNativeRegExpMethod(regexp, str, arg2) };
  1230. }
  1231. return { done: true, value: uncurriedNativeMethod(str, regexp, arg2) };
  1232. }
  1233. return { done: false };
  1234. });
  1235. redefine(String.prototype, KEY, methods[0]);
  1236. redefine(RegExpPrototype$2, SYMBOL, methods[1]);
  1237. }
  1238. if (SHAM) createNonEnumerableProperty(RegExpPrototype$2[SYMBOL], 'sham', true);
  1239. };
  1240. var MATCH$2 = wellKnownSymbol('match');
  1241. // `IsRegExp` abstract operation
  1242. // https://tc39.es/ecma262/#sec-isregexp
  1243. var isRegexp = function (it) {
  1244. var isRegExp;
  1245. return isObject(it) && ((isRegExp = it[MATCH$2]) !== undefined ? !!isRegExp : classofRaw(it) == 'RegExp');
  1246. };
  1247. var noop = function () { /* empty */ };
  1248. var empty = [];
  1249. var construct = getBuiltIn('Reflect', 'construct');
  1250. var constructorRegExp = /^\s*(?:class|function)\b/;
  1251. var exec$3 = functionUncurryThis(constructorRegExp.exec);
  1252. var INCORRECT_TO_STRING = !constructorRegExp.exec(noop);
  1253. var isConstructorModern = function isConstructor(argument) {
  1254. if (!isCallable(argument)) return false;
  1255. try {
  1256. construct(noop, empty, argument);
  1257. return true;
  1258. } catch (error) {
  1259. return false;
  1260. }
  1261. };
  1262. var isConstructorLegacy = function isConstructor(argument) {
  1263. if (!isCallable(argument)) return false;
  1264. switch (classof(argument)) {
  1265. case 'AsyncFunction':
  1266. case 'GeneratorFunction':
  1267. case 'AsyncGeneratorFunction': return false;
  1268. }
  1269. try {
  1270. // we can't check .prototype since constructors produced by .bind haven't it
  1271. // `Function#toString` throws on some built-it function in some legacy engines
  1272. // (for example, `DOMQuad` and similar in FF41-)
  1273. return INCORRECT_TO_STRING || !!exec$3(constructorRegExp, inspectSource(argument));
  1274. } catch (error) {
  1275. return true;
  1276. }
  1277. };
  1278. isConstructorLegacy.sham = true;
  1279. // `IsConstructor` abstract operation
  1280. // https://tc39.es/ecma262/#sec-isconstructor
  1281. var isConstructor = !construct || fails(function () {
  1282. var called;
  1283. return isConstructorModern(isConstructorModern.call)
  1284. || !isConstructorModern(Object)
  1285. || !isConstructorModern(function () { called = true; })
  1286. || called;
  1287. }) ? isConstructorLegacy : isConstructorModern;
  1288. var TypeError$7 = global_1.TypeError;
  1289. // `Assert: IsConstructor(argument) is true`
  1290. var aConstructor = function (argument) {
  1291. if (isConstructor(argument)) return argument;
  1292. throw TypeError$7(tryToString(argument) + ' is not a constructor');
  1293. };
  1294. var SPECIES$4 = wellKnownSymbol('species');
  1295. // `SpeciesConstructor` abstract operation
  1296. // https://tc39.es/ecma262/#sec-speciesconstructor
  1297. var speciesConstructor = function (O, defaultConstructor) {
  1298. var C = anObject(O).constructor;
  1299. var S;
  1300. return C === undefined || (S = anObject(C)[SPECIES$4]) == undefined ? defaultConstructor : aConstructor(S);
  1301. };
  1302. var charAt$4 = functionUncurryThis(''.charAt);
  1303. var charCodeAt$1 = functionUncurryThis(''.charCodeAt);
  1304. var stringSlice$5 = functionUncurryThis(''.slice);
  1305. var createMethod$2 = function (CONVERT_TO_STRING) {
  1306. return function ($this, pos) {
  1307. var S = toString_1(requireObjectCoercible($this));
  1308. var position = toIntegerOrInfinity(pos);
  1309. var size = S.length;
  1310. var first, second;
  1311. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  1312. first = charCodeAt$1(S, position);
  1313. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  1314. || (second = charCodeAt$1(S, position + 1)) < 0xDC00 || second > 0xDFFF
  1315. ? CONVERT_TO_STRING
  1316. ? charAt$4(S, position)
  1317. : first
  1318. : CONVERT_TO_STRING
  1319. ? stringSlice$5(S, position, position + 2)
  1320. : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  1321. };
  1322. };
  1323. var stringMultibyte = {
  1324. // `String.prototype.codePointAt` method
  1325. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  1326. codeAt: createMethod$2(false),
  1327. // `String.prototype.at` method
  1328. // https://github.com/mathiasbynens/String.prototype.at
  1329. charAt: createMethod$2(true)
  1330. };
  1331. var charAt$3 = stringMultibyte.charAt;
  1332. // `AdvanceStringIndex` abstract operation
  1333. // https://tc39.es/ecma262/#sec-advancestringindex
  1334. var advanceStringIndex = function (S, index, unicode) {
  1335. return index + (unicode ? charAt$3(S, index).length : 1);
  1336. };
  1337. var createProperty = function (object, key, value) {
  1338. var propertyKey = toPropertyKey(key);
  1339. if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
  1340. else object[propertyKey] = value;
  1341. };
  1342. var Array$3 = global_1.Array;
  1343. var max$3 = Math.max;
  1344. var arraySliceSimple = function (O, start, end) {
  1345. var length = lengthOfArrayLike(O);
  1346. var k = toAbsoluteIndex(start, length);
  1347. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  1348. var result = Array$3(max$3(fin - k, 0));
  1349. for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);
  1350. result.length = n;
  1351. return result;
  1352. };
  1353. var TypeError$6 = global_1.TypeError;
  1354. // `RegExpExec` abstract operation
  1355. // https://tc39.es/ecma262/#sec-regexpexec
  1356. var regexpExecAbstract = function (R, S) {
  1357. var exec = R.exec;
  1358. if (isCallable(exec)) {
  1359. var result = functionCall(exec, R, S);
  1360. if (result !== null) anObject(result);
  1361. return result;
  1362. }
  1363. if (classofRaw(R) === 'RegExp') return functionCall(regexpExec, R, S);
  1364. throw TypeError$6('RegExp#exec called on incompatible receiver');
  1365. };
  1366. var UNSUPPORTED_Y$1 = regexpStickyHelpers.UNSUPPORTED_Y;
  1367. var MAX_UINT32 = 0xFFFFFFFF;
  1368. var min$4 = Math.min;
  1369. var $push = [].push;
  1370. var exec$2 = functionUncurryThis(/./.exec);
  1371. var push$4 = functionUncurryThis($push);
  1372. var stringSlice$4 = functionUncurryThis(''.slice);
  1373. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  1374. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  1375. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  1376. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1377. var re = /(?:)/;
  1378. var originalExec = re.exec;
  1379. re.exec = function () { return originalExec.apply(this, arguments); };
  1380. var result = 'ab'.split(re);
  1381. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  1382. });
  1383. // @@split logic
  1384. fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
  1385. var internalSplit;
  1386. if (
  1387. 'abbc'.split(/(b)*/)[1] == 'c' ||
  1388. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  1389. 'test'.split(/(?:)/, -1).length != 4 ||
  1390. 'ab'.split(/(?:ab)*/).length != 2 ||
  1391. '.'.split(/(.?)(.?)/).length != 4 ||
  1392. // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
  1393. '.'.split(/()()/).length > 1 ||
  1394. ''.split(/.?/).length
  1395. ) {
  1396. // based on es5-shim implementation, need to rework it
  1397. internalSplit = function (separator, limit) {
  1398. var string = toString_1(requireObjectCoercible(this));
  1399. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1400. if (lim === 0) return [];
  1401. if (separator === undefined) return [string];
  1402. // If `separator` is not a regex, use native split
  1403. if (!isRegexp(separator)) {
  1404. return functionCall(nativeSplit, string, separator, lim);
  1405. }
  1406. var output = [];
  1407. var flags = (separator.ignoreCase ? 'i' : '') +
  1408. (separator.multiline ? 'm' : '') +
  1409. (separator.unicode ? 'u' : '') +
  1410. (separator.sticky ? 'y' : '');
  1411. var lastLastIndex = 0;
  1412. // Make `global` and avoid `lastIndex` issues by working with a copy
  1413. var separatorCopy = new RegExp(separator.source, flags + 'g');
  1414. var match, lastIndex, lastLength;
  1415. while (match = functionCall(regexpExec, separatorCopy, string)) {
  1416. lastIndex = separatorCopy.lastIndex;
  1417. if (lastIndex > lastLastIndex) {
  1418. push$4(output, stringSlice$4(string, lastLastIndex, match.index));
  1419. if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
  1420. lastLength = match[0].length;
  1421. lastLastIndex = lastIndex;
  1422. if (output.length >= lim) break;
  1423. }
  1424. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  1425. }
  1426. if (lastLastIndex === string.length) {
  1427. if (lastLength || !exec$2(separatorCopy, '')) push$4(output, '');
  1428. } else push$4(output, stringSlice$4(string, lastLastIndex));
  1429. return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
  1430. };
  1431. // Chakra, V8
  1432. } else if ('0'.split(undefined, 0).length) {
  1433. internalSplit = function (separator, limit) {
  1434. return separator === undefined && limit === 0 ? [] : functionCall(nativeSplit, this, separator, limit);
  1435. };
  1436. } else internalSplit = nativeSplit;
  1437. return [
  1438. // `String.prototype.split` method
  1439. // https://tc39.es/ecma262/#sec-string.prototype.split
  1440. function split(separator, limit) {
  1441. var O = requireObjectCoercible(this);
  1442. var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT);
  1443. return splitter
  1444. ? functionCall(splitter, separator, O, limit)
  1445. : functionCall(internalSplit, toString_1(O), separator, limit);
  1446. },
  1447. // `RegExp.prototype[@@split]` method
  1448. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  1449. //
  1450. // NOTE: This cannot be properly polyfilled in engines that don't support
  1451. // the 'y' flag.
  1452. function (string, limit) {
  1453. var rx = anObject(this);
  1454. var S = toString_1(string);
  1455. var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
  1456. if (res.done) return res.value;
  1457. var C = speciesConstructor(rx, RegExp);
  1458. var unicodeMatching = rx.unicode;
  1459. var flags = (rx.ignoreCase ? 'i' : '') +
  1460. (rx.multiline ? 'm' : '') +
  1461. (rx.unicode ? 'u' : '') +
  1462. (UNSUPPORTED_Y$1 ? 'g' : 'y');
  1463. // ^(? + rx + ) is needed, in combination with some S slicing, to
  1464. // simulate the 'y' flag.
  1465. var splitter = new C(UNSUPPORTED_Y$1 ? '^(?:' + rx.source + ')' : rx, flags);
  1466. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  1467. if (lim === 0) return [];
  1468. if (S.length === 0) return regexpExecAbstract(splitter, S) === null ? [S] : [];
  1469. var p = 0;
  1470. var q = 0;
  1471. var A = [];
  1472. while (q < S.length) {
  1473. splitter.lastIndex = UNSUPPORTED_Y$1 ? 0 : q;
  1474. var z = regexpExecAbstract(splitter, UNSUPPORTED_Y$1 ? stringSlice$4(S, q) : S);
  1475. var e;
  1476. if (
  1477. z === null ||
  1478. (e = min$4(toLength(splitter.lastIndex + (UNSUPPORTED_Y$1 ? q : 0)), S.length)) === p
  1479. ) {
  1480. q = advanceStringIndex(S, q, unicodeMatching);
  1481. } else {
  1482. push$4(A, stringSlice$4(S, p, q));
  1483. if (A.length === lim) return A;
  1484. for (var i = 1; i <= z.length - 1; i++) {
  1485. push$4(A, z[i]);
  1486. if (A.length === lim) return A;
  1487. }
  1488. q = p = e;
  1489. }
  1490. }
  1491. push$4(A, stringSlice$4(S, p));
  1492. return A;
  1493. }
  1494. ];
  1495. }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y$1);
  1496. var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
  1497. var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable);
  1498. var push$3 = functionUncurryThis([].push);
  1499. // `Object.{ entries, values }` methods implementation
  1500. var createMethod$1 = function (TO_ENTRIES) {
  1501. return function (it) {
  1502. var O = toIndexedObject(it);
  1503. var keys = objectKeys(O);
  1504. var length = keys.length;
  1505. var i = 0;
  1506. var result = [];
  1507. var key;
  1508. while (length > i) {
  1509. key = keys[i++];
  1510. if (!descriptors || propertyIsEnumerable(O, key)) {
  1511. push$3(result, TO_ENTRIES ? [key, O[key]] : O[key]);
  1512. }
  1513. }
  1514. return result;
  1515. };
  1516. };
  1517. var objectToArray = {
  1518. // `Object.entries` method
  1519. // https://tc39.es/ecma262/#sec-object.entries
  1520. entries: createMethod$1(true),
  1521. // `Object.values` method
  1522. // https://tc39.es/ecma262/#sec-object.values
  1523. values: createMethod$1(false)
  1524. };
  1525. var $entries = objectToArray.entries;
  1526. // `Object.entries` method
  1527. // https://tc39.es/ecma262/#sec-object.entries
  1528. _export({ target: 'Object', stat: true }, {
  1529. entries: function entries(O) {
  1530. return $entries(O);
  1531. }
  1532. });
  1533. var UNSCOPABLES = wellKnownSymbol('unscopables');
  1534. var ArrayPrototype = Array.prototype;
  1535. // Array.prototype[@@unscopables]
  1536. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1537. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  1538. objectDefineProperty.f(ArrayPrototype, UNSCOPABLES, {
  1539. configurable: true,
  1540. value: objectCreate(null)
  1541. });
  1542. }
  1543. // add a key to Array.prototype[@@unscopables]
  1544. var addToUnscopables = function (key) {
  1545. ArrayPrototype[UNSCOPABLES][key] = true;
  1546. };
  1547. var $includes = arrayIncludes.includes;
  1548. // `Array.prototype.includes` method
  1549. // https://tc39.es/ecma262/#sec-array.prototype.includes
  1550. _export({ target: 'Array', proto: true }, {
  1551. includes: function includes(el /* , fromIndex = 0 */) {
  1552. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  1553. }
  1554. });
  1555. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1556. addToUnscopables('includes');
  1557. // `IsArray` abstract operation
  1558. // https://tc39.es/ecma262/#sec-isarray
  1559. // eslint-disable-next-line es/no-array-isarray -- safe
  1560. var isArray = Array.isArray || function isArray(argument) {
  1561. return classofRaw(argument) == 'Array';
  1562. };
  1563. var SPECIES$3 = wellKnownSymbol('species');
  1564. var Array$2 = global_1.Array;
  1565. // a part of `ArraySpeciesCreate` abstract operation
  1566. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1567. var arraySpeciesConstructor = function (originalArray) {
  1568. var C;
  1569. if (isArray(originalArray)) {
  1570. C = originalArray.constructor;
  1571. // cross-realm fallback
  1572. if (isConstructor(C) && (C === Array$2 || isArray(C.prototype))) C = undefined;
  1573. else if (isObject(C)) {
  1574. C = C[SPECIES$3];
  1575. if (C === null) C = undefined;
  1576. }
  1577. } return C === undefined ? Array$2 : C;
  1578. };
  1579. // `ArraySpeciesCreate` abstract operation
  1580. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  1581. var arraySpeciesCreate = function (originalArray, length) {
  1582. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  1583. };
  1584. var SPECIES$2 = wellKnownSymbol('species');
  1585. var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
  1586. // We can't use this feature detection in V8 since it causes
  1587. // deoptimization and serious performance degradation
  1588. // https://github.com/zloirock/core-js/issues/677
  1589. return engineV8Version >= 51 || !fails(function () {
  1590. var array = [];
  1591. var constructor = array.constructor = {};
  1592. constructor[SPECIES$2] = function () {
  1593. return { foo: 1 };
  1594. };
  1595. return array[METHOD_NAME](Boolean).foo !== 1;
  1596. });
  1597. };
  1598. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  1599. var MAX_SAFE_INTEGER$1 = 0x1FFFFFFFFFFFFF;
  1600. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  1601. var TypeError$5 = global_1.TypeError;
  1602. // We can't use this feature detection in V8 since it causes
  1603. // deoptimization and serious performance degradation
  1604. // https://github.com/zloirock/core-js/issues/679
  1605. var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
  1606. var array = [];
  1607. array[IS_CONCAT_SPREADABLE] = false;
  1608. return array.concat()[0] !== array;
  1609. });
  1610. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  1611. var isConcatSpreadable = function (O) {
  1612. if (!isObject(O)) return false;
  1613. var spreadable = O[IS_CONCAT_SPREADABLE];
  1614. return spreadable !== undefined ? !!spreadable : isArray(O);
  1615. };
  1616. var FORCED$3 = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  1617. // `Array.prototype.concat` method
  1618. // https://tc39.es/ecma262/#sec-array.prototype.concat
  1619. // with adding support of @@isConcatSpreadable and @@species
  1620. _export({ target: 'Array', proto: true, forced: FORCED$3 }, {
  1621. // eslint-disable-next-line no-unused-vars -- required for `.length`
  1622. concat: function concat(arg) {
  1623. var O = toObject(this);
  1624. var A = arraySpeciesCreate(O, 0);
  1625. var n = 0;
  1626. var i, k, length, len, E;
  1627. for (i = -1, length = arguments.length; i < length; i++) {
  1628. E = i === -1 ? O : arguments[i];
  1629. if (isConcatSpreadable(E)) {
  1630. len = lengthOfArrayLike(E);
  1631. if (n + len > MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1632. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  1633. } else {
  1634. if (n >= MAX_SAFE_INTEGER$1) throw TypeError$5(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  1635. createProperty(A, n++, E);
  1636. }
  1637. }
  1638. A.length = n;
  1639. return A;
  1640. }
  1641. });
  1642. var bind = functionUncurryThis(functionUncurryThis.bind);
  1643. // optional / simple context binding
  1644. var functionBindContext = function (fn, that) {
  1645. aCallable(fn);
  1646. return that === undefined ? fn : functionBindNative ? bind(fn, that) : function (/* ...args */) {
  1647. return fn.apply(that, arguments);
  1648. };
  1649. };
  1650. var push$2 = functionUncurryThis([].push);
  1651. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  1652. var createMethod = function (TYPE) {
  1653. var IS_MAP = TYPE == 1;
  1654. var IS_FILTER = TYPE == 2;
  1655. var IS_SOME = TYPE == 3;
  1656. var IS_EVERY = TYPE == 4;
  1657. var IS_FIND_INDEX = TYPE == 6;
  1658. var IS_FILTER_REJECT = TYPE == 7;
  1659. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  1660. return function ($this, callbackfn, that, specificCreate) {
  1661. var O = toObject($this);
  1662. var self = indexedObject(O);
  1663. var boundFunction = functionBindContext(callbackfn, that);
  1664. var length = lengthOfArrayLike(self);
  1665. var index = 0;
  1666. var create = specificCreate || arraySpeciesCreate;
  1667. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  1668. var value, result;
  1669. for (;length > index; index++) if (NO_HOLES || index in self) {
  1670. value = self[index];
  1671. result = boundFunction(value, index, O);
  1672. if (TYPE) {
  1673. if (IS_MAP) target[index] = result; // map
  1674. else if (result) switch (TYPE) {
  1675. case 3: return true; // some
  1676. case 5: return value; // find
  1677. case 6: return index; // findIndex
  1678. case 2: push$2(target, value); // filter
  1679. } else switch (TYPE) {
  1680. case 4: return false; // every
  1681. case 7: push$2(target, value); // filterReject
  1682. }
  1683. }
  1684. }
  1685. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  1686. };
  1687. };
  1688. var arrayIteration = {
  1689. // `Array.prototype.forEach` method
  1690. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1691. forEach: createMethod(0),
  1692. // `Array.prototype.map` method
  1693. // https://tc39.es/ecma262/#sec-array.prototype.map
  1694. map: createMethod(1),
  1695. // `Array.prototype.filter` method
  1696. // https://tc39.es/ecma262/#sec-array.prototype.filter
  1697. filter: createMethod(2),
  1698. // `Array.prototype.some` method
  1699. // https://tc39.es/ecma262/#sec-array.prototype.some
  1700. some: createMethod(3),
  1701. // `Array.prototype.every` method
  1702. // https://tc39.es/ecma262/#sec-array.prototype.every
  1703. every: createMethod(4),
  1704. // `Array.prototype.find` method
  1705. // https://tc39.es/ecma262/#sec-array.prototype.find
  1706. find: createMethod(5),
  1707. // `Array.prototype.findIndex` method
  1708. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  1709. findIndex: createMethod(6),
  1710. // `Array.prototype.filterReject` method
  1711. // https://github.com/tc39/proposal-array-filtering
  1712. filterReject: createMethod(7)
  1713. };
  1714. var $find = arrayIteration.find;
  1715. var FIND = 'find';
  1716. var SKIPS_HOLES$1 = true;
  1717. // Shouldn't skip holes
  1718. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES$1 = false; });
  1719. // `Array.prototype.find` method
  1720. // https://tc39.es/ecma262/#sec-array.prototype.find
  1721. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES$1 }, {
  1722. find: function find(callbackfn /* , that = undefined */) {
  1723. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1724. }
  1725. });
  1726. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  1727. addToUnscopables(FIND);
  1728. // `Object.prototype.toString` method implementation
  1729. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1730. var objectToString = toStringTagSupport ? {}.toString : function toString() {
  1731. return '[object ' + classof(this) + ']';
  1732. };
  1733. // `Object.prototype.toString` method
  1734. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  1735. if (!toStringTagSupport) {
  1736. redefine(Object.prototype, 'toString', objectToString, { unsafe: true });
  1737. }
  1738. var TypeError$4 = global_1.TypeError;
  1739. var notARegexp = function (it) {
  1740. if (isRegexp(it)) {
  1741. throw TypeError$4("The method doesn't accept regular expressions");
  1742. } return it;
  1743. };
  1744. var MATCH$1 = wellKnownSymbol('match');
  1745. var correctIsRegexpLogic = function (METHOD_NAME) {
  1746. var regexp = /./;
  1747. try {
  1748. '/./'[METHOD_NAME](regexp);
  1749. } catch (error1) {
  1750. try {
  1751. regexp[MATCH$1] = false;
  1752. return '/./'[METHOD_NAME](regexp);
  1753. } catch (error2) { /* empty */ }
  1754. } return false;
  1755. };
  1756. var stringIndexOf$2 = functionUncurryThis(''.indexOf);
  1757. // `String.prototype.includes` method
  1758. // https://tc39.es/ecma262/#sec-string.prototype.includes
  1759. _export({ target: 'String', proto: true, forced: !correctIsRegexpLogic('includes') }, {
  1760. includes: function includes(searchString /* , position = 0 */) {
  1761. return !!~stringIndexOf$2(
  1762. toString_1(requireObjectCoercible(this)),
  1763. toString_1(notARegexp(searchString)),
  1764. arguments.length > 1 ? arguments[1] : undefined
  1765. );
  1766. }
  1767. });
  1768. // iterable DOM collections
  1769. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  1770. var domIterables = {
  1771. CSSRuleList: 0,
  1772. CSSStyleDeclaration: 0,
  1773. CSSValueList: 0,
  1774. ClientRectList: 0,
  1775. DOMRectList: 0,
  1776. DOMStringList: 0,
  1777. DOMTokenList: 1,
  1778. DataTransferItemList: 0,
  1779. FileList: 0,
  1780. HTMLAllCollection: 0,
  1781. HTMLCollection: 0,
  1782. HTMLFormElement: 0,
  1783. HTMLSelectElement: 0,
  1784. MediaList: 0,
  1785. MimeTypeArray: 0,
  1786. NamedNodeMap: 0,
  1787. NodeList: 1,
  1788. PaintRequestList: 0,
  1789. Plugin: 0,
  1790. PluginArray: 0,
  1791. SVGLengthList: 0,
  1792. SVGNumberList: 0,
  1793. SVGPathSegList: 0,
  1794. SVGPointList: 0,
  1795. SVGStringList: 0,
  1796. SVGTransformList: 0,
  1797. SourceBufferList: 0,
  1798. StyleSheetList: 0,
  1799. TextTrackCueList: 0,
  1800. TextTrackList: 0,
  1801. TouchList: 0
  1802. };
  1803. // in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList`
  1804. var classList = documentCreateElement('span').classList;
  1805. var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype;
  1806. var domTokenListPrototype = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype;
  1807. var $forEach = arrayIteration.forEach;
  1808. var STRICT_METHOD$2 = arrayMethodIsStrict('forEach');
  1809. // `Array.prototype.forEach` method implementation
  1810. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  1811. var arrayForEach = !STRICT_METHOD$2 ? function forEach(callbackfn /* , thisArg */) {
  1812. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  1813. // eslint-disable-next-line es/no-array-prototype-foreach -- safe
  1814. } : [].forEach;
  1815. var handlePrototype$1 = function (CollectionPrototype) {
  1816. // some Chrome versions have non-configurable methods on DOMTokenList
  1817. if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try {
  1818. createNonEnumerableProperty(CollectionPrototype, 'forEach', arrayForEach);
  1819. } catch (error) {
  1820. CollectionPrototype.forEach = arrayForEach;
  1821. }
  1822. };
  1823. for (var COLLECTION_NAME$1 in domIterables) {
  1824. if (domIterables[COLLECTION_NAME$1]) {
  1825. handlePrototype$1(global_1[COLLECTION_NAME$1] && global_1[COLLECTION_NAME$1].prototype);
  1826. }
  1827. }
  1828. handlePrototype$1(domTokenListPrototype);
  1829. var trim$2 = stringTrim.trim;
  1830. var charAt$2 = functionUncurryThis(''.charAt);
  1831. var n$ParseFloat = global_1.parseFloat;
  1832. var Symbol$2 = global_1.Symbol;
  1833. var ITERATOR$4 = Symbol$2 && Symbol$2.iterator;
  1834. var FORCED$2 = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity
  1835. // MS Edge 18- broken with boxed symbols
  1836. || (ITERATOR$4 && !fails(function () { n$ParseFloat(Object(ITERATOR$4)); }));
  1837. // `parseFloat` method
  1838. // https://tc39.es/ecma262/#sec-parsefloat-string
  1839. var numberParseFloat = FORCED$2 ? function parseFloat(string) {
  1840. var trimmedString = trim$2(toString_1(string));
  1841. var result = n$ParseFloat(trimmedString);
  1842. return result === 0 && charAt$2(trimmedString, 0) == '-' ? -0 : result;
  1843. } : n$ParseFloat;
  1844. // `parseFloat` method
  1845. // https://tc39.es/ecma262/#sec-parsefloat-string
  1846. _export({ global: true, forced: parseFloat != numberParseFloat }, {
  1847. parseFloat: numberParseFloat
  1848. });
  1849. /* eslint-disable es/no-array-prototype-indexof -- required for testing */
  1850. var $IndexOf = arrayIncludes.indexOf;
  1851. var un$IndexOf = functionUncurryThis([].indexOf);
  1852. var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;
  1853. var STRICT_METHOD$1 = arrayMethodIsStrict('indexOf');
  1854. // `Array.prototype.indexOf` method
  1855. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  1856. _export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD$1 }, {
  1857. indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
  1858. var fromIndex = arguments.length > 1 ? arguments[1] : undefined;
  1859. return NEGATIVE_ZERO
  1860. // convert -0 to +0
  1861. ? un$IndexOf(this, searchElement, fromIndex) || 0
  1862. : $IndexOf(this, searchElement, fromIndex);
  1863. }
  1864. });
  1865. var floor$1 = Math.floor;
  1866. var mergeSort = function (array, comparefn) {
  1867. var length = array.length;
  1868. var middle = floor$1(length / 2);
  1869. return length < 8 ? insertionSort(array, comparefn) : merge(
  1870. array,
  1871. mergeSort(arraySliceSimple(array, 0, middle), comparefn),
  1872. mergeSort(arraySliceSimple(array, middle), comparefn),
  1873. comparefn
  1874. );
  1875. };
  1876. var insertionSort = function (array, comparefn) {
  1877. var length = array.length;
  1878. var i = 1;
  1879. var element, j;
  1880. while (i < length) {
  1881. j = i;
  1882. element = array[i];
  1883. while (j && comparefn(array[j - 1], element) > 0) {
  1884. array[j] = array[--j];
  1885. }
  1886. if (j !== i++) array[j] = element;
  1887. } return array;
  1888. };
  1889. var merge = function (array, left, right, comparefn) {
  1890. var llength = left.length;
  1891. var rlength = right.length;
  1892. var lindex = 0;
  1893. var rindex = 0;
  1894. while (lindex < llength || rindex < rlength) {
  1895. array[lindex + rindex] = (lindex < llength && rindex < rlength)
  1896. ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]
  1897. : lindex < llength ? left[lindex++] : right[rindex++];
  1898. } return array;
  1899. };
  1900. var arraySort = mergeSort;
  1901. var firefox = engineUserAgent.match(/firefox\/(\d+)/i);
  1902. var engineFfVersion = !!firefox && +firefox[1];
  1903. var engineIsIeOrEdge = /MSIE|Trident/.test(engineUserAgent);
  1904. var webkit = engineUserAgent.match(/AppleWebKit\/(\d+)\./);
  1905. var engineWebkitVersion = !!webkit && +webkit[1];
  1906. var test$1 = [];
  1907. var un$Sort = functionUncurryThis(test$1.sort);
  1908. var push$1 = functionUncurryThis(test$1.push);
  1909. // IE8-
  1910. var FAILS_ON_UNDEFINED = fails(function () {
  1911. test$1.sort(undefined);
  1912. });
  1913. // V8 bug
  1914. var FAILS_ON_NULL = fails(function () {
  1915. test$1.sort(null);
  1916. });
  1917. // Old WebKit
  1918. var STRICT_METHOD = arrayMethodIsStrict('sort');
  1919. var STABLE_SORT = !fails(function () {
  1920. // feature detection can be too slow, so check engines versions
  1921. if (engineV8Version) return engineV8Version < 70;
  1922. if (engineFfVersion && engineFfVersion > 3) return;
  1923. if (engineIsIeOrEdge) return true;
  1924. if (engineWebkitVersion) return engineWebkitVersion < 603;
  1925. var result = '';
  1926. var code, chr, value, index;
  1927. // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  1928. for (code = 65; code < 76; code++) {
  1929. chr = String.fromCharCode(code);
  1930. switch (code) {
  1931. case 66: case 69: case 70: case 72: value = 3; break;
  1932. case 68: case 71: value = 4; break;
  1933. default: value = 2;
  1934. }
  1935. for (index = 0; index < 47; index++) {
  1936. test$1.push({ k: chr + index, v: value });
  1937. }
  1938. }
  1939. test$1.sort(function (a, b) { return b.v - a.v; });
  1940. for (index = 0; index < test$1.length; index++) {
  1941. chr = test$1[index].k.charAt(0);
  1942. if (result.charAt(result.length - 1) !== chr) result += chr;
  1943. }
  1944. return result !== 'DGBEFHACIJK';
  1945. });
  1946. var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
  1947. var getSortCompare = function (comparefn) {
  1948. return function (x, y) {
  1949. if (y === undefined) return -1;
  1950. if (x === undefined) return 1;
  1951. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  1952. return toString_1(x) > toString_1(y) ? 1 : -1;
  1953. };
  1954. };
  1955. // `Array.prototype.sort` method
  1956. // https://tc39.es/ecma262/#sec-array.prototype.sort
  1957. _export({ target: 'Array', proto: true, forced: FORCED$1 }, {
  1958. sort: function sort(comparefn) {
  1959. if (comparefn !== undefined) aCallable(comparefn);
  1960. var array = toObject(this);
  1961. if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
  1962. var items = [];
  1963. var arrayLength = lengthOfArrayLike(array);
  1964. var itemsLength, index;
  1965. for (index = 0; index < arrayLength; index++) {
  1966. if (index in array) push$1(items, array[index]);
  1967. }
  1968. arraySort(items, getSortCompare(comparefn));
  1969. itemsLength = items.length;
  1970. index = 0;
  1971. while (index < itemsLength) array[index] = items[index++];
  1972. while (index < arrayLength) delete array[index++];
  1973. return array;
  1974. }
  1975. });
  1976. var floor = Math.floor;
  1977. var charAt$1 = functionUncurryThis(''.charAt);
  1978. var replace$1 = functionUncurryThis(''.replace);
  1979. var stringSlice$3 = functionUncurryThis(''.slice);
  1980. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  1981. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  1982. // `GetSubstitution` abstract operation
  1983. // https://tc39.es/ecma262/#sec-getsubstitution
  1984. var getSubstitution = function (matched, str, position, captures, namedCaptures, replacement) {
  1985. var tailPos = position + matched.length;
  1986. var m = captures.length;
  1987. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  1988. if (namedCaptures !== undefined) {
  1989. namedCaptures = toObject(namedCaptures);
  1990. symbols = SUBSTITUTION_SYMBOLS;
  1991. }
  1992. return replace$1(replacement, symbols, function (match, ch) {
  1993. var capture;
  1994. switch (charAt$1(ch, 0)) {
  1995. case '$': return '$';
  1996. case '&': return matched;
  1997. case '`': return stringSlice$3(str, 0, position);
  1998. case "'": return stringSlice$3(str, tailPos);
  1999. case '<':
  2000. capture = namedCaptures[stringSlice$3(ch, 1, -1)];
  2001. break;
  2002. default: // \d\d?
  2003. var n = +ch;
  2004. if (n === 0) return match;
  2005. if (n > m) {
  2006. var f = floor(n / 10);
  2007. if (f === 0) return match;
  2008. if (f <= m) return captures[f - 1] === undefined ? charAt$1(ch, 1) : captures[f - 1] + charAt$1(ch, 1);
  2009. return match;
  2010. }
  2011. capture = captures[n - 1];
  2012. }
  2013. return capture === undefined ? '' : capture;
  2014. });
  2015. };
  2016. var REPLACE = wellKnownSymbol('replace');
  2017. var max$2 = Math.max;
  2018. var min$3 = Math.min;
  2019. var concat = functionUncurryThis([].concat);
  2020. var push = functionUncurryThis([].push);
  2021. var stringIndexOf$1 = functionUncurryThis(''.indexOf);
  2022. var stringSlice$2 = functionUncurryThis(''.slice);
  2023. var maybeToString = function (it) {
  2024. return it === undefined ? it : String(it);
  2025. };
  2026. // IE <= 11 replaces $0 with the whole match, as if it was $&
  2027. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  2028. var REPLACE_KEEPS_$0 = (function () {
  2029. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  2030. return 'a'.replace(/./, '$0') === '$0';
  2031. })();
  2032. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  2033. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  2034. if (/./[REPLACE]) {
  2035. return /./[REPLACE]('a', '$0') === '';
  2036. }
  2037. return false;
  2038. })();
  2039. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  2040. var re = /./;
  2041. re.exec = function () {
  2042. var result = [];
  2043. result.groups = { a: '7' };
  2044. return result;
  2045. };
  2046. // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  2047. return ''.replace(re, '$<a>') !== '7';
  2048. });
  2049. // @@replace logic
  2050. fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  2051. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  2052. return [
  2053. // `String.prototype.replace` method
  2054. // https://tc39.es/ecma262/#sec-string.prototype.replace
  2055. function replace(searchValue, replaceValue) {
  2056. var O = requireObjectCoercible(this);
  2057. var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
  2058. return replacer
  2059. ? functionCall(replacer, searchValue, O, replaceValue)
  2060. : functionCall(nativeReplace, toString_1(O), searchValue, replaceValue);
  2061. },
  2062. // `RegExp.prototype[@@replace]` method
  2063. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  2064. function (string, replaceValue) {
  2065. var rx = anObject(this);
  2066. var S = toString_1(string);
  2067. if (
  2068. typeof replaceValue == 'string' &&
  2069. stringIndexOf$1(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
  2070. stringIndexOf$1(replaceValue, '$<') === -1
  2071. ) {
  2072. var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
  2073. if (res.done) return res.value;
  2074. }
  2075. var functionalReplace = isCallable(replaceValue);
  2076. if (!functionalReplace) replaceValue = toString_1(replaceValue);
  2077. var global = rx.global;
  2078. if (global) {
  2079. var fullUnicode = rx.unicode;
  2080. rx.lastIndex = 0;
  2081. }
  2082. var results = [];
  2083. while (true) {
  2084. var result = regexpExecAbstract(rx, S);
  2085. if (result === null) break;
  2086. push(results, result);
  2087. if (!global) break;
  2088. var matchStr = toString_1(result[0]);
  2089. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  2090. }
  2091. var accumulatedResult = '';
  2092. var nextSourcePosition = 0;
  2093. for (var i = 0; i < results.length; i++) {
  2094. result = results[i];
  2095. var matched = toString_1(result[0]);
  2096. var position = max$2(min$3(toIntegerOrInfinity(result.index), S.length), 0);
  2097. var captures = [];
  2098. // NOTE: This is equivalent to
  2099. // captures = result.slice(1).map(maybeToString)
  2100. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  2101. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  2102. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  2103. for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
  2104. var namedCaptures = result.groups;
  2105. if (functionalReplace) {
  2106. var replacerArgs = concat([matched], captures, position, S);
  2107. if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
  2108. var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
  2109. } else {
  2110. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  2111. }
  2112. if (position >= nextSourcePosition) {
  2113. accumulatedResult += stringSlice$2(S, nextSourcePosition, position) + replacement;
  2114. nextSourcePosition = position + matched.length;
  2115. }
  2116. }
  2117. return accumulatedResult + stringSlice$2(S, nextSourcePosition);
  2118. }
  2119. ];
  2120. }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
  2121. var $filter = arrayIteration.filter;
  2122. var HAS_SPECIES_SUPPORT$3 = arrayMethodHasSpeciesSupport('filter');
  2123. // `Array.prototype.filter` method
  2124. // https://tc39.es/ecma262/#sec-array.prototype.filter
  2125. // with adding support of @@species
  2126. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$3 }, {
  2127. filter: function filter(callbackfn /* , thisArg */) {
  2128. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2129. }
  2130. });
  2131. // `SameValue` abstract operation
  2132. // https://tc39.es/ecma262/#sec-samevalue
  2133. // eslint-disable-next-line es/no-object-is -- safe
  2134. var sameValue = Object.is || function is(x, y) {
  2135. // eslint-disable-next-line no-self-compare -- NaN check
  2136. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  2137. };
  2138. // @@search logic
  2139. fixRegexpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
  2140. return [
  2141. // `String.prototype.search` method
  2142. // https://tc39.es/ecma262/#sec-string.prototype.search
  2143. function search(regexp) {
  2144. var O = requireObjectCoercible(this);
  2145. var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH);
  2146. return searcher ? functionCall(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString_1(O));
  2147. },
  2148. // `RegExp.prototype[@@search]` method
  2149. // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
  2150. function (string) {
  2151. var rx = anObject(this);
  2152. var S = toString_1(string);
  2153. var res = maybeCallNative(nativeSearch, rx, S);
  2154. if (res.done) return res.value;
  2155. var previousLastIndex = rx.lastIndex;
  2156. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  2157. var result = regexpExecAbstract(rx, S);
  2158. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  2159. return result === null ? -1 : result.index;
  2160. }
  2161. ];
  2162. });
  2163. var trim$1 = stringTrim.trim;
  2164. var $parseInt = global_1.parseInt;
  2165. var Symbol$1 = global_1.Symbol;
  2166. var ITERATOR$3 = Symbol$1 && Symbol$1.iterator;
  2167. var hex = /^[+-]?0x/i;
  2168. var exec$1 = functionUncurryThis(hex.exec);
  2169. var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22
  2170. // MS Edge 18- broken with boxed symbols
  2171. || (ITERATOR$3 && !fails(function () { $parseInt(Object(ITERATOR$3)); }));
  2172. // `parseInt` method
  2173. // https://tc39.es/ecma262/#sec-parseint-string-radix
  2174. var numberParseInt = FORCED ? function parseInt(string, radix) {
  2175. var S = trim$1(toString_1(string));
  2176. return $parseInt(S, (radix >>> 0) || (exec$1(hex, S) ? 16 : 10));
  2177. } : $parseInt;
  2178. // `parseInt` method
  2179. // https://tc39.es/ecma262/#sec-parseint-string-radix
  2180. _export({ global: true, forced: parseInt != numberParseInt }, {
  2181. parseInt: numberParseInt
  2182. });
  2183. var $map = arrayIteration.map;
  2184. var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('map');
  2185. // `Array.prototype.map` method
  2186. // https://tc39.es/ecma262/#sec-array.prototype.map
  2187. // with adding support of @@species
  2188. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 }, {
  2189. map: function map(callbackfn /* , thisArg */) {
  2190. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2191. }
  2192. });
  2193. var $findIndex = arrayIteration.findIndex;
  2194. var FIND_INDEX = 'findIndex';
  2195. var SKIPS_HOLES = true;
  2196. // Shouldn't skip holes
  2197. if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
  2198. // `Array.prototype.findIndex` method
  2199. // https://tc39.es/ecma262/#sec-array.prototype.findindex
  2200. _export({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  2201. findIndex: function findIndex(callbackfn /* , that = undefined */) {
  2202. return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  2203. }
  2204. });
  2205. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  2206. addToUnscopables(FIND_INDEX);
  2207. var String$1 = global_1.String;
  2208. var TypeError$3 = global_1.TypeError;
  2209. var aPossiblePrototype = function (argument) {
  2210. if (typeof argument == 'object' || isCallable(argument)) return argument;
  2211. throw TypeError$3("Can't set " + String$1(argument) + ' as a prototype');
  2212. };
  2213. /* eslint-disable no-proto -- safe */
  2214. // `Object.setPrototypeOf` method
  2215. // https://tc39.es/ecma262/#sec-object.setprototypeof
  2216. // Works with __proto__ only. Old v8 can't work with null proto objects.
  2217. // eslint-disable-next-line es/no-object-setprototypeof -- safe
  2218. var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  2219. var CORRECT_SETTER = false;
  2220. var test = {};
  2221. var setter;
  2222. try {
  2223. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  2224. setter = functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);
  2225. setter(test, []);
  2226. CORRECT_SETTER = test instanceof Array;
  2227. } catch (error) { /* empty */ }
  2228. return function setPrototypeOf(O, proto) {
  2229. anObject(O);
  2230. aPossiblePrototype(proto);
  2231. if (CORRECT_SETTER) setter(O, proto);
  2232. else O.__proto__ = proto;
  2233. return O;
  2234. };
  2235. }() : undefined);
  2236. // makes subclassing work correct for wrapped built-ins
  2237. var inheritIfRequired = function ($this, dummy, Wrapper) {
  2238. var NewTarget, NewTargetPrototype;
  2239. if (
  2240. // it can work only with native `setPrototypeOf`
  2241. objectSetPrototypeOf &&
  2242. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  2243. isCallable(NewTarget = dummy.constructor) &&
  2244. NewTarget !== Wrapper &&
  2245. isObject(NewTargetPrototype = NewTarget.prototype) &&
  2246. NewTargetPrototype !== Wrapper.prototype
  2247. ) objectSetPrototypeOf($this, NewTargetPrototype);
  2248. return $this;
  2249. };
  2250. var SPECIES$1 = wellKnownSymbol('species');
  2251. var setSpecies = function (CONSTRUCTOR_NAME) {
  2252. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  2253. var defineProperty = objectDefineProperty.f;
  2254. if (descriptors && Constructor && !Constructor[SPECIES$1]) {
  2255. defineProperty(Constructor, SPECIES$1, {
  2256. configurable: true,
  2257. get: function () { return this; }
  2258. });
  2259. }
  2260. };
  2261. var defineProperty$3 = objectDefineProperty.f;
  2262. var getOwnPropertyNames$1 = objectGetOwnPropertyNames.f;
  2263. var enforceInternalState = internalState.enforce;
  2264. var MATCH = wellKnownSymbol('match');
  2265. var NativeRegExp = global_1.RegExp;
  2266. var RegExpPrototype$1 = NativeRegExp.prototype;
  2267. var SyntaxError = global_1.SyntaxError;
  2268. var getFlags$1 = functionUncurryThis(regexpFlags);
  2269. var exec = functionUncurryThis(RegExpPrototype$1.exec);
  2270. var charAt = functionUncurryThis(''.charAt);
  2271. var replace = functionUncurryThis(''.replace);
  2272. var stringIndexOf = functionUncurryThis(''.indexOf);
  2273. var stringSlice$1 = functionUncurryThis(''.slice);
  2274. // TODO: Use only propper RegExpIdentifierName
  2275. var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
  2276. var re1 = /a/g;
  2277. var re2 = /a/g;
  2278. // "new" should create a new object, old webkit bug
  2279. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  2280. var MISSED_STICKY = regexpStickyHelpers.MISSED_STICKY;
  2281. var UNSUPPORTED_Y = regexpStickyHelpers.UNSUPPORTED_Y;
  2282. var BASE_FORCED = descriptors &&
  2283. (!CORRECT_NEW || MISSED_STICKY || regexpUnsupportedDotAll || regexpUnsupportedNcg || fails(function () {
  2284. re2[MATCH] = false;
  2285. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  2286. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  2287. }));
  2288. var handleDotAll = function (string) {
  2289. var length = string.length;
  2290. var index = 0;
  2291. var result = '';
  2292. var brackets = false;
  2293. var chr;
  2294. for (; index <= length; index++) {
  2295. chr = charAt(string, index);
  2296. if (chr === '\\') {
  2297. result += chr + charAt(string, ++index);
  2298. continue;
  2299. }
  2300. if (!brackets && chr === '.') {
  2301. result += '[\\s\\S]';
  2302. } else {
  2303. if (chr === '[') {
  2304. brackets = true;
  2305. } else if (chr === ']') {
  2306. brackets = false;
  2307. } result += chr;
  2308. }
  2309. } return result;
  2310. };
  2311. var handleNCG = function (string) {
  2312. var length = string.length;
  2313. var index = 0;
  2314. var result = '';
  2315. var named = [];
  2316. var names = {};
  2317. var brackets = false;
  2318. var ncg = false;
  2319. var groupid = 0;
  2320. var groupname = '';
  2321. var chr;
  2322. for (; index <= length; index++) {
  2323. chr = charAt(string, index);
  2324. if (chr === '\\') {
  2325. chr = chr + charAt(string, ++index);
  2326. } else if (chr === ']') {
  2327. brackets = false;
  2328. } else if (!brackets) switch (true) {
  2329. case chr === '[':
  2330. brackets = true;
  2331. break;
  2332. case chr === '(':
  2333. if (exec(IS_NCG, stringSlice$1(string, index + 1))) {
  2334. index += 2;
  2335. ncg = true;
  2336. }
  2337. result += chr;
  2338. groupid++;
  2339. continue;
  2340. case chr === '>' && ncg:
  2341. if (groupname === '' || hasOwnProperty_1(names, groupname)) {
  2342. throw new SyntaxError('Invalid capture group name');
  2343. }
  2344. names[groupname] = true;
  2345. named[named.length] = [groupname, groupid];
  2346. ncg = false;
  2347. groupname = '';
  2348. continue;
  2349. }
  2350. if (ncg) groupname += chr;
  2351. else result += chr;
  2352. } return [result, named];
  2353. };
  2354. // `RegExp` constructor
  2355. // https://tc39.es/ecma262/#sec-regexp-constructor
  2356. if (isForced_1('RegExp', BASE_FORCED)) {
  2357. var RegExpWrapper = function RegExp(pattern, flags) {
  2358. var thisIsRegExp = objectIsPrototypeOf(RegExpPrototype$1, this);
  2359. var patternIsRegExp = isRegexp(pattern);
  2360. var flagsAreUndefined = flags === undefined;
  2361. var groups = [];
  2362. var rawPattern = pattern;
  2363. var rawFlags, dotAll, sticky, handled, result, state;
  2364. if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
  2365. return pattern;
  2366. }
  2367. if (patternIsRegExp || objectIsPrototypeOf(RegExpPrototype$1, pattern)) {
  2368. pattern = pattern.source;
  2369. if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags$1(rawPattern);
  2370. }
  2371. pattern = pattern === undefined ? '' : toString_1(pattern);
  2372. flags = flags === undefined ? '' : toString_1(flags);
  2373. rawPattern = pattern;
  2374. if (regexpUnsupportedDotAll && 'dotAll' in re1) {
  2375. dotAll = !!flags && stringIndexOf(flags, 's') > -1;
  2376. if (dotAll) flags = replace(flags, /s/g, '');
  2377. }
  2378. rawFlags = flags;
  2379. if (MISSED_STICKY && 'sticky' in re1) {
  2380. sticky = !!flags && stringIndexOf(flags, 'y') > -1;
  2381. if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');
  2382. }
  2383. if (regexpUnsupportedNcg) {
  2384. handled = handleNCG(pattern);
  2385. pattern = handled[0];
  2386. groups = handled[1];
  2387. }
  2388. result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype$1, RegExpWrapper);
  2389. if (dotAll || sticky || groups.length) {
  2390. state = enforceInternalState(result);
  2391. if (dotAll) {
  2392. state.dotAll = true;
  2393. state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
  2394. }
  2395. if (sticky) state.sticky = true;
  2396. if (groups.length) state.groups = groups;
  2397. }
  2398. if (pattern !== rawPattern) try {
  2399. // fails in old engines, but we have no alternatives for unsupported regex syntax
  2400. createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
  2401. } catch (error) { /* empty */ }
  2402. return result;
  2403. };
  2404. var proxy = function (key) {
  2405. key in RegExpWrapper || defineProperty$3(RegExpWrapper, key, {
  2406. configurable: true,
  2407. get: function () { return NativeRegExp[key]; },
  2408. set: function (it) { NativeRegExp[key] = it; }
  2409. });
  2410. };
  2411. for (var keys$1 = getOwnPropertyNames$1(NativeRegExp), index = 0; keys$1.length > index;) {
  2412. proxy(keys$1[index++]);
  2413. }
  2414. RegExpPrototype$1.constructor = RegExpWrapper;
  2415. RegExpWrapper.prototype = RegExpPrototype$1;
  2416. redefine(global_1, 'RegExp', RegExpWrapper);
  2417. }
  2418. // https://tc39.es/ecma262/#sec-get-regexp-@@species
  2419. setSpecies('RegExp');
  2420. var PROPER_FUNCTION_NAME$1 = functionName.PROPER;
  2421. var TO_STRING = 'toString';
  2422. var RegExpPrototype = RegExp.prototype;
  2423. var n$ToString = RegExpPrototype[TO_STRING];
  2424. var getFlags = functionUncurryThis(regexpFlags);
  2425. var NOT_GENERIC = fails(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  2426. // FF44- RegExp#toString has a wrong name
  2427. var INCORRECT_NAME = PROPER_FUNCTION_NAME$1 && n$ToString.name != TO_STRING;
  2428. // `RegExp.prototype.toString` method
  2429. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  2430. if (NOT_GENERIC || INCORRECT_NAME) {
  2431. redefine(RegExp.prototype, TO_STRING, function toString() {
  2432. var R = anObject(this);
  2433. var p = toString_1(R.source);
  2434. var rf = R.flags;
  2435. var f = toString_1(rf === undefined && objectIsPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf);
  2436. return '/' + p + '/' + f;
  2437. }, { unsafe: true });
  2438. }
  2439. var arraySlice$1 = functionUncurryThis([].slice);
  2440. var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('slice');
  2441. var SPECIES = wellKnownSymbol('species');
  2442. var Array$1 = global_1.Array;
  2443. var max$1 = Math.max;
  2444. // `Array.prototype.slice` method
  2445. // https://tc39.es/ecma262/#sec-array.prototype.slice
  2446. // fallback for not array-like ES3 strings and DOM objects
  2447. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
  2448. slice: function slice(start, end) {
  2449. var O = toIndexedObject(this);
  2450. var length = lengthOfArrayLike(O);
  2451. var k = toAbsoluteIndex(start, length);
  2452. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  2453. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  2454. var Constructor, result, n;
  2455. if (isArray(O)) {
  2456. Constructor = O.constructor;
  2457. // cross-realm fallback
  2458. if (isConstructor(Constructor) && (Constructor === Array$1 || isArray(Constructor.prototype))) {
  2459. Constructor = undefined;
  2460. } else if (isObject(Constructor)) {
  2461. Constructor = Constructor[SPECIES];
  2462. if (Constructor === null) Constructor = undefined;
  2463. }
  2464. if (Constructor === Array$1 || Constructor === undefined) {
  2465. return arraySlice$1(O, k, fin);
  2466. }
  2467. }
  2468. result = new (Constructor === undefined ? Array$1 : Constructor)(max$1(fin - k, 0));
  2469. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  2470. result.length = n;
  2471. return result;
  2472. }
  2473. });
  2474. var iterators = {};
  2475. var correctPrototypeGetter = !fails(function () {
  2476. function F() { /* empty */ }
  2477. F.prototype.constructor = null;
  2478. // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  2479. return Object.getPrototypeOf(new F()) !== F.prototype;
  2480. });
  2481. var IE_PROTO = sharedKey('IE_PROTO');
  2482. var Object$1 = global_1.Object;
  2483. var ObjectPrototype = Object$1.prototype;
  2484. // `Object.getPrototypeOf` method
  2485. // https://tc39.es/ecma262/#sec-object.getprototypeof
  2486. var objectGetPrototypeOf = correctPrototypeGetter ? Object$1.getPrototypeOf : function (O) {
  2487. var object = toObject(O);
  2488. if (hasOwnProperty_1(object, IE_PROTO)) return object[IE_PROTO];
  2489. var constructor = object.constructor;
  2490. if (isCallable(constructor) && object instanceof constructor) {
  2491. return constructor.prototype;
  2492. } return object instanceof Object$1 ? ObjectPrototype : null;
  2493. };
  2494. var ITERATOR$2 = wellKnownSymbol('iterator');
  2495. var BUGGY_SAFARI_ITERATORS$1 = false;
  2496. // `%IteratorPrototype%` object
  2497. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  2498. var IteratorPrototype$2, PrototypeOfArrayIteratorPrototype, arrayIterator;
  2499. /* eslint-disable es/no-array-prototype-keys -- safe */
  2500. if ([].keys) {
  2501. arrayIterator = [].keys();
  2502. // Safari 8 has buggy iterators w/o `next`
  2503. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS$1 = true;
  2504. else {
  2505. PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
  2506. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype$2 = PrototypeOfArrayIteratorPrototype;
  2507. }
  2508. }
  2509. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype$2 == undefined || fails(function () {
  2510. var test = {};
  2511. // FF44- legacy iterators case
  2512. return IteratorPrototype$2[ITERATOR$2].call(test) !== test;
  2513. });
  2514. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype$2 = {};
  2515. // `%IteratorPrototype%[@@iterator]()` method
  2516. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  2517. if (!isCallable(IteratorPrototype$2[ITERATOR$2])) {
  2518. redefine(IteratorPrototype$2, ITERATOR$2, function () {
  2519. return this;
  2520. });
  2521. }
  2522. var iteratorsCore = {
  2523. IteratorPrototype: IteratorPrototype$2,
  2524. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS$1
  2525. };
  2526. var defineProperty$2 = objectDefineProperty.f;
  2527. var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
  2528. var setToStringTag = function (target, TAG, STATIC) {
  2529. if (target && !STATIC) target = target.prototype;
  2530. if (target && !hasOwnProperty_1(target, TO_STRING_TAG$1)) {
  2531. defineProperty$2(target, TO_STRING_TAG$1, { configurable: true, value: TAG });
  2532. }
  2533. };
  2534. var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
  2535. var returnThis$1 = function () { return this; };
  2536. var createIteratorConstructor = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {
  2537. var TO_STRING_TAG = NAME + ' Iterator';
  2538. IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });
  2539. setToStringTag(IteratorConstructor, TO_STRING_TAG, false);
  2540. iterators[TO_STRING_TAG] = returnThis$1;
  2541. return IteratorConstructor;
  2542. };
  2543. var PROPER_FUNCTION_NAME = functionName.PROPER;
  2544. var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
  2545. var IteratorPrototype = iteratorsCore.IteratorPrototype;
  2546. var BUGGY_SAFARI_ITERATORS = iteratorsCore.BUGGY_SAFARI_ITERATORS;
  2547. var ITERATOR$1 = wellKnownSymbol('iterator');
  2548. var KEYS = 'keys';
  2549. var VALUES = 'values';
  2550. var ENTRIES = 'entries';
  2551. var returnThis = function () { return this; };
  2552. var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  2553. createIteratorConstructor(IteratorConstructor, NAME, next);
  2554. var getIterationMethod = function (KIND) {
  2555. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  2556. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  2557. switch (KIND) {
  2558. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  2559. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  2560. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  2561. } return function () { return new IteratorConstructor(this); };
  2562. };
  2563. var TO_STRING_TAG = NAME + ' Iterator';
  2564. var INCORRECT_VALUES_NAME = false;
  2565. var IterablePrototype = Iterable.prototype;
  2566. var nativeIterator = IterablePrototype[ITERATOR$1]
  2567. || IterablePrototype['@@iterator']
  2568. || DEFAULT && IterablePrototype[DEFAULT];
  2569. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  2570. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  2571. var CurrentIteratorPrototype, methods, KEY;
  2572. // fix native
  2573. if (anyNativeIterator) {
  2574. CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
  2575. if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  2576. if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  2577. if (objectSetPrototypeOf) {
  2578. objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  2579. } else if (!isCallable(CurrentIteratorPrototype[ITERATOR$1])) {
  2580. redefine(CurrentIteratorPrototype, ITERATOR$1, returnThis);
  2581. }
  2582. }
  2583. // Set @@toStringTag to native iterators
  2584. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true);
  2585. }
  2586. }
  2587. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  2588. if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  2589. if (CONFIGURABLE_FUNCTION_NAME) {
  2590. createNonEnumerableProperty(IterablePrototype, 'name', VALUES);
  2591. } else {
  2592. INCORRECT_VALUES_NAME = true;
  2593. defaultIterator = function values() { return functionCall(nativeIterator, this); };
  2594. }
  2595. }
  2596. // export additional methods
  2597. if (DEFAULT) {
  2598. methods = {
  2599. values: getIterationMethod(VALUES),
  2600. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  2601. entries: getIterationMethod(ENTRIES)
  2602. };
  2603. if (FORCED) for (KEY in methods) {
  2604. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  2605. redefine(IterablePrototype, KEY, methods[KEY]);
  2606. }
  2607. } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  2608. }
  2609. // define iterator
  2610. if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
  2611. redefine(IterablePrototype, ITERATOR$1, defaultIterator, { name: DEFAULT });
  2612. }
  2613. iterators[NAME] = defaultIterator;
  2614. return methods;
  2615. };
  2616. var defineProperty$1 = objectDefineProperty.f;
  2617. var ARRAY_ITERATOR = 'Array Iterator';
  2618. var setInternalState = internalState.set;
  2619. var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
  2620. // `Array.prototype.entries` method
  2621. // https://tc39.es/ecma262/#sec-array.prototype.entries
  2622. // `Array.prototype.keys` method
  2623. // https://tc39.es/ecma262/#sec-array.prototype.keys
  2624. // `Array.prototype.values` method
  2625. // https://tc39.es/ecma262/#sec-array.prototype.values
  2626. // `Array.prototype[@@iterator]` method
  2627. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  2628. // `CreateArrayIterator` internal method
  2629. // https://tc39.es/ecma262/#sec-createarrayiterator
  2630. var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
  2631. setInternalState(this, {
  2632. type: ARRAY_ITERATOR,
  2633. target: toIndexedObject(iterated), // target
  2634. index: 0, // next index
  2635. kind: kind // kind
  2636. });
  2637. // `%ArrayIteratorPrototype%.next` method
  2638. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  2639. }, function () {
  2640. var state = getInternalState(this);
  2641. var target = state.target;
  2642. var kind = state.kind;
  2643. var index = state.index++;
  2644. if (!target || index >= target.length) {
  2645. state.target = undefined;
  2646. return { value: undefined, done: true };
  2647. }
  2648. if (kind == 'keys') return { value: index, done: false };
  2649. if (kind == 'values') return { value: target[index], done: false };
  2650. return { value: [index, target[index]], done: false };
  2651. }, 'values');
  2652. // argumentsList[@@iterator] is %ArrayProto_values%
  2653. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  2654. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  2655. var values = iterators.Arguments = iterators.Array;
  2656. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  2657. addToUnscopables('keys');
  2658. addToUnscopables('values');
  2659. addToUnscopables('entries');
  2660. // V8 ~ Chrome 45- bug
  2661. if (descriptors && values.name !== 'values') try {
  2662. defineProperty$1(values, 'name', { value: 'values' });
  2663. } catch (error) { /* empty */ }
  2664. var ITERATOR = wellKnownSymbol('iterator');
  2665. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  2666. var ArrayValues = es_array_iterator.values;
  2667. var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) {
  2668. if (CollectionPrototype) {
  2669. // some Chrome versions have non-configurable methods on DOMTokenList
  2670. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  2671. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  2672. } catch (error) {
  2673. CollectionPrototype[ITERATOR] = ArrayValues;
  2674. }
  2675. if (!CollectionPrototype[TO_STRING_TAG]) {
  2676. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  2677. }
  2678. if (domIterables[COLLECTION_NAME]) for (var METHOD_NAME in es_array_iterator) {
  2679. // some Chrome versions have non-configurable methods on DOMTokenList
  2680. if (CollectionPrototype[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try {
  2681. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, es_array_iterator[METHOD_NAME]);
  2682. } catch (error) {
  2683. CollectionPrototype[METHOD_NAME] = es_array_iterator[METHOD_NAME];
  2684. }
  2685. }
  2686. }
  2687. };
  2688. for (var COLLECTION_NAME in domIterables) {
  2689. handlePrototype(global_1[COLLECTION_NAME] && global_1[COLLECTION_NAME].prototype, COLLECTION_NAME);
  2690. }
  2691. handlePrototype(domTokenListPrototype, 'DOMTokenList');
  2692. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  2693. var TypeError$2 = global_1.TypeError;
  2694. var max = Math.max;
  2695. var min$2 = Math.min;
  2696. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  2697. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  2698. // `Array.prototype.splice` method
  2699. // https://tc39.es/ecma262/#sec-array.prototype.splice
  2700. // with adding support of @@species
  2701. _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  2702. splice: function splice(start, deleteCount /* , ...items */) {
  2703. var O = toObject(this);
  2704. var len = lengthOfArrayLike(O);
  2705. var actualStart = toAbsoluteIndex(start, len);
  2706. var argumentsLength = arguments.length;
  2707. var insertCount, actualDeleteCount, A, k, from, to;
  2708. if (argumentsLength === 0) {
  2709. insertCount = actualDeleteCount = 0;
  2710. } else if (argumentsLength === 1) {
  2711. insertCount = 0;
  2712. actualDeleteCount = len - actualStart;
  2713. } else {
  2714. insertCount = argumentsLength - 2;
  2715. actualDeleteCount = min$2(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);
  2716. }
  2717. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  2718. throw TypeError$2(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  2719. }
  2720. A = arraySpeciesCreate(O, actualDeleteCount);
  2721. for (k = 0; k < actualDeleteCount; k++) {
  2722. from = actualStart + k;
  2723. if (from in O) createProperty(A, k, O[from]);
  2724. }
  2725. A.length = actualDeleteCount;
  2726. if (insertCount < actualDeleteCount) {
  2727. for (k = actualStart; k < len - actualDeleteCount; k++) {
  2728. from = k + actualDeleteCount;
  2729. to = k + insertCount;
  2730. if (from in O) O[to] = O[from];
  2731. else delete O[to];
  2732. }
  2733. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  2734. } else if (insertCount > actualDeleteCount) {
  2735. for (k = len - actualDeleteCount; k > actualStart; k--) {
  2736. from = k + actualDeleteCount - 1;
  2737. to = k + insertCount - 1;
  2738. if (from in O) O[to] = O[from];
  2739. else delete O[to];
  2740. }
  2741. }
  2742. for (k = 0; k < insertCount; k++) {
  2743. O[k + actualStart] = arguments[k + 2];
  2744. }
  2745. O.length = len - actualDeleteCount + insertCount;
  2746. return A;
  2747. }
  2748. });
  2749. // `thisNumberValue` abstract operation
  2750. // https://tc39.es/ecma262/#sec-thisnumbervalue
  2751. var thisNumberValue = functionUncurryThis(1.0.valueOf);
  2752. var getOwnPropertyNames = objectGetOwnPropertyNames.f;
  2753. var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
  2754. var defineProperty = objectDefineProperty.f;
  2755. var trim = stringTrim.trim;
  2756. var NUMBER = 'Number';
  2757. var NativeNumber = global_1[NUMBER];
  2758. var NumberPrototype = NativeNumber.prototype;
  2759. var TypeError$1 = global_1.TypeError;
  2760. var arraySlice = functionUncurryThis(''.slice);
  2761. var charCodeAt = functionUncurryThis(''.charCodeAt);
  2762. // `ToNumeric` abstract operation
  2763. // https://tc39.es/ecma262/#sec-tonumeric
  2764. var toNumeric = function (value) {
  2765. var primValue = toPrimitive(value, 'number');
  2766. return typeof primValue == 'bigint' ? primValue : toNumber(primValue);
  2767. };
  2768. // `ToNumber` abstract operation
  2769. // https://tc39.es/ecma262/#sec-tonumber
  2770. var toNumber = function (argument) {
  2771. var it = toPrimitive(argument, 'number');
  2772. var first, third, radix, maxCode, digits, length, index, code;
  2773. if (isSymbol(it)) throw TypeError$1('Cannot convert a Symbol value to a number');
  2774. if (typeof it == 'string' && it.length > 2) {
  2775. it = trim(it);
  2776. first = charCodeAt(it, 0);
  2777. if (first === 43 || first === 45) {
  2778. third = charCodeAt(it, 2);
  2779. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  2780. } else if (first === 48) {
  2781. switch (charCodeAt(it, 1)) {
  2782. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  2783. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  2784. default: return +it;
  2785. }
  2786. digits = arraySlice(it, 2);
  2787. length = digits.length;
  2788. for (index = 0; index < length; index++) {
  2789. code = charCodeAt(digits, index);
  2790. // parseInt parses a string to a first unavailable symbol
  2791. // but ToNumber should return NaN if a string contains unavailable symbols
  2792. if (code < 48 || code > maxCode) return NaN;
  2793. } return parseInt(digits, radix);
  2794. }
  2795. } return +it;
  2796. };
  2797. // `Number` constructor
  2798. // https://tc39.es/ecma262/#sec-number-constructor
  2799. if (isForced_1(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  2800. var NumberWrapper = function Number(value) {
  2801. var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value));
  2802. var dummy = this;
  2803. // check on 1..constructor(foo) case
  2804. return objectIsPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); })
  2805. ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n;
  2806. };
  2807. for (var keys = descriptors ? getOwnPropertyNames(NativeNumber) : (
  2808. // ES3:
  2809. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  2810. // ES2015 (in case, if modules with ES2015 Number statics required before):
  2811. 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' +
  2812. // ESNext
  2813. 'fromString,range'
  2814. ).split(','), j = 0, key; keys.length > j; j++) {
  2815. if (hasOwnProperty_1(NativeNumber, key = keys[j]) && !hasOwnProperty_1(NumberWrapper, key)) {
  2816. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor$2(NativeNumber, key));
  2817. }
  2818. }
  2819. NumberWrapper.prototype = NumberPrototype;
  2820. NumberPrototype.constructor = NumberWrapper;
  2821. redefine(global_1, NUMBER, NumberWrapper);
  2822. }
  2823. var un$Reverse = functionUncurryThis([].reverse);
  2824. var test = [1, 2];
  2825. // `Array.prototype.reverse` method
  2826. // https://tc39.es/ecma262/#sec-array.prototype.reverse
  2827. // fix for Safari 12.0 bug
  2828. // https://bugs.webkit.org/show_bug.cgi?id=188794
  2829. _export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
  2830. reverse: function reverse() {
  2831. // eslint-disable-next-line no-self-assign -- dirty hack
  2832. if (isArray(this)) this.length = this.length;
  2833. return un$Reverse(this);
  2834. }
  2835. });
  2836. var FAILS_ON_PRIMITIVES = fails(function () { objectKeys(1); });
  2837. // `Object.keys` method
  2838. // https://tc39.es/ecma262/#sec-object.keys
  2839. _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  2840. keys: function keys(it) {
  2841. return objectKeys(toObject(it));
  2842. }
  2843. });
  2844. // @@match logic
  2845. fixRegexpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
  2846. return [
  2847. // `String.prototype.match` method
  2848. // https://tc39.es/ecma262/#sec-string.prototype.match
  2849. function match(regexp) {
  2850. var O = requireObjectCoercible(this);
  2851. var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH);
  2852. return matcher ? functionCall(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString_1(O));
  2853. },
  2854. // `RegExp.prototype[@@match]` method
  2855. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  2856. function (string) {
  2857. var rx = anObject(this);
  2858. var S = toString_1(string);
  2859. var res = maybeCallNative(nativeMatch, rx, S);
  2860. if (res.done) return res.value;
  2861. if (!rx.global) return regexpExecAbstract(rx, S);
  2862. var fullUnicode = rx.unicode;
  2863. rx.lastIndex = 0;
  2864. var A = [];
  2865. var n = 0;
  2866. var result;
  2867. while ((result = regexpExecAbstract(rx, S)) !== null) {
  2868. var matchStr = toString_1(result[0]);
  2869. A[n] = matchStr;
  2870. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  2871. n++;
  2872. }
  2873. return n === 0 ? null : A;
  2874. }
  2875. ];
  2876. });
  2877. var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
  2878. // eslint-disable-next-line es/no-string-prototype-startswith -- safe
  2879. var un$StartsWith = functionUncurryThis(''.startsWith);
  2880. var stringSlice = functionUncurryThis(''.slice);
  2881. var min$1 = Math.min;
  2882. var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegexpLogic('startsWith');
  2883. // https://github.com/zloirock/core-js/pull/702
  2884. var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
  2885. var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'startsWith');
  2886. return descriptor && !descriptor.writable;
  2887. }();
  2888. // `String.prototype.startsWith` method
  2889. // https://tc39.es/ecma262/#sec-string.prototype.startswith
  2890. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
  2891. startsWith: function startsWith(searchString /* , position = 0 */) {
  2892. var that = toString_1(requireObjectCoercible(this));
  2893. notARegexp(searchString);
  2894. var index = toLength(min$1(arguments.length > 1 ? arguments[1] : undefined, that.length));
  2895. var search = toString_1(searchString);
  2896. return un$StartsWith
  2897. ? un$StartsWith(that, search, index)
  2898. : stringSlice(that, index, index + search.length) === search;
  2899. }
  2900. });
  2901. var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
  2902. // eslint-disable-next-line es/no-string-prototype-endswith -- safe
  2903. var un$EndsWith = functionUncurryThis(''.endsWith);
  2904. var slice = functionUncurryThis(''.slice);
  2905. var min = Math.min;
  2906. var CORRECT_IS_REGEXP_LOGIC = correctIsRegexpLogic('endsWith');
  2907. // https://github.com/zloirock/core-js/pull/702
  2908. var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
  2909. var descriptor = getOwnPropertyDescriptor(String.prototype, 'endsWith');
  2910. return descriptor && !descriptor.writable;
  2911. }();
  2912. // `String.prototype.endsWith` method
  2913. // https://tc39.es/ecma262/#sec-string.prototype.endswith
  2914. _export({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
  2915. endsWith: function endsWith(searchString /* , endPosition = @length */) {
  2916. var that = toString_1(requireObjectCoercible(this));
  2917. notARegexp(searchString);
  2918. var endPosition = arguments.length > 1 ? arguments[1] : undefined;
  2919. var len = that.length;
  2920. var end = endPosition === undefined ? len : min(toLength(endPosition), len);
  2921. var search = toString_1(searchString);
  2922. return un$EndsWith
  2923. ? un$EndsWith(that, search, end)
  2924. : slice(that, end - search.length, end) === search;
  2925. }
  2926. });
  2927. var Utils = {
  2928. getBootstrapVersion: function getBootstrapVersion() {
  2929. var bootstrapVersion = 5;
  2930. try {
  2931. var rawVersion = $__default["default"].fn.dropdown.Constructor.VERSION; // Only try to parse VERSION if it is defined.
  2932. // It is undefined in older versions of Bootstrap (tested with 3.1.1).
  2933. if (rawVersion !== undefined) {
  2934. bootstrapVersion = parseInt(rawVersion, 10);
  2935. }
  2936. } catch (e) {// ignore
  2937. }
  2938. try {
  2939. // eslint-disable-next-line no-undef
  2940. var _rawVersion = bootstrap.Tooltip.VERSION;
  2941. if (_rawVersion !== undefined) {
  2942. bootstrapVersion = parseInt(_rawVersion, 10);
  2943. }
  2944. } catch (e) {// ignore
  2945. }
  2946. return bootstrapVersion;
  2947. },
  2948. getIconsPrefix: function getIconsPrefix(theme) {
  2949. return {
  2950. bootstrap3: 'glyphicon',
  2951. bootstrap4: 'fa',
  2952. bootstrap5: 'bi',
  2953. 'bootstrap-table': 'icon',
  2954. bulma: 'fa',
  2955. foundation: 'fa',
  2956. materialize: 'material-icons',
  2957. semantic: 'fa'
  2958. }[theme] || 'fa';
  2959. },
  2960. getIcons: function getIcons(prefix) {
  2961. return {
  2962. glyphicon: {
  2963. paginationSwitchDown: 'glyphicon-collapse-down icon-chevron-down',
  2964. paginationSwitchUp: 'glyphicon-collapse-up icon-chevron-up',
  2965. refresh: 'glyphicon-refresh icon-refresh',
  2966. toggleOff: 'glyphicon-list-alt icon-list-alt',
  2967. toggleOn: 'glyphicon-list-alt icon-list-alt',
  2968. columns: 'glyphicon-th icon-th',
  2969. detailOpen: 'glyphicon-plus icon-plus',
  2970. detailClose: 'glyphicon-minus icon-minus',
  2971. fullscreen: 'glyphicon-fullscreen',
  2972. search: 'glyphicon-search',
  2973. clearSearch: 'glyphicon-trash'
  2974. },
  2975. fa: {
  2976. paginationSwitchDown: 'fa-caret-square-down',
  2977. paginationSwitchUp: 'fa-caret-square-up',
  2978. refresh: 'fa-sync',
  2979. toggleOff: 'fa-toggle-off',
  2980. toggleOn: 'fa-toggle-on',
  2981. columns: 'fa-th-list',
  2982. detailOpen: 'fa-plus',
  2983. detailClose: 'fa-minus',
  2984. fullscreen: 'fa-arrows-alt',
  2985. search: 'fa-search',
  2986. clearSearch: 'fa-trash'
  2987. },
  2988. bi: {
  2989. paginationSwitchDown: 'bi-caret-down-square',
  2990. paginationSwitchUp: 'bi-caret-up-square',
  2991. refresh: 'bi-arrow-clockwise',
  2992. toggleOff: 'bi-toggle-off',
  2993. toggleOn: 'bi-toggle-on',
  2994. columns: 'bi-list-ul',
  2995. detailOpen: 'bi-plus',
  2996. detailClose: 'bi-dash',
  2997. fullscreen: 'bi-arrows-move',
  2998. search: 'bi-search',
  2999. clearSearch: 'bi-trash'
  3000. },
  3001. icon: {
  3002. paginationSwitchDown: 'icon-arrow-up-circle',
  3003. paginationSwitchUp: 'icon-arrow-down-circle',
  3004. refresh: 'icon-refresh-cw',
  3005. toggleOff: 'icon-toggle-right',
  3006. toggleOn: 'icon-toggle-right',
  3007. columns: 'icon-list',
  3008. detailOpen: 'icon-plus',
  3009. detailClose: 'icon-minus',
  3010. fullscreen: 'icon-maximize',
  3011. search: 'icon-search',
  3012. clearSearch: 'icon-trash-2'
  3013. },
  3014. 'material-icons': {
  3015. paginationSwitchDown: 'grid_on',
  3016. paginationSwitchUp: 'grid_off',
  3017. refresh: 'refresh',
  3018. toggleOff: 'tablet',
  3019. toggleOn: 'tablet_android',
  3020. columns: 'view_list',
  3021. detailOpen: 'add',
  3022. detailClose: 'remove',
  3023. fullscreen: 'fullscreen',
  3024. sort: 'sort',
  3025. search: 'search',
  3026. clearSearch: 'delete'
  3027. }
  3028. }[prefix];
  3029. },
  3030. getSearchInput: function getSearchInput(that) {
  3031. if (typeof that.options.searchSelector === 'string') {
  3032. return $__default["default"](that.options.searchSelector);
  3033. }
  3034. return that.$toolbar.find('.search input');
  3035. },
  3036. // it only does '%s', and return '' when arguments are undefined
  3037. sprintf: function sprintf(_str) {
  3038. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3039. args[_key - 1] = arguments[_key];
  3040. }
  3041. var flag = true;
  3042. var i = 0;
  3043. var str = _str.replace(/%s/g, function () {
  3044. var arg = args[i++];
  3045. if (typeof arg === 'undefined') {
  3046. flag = false;
  3047. return '';
  3048. }
  3049. return arg;
  3050. });
  3051. return flag ? str : '';
  3052. },
  3053. isObject: function isObject(val) {
  3054. return val instanceof Object && !Array.isArray(val);
  3055. },
  3056. isEmptyObject: function isEmptyObject() {
  3057. var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  3058. return Object.entries(obj).length === 0 && obj.constructor === Object;
  3059. },
  3060. isNumeric: function isNumeric(n) {
  3061. return !isNaN(parseFloat(n)) && isFinite(n);
  3062. },
  3063. getFieldTitle: function getFieldTitle(list, value) {
  3064. var _iterator = _createForOfIteratorHelper(list),
  3065. _step;
  3066. try {
  3067. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  3068. var item = _step.value;
  3069. if (item.field === value) {
  3070. return item.title;
  3071. }
  3072. }
  3073. } catch (err) {
  3074. _iterator.e(err);
  3075. } finally {
  3076. _iterator.f();
  3077. }
  3078. return '';
  3079. },
  3080. setFieldIndex: function setFieldIndex(columns) {
  3081. var totalCol = 0;
  3082. var flag = [];
  3083. var _iterator2 = _createForOfIteratorHelper(columns[0]),
  3084. _step2;
  3085. try {
  3086. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  3087. var column = _step2.value;
  3088. totalCol += column.colspan || 1;
  3089. }
  3090. } catch (err) {
  3091. _iterator2.e(err);
  3092. } finally {
  3093. _iterator2.f();
  3094. }
  3095. for (var i = 0; i < columns.length; i++) {
  3096. flag[i] = [];
  3097. for (var j = 0; j < totalCol; j++) {
  3098. flag[i][j] = false;
  3099. }
  3100. }
  3101. for (var _i = 0; _i < columns.length; _i++) {
  3102. var _iterator3 = _createForOfIteratorHelper(columns[_i]),
  3103. _step3;
  3104. try {
  3105. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  3106. var r = _step3.value;
  3107. var rowspan = r.rowspan || 1;
  3108. var colspan = r.colspan || 1;
  3109. var index = flag[_i].indexOf(false);
  3110. r.colspanIndex = index;
  3111. if (colspan === 1) {
  3112. r.fieldIndex = index; // when field is undefined, use index instead
  3113. if (typeof r.field === 'undefined') {
  3114. r.field = index;
  3115. }
  3116. } else {
  3117. r.colspanGroup = r.colspan;
  3118. }
  3119. for (var _j = 0; _j < rowspan; _j++) {
  3120. for (var k = 0; k < colspan; k++) {
  3121. flag[_i + _j][index + k] = true;
  3122. }
  3123. }
  3124. }
  3125. } catch (err) {
  3126. _iterator3.e(err);
  3127. } finally {
  3128. _iterator3.f();
  3129. }
  3130. }
  3131. },
  3132. normalizeAccent: function normalizeAccent(value) {
  3133. if (typeof value !== 'string') {
  3134. return value;
  3135. }
  3136. return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
  3137. },
  3138. updateFieldGroup: function updateFieldGroup(columns) {
  3139. var _ref;
  3140. var allColumns = (_ref = []).concat.apply(_ref, _toConsumableArray(columns));
  3141. var _iterator4 = _createForOfIteratorHelper(columns),
  3142. _step4;
  3143. try {
  3144. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  3145. var c = _step4.value;
  3146. var _iterator5 = _createForOfIteratorHelper(c),
  3147. _step5;
  3148. try {
  3149. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  3150. var r = _step5.value;
  3151. if (r.colspanGroup > 1) {
  3152. var colspan = 0;
  3153. var _loop = function _loop(i) {
  3154. var column = allColumns.find(function (col) {
  3155. return col.fieldIndex === i;
  3156. });
  3157. if (column.visible) {
  3158. colspan++;
  3159. }
  3160. };
  3161. for (var i = r.colspanIndex; i < r.colspanIndex + r.colspanGroup; i++) {
  3162. _loop(i);
  3163. }
  3164. r.colspan = colspan;
  3165. r.visible = colspan > 0;
  3166. }
  3167. }
  3168. } catch (err) {
  3169. _iterator5.e(err);
  3170. } finally {
  3171. _iterator5.f();
  3172. }
  3173. }
  3174. } catch (err) {
  3175. _iterator4.e(err);
  3176. } finally {
  3177. _iterator4.f();
  3178. }
  3179. },
  3180. getScrollBarWidth: function getScrollBarWidth() {
  3181. if (this.cachedWidth === undefined) {
  3182. var $inner = $__default["default"]('<div/>').addClass('fixed-table-scroll-inner');
  3183. var $outer = $__default["default"]('<div/>').addClass('fixed-table-scroll-outer');
  3184. $outer.append($inner);
  3185. $__default["default"]('body').append($outer);
  3186. var w1 = $inner[0].offsetWidth;
  3187. $outer.css('overflow', 'scroll');
  3188. var w2 = $inner[0].offsetWidth;
  3189. if (w1 === w2) {
  3190. w2 = $outer[0].clientWidth;
  3191. }
  3192. $outer.remove();
  3193. this.cachedWidth = w1 - w2;
  3194. }
  3195. return this.cachedWidth;
  3196. },
  3197. calculateObjectValue: function calculateObjectValue(self, name, args, defaultValue) {
  3198. var func = name;
  3199. if (typeof name === 'string') {
  3200. // support obj.func1.func2
  3201. var names = name.split('.');
  3202. if (names.length > 1) {
  3203. func = window;
  3204. var _iterator6 = _createForOfIteratorHelper(names),
  3205. _step6;
  3206. try {
  3207. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  3208. var f = _step6.value;
  3209. func = func[f];
  3210. }
  3211. } catch (err) {
  3212. _iterator6.e(err);
  3213. } finally {
  3214. _iterator6.f();
  3215. }
  3216. } else {
  3217. func = window[name];
  3218. }
  3219. }
  3220. if (func !== null && _typeof(func) === 'object') {
  3221. return func;
  3222. }
  3223. if (typeof func === 'function') {
  3224. return func.apply(self, args || []);
  3225. }
  3226. if (!func && typeof name === 'string' && args && this.sprintf.apply(this, [name].concat(_toConsumableArray(args)))) {
  3227. return this.sprintf.apply(this, [name].concat(_toConsumableArray(args)));
  3228. }
  3229. return defaultValue;
  3230. },
  3231. compareObjects: function compareObjects(objectA, objectB, compareLength) {
  3232. var aKeys = Object.keys(objectA);
  3233. var bKeys = Object.keys(objectB);
  3234. if (compareLength && aKeys.length !== bKeys.length) {
  3235. return false;
  3236. }
  3237. for (var _i2 = 0, _aKeys = aKeys; _i2 < _aKeys.length; _i2++) {
  3238. var key = _aKeys[_i2];
  3239. if (bKeys.includes(key) && objectA[key] !== objectB[key]) {
  3240. return false;
  3241. }
  3242. }
  3243. return true;
  3244. },
  3245. regexCompare: function regexCompare(value, search) {
  3246. try {
  3247. var regexpParts = search.match(/^\/(.*?)\/([gim]*)$/);
  3248. if (value.toString().search(regexpParts ? new RegExp(regexpParts[1], regexpParts[2]) : new RegExp(search, 'gim')) !== -1) {
  3249. return true;
  3250. }
  3251. } catch (e) {
  3252. return false;
  3253. }
  3254. },
  3255. escapeHTML: function escapeHTML(text) {
  3256. if (!text) {
  3257. return text;
  3258. }
  3259. return text.toString().replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;');
  3260. },
  3261. unescapeHTML: function unescapeHTML(text) {
  3262. if (typeof text !== 'string' || !text) {
  3263. return text;
  3264. }
  3265. return text.toString().replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, '\'');
  3266. },
  3267. removeHTML: function removeHTML(text) {
  3268. if (!text) {
  3269. return text;
  3270. }
  3271. return text.toString().replace(/(<([^>]+)>)/ig, '').replace(/&[#A-Za-z0-9]+;/gi, '').trim();
  3272. },
  3273. getRealDataAttr: function getRealDataAttr(dataAttr) {
  3274. for (var _i3 = 0, _Object$entries = Object.entries(dataAttr); _i3 < _Object$entries.length; _i3++) {
  3275. var _Object$entries$_i = _slicedToArray(_Object$entries[_i3], 2),
  3276. attr = _Object$entries$_i[0],
  3277. value = _Object$entries$_i[1];
  3278. var auxAttr = attr.split(/(?=[A-Z])/).join('-').toLowerCase();
  3279. if (auxAttr !== attr) {
  3280. dataAttr[auxAttr] = value;
  3281. delete dataAttr[attr];
  3282. }
  3283. }
  3284. return dataAttr;
  3285. },
  3286. getItemField: function getItemField(item, field, escape) {
  3287. var columnEscape = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
  3288. var value = item; // use column escape if it is defined
  3289. if (typeof columnEscape !== 'undefined') {
  3290. escape = columnEscape;
  3291. }
  3292. if (typeof field !== 'string' || item.hasOwnProperty(field)) {
  3293. return escape ? this.escapeHTML(item[field]) : item[field];
  3294. }
  3295. var props = field.split('.');
  3296. var _iterator7 = _createForOfIteratorHelper(props),
  3297. _step7;
  3298. try {
  3299. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  3300. var p = _step7.value;
  3301. value = value && value[p];
  3302. }
  3303. } catch (err) {
  3304. _iterator7.e(err);
  3305. } finally {
  3306. _iterator7.f();
  3307. }
  3308. return escape ? this.escapeHTML(value) : value;
  3309. },
  3310. isIEBrowser: function isIEBrowser() {
  3311. return navigator.userAgent.includes('MSIE ') || /Trident.*rv:11\./.test(navigator.userAgent);
  3312. },
  3313. findIndex: function findIndex(items, item) {
  3314. var _iterator8 = _createForOfIteratorHelper(items),
  3315. _step8;
  3316. try {
  3317. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  3318. var it = _step8.value;
  3319. if (JSON.stringify(it) === JSON.stringify(item)) {
  3320. return items.indexOf(it);
  3321. }
  3322. }
  3323. } catch (err) {
  3324. _iterator8.e(err);
  3325. } finally {
  3326. _iterator8.f();
  3327. }
  3328. return -1;
  3329. },
  3330. trToData: function trToData(columns, $els) {
  3331. var _this = this;
  3332. var data = [];
  3333. var m = [];
  3334. $els.each(function (y, el) {
  3335. var $el = $__default["default"](el);
  3336. var row = {}; // save tr's id, class and data-* attributes
  3337. row._id = $el.attr('id');
  3338. row._class = $el.attr('class');
  3339. row._data = _this.getRealDataAttr($el.data());
  3340. row._style = $el.attr('style');
  3341. $el.find('>td,>th').each(function (_x, el) {
  3342. var $el = $__default["default"](el);
  3343. var cspan = +$el.attr('colspan') || 1;
  3344. var rspan = +$el.attr('rowspan') || 1;
  3345. var x = _x; // skip already occupied cells in current row
  3346. for (; m[y] && m[y][x]; x++) {// ignore
  3347. } // mark matrix elements occupied by current cell with true
  3348. for (var tx = x; tx < x + cspan; tx++) {
  3349. for (var ty = y; ty < y + rspan; ty++) {
  3350. if (!m[ty]) {
  3351. // fill missing rows
  3352. m[ty] = [];
  3353. }
  3354. m[ty][tx] = true;
  3355. }
  3356. }
  3357. var field = columns[x].field;
  3358. row[field] = $el.html().trim(); // save td's id, class and data-* attributes
  3359. row["_".concat(field, "_id")] = $el.attr('id');
  3360. row["_".concat(field, "_class")] = $el.attr('class');
  3361. row["_".concat(field, "_rowspan")] = $el.attr('rowspan');
  3362. row["_".concat(field, "_colspan")] = $el.attr('colspan');
  3363. row["_".concat(field, "_title")] = $el.attr('title');
  3364. row["_".concat(field, "_data")] = _this.getRealDataAttr($el.data());
  3365. row["_".concat(field, "_style")] = $el.attr('style');
  3366. });
  3367. data.push(row);
  3368. });
  3369. return data;
  3370. },
  3371. sort: function sort(a, b, order, sortStable, aPosition, bPosition) {
  3372. if (a === undefined || a === null) {
  3373. a = '';
  3374. }
  3375. if (b === undefined || b === null) {
  3376. b = '';
  3377. }
  3378. if (sortStable && a === b) {
  3379. a = aPosition;
  3380. b = bPosition;
  3381. } // If both values are numeric, do a numeric comparison
  3382. if (this.isNumeric(a) && this.isNumeric(b)) {
  3383. // Convert numerical values form string to float.
  3384. a = parseFloat(a);
  3385. b = parseFloat(b);
  3386. if (a < b) {
  3387. return order * -1;
  3388. }
  3389. if (a > b) {
  3390. return order;
  3391. }
  3392. return 0;
  3393. }
  3394. if (a === b) {
  3395. return 0;
  3396. } // If value is not a string, convert to string
  3397. if (typeof a !== 'string') {
  3398. a = a.toString();
  3399. }
  3400. if (a.localeCompare(b) === -1) {
  3401. return order * -1;
  3402. }
  3403. return order;
  3404. },
  3405. getEventName: function getEventName(eventPrefix) {
  3406. var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  3407. id = id || "".concat(+new Date()).concat(~~(Math.random() * 1000000));
  3408. return "".concat(eventPrefix, "-").concat(id);
  3409. },
  3410. hasDetailViewIcon: function hasDetailViewIcon(options) {
  3411. return options.detailView && options.detailViewIcon && !options.cardView;
  3412. },
  3413. getDetailViewIndexOffset: function getDetailViewIndexOffset(options) {
  3414. return this.hasDetailViewIcon(options) && options.detailViewAlign !== 'right' ? 1 : 0;
  3415. },
  3416. checkAutoMergeCells: function checkAutoMergeCells(data) {
  3417. var _iterator9 = _createForOfIteratorHelper(data),
  3418. _step9;
  3419. try {
  3420. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  3421. var row = _step9.value;
  3422. for (var _i4 = 0, _Object$keys = Object.keys(row); _i4 < _Object$keys.length; _i4++) {
  3423. var key = _Object$keys[_i4];
  3424. if (key.startsWith('_') && (key.endsWith('_rowspan') || key.endsWith('_colspan'))) {
  3425. return true;
  3426. }
  3427. }
  3428. }
  3429. } catch (err) {
  3430. _iterator9.e(err);
  3431. } finally {
  3432. _iterator9.f();
  3433. }
  3434. return false;
  3435. },
  3436. deepCopy: function deepCopy(arg) {
  3437. if (arg === undefined) {
  3438. return arg;
  3439. }
  3440. return $__default["default"].extend(true, Array.isArray(arg) ? [] : {}, arg);
  3441. },
  3442. debounce: function debounce(func, wait, immediate) {
  3443. var timeout;
  3444. return function executedFunction() {
  3445. var context = this;
  3446. var args = arguments;
  3447. var later = function later() {
  3448. timeout = null;
  3449. if (!immediate) func.apply(context, args);
  3450. };
  3451. var callNow = immediate && !timeout;
  3452. clearTimeout(timeout);
  3453. timeout = setTimeout(later, wait);
  3454. if (callNow) func.apply(context, args);
  3455. };
  3456. }
  3457. };
  3458. var VERSION = '1.20.0';
  3459. var bootstrapVersion = Utils.getBootstrapVersion();
  3460. var CONSTANTS = {
  3461. 3: {
  3462. classes: {
  3463. buttonsPrefix: 'btn',
  3464. buttons: 'default',
  3465. buttonsGroup: 'btn-group',
  3466. buttonsDropdown: 'btn-group',
  3467. pull: 'pull',
  3468. inputGroup: 'input-group',
  3469. inputPrefix: 'input-',
  3470. input: 'form-control',
  3471. select: 'form-control',
  3472. paginationDropdown: 'btn-group dropdown',
  3473. dropup: 'dropup',
  3474. dropdownActive: 'active',
  3475. paginationActive: 'active',
  3476. buttonActive: 'active'
  3477. },
  3478. html: {
  3479. toolbarDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  3480. toolbarDropdownItem: '<li class="dropdown-item-marker" role="menuitem"><label>%s</label></li>',
  3481. toolbarDropdownSeparator: '<li class="divider"></li>',
  3482. pageDropdown: ['<ul class="dropdown-menu" role="menu">', '</ul>'],
  3483. pageDropdownItem: '<li role="menuitem" class="%s"><a href="#">%s</a></li>',
  3484. dropdownCaret: '<span class="caret"></span>',
  3485. pagination: ['<ul class="pagination%s">', '</ul>'],
  3486. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3487. icon: '<i class="%s %s"></i>',
  3488. inputGroup: '<div class="input-group">%s<span class="input-group-btn">%s</span></div>',
  3489. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3490. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3491. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3492. }
  3493. },
  3494. 4: {
  3495. classes: {
  3496. buttonsPrefix: 'btn',
  3497. buttons: 'secondary',
  3498. buttonsGroup: 'btn-group',
  3499. buttonsDropdown: 'btn-group',
  3500. pull: 'float',
  3501. inputGroup: 'btn-group',
  3502. inputPrefix: 'form-control-',
  3503. input: 'form-control',
  3504. select: 'form-control',
  3505. paginationDropdown: 'btn-group dropdown',
  3506. dropup: 'dropup',
  3507. dropdownActive: 'active',
  3508. paginationActive: 'active',
  3509. buttonActive: 'active'
  3510. },
  3511. html: {
  3512. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  3513. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  3514. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  3515. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  3516. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  3517. dropdownCaret: '<span class="caret"></span>',
  3518. pagination: ['<ul class="pagination%s">', '</ul>'],
  3519. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3520. icon: '<i class="%s %s"></i>',
  3521. inputGroup: '<div class="input-group">%s<div class="input-group-append">%s</div></div>',
  3522. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3523. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3524. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3525. }
  3526. },
  3527. 5: {
  3528. classes: {
  3529. buttonsPrefix: 'btn',
  3530. buttons: 'secondary',
  3531. buttonsGroup: 'btn-group',
  3532. buttonsDropdown: 'btn-group',
  3533. pull: 'float',
  3534. inputGroup: 'btn-group',
  3535. inputPrefix: 'form-control-',
  3536. input: 'form-control',
  3537. select: 'form-select',
  3538. paginationDropdown: 'btn-group dropdown',
  3539. dropup: 'dropup',
  3540. dropdownActive: 'active',
  3541. paginationActive: 'active',
  3542. buttonActive: 'active'
  3543. },
  3544. html: {
  3545. dataToggle: 'data-bs-toggle',
  3546. toolbarDropdown: ['<div class="dropdown-menu dropdown-menu-right">', '</div>'],
  3547. toolbarDropdownItem: '<label class="dropdown-item dropdown-item-marker">%s</label>',
  3548. pageDropdown: ['<div class="dropdown-menu">', '</div>'],
  3549. pageDropdownItem: '<a class="dropdown-item %s" href="#">%s</a>',
  3550. toolbarDropdownSeparator: '<div class="dropdown-divider"></div>',
  3551. dropdownCaret: '<span class="caret"></span>',
  3552. pagination: ['<ul class="pagination%s">', '</ul>'],
  3553. paginationItem: '<li class="page-item%s"><a class="page-link" aria-label="%s" href="javascript:void(0)">%s</a></li>',
  3554. icon: '<i class="%s %s"></i>',
  3555. inputGroup: '<div class="input-group">%s%s</div>',
  3556. searchInput: '<input class="%s%s" type="text" placeholder="%s">',
  3557. searchButton: '<button class="%s" type="button" name="search" title="%s">%s %s</button>',
  3558. searchClearButton: '<button class="%s" type="button" name="clearSearch" title="%s">%s %s</button>'
  3559. }
  3560. }
  3561. }[bootstrapVersion];
  3562. var DEFAULTS = {
  3563. height: undefined,
  3564. classes: 'table table-bordered table-hover',
  3565. buttons: {},
  3566. theadClasses: '',
  3567. headerStyle: function headerStyle(column) {
  3568. return {};
  3569. },
  3570. rowStyle: function rowStyle(row, index) {
  3571. return {};
  3572. },
  3573. rowAttributes: function rowAttributes(row, index) {
  3574. return {};
  3575. },
  3576. undefinedText: '-',
  3577. locale: undefined,
  3578. virtualScroll: false,
  3579. virtualScrollItemHeight: undefined,
  3580. sortable: true,
  3581. sortClass: undefined,
  3582. silentSort: true,
  3583. sortName: undefined,
  3584. sortOrder: undefined,
  3585. sortReset: false,
  3586. sortStable: false,
  3587. rememberOrder: false,
  3588. serverSort: true,
  3589. customSort: undefined,
  3590. columns: [[]],
  3591. data: [],
  3592. url: undefined,
  3593. method: 'get',
  3594. cache: true,
  3595. contentType: 'application/json',
  3596. dataType: 'json',
  3597. ajax: undefined,
  3598. ajaxOptions: {},
  3599. queryParams: function queryParams(params) {
  3600. return params;
  3601. },
  3602. queryParamsType: 'limit',
  3603. // 'limit', undefined
  3604. responseHandler: function responseHandler(res) {
  3605. return res;
  3606. },
  3607. totalField: 'total',
  3608. totalNotFilteredField: 'totalNotFiltered',
  3609. dataField: 'rows',
  3610. footerField: 'footer',
  3611. pagination: false,
  3612. paginationParts: ['pageInfo', 'pageSize', 'pageList'],
  3613. showExtendedPagination: false,
  3614. paginationLoop: true,
  3615. sidePagination: 'client',
  3616. // client or server
  3617. totalRows: 0,
  3618. totalNotFiltered: 0,
  3619. pageNumber: 1,
  3620. pageSize: 10,
  3621. pageList: [10, 25, 50, 100],
  3622. paginationHAlign: 'right',
  3623. // right, left
  3624. paginationVAlign: 'bottom',
  3625. // bottom, top, both
  3626. paginationDetailHAlign: 'left',
  3627. // right, left
  3628. paginationPreText: '&lsaquo;',
  3629. paginationNextText: '&rsaquo;',
  3630. paginationSuccessivelySize: 5,
  3631. // Maximum successively number of pages in a row
  3632. paginationPagesBySide: 1,
  3633. // Number of pages on each side (right, left) of the current page.
  3634. paginationUseIntermediate: false,
  3635. // Calculate intermediate pages for quick access
  3636. search: false,
  3637. searchHighlight: false,
  3638. searchOnEnterKey: false,
  3639. strictSearch: false,
  3640. regexSearch: false,
  3641. searchSelector: false,
  3642. visibleSearch: false,
  3643. showButtonIcons: true,
  3644. showButtonText: false,
  3645. showSearchButton: false,
  3646. showSearchClearButton: false,
  3647. trimOnSearch: true,
  3648. searchAlign: 'right',
  3649. searchTimeOut: 500,
  3650. searchText: '',
  3651. customSearch: undefined,
  3652. showHeader: true,
  3653. showFooter: false,
  3654. footerStyle: function footerStyle(column) {
  3655. return {};
  3656. },
  3657. searchAccentNeutralise: false,
  3658. showColumns: false,
  3659. showColumnsToggleAll: false,
  3660. showColumnsSearch: false,
  3661. minimumCountColumns: 1,
  3662. showPaginationSwitch: false,
  3663. showRefresh: false,
  3664. showToggle: false,
  3665. showFullscreen: false,
  3666. smartDisplay: true,
  3667. escape: false,
  3668. filterOptions: {
  3669. filterAlgorithm: 'and'
  3670. },
  3671. idField: undefined,
  3672. selectItemName: 'btSelectItem',
  3673. clickToSelect: false,
  3674. ignoreClickToSelectOn: function ignoreClickToSelectOn(_ref) {
  3675. var tagName = _ref.tagName;
  3676. return ['A', 'BUTTON'].includes(tagName);
  3677. },
  3678. singleSelect: false,
  3679. checkboxHeader: true,
  3680. maintainMetaData: false,
  3681. multipleSelectRow: false,
  3682. uniqueId: undefined,
  3683. cardView: false,
  3684. detailView: false,
  3685. detailViewIcon: true,
  3686. detailViewByClick: false,
  3687. detailViewAlign: 'left',
  3688. detailFormatter: function detailFormatter(index, row) {
  3689. return '';
  3690. },
  3691. detailFilter: function detailFilter(index, row) {
  3692. return true;
  3693. },
  3694. toolbar: undefined,
  3695. toolbarAlign: 'left',
  3696. buttonsToolbar: undefined,
  3697. buttonsAlign: 'right',
  3698. buttonsOrder: ['paginationSwitch', 'refresh', 'toggle', 'fullscreen', 'columns'],
  3699. buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
  3700. buttonsClass: CONSTANTS.classes.buttons,
  3701. iconsPrefix: undefined,
  3702. // init in initConstants
  3703. icons: {},
  3704. // init in initConstants
  3705. iconSize: undefined,
  3706. loadingFontSize: 'auto',
  3707. loadingTemplate: function loadingTemplate(loadingMessage) {
  3708. return "<span class=\"loading-wrap\">\n <span class=\"loading-text\">".concat(loadingMessage, "</span>\n <span class=\"animation-wrap\"><span class=\"animation-dot\"></span></span>\n </span>\n ");
  3709. },
  3710. onAll: function onAll(name, args) {
  3711. return false;
  3712. },
  3713. onClickCell: function onClickCell(field, value, row, $element) {
  3714. return false;
  3715. },
  3716. onDblClickCell: function onDblClickCell(field, value, row, $element) {
  3717. return false;
  3718. },
  3719. onClickRow: function onClickRow(item, $element) {
  3720. return false;
  3721. },
  3722. onDblClickRow: function onDblClickRow(item, $element) {
  3723. return false;
  3724. },
  3725. onSort: function onSort(name, order) {
  3726. return false;
  3727. },
  3728. onCheck: function onCheck(row) {
  3729. return false;
  3730. },
  3731. onUncheck: function onUncheck(row) {
  3732. return false;
  3733. },
  3734. onCheckAll: function onCheckAll(rows) {
  3735. return false;
  3736. },
  3737. onUncheckAll: function onUncheckAll(rows) {
  3738. return false;
  3739. },
  3740. onCheckSome: function onCheckSome(rows) {
  3741. return false;
  3742. },
  3743. onUncheckSome: function onUncheckSome(rows) {
  3744. return false;
  3745. },
  3746. onLoadSuccess: function onLoadSuccess(data) {
  3747. return false;
  3748. },
  3749. onLoadError: function onLoadError(status) {
  3750. return false;
  3751. },
  3752. onColumnSwitch: function onColumnSwitch(field, checked) {
  3753. return false;
  3754. },
  3755. onColumnSwitchAll: function onColumnSwitchAll(checked) {
  3756. return false;
  3757. },
  3758. onPageChange: function onPageChange(number, size) {
  3759. return false;
  3760. },
  3761. onSearch: function onSearch(text) {
  3762. return false;
  3763. },
  3764. onToggle: function onToggle(cardView) {
  3765. return false;
  3766. },
  3767. onPreBody: function onPreBody(data) {
  3768. return false;
  3769. },
  3770. onPostBody: function onPostBody() {
  3771. return false;
  3772. },
  3773. onPostHeader: function onPostHeader() {
  3774. return false;
  3775. },
  3776. onPostFooter: function onPostFooter() {
  3777. return false;
  3778. },
  3779. onExpandRow: function onExpandRow(index, row, $detail) {
  3780. return false;
  3781. },
  3782. onCollapseRow: function onCollapseRow(index, row) {
  3783. return false;
  3784. },
  3785. onRefreshOptions: function onRefreshOptions(options) {
  3786. return false;
  3787. },
  3788. onRefresh: function onRefresh(params) {
  3789. return false;
  3790. },
  3791. onResetView: function onResetView() {
  3792. return false;
  3793. },
  3794. onScrollBody: function onScrollBody() {
  3795. return false;
  3796. },
  3797. onTogglePagination: function onTogglePagination(newState) {
  3798. return false;
  3799. },
  3800. onVirtualScroll: function onVirtualScroll(startIndex, endIndex) {
  3801. return false;
  3802. }
  3803. };
  3804. var EN = {
  3805. formatLoadingMessage: function formatLoadingMessage() {
  3806. return 'Loading, please wait';
  3807. },
  3808. formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
  3809. return "".concat(pageNumber, " rows per page");
  3810. },
  3811. formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows, totalNotFiltered) {
  3812. if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
  3813. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows (filtered from ").concat(totalNotFiltered, " total rows)");
  3814. }
  3815. return "Showing ".concat(pageFrom, " to ").concat(pageTo, " of ").concat(totalRows, " rows");
  3816. },
  3817. formatSRPaginationPreText: function formatSRPaginationPreText() {
  3818. return 'previous page';
  3819. },
  3820. formatSRPaginationPageText: function formatSRPaginationPageText(page) {
  3821. return "to page ".concat(page);
  3822. },
  3823. formatSRPaginationNextText: function formatSRPaginationNextText() {
  3824. return 'next page';
  3825. },
  3826. formatDetailPagination: function formatDetailPagination(totalRows) {
  3827. return "Showing ".concat(totalRows, " rows");
  3828. },
  3829. formatSearch: function formatSearch() {
  3830. return 'Search';
  3831. },
  3832. formatClearSearch: function formatClearSearch() {
  3833. return 'Clear Search';
  3834. },
  3835. formatNoMatches: function formatNoMatches() {
  3836. return 'No matching records found';
  3837. },
  3838. formatPaginationSwitch: function formatPaginationSwitch() {
  3839. return 'Hide/Show pagination';
  3840. },
  3841. formatPaginationSwitchDown: function formatPaginationSwitchDown() {
  3842. return 'Show pagination';
  3843. },
  3844. formatPaginationSwitchUp: function formatPaginationSwitchUp() {
  3845. return 'Hide pagination';
  3846. },
  3847. formatRefresh: function formatRefresh() {
  3848. return 'Refresh';
  3849. },
  3850. formatToggle: function formatToggle() {
  3851. return 'Toggle';
  3852. },
  3853. formatToggleOn: function formatToggleOn() {
  3854. return 'Show card view';
  3855. },
  3856. formatToggleOff: function formatToggleOff() {
  3857. return 'Hide card view';
  3858. },
  3859. formatColumns: function formatColumns() {
  3860. return 'Columns';
  3861. },
  3862. formatColumnsToggleAll: function formatColumnsToggleAll() {
  3863. return 'Toggle all';
  3864. },
  3865. formatFullscreen: function formatFullscreen() {
  3866. return 'Fullscreen';
  3867. },
  3868. formatAllRows: function formatAllRows() {
  3869. return 'All';
  3870. }
  3871. };
  3872. var COLUMN_DEFAULTS = {
  3873. field: undefined,
  3874. title: undefined,
  3875. titleTooltip: undefined,
  3876. class: undefined,
  3877. width: undefined,
  3878. widthUnit: 'px',
  3879. rowspan: undefined,
  3880. colspan: undefined,
  3881. align: undefined,
  3882. // left, right, center
  3883. halign: undefined,
  3884. // left, right, center
  3885. falign: undefined,
  3886. // left, right, center
  3887. valign: undefined,
  3888. // top, middle, bottom
  3889. cellStyle: undefined,
  3890. radio: false,
  3891. checkbox: false,
  3892. checkboxEnabled: true,
  3893. clickToSelect: true,
  3894. showSelectTitle: false,
  3895. sortable: false,
  3896. sortName: undefined,
  3897. order: 'asc',
  3898. // asc, desc
  3899. sorter: undefined,
  3900. visible: true,
  3901. switchable: true,
  3902. cardVisible: true,
  3903. searchable: true,
  3904. formatter: undefined,
  3905. footerFormatter: undefined,
  3906. detailFormatter: undefined,
  3907. searchFormatter: true,
  3908. searchHighlightFormatter: false,
  3909. escape: undefined,
  3910. events: undefined
  3911. };
  3912. var METHODS = ['getOptions', 'refreshOptions', 'getData', 'getSelections', 'load', 'append', 'prepend', 'remove', 'removeAll', 'insertRow', 'updateRow', 'getRowByUniqueId', 'updateByUniqueId', 'removeByUniqueId', 'updateCell', 'updateCellByUniqueId', 'showRow', 'hideRow', 'getHiddenRows', 'showColumn', 'hideColumn', 'getVisibleColumns', 'getHiddenColumns', 'showAllColumns', 'hideAllColumns', 'mergeCells', 'checkAll', 'uncheckAll', 'checkInvert', 'check', 'uncheck', 'checkBy', 'uncheckBy', 'refresh', 'destroy', 'resetView', 'showLoading', 'hideLoading', 'togglePagination', 'toggleFullscreen', 'toggleView', 'resetSearch', 'filterBy', 'scrollTo', 'getScrollPosition', 'selectPage', 'prevPage', 'nextPage', 'toggleDetailView', 'expandRow', 'collapseRow', 'expandRowByUniqueId', 'collapseRowByUniqueId', 'expandAllRows', 'collapseAllRows', 'updateColumnTitle', 'updateFormatText'];
  3913. var EVENTS = {
  3914. 'all.bs.table': 'onAll',
  3915. 'click-row.bs.table': 'onClickRow',
  3916. 'dbl-click-row.bs.table': 'onDblClickRow',
  3917. 'click-cell.bs.table': 'onClickCell',
  3918. 'dbl-click-cell.bs.table': 'onDblClickCell',
  3919. 'sort.bs.table': 'onSort',
  3920. 'check.bs.table': 'onCheck',
  3921. 'uncheck.bs.table': 'onUncheck',
  3922. 'check-all.bs.table': 'onCheckAll',
  3923. 'uncheck-all.bs.table': 'onUncheckAll',
  3924. 'check-some.bs.table': 'onCheckSome',
  3925. 'uncheck-some.bs.table': 'onUncheckSome',
  3926. 'load-success.bs.table': 'onLoadSuccess',
  3927. 'load-error.bs.table': 'onLoadError',
  3928. 'column-switch.bs.table': 'onColumnSwitch',
  3929. 'column-switch-all.bs.table': 'onColumnSwitchAll',
  3930. 'page-change.bs.table': 'onPageChange',
  3931. 'search.bs.table': 'onSearch',
  3932. 'toggle.bs.table': 'onToggle',
  3933. 'pre-body.bs.table': 'onPreBody',
  3934. 'post-body.bs.table': 'onPostBody',
  3935. 'post-header.bs.table': 'onPostHeader',
  3936. 'post-footer.bs.table': 'onPostFooter',
  3937. 'expand-row.bs.table': 'onExpandRow',
  3938. 'collapse-row.bs.table': 'onCollapseRow',
  3939. 'refresh-options.bs.table': 'onRefreshOptions',
  3940. 'reset-view.bs.table': 'onResetView',
  3941. 'refresh.bs.table': 'onRefresh',
  3942. 'scroll-body.bs.table': 'onScrollBody',
  3943. 'toggle-pagination.bs.table': 'onTogglePagination',
  3944. 'virtual-scroll.bs.table': 'onVirtualScroll'
  3945. };
  3946. Object.assign(DEFAULTS, EN);
  3947. var Constants = {
  3948. VERSION: VERSION,
  3949. THEME: "bootstrap".concat(bootstrapVersion),
  3950. CONSTANTS: CONSTANTS,
  3951. DEFAULTS: DEFAULTS,
  3952. COLUMN_DEFAULTS: COLUMN_DEFAULTS,
  3953. METHODS: METHODS,
  3954. EVENTS: EVENTS,
  3955. LOCALES: {
  3956. en: EN,
  3957. 'en-US': EN
  3958. }
  3959. };
  3960. var BLOCK_ROWS = 50;
  3961. var CLUSTER_BLOCKS = 4;
  3962. var VirtualScroll = /*#__PURE__*/function () {
  3963. function VirtualScroll(options) {
  3964. var _this = this;
  3965. _classCallCheck(this, VirtualScroll);
  3966. this.rows = options.rows;
  3967. this.scrollEl = options.scrollEl;
  3968. this.contentEl = options.contentEl;
  3969. this.callback = options.callback;
  3970. this.itemHeight = options.itemHeight;
  3971. this.cache = {};
  3972. this.scrollTop = this.scrollEl.scrollTop;
  3973. this.initDOM(this.rows, options.fixedScroll);
  3974. this.scrollEl.scrollTop = this.scrollTop;
  3975. this.lastCluster = 0;
  3976. var onScroll = function onScroll() {
  3977. if (_this.lastCluster !== (_this.lastCluster = _this.getNum())) {
  3978. _this.initDOM(_this.rows);
  3979. _this.callback(_this.startIndex, _this.endIndex);
  3980. }
  3981. };
  3982. this.scrollEl.addEventListener('scroll', onScroll, false);
  3983. this.destroy = function () {
  3984. _this.contentEl.innerHtml = '';
  3985. _this.scrollEl.removeEventListener('scroll', onScroll, false);
  3986. };
  3987. }
  3988. _createClass(VirtualScroll, [{
  3989. key: "initDOM",
  3990. value: function initDOM(rows, fixedScroll) {
  3991. if (typeof this.clusterHeight === 'undefined') {
  3992. this.cache.scrollTop = this.scrollEl.scrollTop;
  3993. this.cache.data = this.contentEl.innerHTML = rows[0] + rows[0] + rows[0];
  3994. this.getRowsHeight(rows);
  3995. }
  3996. var data = this.initData(rows, this.getNum(fixedScroll));
  3997. var thisRows = data.rows.join('');
  3998. var dataChanged = this.checkChanges('data', thisRows);
  3999. var topOffsetChanged = this.checkChanges('top', data.topOffset);
  4000. var bottomOffsetChanged = this.checkChanges('bottom', data.bottomOffset);
  4001. var html = [];
  4002. if (dataChanged && topOffsetChanged) {
  4003. if (data.topOffset) {
  4004. html.push(this.getExtra('top', data.topOffset));
  4005. }
  4006. html.push(thisRows);
  4007. if (data.bottomOffset) {
  4008. html.push(this.getExtra('bottom', data.bottomOffset));
  4009. }
  4010. this.startIndex = data.start;
  4011. this.endIndex = data.end;
  4012. this.contentEl.innerHTML = html.join('');
  4013. if (fixedScroll) {
  4014. this.contentEl.scrollTop = this.cache.scrollTop;
  4015. }
  4016. } else if (bottomOffsetChanged) {
  4017. this.contentEl.lastChild.style.height = "".concat(data.bottomOffset, "px");
  4018. }
  4019. }
  4020. }, {
  4021. key: "getRowsHeight",
  4022. value: function getRowsHeight() {
  4023. if (typeof this.itemHeight === 'undefined') {
  4024. var nodes = this.contentEl.children;
  4025. var node = nodes[Math.floor(nodes.length / 2)];
  4026. this.itemHeight = node.offsetHeight;
  4027. }
  4028. this.blockHeight = this.itemHeight * BLOCK_ROWS;
  4029. this.clusterRows = BLOCK_ROWS * CLUSTER_BLOCKS;
  4030. this.clusterHeight = this.blockHeight * CLUSTER_BLOCKS;
  4031. }
  4032. }, {
  4033. key: "getNum",
  4034. value: function getNum(fixedScroll) {
  4035. this.scrollTop = fixedScroll ? this.cache.scrollTop : this.scrollEl.scrollTop;
  4036. return Math.floor(this.scrollTop / (this.clusterHeight - this.blockHeight)) || 0;
  4037. }
  4038. }, {
  4039. key: "initData",
  4040. value: function initData(rows, num) {
  4041. if (rows.length < BLOCK_ROWS) {
  4042. return {
  4043. topOffset: 0,
  4044. bottomOffset: 0,
  4045. rowsAbove: 0,
  4046. rows: rows
  4047. };
  4048. }
  4049. var start = Math.max((this.clusterRows - BLOCK_ROWS) * num, 0);
  4050. var end = start + this.clusterRows;
  4051. var topOffset = Math.max(start * this.itemHeight, 0);
  4052. var bottomOffset = Math.max((rows.length - end) * this.itemHeight, 0);
  4053. var thisRows = [];
  4054. var rowsAbove = start;
  4055. if (topOffset < 1) {
  4056. rowsAbove++;
  4057. }
  4058. for (var i = start; i < end; i++) {
  4059. rows[i] && thisRows.push(rows[i]);
  4060. }
  4061. return {
  4062. start: start,
  4063. end: end,
  4064. topOffset: topOffset,
  4065. bottomOffset: bottomOffset,
  4066. rowsAbove: rowsAbove,
  4067. rows: thisRows
  4068. };
  4069. }
  4070. }, {
  4071. key: "checkChanges",
  4072. value: function checkChanges(type, value) {
  4073. var changed = value !== this.cache[type];
  4074. this.cache[type] = value;
  4075. return changed;
  4076. }
  4077. }, {
  4078. key: "getExtra",
  4079. value: function getExtra(className, height) {
  4080. var tag = document.createElement('tr');
  4081. tag.className = "virtual-scroll-".concat(className);
  4082. if (height) {
  4083. tag.style.height = "".concat(height, "px");
  4084. }
  4085. return tag.outerHTML;
  4086. }
  4087. }]);
  4088. return VirtualScroll;
  4089. }();
  4090. var BootstrapTable = /*#__PURE__*/function () {
  4091. function BootstrapTable(el, options) {
  4092. _classCallCheck(this, BootstrapTable);
  4093. this.options = options;
  4094. this.$el = $__default["default"](el);
  4095. this.$el_ = this.$el.clone();
  4096. this.timeoutId_ = 0;
  4097. this.timeoutFooter_ = 0;
  4098. }
  4099. _createClass(BootstrapTable, [{
  4100. key: "init",
  4101. value: function init() {
  4102. this.initConstants();
  4103. this.initLocale();
  4104. this.initContainer();
  4105. this.initTable();
  4106. this.initHeader();
  4107. this.initData();
  4108. this.initHiddenRows();
  4109. this.initToolbar();
  4110. this.initPagination();
  4111. this.initBody();
  4112. this.initSearchText();
  4113. this.initServer();
  4114. }
  4115. }, {
  4116. key: "initConstants",
  4117. value: function initConstants() {
  4118. var opts = this.options;
  4119. this.constants = Constants.CONSTANTS;
  4120. this.constants.theme = $__default["default"].fn.bootstrapTable.theme;
  4121. this.constants.dataToggle = this.constants.html.dataToggle || 'data-toggle'; // init iconsPrefix and icons
  4122. var iconsPrefix = Utils.getIconsPrefix($__default["default"].fn.bootstrapTable.theme);
  4123. var icons = Utils.getIcons(iconsPrefix);
  4124. opts.iconsPrefix = opts.iconsPrefix || $__default["default"].fn.bootstrapTable.defaults.iconsPrefix || iconsPrefix;
  4125. opts.icons = Object.assign(icons, $__default["default"].fn.bootstrapTable.defaults.icons, opts.icons); // init buttons class
  4126. var buttonsPrefix = opts.buttonsPrefix ? "".concat(opts.buttonsPrefix, "-") : '';
  4127. this.constants.buttonsClass = [opts.buttonsPrefix, buttonsPrefix + opts.buttonsClass, Utils.sprintf("".concat(buttonsPrefix, "%s"), opts.iconSize)].join(' ').trim();
  4128. this.buttons = Utils.calculateObjectValue(this, opts.buttons, [], {});
  4129. if (_typeof(this.buttons) !== 'object') {
  4130. this.buttons = {};
  4131. }
  4132. if (typeof opts.icons === 'string') {
  4133. opts.icons = Utils.calculateObjectValue(null, opts.icons);
  4134. }
  4135. }
  4136. }, {
  4137. key: "initLocale",
  4138. value: function initLocale() {
  4139. if (this.options.locale) {
  4140. var locales = $__default["default"].fn.bootstrapTable.locales;
  4141. var parts = this.options.locale.split(/-|_/);
  4142. parts[0] = parts[0].toLowerCase();
  4143. if (parts[1]) {
  4144. parts[1] = parts[1].toUpperCase();
  4145. }
  4146. var localesToExtend = {};
  4147. if (locales[this.options.locale]) {
  4148. localesToExtend = locales[this.options.locale];
  4149. } else if (locales[parts.join('-')]) {
  4150. localesToExtend = locales[parts.join('-')];
  4151. } else if (locales[parts[0]]) {
  4152. localesToExtend = locales[parts[0]];
  4153. }
  4154. for (var _i = 0, _Object$entries = Object.entries(localesToExtend); _i < _Object$entries.length; _i++) {
  4155. var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
  4156. formatName = _Object$entries$_i[0],
  4157. func = _Object$entries$_i[1];
  4158. if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
  4159. continue;
  4160. }
  4161. this.options[formatName] = func;
  4162. }
  4163. }
  4164. }
  4165. }, {
  4166. key: "initContainer",
  4167. value: function initContainer() {
  4168. var topPagination = ['top', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination clearfix"></div>' : '';
  4169. var bottomPagination = ['bottom', 'both'].includes(this.options.paginationVAlign) ? '<div class="fixed-table-pagination"></div>' : '';
  4170. var loadingTemplate = Utils.calculateObjectValue(this.options, this.options.loadingTemplate, [this.options.formatLoadingMessage()]);
  4171. this.$container = $__default["default"]("\n <div class=\"bootstrap-table ".concat(this.constants.theme, "\">\n <div class=\"fixed-table-toolbar\"></div>\n ").concat(topPagination, "\n <div class=\"fixed-table-container\">\n <div class=\"fixed-table-header\"><table></table></div>\n <div class=\"fixed-table-body\">\n <div class=\"fixed-table-loading\">\n ").concat(loadingTemplate, "\n </div>\n </div>\n <div class=\"fixed-table-footer\"></div>\n </div>\n ").concat(bottomPagination, "\n </div>\n "));
  4172. this.$container.insertAfter(this.$el);
  4173. this.$tableContainer = this.$container.find('.fixed-table-container');
  4174. this.$tableHeader = this.$container.find('.fixed-table-header');
  4175. this.$tableBody = this.$container.find('.fixed-table-body');
  4176. this.$tableLoading = this.$container.find('.fixed-table-loading');
  4177. this.$tableFooter = this.$el.find('tfoot'); // checking if custom table-toolbar exists or not
  4178. if (this.options.buttonsToolbar) {
  4179. this.$toolbar = $__default["default"]('body').find(this.options.buttonsToolbar);
  4180. } else {
  4181. this.$toolbar = this.$container.find('.fixed-table-toolbar');
  4182. }
  4183. this.$pagination = this.$container.find('.fixed-table-pagination');
  4184. this.$tableBody.append(this.$el);
  4185. this.$container.after('<div class="clearfix"></div>');
  4186. this.$el.addClass(this.options.classes);
  4187. this.$tableLoading.addClass(this.options.classes);
  4188. if (this.options.height) {
  4189. this.$tableContainer.addClass('fixed-height');
  4190. if (this.options.showFooter) {
  4191. this.$tableContainer.addClass('has-footer');
  4192. }
  4193. if (this.options.classes.split(' ').includes('table-bordered')) {
  4194. this.$tableBody.append('<div class="fixed-table-border"></div>');
  4195. this.$tableBorder = this.$tableBody.find('.fixed-table-border');
  4196. this.$tableLoading.addClass('fixed-table-border');
  4197. }
  4198. this.$tableFooter = this.$container.find('.fixed-table-footer');
  4199. }
  4200. }
  4201. }, {
  4202. key: "initTable",
  4203. value: function initTable() {
  4204. var _this = this;
  4205. var columns = [];
  4206. this.$header = this.$el.find('>thead');
  4207. if (!this.$header.length) {
  4208. this.$header = $__default["default"]("<thead class=\"".concat(this.options.theadClasses, "\"></thead>")).appendTo(this.$el);
  4209. } else if (this.options.theadClasses) {
  4210. this.$header.addClass(this.options.theadClasses);
  4211. }
  4212. this._headerTrClasses = [];
  4213. this._headerTrStyles = [];
  4214. this.$header.find('tr').each(function (i, el) {
  4215. var $tr = $__default["default"](el);
  4216. var column = [];
  4217. $tr.find('th').each(function (i, el) {
  4218. var $th = $__default["default"](el); // #2014: getFieldIndex and elsewhere assume this is string, causes issues if not
  4219. if (typeof $th.data('field') !== 'undefined') {
  4220. $th.data('field', "".concat($th.data('field')));
  4221. }
  4222. column.push($__default["default"].extend({}, {
  4223. title: $th.html(),
  4224. class: $th.attr('class'),
  4225. titleTooltip: $th.attr('title'),
  4226. rowspan: $th.attr('rowspan') ? +$th.attr('rowspan') : undefined,
  4227. colspan: $th.attr('colspan') ? +$th.attr('colspan') : undefined
  4228. }, $th.data()));
  4229. });
  4230. columns.push(column);
  4231. if ($tr.attr('class')) {
  4232. _this._headerTrClasses.push($tr.attr('class'));
  4233. }
  4234. if ($tr.attr('style')) {
  4235. _this._headerTrStyles.push($tr.attr('style'));
  4236. }
  4237. });
  4238. if (!Array.isArray(this.options.columns[0])) {
  4239. this.options.columns = [this.options.columns];
  4240. }
  4241. this.options.columns = $__default["default"].extend(true, [], columns, this.options.columns);
  4242. this.columns = [];
  4243. this.fieldsColumnsIndex = [];
  4244. Utils.setFieldIndex(this.options.columns);
  4245. this.options.columns.forEach(function (columns, i) {
  4246. columns.forEach(function (_column, j) {
  4247. var column = $__default["default"].extend({}, BootstrapTable.COLUMN_DEFAULTS, _column);
  4248. if (typeof column.fieldIndex !== 'undefined') {
  4249. _this.columns[column.fieldIndex] = column;
  4250. _this.fieldsColumnsIndex[column.field] = column.fieldIndex;
  4251. }
  4252. _this.options.columns[i][j] = column;
  4253. });
  4254. }); // if options.data is setting, do not process tbody and tfoot data
  4255. if (!this.options.data.length) {
  4256. var htmlData = Utils.trToData(this.columns, this.$el.find('>tbody>tr'));
  4257. if (htmlData.length) {
  4258. this.options.data = htmlData;
  4259. this.fromHtml = true;
  4260. }
  4261. }
  4262. if (!(this.options.pagination && this.options.sidePagination !== 'server')) {
  4263. this.footerData = Utils.trToData(this.columns, this.$el.find('>tfoot>tr'));
  4264. }
  4265. if (this.footerData) {
  4266. this.$el.find('tfoot').html('<tr></tr>');
  4267. }
  4268. if (!this.options.showFooter || this.options.cardView) {
  4269. this.$tableFooter.hide();
  4270. } else {
  4271. this.$tableFooter.show();
  4272. }
  4273. }
  4274. }, {
  4275. key: "initHeader",
  4276. value: function initHeader() {
  4277. var _this2 = this;
  4278. var visibleColumns = {};
  4279. var headerHtml = [];
  4280. this.header = {
  4281. fields: [],
  4282. styles: [],
  4283. classes: [],
  4284. formatters: [],
  4285. detailFormatters: [],
  4286. events: [],
  4287. sorters: [],
  4288. sortNames: [],
  4289. cellStyles: [],
  4290. searchables: []
  4291. };
  4292. Utils.updateFieldGroup(this.options.columns);
  4293. this.options.columns.forEach(function (columns, i) {
  4294. var html = [];
  4295. html.push("<tr".concat(Utils.sprintf(' class="%s"', _this2._headerTrClasses[i]), " ").concat(Utils.sprintf(' style="%s"', _this2._headerTrStyles[i]), ">"));
  4296. var detailViewTemplate = '';
  4297. if (i === 0 && Utils.hasDetailViewIcon(_this2.options)) {
  4298. var rowspan = _this2.options.columns.length > 1 ? " rowspan=\"".concat(_this2.options.columns.length, "\"") : '';
  4299. detailViewTemplate = "<th class=\"detail\"".concat(rowspan, ">\n <div class=\"fht-cell\"></div>\n </th>");
  4300. }
  4301. if (detailViewTemplate && _this2.options.detailViewAlign !== 'right') {
  4302. html.push(detailViewTemplate);
  4303. }
  4304. columns.forEach(function (column, j) {
  4305. var class_ = Utils.sprintf(' class="%s"', column['class']);
  4306. var unitWidth = column.widthUnit;
  4307. var width = parseFloat(column.width);
  4308. var halign = Utils.sprintf('text-align: %s; ', column.halign ? column.halign : column.align);
  4309. var align = Utils.sprintf('text-align: %s; ', column.align);
  4310. var style = Utils.sprintf('vertical-align: %s; ', column.valign);
  4311. style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ? !column.showSelectTitle ? '36px' : undefined : width ? width + unitWidth : undefined);
  4312. if (typeof column.fieldIndex === 'undefined' && !column.visible) {
  4313. return;
  4314. }
  4315. var headerStyle = Utils.calculateObjectValue(null, _this2.options.headerStyle, [column]);
  4316. var csses = [];
  4317. var classes = '';
  4318. if (headerStyle && headerStyle.css) {
  4319. for (var _i2 = 0, _Object$entries2 = Object.entries(headerStyle.css); _i2 < _Object$entries2.length; _i2++) {
  4320. var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
  4321. key = _Object$entries2$_i[0],
  4322. value = _Object$entries2$_i[1];
  4323. csses.push("".concat(key, ": ").concat(value));
  4324. }
  4325. }
  4326. if (headerStyle && headerStyle.classes) {
  4327. classes = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], headerStyle.classes].join(' ') : headerStyle.classes);
  4328. }
  4329. if (typeof column.fieldIndex !== 'undefined') {
  4330. _this2.header.fields[column.fieldIndex] = column.field;
  4331. _this2.header.styles[column.fieldIndex] = align + style;
  4332. _this2.header.classes[column.fieldIndex] = class_;
  4333. _this2.header.formatters[column.fieldIndex] = column.formatter;
  4334. _this2.header.detailFormatters[column.fieldIndex] = column.detailFormatter;
  4335. _this2.header.events[column.fieldIndex] = column.events;
  4336. _this2.header.sorters[column.fieldIndex] = column.sorter;
  4337. _this2.header.sortNames[column.fieldIndex] = column.sortName;
  4338. _this2.header.cellStyles[column.fieldIndex] = column.cellStyle;
  4339. _this2.header.searchables[column.fieldIndex] = column.searchable;
  4340. if (!column.visible) {
  4341. return;
  4342. }
  4343. if (_this2.options.cardView && !column.cardVisible) {
  4344. return;
  4345. }
  4346. visibleColumns[column.field] = column;
  4347. }
  4348. html.push("<th".concat(Utils.sprintf(' title="%s"', column.titleTooltip)), column.checkbox || column.radio ? Utils.sprintf(' class="bs-checkbox %s"', column['class'] || '') : classes || class_, Utils.sprintf(' style="%s"', halign + style + csses.join('; ')), Utils.sprintf(' rowspan="%s"', column.rowspan), Utils.sprintf(' colspan="%s"', column.colspan), Utils.sprintf(' data-field="%s"', column.field), // If `column` is not the first element of `this.options.columns[0]`, then className 'data-not-first-th' should be added.
  4349. j === 0 && i > 0 ? ' data-not-first-th' : '', '>');
  4350. html.push(Utils.sprintf('<div class="th-inner %s">', _this2.options.sortable && column.sortable ? 'sortable both' : ''));
  4351. var text = _this2.options.escape ? Utils.escapeHTML(column.title) : column.title;
  4352. var title = text;
  4353. if (column.checkbox) {
  4354. text = '';
  4355. if (!_this2.options.singleSelect && _this2.options.checkboxHeader) {
  4356. text = '<label><input name="btSelectAll" type="checkbox" /><span></span></label>';
  4357. }
  4358. _this2.header.stateField = column.field;
  4359. }
  4360. if (column.radio) {
  4361. text = '';
  4362. _this2.header.stateField = column.field;
  4363. }
  4364. if (!text && column.showSelectTitle) {
  4365. text += title;
  4366. }
  4367. html.push(text);
  4368. html.push('</div>');
  4369. html.push('<div class="fht-cell"></div>');
  4370. html.push('</div>');
  4371. html.push('</th>');
  4372. });
  4373. if (detailViewTemplate && _this2.options.detailViewAlign === 'right') {
  4374. html.push(detailViewTemplate);
  4375. }
  4376. html.push('</tr>');
  4377. if (html.length > 3) {
  4378. headerHtml.push(html.join(''));
  4379. }
  4380. });
  4381. this.$header.html(headerHtml.join(''));
  4382. this.$header.find('th[data-field]').each(function (i, el) {
  4383. $__default["default"](el).data(visibleColumns[$__default["default"](el).data('field')]);
  4384. });
  4385. this.$container.off('click', '.th-inner').on('click', '.th-inner', function (e) {
  4386. var $this = $__default["default"](e.currentTarget);
  4387. if (_this2.options.detailView && !$this.parent().hasClass('bs-checkbox')) {
  4388. if ($this.closest('.bootstrap-table')[0] !== _this2.$container[0]) {
  4389. return false;
  4390. }
  4391. }
  4392. if (_this2.options.sortable && $this.parent().data().sortable) {
  4393. _this2.onSort(e);
  4394. }
  4395. });
  4396. var resizeEvent = Utils.getEventName('resize.bootstrap-table', this.$el.attr('id'));
  4397. $__default["default"](window).off(resizeEvent);
  4398. if (!this.options.showHeader || this.options.cardView) {
  4399. this.$header.hide();
  4400. this.$tableHeader.hide();
  4401. this.$tableLoading.css('top', 0);
  4402. } else {
  4403. this.$header.show();
  4404. this.$tableHeader.show();
  4405. this.$tableLoading.css('top', this.$header.outerHeight() + 1); // Assign the correct sortable arrow
  4406. this.getCaret();
  4407. $__default["default"](window).on(resizeEvent, function () {
  4408. return _this2.resetView();
  4409. });
  4410. }
  4411. this.$selectAll = this.$header.find('[name="btSelectAll"]');
  4412. this.$selectAll.off('click').on('click', function (e) {
  4413. e.stopPropagation();
  4414. var checked = $__default["default"](e.currentTarget).prop('checked');
  4415. _this2[checked ? 'checkAll' : 'uncheckAll']();
  4416. _this2.updateSelected();
  4417. });
  4418. }
  4419. }, {
  4420. key: "initData",
  4421. value: function initData(data, type) {
  4422. if (type === 'append') {
  4423. this.options.data = this.options.data.concat(data);
  4424. } else if (type === 'prepend') {
  4425. this.options.data = [].concat(data).concat(this.options.data);
  4426. } else {
  4427. data = data || Utils.deepCopy(this.options.data);
  4428. this.options.data = Array.isArray(data) ? data : data[this.options.dataField];
  4429. }
  4430. this.data = _toConsumableArray(this.options.data);
  4431. if (this.options.sortReset) {
  4432. this.unsortedData = _toConsumableArray(this.data);
  4433. }
  4434. if (this.options.sidePagination === 'server') {
  4435. return;
  4436. }
  4437. this.initSort();
  4438. }
  4439. }, {
  4440. key: "initSort",
  4441. value: function initSort() {
  4442. var _this3 = this;
  4443. var name = this.options.sortName;
  4444. var order = this.options.sortOrder === 'desc' ? -1 : 1;
  4445. var index = this.header.fields.indexOf(this.options.sortName);
  4446. var timeoutId = 0;
  4447. if (index !== -1) {
  4448. if (this.options.sortStable) {
  4449. this.data.forEach(function (row, i) {
  4450. if (!row.hasOwnProperty('_position')) {
  4451. row._position = i;
  4452. }
  4453. });
  4454. }
  4455. if (this.options.customSort) {
  4456. Utils.calculateObjectValue(this.options, this.options.customSort, [this.options.sortName, this.options.sortOrder, this.data]);
  4457. } else {
  4458. this.data.sort(function (a, b) {
  4459. if (_this3.header.sortNames[index]) {
  4460. name = _this3.header.sortNames[index];
  4461. }
  4462. var aa = Utils.getItemField(a, name, _this3.options.escape);
  4463. var bb = Utils.getItemField(b, name, _this3.options.escape);
  4464. var value = Utils.calculateObjectValue(_this3.header, _this3.header.sorters[index], [aa, bb, a, b]);
  4465. if (value !== undefined) {
  4466. if (_this3.options.sortStable && value === 0) {
  4467. return order * (a._position - b._position);
  4468. }
  4469. return order * value;
  4470. }
  4471. return Utils.sort(aa, bb, order, _this3.options.sortStable, a._position, b._position);
  4472. });
  4473. }
  4474. if (this.options.sortClass !== undefined) {
  4475. clearTimeout(timeoutId);
  4476. timeoutId = setTimeout(function () {
  4477. _this3.$el.removeClass(_this3.options.sortClass);
  4478. var index = _this3.$header.find("[data-field=\"".concat(_this3.options.sortName, "\"]")).index();
  4479. _this3.$el.find("tr td:nth-child(".concat(index + 1, ")")).addClass(_this3.options.sortClass);
  4480. }, 250);
  4481. }
  4482. } else if (this.options.sortReset) {
  4483. this.data = _toConsumableArray(this.unsortedData);
  4484. }
  4485. }
  4486. }, {
  4487. key: "onSort",
  4488. value: function onSort(_ref) {
  4489. var type = _ref.type,
  4490. currentTarget = _ref.currentTarget;
  4491. var $this = type === 'keypress' ? $__default["default"](currentTarget) : $__default["default"](currentTarget).parent();
  4492. var $this_ = this.$header.find('th').eq($this.index());
  4493. this.$header.add(this.$header_).find('span.order').remove();
  4494. if (this.options.sortName === $this.data('field')) {
  4495. var currentSortOrder = this.options.sortOrder;
  4496. if (currentSortOrder === undefined) {
  4497. this.options.sortOrder = 'asc';
  4498. } else if (currentSortOrder === 'asc') {
  4499. this.options.sortOrder = 'desc';
  4500. } else if (this.options.sortOrder === 'desc') {
  4501. this.options.sortOrder = this.options.sortReset ? undefined : 'asc';
  4502. }
  4503. if (this.options.sortOrder === undefined) {
  4504. this.options.sortName = undefined;
  4505. }
  4506. } else {
  4507. this.options.sortName = $this.data('field');
  4508. if (this.options.rememberOrder) {
  4509. this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
  4510. } else {
  4511. this.options.sortOrder = this.columns[this.fieldsColumnsIndex[$this.data('field')]].sortOrder || this.columns[this.fieldsColumnsIndex[$this.data('field')]].order;
  4512. }
  4513. }
  4514. this.trigger('sort', this.options.sortName, this.options.sortOrder);
  4515. $this.add($this_).data('order', this.options.sortOrder); // Assign the correct sortable arrow
  4516. this.getCaret();
  4517. if (this.options.sidePagination === 'server' && this.options.serverSort) {
  4518. this.options.pageNumber = 1;
  4519. this.initServer(this.options.silentSort);
  4520. return;
  4521. }
  4522. this.initSort();
  4523. this.initBody();
  4524. }
  4525. }, {
  4526. key: "initToolbar",
  4527. value: function initToolbar() {
  4528. var _this4 = this;
  4529. var opts = this.options;
  4530. var html = [];
  4531. var timeoutId = 0;
  4532. var $keepOpen;
  4533. var switchableCount = 0;
  4534. if (this.$toolbar.find('.bs-bars').children().length) {
  4535. $__default["default"]('body').append($__default["default"](opts.toolbar));
  4536. }
  4537. this.$toolbar.html('');
  4538. if (typeof opts.toolbar === 'string' || _typeof(opts.toolbar) === 'object') {
  4539. $__default["default"](Utils.sprintf('<div class="bs-bars %s-%s"></div>', this.constants.classes.pull, opts.toolbarAlign)).appendTo(this.$toolbar).append($__default["default"](opts.toolbar));
  4540. } // showColumns, showToggle, showRefresh
  4541. html = ["<div class=\"".concat(['columns', "columns-".concat(opts.buttonsAlign), this.constants.classes.buttonsGroup, "".concat(this.constants.classes.pull, "-").concat(opts.buttonsAlign)].join(' '), "\">")];
  4542. if (typeof opts.buttonsOrder === 'string') {
  4543. opts.buttonsOrder = opts.buttonsOrder.replace(/\[|\]| |'/g, '').split(',');
  4544. }
  4545. this.buttons = Object.assign(this.buttons, {
  4546. paginationSwitch: {
  4547. text: opts.pagination ? opts.formatPaginationSwitchUp() : opts.formatPaginationSwitchDown(),
  4548. icon: opts.pagination ? opts.icons.paginationSwitchDown : opts.icons.paginationSwitchUp,
  4549. render: false,
  4550. event: this.togglePagination,
  4551. attributes: {
  4552. 'aria-label': opts.formatPaginationSwitch(),
  4553. title: opts.formatPaginationSwitch()
  4554. }
  4555. },
  4556. refresh: {
  4557. text: opts.formatRefresh(),
  4558. icon: opts.icons.refresh,
  4559. render: false,
  4560. event: this.refresh,
  4561. attributes: {
  4562. 'aria-label': opts.formatRefresh(),
  4563. title: opts.formatRefresh()
  4564. }
  4565. },
  4566. toggle: {
  4567. text: opts.formatToggle(),
  4568. icon: opts.icons.toggleOff,
  4569. render: false,
  4570. event: this.toggleView,
  4571. attributes: {
  4572. 'aria-label': opts.formatToggleOn(),
  4573. title: opts.formatToggleOn()
  4574. }
  4575. },
  4576. fullscreen: {
  4577. text: opts.formatFullscreen(),
  4578. icon: opts.icons.fullscreen,
  4579. render: false,
  4580. event: this.toggleFullscreen,
  4581. attributes: {
  4582. 'aria-label': opts.formatFullscreen(),
  4583. title: opts.formatFullscreen()
  4584. }
  4585. },
  4586. columns: {
  4587. render: false,
  4588. html: function html() {
  4589. var html = [];
  4590. html.push("<div class=\"keep-open ".concat(_this4.constants.classes.buttonsDropdown, "\" title=\"").concat(opts.formatColumns(), "\">\n <button class=\"").concat(_this4.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(_this4.constants.dataToggle, "=\"dropdown\"\n aria-label=\"Columns\" title=\"").concat(opts.formatColumns(), "\">\n ").concat(opts.showButtonIcons ? Utils.sprintf(_this4.constants.html.icon, opts.iconsPrefix, opts.icons.columns) : '', "\n ").concat(opts.showButtonText ? opts.formatColumns() : '', "\n ").concat(_this4.constants.html.dropdownCaret, "\n </button>\n ").concat(_this4.constants.html.toolbarDropdown[0]));
  4591. if (opts.showColumnsSearch) {
  4592. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="text" class="%s" name="columnsSearch" placeholder="%s" autocomplete="off">', _this4.constants.classes.input, opts.formatSearch())));
  4593. html.push(_this4.constants.html.toolbarDropdownSeparator);
  4594. }
  4595. if (opts.showColumnsToggleAll) {
  4596. var allFieldsVisible = _this4.getVisibleColumns().length === _this4.columns.filter(function (column) {
  4597. return !_this4.isSelectionColumn(column);
  4598. }).length;
  4599. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" class="toggle-all" %s> <span>%s</span>', allFieldsVisible ? 'checked="checked"' : '', opts.formatColumnsToggleAll())));
  4600. html.push(_this4.constants.html.toolbarDropdownSeparator);
  4601. }
  4602. var visibleColumns = 0;
  4603. _this4.columns.forEach(function (column) {
  4604. if (column.visible) {
  4605. visibleColumns++;
  4606. }
  4607. });
  4608. _this4.columns.forEach(function (column, i) {
  4609. if (_this4.isSelectionColumn(column)) {
  4610. return;
  4611. }
  4612. if (opts.cardView && !column.cardVisible) {
  4613. return;
  4614. }
  4615. var checked = column.visible ? ' checked="checked"' : '';
  4616. var disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : '';
  4617. if (column.switchable) {
  4618. html.push(Utils.sprintf(_this4.constants.html.toolbarDropdownItem, Utils.sprintf('<input type="checkbox" data-field="%s" value="%s"%s%s> <span>%s</span>', column.field, i, checked, disabled, column.title)));
  4619. switchableCount++;
  4620. }
  4621. });
  4622. html.push(_this4.constants.html.toolbarDropdown[1], '</div>');
  4623. return html.join('');
  4624. }
  4625. }
  4626. });
  4627. var buttonsHtml = {};
  4628. for (var _i3 = 0, _Object$entries3 = Object.entries(this.buttons); _i3 < _Object$entries3.length; _i3++) {
  4629. var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),
  4630. buttonName = _Object$entries3$_i[0],
  4631. buttonConfig = _Object$entries3$_i[1];
  4632. var buttonHtml = void 0;
  4633. if (buttonConfig.hasOwnProperty('html')) {
  4634. if (typeof buttonConfig.html === 'function') {
  4635. buttonHtml = buttonConfig.html();
  4636. } else if (typeof buttonConfig.html === 'string') {
  4637. buttonHtml = buttonConfig.html;
  4638. }
  4639. } else {
  4640. buttonHtml = "<button class=\"".concat(this.constants.buttonsClass, "\" type=\"button\" name=\"").concat(buttonName, "\"");
  4641. if (buttonConfig.hasOwnProperty('attributes')) {
  4642. for (var _i4 = 0, _Object$entries4 = Object.entries(buttonConfig.attributes); _i4 < _Object$entries4.length; _i4++) {
  4643. var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),
  4644. attributeName = _Object$entries4$_i[0],
  4645. value = _Object$entries4$_i[1];
  4646. buttonHtml += " ".concat(attributeName, "=\"").concat(value, "\"");
  4647. }
  4648. }
  4649. buttonHtml += '>';
  4650. if (opts.showButtonIcons && buttonConfig.hasOwnProperty('icon')) {
  4651. buttonHtml += "".concat(Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, buttonConfig.icon), " ");
  4652. }
  4653. if (opts.showButtonText && buttonConfig.hasOwnProperty('text')) {
  4654. buttonHtml += buttonConfig.text;
  4655. }
  4656. buttonHtml += '</button>';
  4657. }
  4658. buttonsHtml[buttonName] = buttonHtml;
  4659. var optionName = "show".concat(buttonName.charAt(0).toUpperCase()).concat(buttonName.substring(1));
  4660. var showOption = opts[optionName];
  4661. if ((!buttonConfig.hasOwnProperty('render') || buttonConfig.hasOwnProperty('render') && buttonConfig.render) && (showOption === undefined || showOption === true)) {
  4662. opts[optionName] = true;
  4663. }
  4664. if (!opts.buttonsOrder.includes(buttonName)) {
  4665. opts.buttonsOrder.push(buttonName);
  4666. }
  4667. } // Adding the button html to the final toolbar html when the showOption is true
  4668. var _iterator = _createForOfIteratorHelper(opts.buttonsOrder),
  4669. _step;
  4670. try {
  4671. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  4672. var button = _step.value;
  4673. var _showOption = opts["show".concat(button.charAt(0).toUpperCase()).concat(button.substring(1))];
  4674. if (_showOption) {
  4675. html.push(buttonsHtml[button]);
  4676. }
  4677. }
  4678. } catch (err) {
  4679. _iterator.e(err);
  4680. } finally {
  4681. _iterator.f();
  4682. }
  4683. html.push('</div>'); // Fix #188: this.showToolbar is for extensions
  4684. if (this.showToolbar || html.length > 2) {
  4685. this.$toolbar.append(html.join(''));
  4686. }
  4687. for (var _i5 = 0, _Object$entries5 = Object.entries(this.buttons); _i5 < _Object$entries5.length; _i5++) {
  4688. var _Object$entries5$_i = _slicedToArray(_Object$entries5[_i5], 2),
  4689. _buttonName = _Object$entries5$_i[0],
  4690. _buttonConfig = _Object$entries5$_i[1];
  4691. if (_buttonConfig.hasOwnProperty('event')) {
  4692. if (typeof _buttonConfig.event === 'function' || typeof _buttonConfig.event === 'string') {
  4693. var _ret = function () {
  4694. var event = typeof _buttonConfig.event === 'string' ? window[_buttonConfig.event] : _buttonConfig.event;
  4695. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off('click').on('click', function () {
  4696. return event.call(_this4);
  4697. });
  4698. return "continue";
  4699. }();
  4700. if (_ret === "continue") continue;
  4701. }
  4702. var _loop = function _loop() {
  4703. var _Object$entries6$_i = _slicedToArray(_Object$entries6[_i6], 2),
  4704. eventType = _Object$entries6$_i[0],
  4705. eventFunction = _Object$entries6$_i[1];
  4706. var event = typeof eventFunction === 'string' ? window[eventFunction] : eventFunction;
  4707. _this4.$toolbar.find("button[name=\"".concat(_buttonName, "\"]")).off(eventType).on(eventType, function () {
  4708. return event.call(_this4);
  4709. });
  4710. };
  4711. for (var _i6 = 0, _Object$entries6 = Object.entries(_buttonConfig.event); _i6 < _Object$entries6.length; _i6++) {
  4712. _loop();
  4713. }
  4714. }
  4715. }
  4716. if (opts.showColumns) {
  4717. $keepOpen = this.$toolbar.find('.keep-open');
  4718. var $checkboxes = $keepOpen.find('input[type="checkbox"]:not(".toggle-all")');
  4719. var $toggleAll = $keepOpen.find('input[type="checkbox"].toggle-all');
  4720. if (switchableCount <= opts.minimumCountColumns) {
  4721. $keepOpen.find('input').prop('disabled', true);
  4722. }
  4723. $keepOpen.find('li, label').off('click').on('click', function (e) {
  4724. e.stopImmediatePropagation();
  4725. });
  4726. $checkboxes.off('click').on('click', function (_ref2) {
  4727. var currentTarget = _ref2.currentTarget;
  4728. var $this = $__default["default"](currentTarget);
  4729. _this4._toggleColumn($this.val(), $this.prop('checked'), false);
  4730. _this4.trigger('column-switch', $this.data('field'), $this.prop('checked'));
  4731. $toggleAll.prop('checked', $checkboxes.filter(':checked').length === _this4.columns.filter(function (column) {
  4732. return !_this4.isSelectionColumn(column);
  4733. }).length);
  4734. });
  4735. $toggleAll.off('click').on('click', function (_ref3) {
  4736. var currentTarget = _ref3.currentTarget;
  4737. _this4._toggleAllColumns($__default["default"](currentTarget).prop('checked'));
  4738. _this4.trigger('column-switch-all', $__default["default"](currentTarget).prop('checked'));
  4739. });
  4740. if (opts.showColumnsSearch) {
  4741. var $columnsSearch = $keepOpen.find('[name="columnsSearch"]');
  4742. var $listItems = $keepOpen.find('.dropdown-item-marker');
  4743. $columnsSearch.on('keyup paste change', function (_ref4) {
  4744. var currentTarget = _ref4.currentTarget;
  4745. var $this = $__default["default"](currentTarget);
  4746. var searchValue = $this.val().toLowerCase();
  4747. $listItems.show();
  4748. $checkboxes.each(function (i, el) {
  4749. var $checkbox = $__default["default"](el);
  4750. var $listItem = $checkbox.parents('.dropdown-item-marker');
  4751. var text = $listItem.text().toLowerCase();
  4752. if (!text.includes(searchValue)) {
  4753. $listItem.hide();
  4754. }
  4755. });
  4756. });
  4757. }
  4758. }
  4759. var handleInputEvent = function handleInputEvent($searchInput) {
  4760. var eventTriggers = 'keyup drop blur mouseup';
  4761. $searchInput.off(eventTriggers).on(eventTriggers, function (event) {
  4762. if (opts.searchOnEnterKey && event.keyCode !== 13) {
  4763. return;
  4764. }
  4765. if ([37, 38, 39, 40].includes(event.keyCode)) {
  4766. return;
  4767. }
  4768. clearTimeout(timeoutId); // doesn't matter if it's 0
  4769. timeoutId = setTimeout(function () {
  4770. _this4.onSearch({
  4771. currentTarget: event.currentTarget
  4772. });
  4773. }, opts.searchTimeOut);
  4774. });
  4775. }; // Fix #4516: this.showSearchClearButton is for extensions
  4776. if ((opts.search || this.showSearchClearButton) && typeof opts.searchSelector !== 'string') {
  4777. html = [];
  4778. var showSearchButton = Utils.sprintf(this.constants.html.searchButton, this.constants.buttonsClass, opts.formatSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.search) : '', opts.showButtonText ? opts.formatSearch() : '');
  4779. var showSearchClearButton = Utils.sprintf(this.constants.html.searchClearButton, this.constants.buttonsClass, opts.formatClearSearch(), opts.showButtonIcons ? Utils.sprintf(this.constants.html.icon, opts.iconsPrefix, opts.icons.clearSearch) : '', opts.showButtonText ? opts.formatClearSearch() : '');
  4780. var searchInputHtml = "<input class=\"".concat(this.constants.classes.input, "\n ").concat(Utils.sprintf(' %s%s', this.constants.classes.inputPrefix, opts.iconSize), "\n search-input\" type=\"search\" placeholder=\"").concat(opts.formatSearch(), "\" autocomplete=\"off\">");
  4781. var searchInputFinalHtml = searchInputHtml;
  4782. if (opts.showSearchButton || opts.showSearchClearButton) {
  4783. var _buttonsHtml = (opts.showSearchButton ? showSearchButton : '') + (opts.showSearchClearButton ? showSearchClearButton : '');
  4784. searchInputFinalHtml = opts.search ? Utils.sprintf(this.constants.html.inputGroup, searchInputHtml, _buttonsHtml) : _buttonsHtml;
  4785. }
  4786. html.push(Utils.sprintf("\n <div class=\"".concat(this.constants.classes.pull, "-").concat(opts.searchAlign, " search ").concat(this.constants.classes.inputGroup, "\">\n %s\n </div>\n "), searchInputFinalHtml));
  4787. this.$toolbar.append(html.join(''));
  4788. var $searchInput = Utils.getSearchInput(this);
  4789. if (opts.showSearchButton) {
  4790. this.$toolbar.find('.search button[name=search]').off('click').on('click', function () {
  4791. clearTimeout(timeoutId); // doesn't matter if it's 0
  4792. timeoutId = setTimeout(function () {
  4793. _this4.onSearch({
  4794. currentTarget: $searchInput
  4795. });
  4796. }, opts.searchTimeOut);
  4797. });
  4798. if (opts.searchOnEnterKey) {
  4799. handleInputEvent($searchInput);
  4800. }
  4801. } else {
  4802. handleInputEvent($searchInput);
  4803. }
  4804. if (opts.showSearchClearButton) {
  4805. this.$toolbar.find('.search button[name=clearSearch]').click(function () {
  4806. _this4.resetSearch();
  4807. });
  4808. }
  4809. } else if (typeof opts.searchSelector === 'string') {
  4810. var _$searchInput = Utils.getSearchInput(this);
  4811. handleInputEvent(_$searchInput);
  4812. }
  4813. }
  4814. }, {
  4815. key: "onSearch",
  4816. value: function onSearch() {
  4817. var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  4818. currentTarget = _ref5.currentTarget,
  4819. firedByInitSearchText = _ref5.firedByInitSearchText;
  4820. var overwriteSearchText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  4821. if (currentTarget !== undefined && $__default["default"](currentTarget).length && overwriteSearchText) {
  4822. var text = $__default["default"](currentTarget).val().trim();
  4823. if (this.options.trimOnSearch && $__default["default"](currentTarget).val() !== text) {
  4824. $__default["default"](currentTarget).val(text);
  4825. }
  4826. if (this.searchText === text) {
  4827. return;
  4828. }
  4829. var $searchInput = Utils.getSearchInput(this);
  4830. var $currentTarget = currentTarget instanceof jQuery ? currentTarget : $__default["default"](currentTarget);
  4831. if ($currentTarget.is($searchInput) || $currentTarget.hasClass('search-input')) {
  4832. this.searchText = text;
  4833. this.options.searchText = text;
  4834. }
  4835. }
  4836. if (!firedByInitSearchText && !this.options.cookie) {
  4837. this.options.pageNumber = 1;
  4838. }
  4839. this.initSearch();
  4840. if (firedByInitSearchText) {
  4841. if (this.options.sidePagination === 'client') {
  4842. this.updatePagination();
  4843. }
  4844. } else {
  4845. this.updatePagination();
  4846. }
  4847. this.trigger('search', this.searchText);
  4848. }
  4849. }, {
  4850. key: "initSearch",
  4851. value: function initSearch() {
  4852. var _this5 = this;
  4853. this.filterOptions = this.filterOptions || this.options.filterOptions;
  4854. if (this.options.sidePagination !== 'server') {
  4855. if (this.options.customSearch) {
  4856. this.data = Utils.calculateObjectValue(this.options, this.options.customSearch, [this.options.data, this.searchText, this.filterColumns]);
  4857. if (this.options.sortReset) {
  4858. this.unsortedData = _toConsumableArray(this.data);
  4859. }
  4860. return;
  4861. }
  4862. var rawSearchText = this.searchText && (this.fromHtml ? Utils.escapeHTML(this.searchText) : this.searchText);
  4863. var searchText = rawSearchText ? rawSearchText.toLowerCase() : '';
  4864. var f = Utils.isEmptyObject(this.filterColumns) ? null : this.filterColumns;
  4865. if (this.options.searchAccentNeutralise) {
  4866. searchText = Utils.normalizeAccent(searchText);
  4867. } // Check filter
  4868. if (typeof this.filterOptions.filterAlgorithm === 'function') {
  4869. this.data = this.options.data.filter(function (item) {
  4870. return _this5.filterOptions.filterAlgorithm.apply(null, [item, f]);
  4871. });
  4872. } else if (typeof this.filterOptions.filterAlgorithm === 'string') {
  4873. this.data = f ? this.options.data.filter(function (item) {
  4874. var filterAlgorithm = _this5.filterOptions.filterAlgorithm;
  4875. if (filterAlgorithm === 'and') {
  4876. for (var key in f) {
  4877. if (Array.isArray(f[key]) && !f[key].includes(item[key]) || !Array.isArray(f[key]) && item[key] !== f[key]) {
  4878. return false;
  4879. }
  4880. }
  4881. } else if (filterAlgorithm === 'or') {
  4882. var match = false;
  4883. for (var _key in f) {
  4884. if (Array.isArray(f[_key]) && f[_key].includes(item[_key]) || !Array.isArray(f[_key]) && item[_key] === f[_key]) {
  4885. match = true;
  4886. }
  4887. }
  4888. return match;
  4889. }
  4890. return true;
  4891. }) : _toConsumableArray(this.options.data);
  4892. }
  4893. var visibleFields = this.getVisibleFields();
  4894. this.data = searchText ? this.data.filter(function (item, i) {
  4895. for (var j = 0; j < _this5.header.fields.length; j++) {
  4896. if (!_this5.header.searchables[j] || _this5.options.visibleSearch && visibleFields.indexOf(_this5.header.fields[j]) === -1) {
  4897. continue;
  4898. }
  4899. var key = Utils.isNumeric(_this5.header.fields[j]) ? parseInt(_this5.header.fields[j], 10) : _this5.header.fields[j];
  4900. var column = _this5.columns[_this5.fieldsColumnsIndex[key]];
  4901. var value = void 0;
  4902. if (typeof key === 'string') {
  4903. value = item;
  4904. var props = key.split('.');
  4905. for (var _i7 = 0; _i7 < props.length; _i7++) {
  4906. if (value[props[_i7]] !== null) {
  4907. value = value[props[_i7]];
  4908. }
  4909. }
  4910. } else {
  4911. value = item[key];
  4912. }
  4913. if (_this5.options.searchAccentNeutralise) {
  4914. value = Utils.normalizeAccent(value);
  4915. } // Fix #142: respect searchFormatter boolean
  4916. if (column && column.searchFormatter) {
  4917. value = Utils.calculateObjectValue(column, _this5.header.formatters[j], [value, item, i, column.field], value);
  4918. }
  4919. if (typeof value === 'string' || typeof value === 'number') {
  4920. if (_this5.options.strictSearch && "".concat(value).toLowerCase() === searchText || _this5.options.regexSearch && Utils.regexCompare(value, rawSearchText)) {
  4921. return true;
  4922. }
  4923. var largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(-?\d+)?|(-?\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm;
  4924. var matches = largerSmallerEqualsRegex.exec(_this5.searchText);
  4925. var comparisonCheck = false;
  4926. if (matches) {
  4927. var operator = matches[1] || "".concat(matches[5], "l");
  4928. var comparisonValue = matches[2] || matches[3];
  4929. var int = parseInt(value, 10);
  4930. var comparisonInt = parseInt(comparisonValue, 10);
  4931. switch (operator) {
  4932. case '>':
  4933. case '<l':
  4934. comparisonCheck = int > comparisonInt;
  4935. break;
  4936. case '<':
  4937. case '>l':
  4938. comparisonCheck = int < comparisonInt;
  4939. break;
  4940. case '<=':
  4941. case '=<':
  4942. case '>=l':
  4943. case '=>l':
  4944. comparisonCheck = int <= comparisonInt;
  4945. break;
  4946. case '>=':
  4947. case '=>':
  4948. case '<=l':
  4949. case '=<l':
  4950. comparisonCheck = int >= comparisonInt;
  4951. break;
  4952. }
  4953. }
  4954. if (comparisonCheck || "".concat(value).toLowerCase().includes(searchText)) {
  4955. return true;
  4956. }
  4957. }
  4958. }
  4959. return false;
  4960. }) : this.data;
  4961. if (this.options.sortReset) {
  4962. this.unsortedData = _toConsumableArray(this.data);
  4963. }
  4964. this.initSort();
  4965. }
  4966. }
  4967. }, {
  4968. key: "initPagination",
  4969. value: function initPagination() {
  4970. var _this6 = this;
  4971. var opts = this.options;
  4972. if (!opts.pagination) {
  4973. this.$pagination.hide();
  4974. return;
  4975. }
  4976. this.$pagination.show();
  4977. var html = [];
  4978. var allSelected = false;
  4979. var i;
  4980. var from;
  4981. var to;
  4982. var $pageList;
  4983. var $pre;
  4984. var $next;
  4985. var $number;
  4986. var data = this.getData({
  4987. includeHiddenRows: false
  4988. });
  4989. var pageList = opts.pageList;
  4990. if (typeof pageList === 'string') {
  4991. pageList = pageList.replace(/\[|\]| /g, '').toLowerCase().split(',');
  4992. }
  4993. pageList = pageList.map(function (value) {
  4994. if (typeof value === 'string') {
  4995. return value.toLowerCase() === opts.formatAllRows().toLowerCase() || ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value;
  4996. }
  4997. return value;
  4998. });
  4999. this.paginationParts = opts.paginationParts;
  5000. if (typeof this.paginationParts === 'string') {
  5001. this.paginationParts = this.paginationParts.replace(/\[|\]| |'/g, '').split(',');
  5002. }
  5003. if (opts.sidePagination !== 'server') {
  5004. opts.totalRows = data.length;
  5005. }
  5006. this.totalPages = 0;
  5007. if (opts.totalRows) {
  5008. if (opts.pageSize === opts.formatAllRows()) {
  5009. opts.pageSize = opts.totalRows;
  5010. allSelected = true;
  5011. }
  5012. this.totalPages = ~~((opts.totalRows - 1) / opts.pageSize) + 1;
  5013. opts.totalPages = this.totalPages;
  5014. }
  5015. if (this.totalPages > 0 && opts.pageNumber > this.totalPages) {
  5016. opts.pageNumber = this.totalPages;
  5017. }
  5018. this.pageFrom = (opts.pageNumber - 1) * opts.pageSize + 1;
  5019. this.pageTo = opts.pageNumber * opts.pageSize;
  5020. if (this.pageTo > opts.totalRows) {
  5021. this.pageTo = opts.totalRows;
  5022. }
  5023. if (this.options.pagination && this.options.sidePagination !== 'server') {
  5024. this.options.totalNotFiltered = this.options.data.length;
  5025. }
  5026. if (!this.options.showExtendedPagination) {
  5027. this.options.totalNotFiltered = undefined;
  5028. }
  5029. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  5030. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationDetailHAlign, " pagination-detail\">"));
  5031. }
  5032. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort')) {
  5033. var paginationInfo = this.paginationParts.includes('pageInfoShort') ? opts.formatDetailPagination(opts.totalRows) : opts.formatShowingRows(this.pageFrom, this.pageTo, opts.totalRows, opts.totalNotFiltered);
  5034. html.push("<span class=\"pagination-info\">\n ".concat(paginationInfo, "\n </span>"));
  5035. }
  5036. if (this.paginationParts.includes('pageSize')) {
  5037. html.push('<div class="page-list">');
  5038. var pageNumber = ["<div class=\"".concat(this.constants.classes.paginationDropdown, "\">\n <button class=\"").concat(this.constants.buttonsClass, " dropdown-toggle\" type=\"button\" ").concat(this.constants.dataToggle, "=\"dropdown\">\n <span class=\"page-size\">\n ").concat(allSelected ? opts.formatAllRows() : opts.pageSize, "\n </span>\n ").concat(this.constants.html.dropdownCaret, "\n </button>\n ").concat(this.constants.html.pageDropdown[0])];
  5039. pageList.forEach(function (page, i) {
  5040. if (!opts.smartDisplay || i === 0 || pageList[i - 1] < opts.totalRows || page === opts.formatAllRows()) {
  5041. var active;
  5042. if (allSelected) {
  5043. active = page === opts.formatAllRows() ? _this6.constants.classes.dropdownActive : '';
  5044. } else {
  5045. active = page === opts.pageSize ? _this6.constants.classes.dropdownActive : '';
  5046. }
  5047. pageNumber.push(Utils.sprintf(_this6.constants.html.pageDropdownItem, active, page));
  5048. }
  5049. });
  5050. pageNumber.push("".concat(this.constants.html.pageDropdown[1], "</div>"));
  5051. html.push(opts.formatRecordsPerPage(pageNumber.join('')));
  5052. }
  5053. if (this.paginationParts.includes('pageInfo') || this.paginationParts.includes('pageInfoShort') || this.paginationParts.includes('pageSize')) {
  5054. html.push('</div></div>');
  5055. }
  5056. if (this.paginationParts.includes('pageList')) {
  5057. html.push("<div class=\"".concat(this.constants.classes.pull, "-").concat(opts.paginationHAlign, " pagination\">"), Utils.sprintf(this.constants.html.pagination[0], Utils.sprintf(' pagination-%s', opts.iconSize)), Utils.sprintf(this.constants.html.paginationItem, ' page-pre', opts.formatSRPaginationPreText(), opts.paginationPreText));
  5058. if (this.totalPages < opts.paginationSuccessivelySize) {
  5059. from = 1;
  5060. to = this.totalPages;
  5061. } else {
  5062. from = opts.pageNumber - opts.paginationPagesBySide;
  5063. to = from + opts.paginationPagesBySide * 2;
  5064. }
  5065. if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
  5066. to = opts.paginationSuccessivelySize;
  5067. }
  5068. if (opts.paginationSuccessivelySize > this.totalPages - from) {
  5069. from = from - (opts.paginationSuccessivelySize - (this.totalPages - from)) + 1;
  5070. }
  5071. if (from < 1) {
  5072. from = 1;
  5073. }
  5074. if (to > this.totalPages) {
  5075. to = this.totalPages;
  5076. }
  5077. var middleSize = Math.round(opts.paginationPagesBySide / 2);
  5078. var pageItem = function pageItem(i) {
  5079. var classes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  5080. return Utils.sprintf(_this6.constants.html.paginationItem, classes + (i === opts.pageNumber ? " ".concat(_this6.constants.classes.paginationActive) : ''), opts.formatSRPaginationPageText(i), i);
  5081. };
  5082. if (from > 1) {
  5083. var max = opts.paginationPagesBySide;
  5084. if (max >= from) max = from - 1;
  5085. for (i = 1; i <= max; i++) {
  5086. html.push(pageItem(i));
  5087. }
  5088. if (from - 1 === max + 1) {
  5089. i = from - 1;
  5090. html.push(pageItem(i));
  5091. } else if (from - 1 > max) {
  5092. if (from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide && opts.paginationUseIntermediate) {
  5093. i = Math.round((from - middleSize) / 2 + middleSize);
  5094. html.push(pageItem(i, ' page-intermediate'));
  5095. } else {
  5096. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-first-separator disabled', '', '...'));
  5097. }
  5098. }
  5099. }
  5100. for (i = from; i <= to; i++) {
  5101. html.push(pageItem(i));
  5102. }
  5103. if (this.totalPages > to) {
  5104. var min = this.totalPages - (opts.paginationPagesBySide - 1);
  5105. if (to >= min) min = to + 1;
  5106. if (to + 1 === min - 1) {
  5107. i = to + 1;
  5108. html.push(pageItem(i));
  5109. } else if (min > to + 1) {
  5110. if (this.totalPages - to > opts.paginationPagesBySide * 2 && opts.paginationUseIntermediate) {
  5111. i = Math.round((this.totalPages - middleSize - to) / 2 + to);
  5112. html.push(pageItem(i, ' page-intermediate'));
  5113. } else {
  5114. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-last-separator disabled', '', '...'));
  5115. }
  5116. }
  5117. for (i = min; i <= this.totalPages; i++) {
  5118. html.push(pageItem(i));
  5119. }
  5120. }
  5121. html.push(Utils.sprintf(this.constants.html.paginationItem, ' page-next', opts.formatSRPaginationNextText(), opts.paginationNextText));
  5122. html.push(this.constants.html.pagination[1], '</div>');
  5123. }
  5124. this.$pagination.html(html.join(''));
  5125. var dropupClass = ['bottom', 'both'].includes(opts.paginationVAlign) ? " ".concat(this.constants.classes.dropup) : '';
  5126. this.$pagination.last().find('.page-list > div').addClass(dropupClass);
  5127. if (!opts.onlyInfoPagination) {
  5128. $pageList = this.$pagination.find('.page-list a');
  5129. $pre = this.$pagination.find('.page-pre');
  5130. $next = this.$pagination.find('.page-next');
  5131. $number = this.$pagination.find('.page-item').not('.page-next, .page-pre, .page-last-separator, .page-first-separator');
  5132. if (this.totalPages <= 1) {
  5133. this.$pagination.find('div.pagination').hide();
  5134. }
  5135. if (opts.smartDisplay) {
  5136. if (pageList.length < 2 || opts.totalRows <= pageList[0]) {
  5137. this.$pagination.find('div.page-list').hide();
  5138. }
  5139. } // when data is empty, hide the pagination
  5140. this.$pagination[this.getData().length ? 'show' : 'hide']();
  5141. if (!opts.paginationLoop) {
  5142. if (opts.pageNumber === 1) {
  5143. $pre.addClass('disabled');
  5144. }
  5145. if (opts.pageNumber === this.totalPages) {
  5146. $next.addClass('disabled');
  5147. }
  5148. }
  5149. if (allSelected) {
  5150. opts.pageSize = opts.formatAllRows();
  5151. } // removed the events for last and first, onPageNumber executeds the same logic
  5152. $pageList.off('click').on('click', function (e) {
  5153. return _this6.onPageListChange(e);
  5154. });
  5155. $pre.off('click').on('click', function (e) {
  5156. return _this6.onPagePre(e);
  5157. });
  5158. $next.off('click').on('click', function (e) {
  5159. return _this6.onPageNext(e);
  5160. });
  5161. $number.off('click').on('click', function (e) {
  5162. return _this6.onPageNumber(e);
  5163. });
  5164. }
  5165. }
  5166. }, {
  5167. key: "updatePagination",
  5168. value: function updatePagination(event) {
  5169. // Fix #171: IE disabled button can be clicked bug.
  5170. if (event && $__default["default"](event.currentTarget).hasClass('disabled')) {
  5171. return;
  5172. }
  5173. if (!this.options.maintainMetaData) {
  5174. this.resetRows();
  5175. }
  5176. this.initPagination();
  5177. this.trigger('page-change', this.options.pageNumber, this.options.pageSize);
  5178. if (this.options.sidePagination === 'server') {
  5179. this.initServer();
  5180. } else {
  5181. this.initBody();
  5182. }
  5183. }
  5184. }, {
  5185. key: "onPageListChange",
  5186. value: function onPageListChange(event) {
  5187. event.preventDefault();
  5188. var $this = $__default["default"](event.currentTarget);
  5189. $this.parent().addClass(this.constants.classes.dropdownActive).siblings().removeClass(this.constants.classes.dropdownActive);
  5190. this.options.pageSize = $this.text().toUpperCase() === this.options.formatAllRows().toUpperCase() ? this.options.formatAllRows() : +$this.text();
  5191. this.$toolbar.find('.page-size').text(this.options.pageSize);
  5192. this.updatePagination(event);
  5193. return false;
  5194. }
  5195. }, {
  5196. key: "onPagePre",
  5197. value: function onPagePre(event) {
  5198. if ($__default["default"](event.target).hasClass('disabled')) {
  5199. return;
  5200. }
  5201. event.preventDefault();
  5202. if (this.options.pageNumber - 1 === 0) {
  5203. this.options.pageNumber = this.options.totalPages;
  5204. } else {
  5205. this.options.pageNumber--;
  5206. }
  5207. this.updatePagination(event);
  5208. return false;
  5209. }
  5210. }, {
  5211. key: "onPageNext",
  5212. value: function onPageNext(event) {
  5213. if ($__default["default"](event.target).hasClass('disabled')) {
  5214. return;
  5215. }
  5216. event.preventDefault();
  5217. if (this.options.pageNumber + 1 > this.options.totalPages) {
  5218. this.options.pageNumber = 1;
  5219. } else {
  5220. this.options.pageNumber++;
  5221. }
  5222. this.updatePagination(event);
  5223. return false;
  5224. }
  5225. }, {
  5226. key: "onPageNumber",
  5227. value: function onPageNumber(event) {
  5228. event.preventDefault();
  5229. if (this.options.pageNumber === +$__default["default"](event.currentTarget).text()) {
  5230. return;
  5231. }
  5232. this.options.pageNumber = +$__default["default"](event.currentTarget).text();
  5233. this.updatePagination(event);
  5234. return false;
  5235. } // eslint-disable-next-line no-unused-vars
  5236. }, {
  5237. key: "initRow",
  5238. value: function initRow(item, i, data, trFragments) {
  5239. var _this7 = this;
  5240. var html = [];
  5241. var style = {};
  5242. var csses = [];
  5243. var data_ = '';
  5244. var attributes = {};
  5245. var htmlAttributes = [];
  5246. if (Utils.findIndex(this.hiddenRows, item) > -1) {
  5247. return;
  5248. }
  5249. style = Utils.calculateObjectValue(this.options, this.options.rowStyle, [item, i], style);
  5250. if (style && style.css) {
  5251. for (var _i8 = 0, _Object$entries7 = Object.entries(style.css); _i8 < _Object$entries7.length; _i8++) {
  5252. var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
  5253. key = _Object$entries7$_i[0],
  5254. value = _Object$entries7$_i[1];
  5255. csses.push("".concat(key, ": ").concat(value));
  5256. }
  5257. }
  5258. attributes = Utils.calculateObjectValue(this.options, this.options.rowAttributes, [item, i], attributes);
  5259. if (attributes) {
  5260. for (var _i9 = 0, _Object$entries8 = Object.entries(attributes); _i9 < _Object$entries8.length; _i9++) {
  5261. var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
  5262. _key2 = _Object$entries8$_i[0],
  5263. _value = _Object$entries8$_i[1];
  5264. htmlAttributes.push("".concat(_key2, "=\"").concat(Utils.escapeHTML(_value), "\""));
  5265. }
  5266. }
  5267. if (item._data && !Utils.isEmptyObject(item._data)) {
  5268. for (var _i10 = 0, _Object$entries9 = Object.entries(item._data); _i10 < _Object$entries9.length; _i10++) {
  5269. var _Object$entries9$_i = _slicedToArray(_Object$entries9[_i10], 2),
  5270. k = _Object$entries9$_i[0],
  5271. v = _Object$entries9$_i[1];
  5272. // ignore data-index
  5273. if (k === 'index') {
  5274. return;
  5275. }
  5276. data_ += " data-".concat(k, "='").concat(_typeof(v) === 'object' ? JSON.stringify(v) : v, "'");
  5277. }
  5278. }
  5279. html.push('<tr', Utils.sprintf(' %s', htmlAttributes.length ? htmlAttributes.join(' ') : undefined), Utils.sprintf(' id="%s"', Array.isArray(item) ? undefined : item._id), Utils.sprintf(' class="%s"', style.classes || (Array.isArray(item) ? undefined : item._class)), Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style), " data-index=\"".concat(i, "\""), Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)), Utils.sprintf(' data-has-detail-view="%s"', this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined), Utils.sprintf('%s', data_), '>');
  5280. if (this.options.cardView) {
  5281. html.push("<td colspan=\"".concat(this.header.fields.length, "\"><div class=\"card-views\">"));
  5282. }
  5283. var detailViewTemplate = '';
  5284. if (Utils.hasDetailViewIcon(this.options)) {
  5285. detailViewTemplate = '<td>';
  5286. if (Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) {
  5287. detailViewTemplate += "\n <a class=\"detail-icon\" href=\"#\">\n ".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen), "\n </a>\n ");
  5288. }
  5289. detailViewTemplate += '</td>';
  5290. }
  5291. if (detailViewTemplate && this.options.detailViewAlign !== 'right') {
  5292. html.push(detailViewTemplate);
  5293. }
  5294. this.header.fields.forEach(function (field, j) {
  5295. var column = _this7.columns[j];
  5296. var text = '';
  5297. var value_ = Utils.getItemField(item, field, _this7.options.escape, column.escape);
  5298. var value = '';
  5299. var type = '';
  5300. var cellStyle = {};
  5301. var id_ = '';
  5302. var class_ = _this7.header.classes[j];
  5303. var style_ = '';
  5304. var styleToAdd_ = '';
  5305. var data_ = '';
  5306. var rowspan_ = '';
  5307. var colspan_ = '';
  5308. var title_ = '';
  5309. if ((_this7.fromHtml || _this7.autoMergeCells) && typeof value_ === 'undefined') {
  5310. if (!column.checkbox && !column.radio) {
  5311. return;
  5312. }
  5313. }
  5314. if (!column.visible) {
  5315. return;
  5316. }
  5317. if (_this7.options.cardView && !column.cardVisible) {
  5318. return;
  5319. }
  5320. if (column.escape) {
  5321. value_ = Utils.escapeHTML(value_);
  5322. } // Style concat
  5323. if (csses.concat([_this7.header.styles[j]]).length) {
  5324. styleToAdd_ += "".concat(csses.concat([_this7.header.styles[j]]).join('; '));
  5325. }
  5326. if (item["_".concat(field, "_style")]) {
  5327. styleToAdd_ += "".concat(item["_".concat(field, "_style")]);
  5328. }
  5329. if (styleToAdd_) {
  5330. style_ = " style=\"".concat(styleToAdd_, "\"");
  5331. } // Style concat
  5332. // handle id and class of td
  5333. if (item["_".concat(field, "_id")]) {
  5334. id_ = Utils.sprintf(' id="%s"', item["_".concat(field, "_id")]);
  5335. }
  5336. if (item["_".concat(field, "_class")]) {
  5337. class_ = Utils.sprintf(' class="%s"', item["_".concat(field, "_class")]);
  5338. }
  5339. if (item["_".concat(field, "_rowspan")]) {
  5340. rowspan_ = Utils.sprintf(' rowspan="%s"', item["_".concat(field, "_rowspan")]);
  5341. }
  5342. if (item["_".concat(field, "_colspan")]) {
  5343. colspan_ = Utils.sprintf(' colspan="%s"', item["_".concat(field, "_colspan")]);
  5344. }
  5345. if (item["_".concat(field, "_title")]) {
  5346. title_ = Utils.sprintf(' title="%s"', item["_".concat(field, "_title")]);
  5347. }
  5348. cellStyle = Utils.calculateObjectValue(_this7.header, _this7.header.cellStyles[j], [value_, item, i, field], cellStyle);
  5349. if (cellStyle.classes) {
  5350. class_ = " class=\"".concat(cellStyle.classes, "\"");
  5351. }
  5352. if (cellStyle.css) {
  5353. var csses_ = [];
  5354. for (var _i11 = 0, _Object$entries10 = Object.entries(cellStyle.css); _i11 < _Object$entries10.length; _i11++) {
  5355. var _Object$entries10$_i = _slicedToArray(_Object$entries10[_i11], 2),
  5356. _key3 = _Object$entries10$_i[0],
  5357. _value2 = _Object$entries10$_i[1];
  5358. csses_.push("".concat(_key3, ": ").concat(_value2));
  5359. }
  5360. style_ = " style=\"".concat(csses_.concat(_this7.header.styles[j]).join('; '), "\"");
  5361. }
  5362. value = Utils.calculateObjectValue(column, _this7.header.formatters[j], [value_, item, i, field], value_);
  5363. if (!(column.checkbox || column.radio)) {
  5364. value = typeof value === 'undefined' || value === null ? _this7.options.undefinedText : value;
  5365. }
  5366. if (column.searchable && _this7.searchText && _this7.options.searchHighlight && !(column.checkbox || column.radio)) {
  5367. var defValue = '';
  5368. var regExp = new RegExp("(".concat(_this7.searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), ")"), 'gim');
  5369. var marker = '<mark>$1</mark>';
  5370. var isHTML = value && /<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i.test(value);
  5371. if (isHTML) {
  5372. // value can contains a HTML tags
  5373. var textContent = new DOMParser().parseFromString(value.toString(), 'text/html').documentElement.textContent;
  5374. var textReplaced = textContent.replace(regExp, marker);
  5375. textContent = textContent.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
  5376. defValue = value.replace(new RegExp("(>\\s*)(".concat(textContent, ")(\\s*)"), 'gm'), "$1".concat(textReplaced, "$3"));
  5377. } else {
  5378. // but usually not
  5379. defValue = value.toString().replace(regExp, marker);
  5380. }
  5381. value = Utils.calculateObjectValue(column, column.searchHighlightFormatter, [value, _this7.searchText], defValue);
  5382. }
  5383. if (item["_".concat(field, "_data")] && !Utils.isEmptyObject(item["_".concat(field, "_data")])) {
  5384. for (var _i12 = 0, _Object$entries11 = Object.entries(item["_".concat(field, "_data")]); _i12 < _Object$entries11.length; _i12++) {
  5385. var _Object$entries11$_i = _slicedToArray(_Object$entries11[_i12], 2),
  5386. _k = _Object$entries11$_i[0],
  5387. _v = _Object$entries11$_i[1];
  5388. // ignore data-index
  5389. if (_k === 'index') {
  5390. return;
  5391. }
  5392. data_ += " data-".concat(_k, "=\"").concat(_v, "\"");
  5393. }
  5394. }
  5395. if (column.checkbox || column.radio) {
  5396. type = column.checkbox ? 'checkbox' : type;
  5397. type = column.radio ? 'radio' : type;
  5398. var c = column['class'] || '';
  5399. var isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ? value.checked : (value === true || value_) && value !== false;
  5400. var isDisabled = !column.checkboxEnabled || value && value.disabled;
  5401. text = [_this7.options.cardView ? "<div class=\"card-view ".concat(c, "\">") : "<td class=\"bs-checkbox ".concat(c, "\"").concat(class_).concat(style_, ">"), "<label>\n <input\n data-index=\"".concat(i, "\"\n name=\"").concat(_this7.options.selectItemName, "\"\n type=\"").concat(type, "\"\n ").concat(Utils.sprintf('value="%s"', item[_this7.options.idField]), "\n ").concat(Utils.sprintf('checked="%s"', isChecked ? 'checked' : undefined), "\n ").concat(Utils.sprintf('disabled="%s"', isDisabled ? 'disabled' : undefined), " />\n <span></span>\n </label>"), _this7.header.formatters[j] && typeof value === 'string' ? value : '', _this7.options.cardView ? '</div>' : '</td>'].join('');
  5402. item[_this7.header.stateField] = value === true || !!value_ || value && value.checked;
  5403. } else if (_this7.options.cardView) {
  5404. var cardTitle = _this7.options.showHeader ? "<span class=\"card-view-title ".concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(Utils.getFieldTitle(_this7.columns, field), "</span>") : '';
  5405. text = "<div class=\"card-view\">".concat(cardTitle, "<span class=\"card-view-value ").concat(cellStyle.classes || '', "\"").concat(style_, ">").concat(value, "</span></div>");
  5406. if (_this7.options.smartDisplay && value === '') {
  5407. text = '<div class="card-view"></div>';
  5408. }
  5409. } else {
  5410. text = "<td".concat(id_).concat(class_).concat(style_).concat(data_).concat(rowspan_).concat(colspan_).concat(title_, ">").concat(value, "</td>");
  5411. }
  5412. html.push(text);
  5413. });
  5414. if (detailViewTemplate && this.options.detailViewAlign === 'right') {
  5415. html.push(detailViewTemplate);
  5416. }
  5417. if (this.options.cardView) {
  5418. html.push('</div></td>');
  5419. }
  5420. html.push('</tr>');
  5421. return html.join('');
  5422. }
  5423. }, {
  5424. key: "initBody",
  5425. value: function initBody(fixedScroll, updatedUid) {
  5426. var _this8 = this;
  5427. var data = this.getData();
  5428. this.trigger('pre-body', data);
  5429. this.$body = this.$el.find('>tbody');
  5430. if (!this.$body.length) {
  5431. this.$body = $__default["default"]('<tbody></tbody>').appendTo(this.$el);
  5432. } // Fix #389 Bootstrap-table-flatJSON is not working
  5433. if (!this.options.pagination || this.options.sidePagination === 'server') {
  5434. this.pageFrom = 1;
  5435. this.pageTo = data.length;
  5436. }
  5437. var rows = [];
  5438. var trFragments = $__default["default"](document.createDocumentFragment());
  5439. var hasTr = false;
  5440. var toExpand = [];
  5441. this.autoMergeCells = Utils.checkAutoMergeCells(data.slice(this.pageFrom - 1, this.pageTo));
  5442. for (var i = this.pageFrom - 1; i < this.pageTo; i++) {
  5443. var item = data[i];
  5444. var tr = this.initRow(item, i, data, trFragments);
  5445. hasTr = hasTr || !!tr;
  5446. if (tr && typeof tr === 'string') {
  5447. var uniqueId = this.options.uniqueId;
  5448. if (uniqueId && item.hasOwnProperty(uniqueId)) {
  5449. var itemUniqueId = item[uniqueId];
  5450. var oldTr = this.$body.find(Utils.sprintf('> tr[data-uniqueid="%s"][data-has-detail-view]', itemUniqueId));
  5451. var oldTrNext = oldTr.next();
  5452. if (oldTrNext.is('tr.detail-view')) {
  5453. toExpand.push(i);
  5454. if (!updatedUid || itemUniqueId !== updatedUid) {
  5455. tr += oldTrNext[0].outerHTML;
  5456. }
  5457. }
  5458. }
  5459. if (!this.options.virtualScroll) {
  5460. trFragments.append(tr);
  5461. } else {
  5462. rows.push(tr);
  5463. }
  5464. }
  5465. } // show no records
  5466. if (!hasTr) {
  5467. this.$body.html("<tr class=\"no-records-found\">".concat(Utils.sprintf('<td colspan="%s">%s</td>', this.getVisibleFields().length + Utils.getDetailViewIndexOffset(this.options), this.options.formatNoMatches()), "</tr>"));
  5468. } else if (!this.options.virtualScroll) {
  5469. this.$body.html(trFragments);
  5470. } else {
  5471. if (this.virtualScroll) {
  5472. this.virtualScroll.destroy();
  5473. }
  5474. this.virtualScroll = new VirtualScroll({
  5475. rows: rows,
  5476. fixedScroll: fixedScroll,
  5477. scrollEl: this.$tableBody[0],
  5478. contentEl: this.$body[0],
  5479. itemHeight: this.options.virtualScrollItemHeight,
  5480. callback: function callback(startIndex, endIndex) {
  5481. _this8.fitHeader();
  5482. _this8.initBodyEvent();
  5483. _this8.trigger('virtual-scroll', startIndex, endIndex);
  5484. }
  5485. });
  5486. }
  5487. toExpand.forEach(function (index) {
  5488. _this8.expandRow(index);
  5489. });
  5490. if (!fixedScroll) {
  5491. this.scrollTo(0);
  5492. }
  5493. this.initBodyEvent();
  5494. this.initFooter();
  5495. this.resetView();
  5496. this.updateSelected();
  5497. if (this.options.sidePagination !== 'server') {
  5498. this.options.totalRows = data.length;
  5499. }
  5500. this.trigger('post-body', data);
  5501. }
  5502. }, {
  5503. key: "initBodyEvent",
  5504. value: function initBodyEvent() {
  5505. var _this9 = this;
  5506. // click to select by column
  5507. this.$body.find('> tr[data-index] > td').off('click dblclick').on('click dblclick', function (e) {
  5508. var $td = $__default["default"](e.currentTarget);
  5509. var $tr = $td.parent();
  5510. var $cardViewArr = $__default["default"](e.target).parents('.card-views').children();
  5511. var $cardViewTarget = $__default["default"](e.target).parents('.card-view');
  5512. var rowIndex = $tr.data('index');
  5513. var item = _this9.data[rowIndex];
  5514. var index = _this9.options.cardView ? $cardViewArr.index($cardViewTarget) : $td[0].cellIndex;
  5515. var fields = _this9.getVisibleFields();
  5516. var field = fields[index - Utils.getDetailViewIndexOffset(_this9.options)];
  5517. var column = _this9.columns[_this9.fieldsColumnsIndex[field]];
  5518. var value = Utils.getItemField(item, field, _this9.options.escape, column.escape);
  5519. if ($td.find('.detail-icon').length) {
  5520. return;
  5521. }
  5522. _this9.trigger(e.type === 'click' ? 'click-cell' : 'dbl-click-cell', field, value, item, $td);
  5523. _this9.trigger(e.type === 'click' ? 'click-row' : 'dbl-click-row', item, $tr, field); // if click to select - then trigger the checkbox/radio click
  5524. if (e.type === 'click' && _this9.options.clickToSelect && column.clickToSelect && !Utils.calculateObjectValue(_this9.options, _this9.options.ignoreClickToSelectOn, [e.target])) {
  5525. var $selectItem = $tr.find(Utils.sprintf('[name="%s"]', _this9.options.selectItemName));
  5526. if ($selectItem.length) {
  5527. $selectItem[0].click();
  5528. }
  5529. }
  5530. if (e.type === 'click' && _this9.options.detailViewByClick) {
  5531. _this9.toggleDetailView(rowIndex, _this9.header.detailFormatters[_this9.fieldsColumnsIndex[field]]);
  5532. }
  5533. }).off('mousedown').on('mousedown', function (e) {
  5534. // https://github.com/jquery/jquery/issues/1741
  5535. _this9.multipleSelectRowCtrlKey = e.ctrlKey || e.metaKey;
  5536. _this9.multipleSelectRowShiftKey = e.shiftKey;
  5537. });
  5538. this.$body.find('> tr[data-index] > td > .detail-icon').off('click').on('click', function (e) {
  5539. e.preventDefault();
  5540. _this9.toggleDetailView($__default["default"](e.currentTarget).parent().parent().data('index'));
  5541. return false;
  5542. });
  5543. this.$selectItem = this.$body.find(Utils.sprintf('[name="%s"]', this.options.selectItemName));
  5544. this.$selectItem.off('click').on('click', function (e) {
  5545. e.stopImmediatePropagation();
  5546. var $this = $__default["default"](e.currentTarget);
  5547. _this9._toggleCheck($this.prop('checked'), $this.data('index'));
  5548. });
  5549. this.header.events.forEach(function (_events, i) {
  5550. var events = _events;
  5551. if (!events) {
  5552. return;
  5553. } // fix bug, if events is defined with namespace
  5554. if (typeof events === 'string') {
  5555. events = Utils.calculateObjectValue(null, events);
  5556. }
  5557. if (!events) {
  5558. throw new Error("Unknown event in the scope: ".concat(_events));
  5559. }
  5560. var field = _this9.header.fields[i];
  5561. var fieldIndex = _this9.getVisibleFields().indexOf(field);
  5562. if (fieldIndex === -1) {
  5563. return;
  5564. }
  5565. fieldIndex += Utils.getDetailViewIndexOffset(_this9.options);
  5566. var _loop2 = function _loop2(key) {
  5567. if (!events.hasOwnProperty(key)) {
  5568. return "continue";
  5569. }
  5570. var event = events[key];
  5571. _this9.$body.find('>tr:not(.no-records-found)').each(function (i, tr) {
  5572. var $tr = $__default["default"](tr);
  5573. var $td = $tr.find(_this9.options.cardView ? '.card-views>.card-view' : '>td').eq(fieldIndex);
  5574. var index = key.indexOf(' ');
  5575. var name = key.substring(0, index);
  5576. var el = key.substring(index + 1);
  5577. $td.find(el).off(name).on(name, function (e) {
  5578. var index = $tr.data('index');
  5579. var row = _this9.data[index];
  5580. var value = row[field];
  5581. event.apply(_this9, [e, value, row, index]);
  5582. });
  5583. });
  5584. };
  5585. for (var key in events) {
  5586. var _ret2 = _loop2(key);
  5587. if (_ret2 === "continue") continue;
  5588. }
  5589. });
  5590. }
  5591. }, {
  5592. key: "initServer",
  5593. value: function initServer(silent, query, url) {
  5594. var _this10 = this;
  5595. var data = {};
  5596. var index = this.header.fields.indexOf(this.options.sortName);
  5597. var params = {
  5598. searchText: this.searchText,
  5599. sortName: this.options.sortName,
  5600. sortOrder: this.options.sortOrder
  5601. };
  5602. if (this.header.sortNames[index]) {
  5603. params.sortName = this.header.sortNames[index];
  5604. }
  5605. if (this.options.pagination && this.options.sidePagination === 'server') {
  5606. params.pageSize = this.options.pageSize === this.options.formatAllRows() ? this.options.totalRows : this.options.pageSize;
  5607. params.pageNumber = this.options.pageNumber;
  5608. }
  5609. if (!(url || this.options.url) && !this.options.ajax) {
  5610. return;
  5611. }
  5612. if (this.options.queryParamsType === 'limit') {
  5613. params = {
  5614. search: params.searchText,
  5615. sort: params.sortName,
  5616. order: params.sortOrder
  5617. };
  5618. if (this.options.pagination && this.options.sidePagination === 'server') {
  5619. params.offset = this.options.pageSize === this.options.formatAllRows() ? 0 : this.options.pageSize * (this.options.pageNumber - 1);
  5620. params.limit = this.options.pageSize;
  5621. if (params.limit === 0 || this.options.pageSize === this.options.formatAllRows()) {
  5622. delete params.limit;
  5623. }
  5624. }
  5625. }
  5626. if (this.options.search && this.options.sidePagination === 'server' && this.columns.filter(function (column) {
  5627. return !column.searchable;
  5628. }).length) {
  5629. params.searchable = [];
  5630. var _iterator2 = _createForOfIteratorHelper(this.columns),
  5631. _step2;
  5632. try {
  5633. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  5634. var column = _step2.value;
  5635. if (!column.checkbox && column.searchable && (this.options.visibleSearch && column.visible || !this.options.visibleSearch)) {
  5636. params.searchable.push(column.field);
  5637. }
  5638. }
  5639. } catch (err) {
  5640. _iterator2.e(err);
  5641. } finally {
  5642. _iterator2.f();
  5643. }
  5644. }
  5645. if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
  5646. params.filter = JSON.stringify(this.filterColumnsPartial, null);
  5647. }
  5648. $__default["default"].extend(params, query || {});
  5649. data = Utils.calculateObjectValue(this.options, this.options.queryParams, [params], data); // false to stop request
  5650. if (data === false) {
  5651. return;
  5652. }
  5653. if (!silent) {
  5654. this.showLoading();
  5655. }
  5656. var request = $__default["default"].extend({}, Utils.calculateObjectValue(null, this.options.ajaxOptions), {
  5657. type: this.options.method,
  5658. url: url || this.options.url,
  5659. data: this.options.contentType === 'application/json' && this.options.method === 'post' ? JSON.stringify(data) : data,
  5660. cache: this.options.cache,
  5661. contentType: this.options.contentType,
  5662. dataType: this.options.dataType,
  5663. success: function success(_res, textStatus, jqXHR) {
  5664. var res = Utils.calculateObjectValue(_this10.options, _this10.options.responseHandler, [_res, jqXHR], _res);
  5665. _this10.load(res);
  5666. _this10.trigger('load-success', res, jqXHR && jqXHR.status, jqXHR);
  5667. if (!silent) {
  5668. _this10.hideLoading();
  5669. }
  5670. if (_this10.options.sidePagination === 'server' && _this10.options.pageNumber > 1 && res[_this10.options.totalField] > 0 && !res[_this10.options.dataField].length) {
  5671. _this10.updatePagination();
  5672. }
  5673. },
  5674. error: function error(jqXHR) {
  5675. // abort ajax by multiple request
  5676. if (jqXHR && jqXHR.status === 0 && _this10._xhrAbort) {
  5677. _this10._xhrAbort = false;
  5678. return;
  5679. }
  5680. var data = [];
  5681. if (_this10.options.sidePagination === 'server') {
  5682. data = {};
  5683. data[_this10.options.totalField] = 0;
  5684. data[_this10.options.dataField] = [];
  5685. }
  5686. _this10.load(data);
  5687. _this10.trigger('load-error', jqXHR && jqXHR.status, jqXHR);
  5688. if (!silent) {
  5689. _this10.hideLoading();
  5690. }
  5691. }
  5692. });
  5693. if (this.options.ajax) {
  5694. Utils.calculateObjectValue(this, this.options.ajax, [request], null);
  5695. } else {
  5696. if (this._xhr && this._xhr.readyState !== 4) {
  5697. this._xhrAbort = true;
  5698. this._xhr.abort();
  5699. }
  5700. this._xhr = $__default["default"].ajax(request);
  5701. }
  5702. return data;
  5703. }
  5704. }, {
  5705. key: "initSearchText",
  5706. value: function initSearchText() {
  5707. if (this.options.search) {
  5708. this.searchText = '';
  5709. if (this.options.searchText !== '') {
  5710. var $search = Utils.getSearchInput(this);
  5711. $search.val(this.options.searchText);
  5712. this.onSearch({
  5713. currentTarget: $search,
  5714. firedByInitSearchText: true
  5715. });
  5716. }
  5717. }
  5718. }
  5719. }, {
  5720. key: "getCaret",
  5721. value: function getCaret() {
  5722. var _this11 = this;
  5723. this.$header.find('th').each(function (i, th) {
  5724. $__default["default"](th).find('.sortable').removeClass('desc asc').addClass($__default["default"](th).data('field') === _this11.options.sortName ? _this11.options.sortOrder : 'both');
  5725. });
  5726. }
  5727. }, {
  5728. key: "updateSelected",
  5729. value: function updateSelected() {
  5730. var checkAll = this.$selectItem.filter(':enabled').length && this.$selectItem.filter(':enabled').length === this.$selectItem.filter(':enabled').filter(':checked').length;
  5731. this.$selectAll.add(this.$selectAll_).prop('checked', checkAll);
  5732. this.$selectItem.each(function (i, el) {
  5733. $__default["default"](el).closest('tr')[$__default["default"](el).prop('checked') ? 'addClass' : 'removeClass']('selected');
  5734. });
  5735. }
  5736. }, {
  5737. key: "updateRows",
  5738. value: function updateRows() {
  5739. var _this12 = this;
  5740. this.$selectItem.each(function (i, el) {
  5741. _this12.data[$__default["default"](el).data('index')][_this12.header.stateField] = $__default["default"](el).prop('checked');
  5742. });
  5743. }
  5744. }, {
  5745. key: "resetRows",
  5746. value: function resetRows() {
  5747. var _iterator3 = _createForOfIteratorHelper(this.data),
  5748. _step3;
  5749. try {
  5750. for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
  5751. var row = _step3.value;
  5752. this.$selectAll.prop('checked', false);
  5753. this.$selectItem.prop('checked', false);
  5754. if (this.header.stateField) {
  5755. row[this.header.stateField] = false;
  5756. }
  5757. }
  5758. } catch (err) {
  5759. _iterator3.e(err);
  5760. } finally {
  5761. _iterator3.f();
  5762. }
  5763. this.initHiddenRows();
  5764. }
  5765. }, {
  5766. key: "trigger",
  5767. value: function trigger(_name) {
  5768. var _this$options, _this$options2;
  5769. var name = "".concat(_name, ".bs.table");
  5770. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key4 = 1; _key4 < _len; _key4++) {
  5771. args[_key4 - 1] = arguments[_key4];
  5772. }
  5773. (_this$options = this.options)[BootstrapTable.EVENTS[name]].apply(_this$options, [].concat(args, [this]));
  5774. this.$el.trigger($__default["default"].Event(name, {
  5775. sender: this
  5776. }), args);
  5777. (_this$options2 = this.options).onAll.apply(_this$options2, [name].concat([].concat(args, [this])));
  5778. this.$el.trigger($__default["default"].Event('all.bs.table', {
  5779. sender: this
  5780. }), [name, args]);
  5781. }
  5782. }, {
  5783. key: "resetHeader",
  5784. value: function resetHeader() {
  5785. var _this13 = this;
  5786. // fix #61: the hidden table reset header bug.
  5787. // fix bug: get $el.css('width') error sometime (height = 500)
  5788. clearTimeout(this.timeoutId_);
  5789. this.timeoutId_ = setTimeout(function () {
  5790. return _this13.fitHeader();
  5791. }, this.$el.is(':hidden') ? 100 : 0);
  5792. }
  5793. }, {
  5794. key: "fitHeader",
  5795. value: function fitHeader() {
  5796. var _this14 = this;
  5797. if (this.$el.is(':hidden')) {
  5798. this.timeoutId_ = setTimeout(function () {
  5799. return _this14.fitHeader();
  5800. }, 100);
  5801. return;
  5802. }
  5803. var fixedBody = this.$tableBody.get(0);
  5804. var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  5805. this.$el.css('margin-top', -this.$header.outerHeight());
  5806. var focused = $__default["default"](':focus');
  5807. if (focused.length > 0) {
  5808. var $th = focused.parents('th');
  5809. if ($th.length > 0) {
  5810. var dataField = $th.attr('data-field');
  5811. if (dataField !== undefined) {
  5812. var $headerTh = this.$header.find("[data-field='".concat(dataField, "']"));
  5813. if ($headerTh.length > 0) {
  5814. $headerTh.find(':input').addClass('focus-temp');
  5815. }
  5816. }
  5817. }
  5818. }
  5819. this.$header_ = this.$header.clone(true, true);
  5820. this.$selectAll_ = this.$header_.find('[name="btSelectAll"]');
  5821. this.$tableHeader.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).html('').attr('class', this.$el.attr('class')).append(this.$header_);
  5822. this.$tableLoading.css('width', this.$el.outerWidth());
  5823. var focusedTemp = $__default["default"]('.focus-temp:visible:eq(0)');
  5824. if (focusedTemp.length > 0) {
  5825. focusedTemp.focus();
  5826. this.$header.find('.focus-temp').removeClass('focus-temp');
  5827. } // fix bug: $.data() is not working as expected after $.append()
  5828. this.$header.find('th[data-field]').each(function (i, el) {
  5829. _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', $__default["default"](el).data('field'))).data($__default["default"](el).data());
  5830. });
  5831. var visibleFields = this.getVisibleFields();
  5832. var $ths = this.$header_.find('th');
  5833. var $tr = this.$body.find('>tr:not(.no-records-found,.virtual-scroll-top)').eq(0);
  5834. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  5835. $tr = $tr.next();
  5836. }
  5837. var trLength = $tr.find('> *').length;
  5838. $tr.find('> *').each(function (i, el) {
  5839. var $this = $__default["default"](el);
  5840. if (Utils.hasDetailViewIcon(_this14.options)) {
  5841. if (i === 0 && _this14.options.detailViewAlign !== 'right' || i === trLength - 1 && _this14.options.detailViewAlign === 'right') {
  5842. var $thDetail = $ths.filter('.detail');
  5843. var _zoomWidth = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  5844. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth);
  5845. return;
  5846. }
  5847. }
  5848. var index = i - Utils.getDetailViewIndexOffset(_this14.options);
  5849. var $th = _this14.$header_.find(Utils.sprintf('th[data-field="%s"]', visibleFields[index]));
  5850. if ($th.length > 1) {
  5851. $th = $__default["default"]($ths[$this[0].cellIndex]);
  5852. }
  5853. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  5854. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  5855. });
  5856. this.horizontalScroll();
  5857. this.trigger('post-header');
  5858. }
  5859. }, {
  5860. key: "initFooter",
  5861. value: function initFooter() {
  5862. if (!this.options.showFooter || this.options.cardView) {
  5863. // do nothing
  5864. return;
  5865. }
  5866. var data = this.getData();
  5867. var html = [];
  5868. var detailTemplate = '';
  5869. if (Utils.hasDetailViewIcon(this.options)) {
  5870. detailTemplate = '<th class="detail"><div class="th-inner"></div><div class="fht-cell"></div></th>';
  5871. }
  5872. if (detailTemplate && this.options.detailViewAlign !== 'right') {
  5873. html.push(detailTemplate);
  5874. }
  5875. var _iterator4 = _createForOfIteratorHelper(this.columns),
  5876. _step4;
  5877. try {
  5878. for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
  5879. var column = _step4.value;
  5880. var falign = '';
  5881. var valign = '';
  5882. var csses = [];
  5883. var style = {};
  5884. var class_ = Utils.sprintf(' class="%s"', column['class']);
  5885. if (!column.visible || this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])) {
  5886. continue;
  5887. }
  5888. if (this.options.cardView && !column.cardVisible) {
  5889. return;
  5890. }
  5891. falign = Utils.sprintf('text-align: %s; ', column.falign ? column.falign : column.align);
  5892. valign = Utils.sprintf('vertical-align: %s; ', column.valign);
  5893. style = Utils.calculateObjectValue(null, this.options.footerStyle, [column]);
  5894. if (style && style.css) {
  5895. for (var _i13 = 0, _Object$entries12 = Object.entries(style.css); _i13 < _Object$entries12.length; _i13++) {
  5896. var _Object$entries12$_i = _slicedToArray(_Object$entries12[_i13], 2),
  5897. key = _Object$entries12$_i[0],
  5898. _value3 = _Object$entries12$_i[1];
  5899. csses.push("".concat(key, ": ").concat(_value3));
  5900. }
  5901. }
  5902. if (style && style.classes) {
  5903. class_ = Utils.sprintf(' class="%s"', column['class'] ? [column['class'], style.classes].join(' ') : style.classes);
  5904. }
  5905. html.push('<th', class_, Utils.sprintf(' style="%s"', falign + valign + csses.concat().join('; ')));
  5906. var colspan = 0;
  5907. if (this.footerData && this.footerData.length > 0) {
  5908. colspan = this.footerData[0]["_".concat(column.field, "_colspan")] || 0;
  5909. }
  5910. if (colspan) {
  5911. html.push(" colspan=\"".concat(colspan, "\" "));
  5912. }
  5913. html.push('>');
  5914. html.push('<div class="th-inner">');
  5915. var value = '';
  5916. if (this.footerData && this.footerData.length > 0) {
  5917. value = this.footerData[0][column.field] || '';
  5918. }
  5919. html.push(Utils.calculateObjectValue(column, column.footerFormatter, [data, value], value));
  5920. html.push('</div>');
  5921. html.push('<div class="fht-cell"></div>');
  5922. html.push('</div>');
  5923. html.push('</th>');
  5924. }
  5925. } catch (err) {
  5926. _iterator4.e(err);
  5927. } finally {
  5928. _iterator4.f();
  5929. }
  5930. if (detailTemplate && this.options.detailViewAlign === 'right') {
  5931. html.push(detailTemplate);
  5932. }
  5933. if (!this.options.height && !this.$tableFooter.length) {
  5934. this.$el.append('<tfoot><tr></tr></tfoot>');
  5935. this.$tableFooter = this.$el.find('tfoot');
  5936. }
  5937. if (!this.$tableFooter.find('tr').length) {
  5938. this.$tableFooter.html('<table><thead><tr></tr></thead></table>');
  5939. }
  5940. this.$tableFooter.find('tr').html(html.join(''));
  5941. this.trigger('post-footer', this.$tableFooter);
  5942. }
  5943. }, {
  5944. key: "fitFooter",
  5945. value: function fitFooter() {
  5946. var _this15 = this;
  5947. if (this.$el.is(':hidden')) {
  5948. setTimeout(function () {
  5949. return _this15.fitFooter();
  5950. }, 100);
  5951. return;
  5952. }
  5953. var fixedBody = this.$tableBody.get(0);
  5954. var scrollWidth = this.hasScrollBar && fixedBody.scrollHeight > fixedBody.clientHeight + this.$header.outerHeight() ? Utils.getScrollBarWidth() : 0;
  5955. this.$tableFooter.css('margin-right', scrollWidth).find('table').css('width', this.$el.outerWidth()).attr('class', this.$el.attr('class'));
  5956. var $ths = this.$tableFooter.find('th');
  5957. var $tr = this.$body.find('>tr:first-child:not(.no-records-found)');
  5958. $ths.find('.fht-cell').width('auto');
  5959. while ($tr.length && $tr.find('>td[colspan]:not([colspan="1"])').length) {
  5960. $tr = $tr.next();
  5961. }
  5962. var trLength = $tr.find('> *').length;
  5963. $tr.find('> *').each(function (i, el) {
  5964. var $this = $__default["default"](el);
  5965. if (Utils.hasDetailViewIcon(_this15.options)) {
  5966. if (i === 0 && _this15.options.detailViewAlign === 'left' || i === trLength - 1 && _this15.options.detailViewAlign === 'right') {
  5967. var $thDetail = $ths.filter('.detail');
  5968. var _zoomWidth2 = $thDetail.innerWidth() - $thDetail.find('.fht-cell').width();
  5969. $thDetail.find('.fht-cell').width($this.innerWidth() - _zoomWidth2);
  5970. return;
  5971. }
  5972. }
  5973. var $th = $ths.eq(i);
  5974. var zoomWidth = $th.innerWidth() - $th.find('.fht-cell').width();
  5975. $th.find('.fht-cell').width($this.innerWidth() - zoomWidth);
  5976. });
  5977. this.horizontalScroll();
  5978. }
  5979. }, {
  5980. key: "horizontalScroll",
  5981. value: function horizontalScroll() {
  5982. var _this16 = this;
  5983. // horizontal scroll event
  5984. // TODO: it's probably better improving the layout than binding to scroll event
  5985. this.$tableBody.off('scroll').on('scroll', function () {
  5986. var scrollLeft = _this16.$tableBody.scrollLeft();
  5987. if (_this16.options.showHeader && _this16.options.height) {
  5988. _this16.$tableHeader.scrollLeft(scrollLeft);
  5989. }
  5990. if (_this16.options.showFooter && !_this16.options.cardView) {
  5991. _this16.$tableFooter.scrollLeft(scrollLeft);
  5992. }
  5993. _this16.trigger('scroll-body', _this16.$tableBody);
  5994. });
  5995. }
  5996. }, {
  5997. key: "getVisibleFields",
  5998. value: function getVisibleFields() {
  5999. var visibleFields = [];
  6000. var _iterator5 = _createForOfIteratorHelper(this.header.fields),
  6001. _step5;
  6002. try {
  6003. for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
  6004. var field = _step5.value;
  6005. var column = this.columns[this.fieldsColumnsIndex[field]];
  6006. if (!column || !column.visible || this.options.cardView && !column.cardVisible) {
  6007. continue;
  6008. }
  6009. visibleFields.push(field);
  6010. }
  6011. } catch (err) {
  6012. _iterator5.e(err);
  6013. } finally {
  6014. _iterator5.f();
  6015. }
  6016. return visibleFields;
  6017. }
  6018. }, {
  6019. key: "initHiddenRows",
  6020. value: function initHiddenRows() {
  6021. this.hiddenRows = [];
  6022. } // PUBLIC FUNCTION DEFINITION
  6023. // =======================
  6024. }, {
  6025. key: "getOptions",
  6026. value: function getOptions() {
  6027. // deep copy and remove data
  6028. var options = $__default["default"].extend({}, this.options);
  6029. delete options.data;
  6030. return $__default["default"].extend(true, {}, options);
  6031. }
  6032. }, {
  6033. key: "refreshOptions",
  6034. value: function refreshOptions(options) {
  6035. // If the objects are equivalent then avoid the call of destroy / init methods
  6036. if (Utils.compareObjects(this.options, options, true)) {
  6037. return;
  6038. }
  6039. this.options = $__default["default"].extend(this.options, options);
  6040. this.trigger('refresh-options', this.options);
  6041. this.destroy();
  6042. this.init();
  6043. }
  6044. }, {
  6045. key: "getData",
  6046. value: function getData(params) {
  6047. var _this17 = this;
  6048. var data = this.options.data;
  6049. if ((this.searchText || this.options.customSearch || this.options.sortName !== undefined || this.enableCustomSort || // Fix #4616: this.enableCustomSort is for extensions
  6050. !Utils.isEmptyObject(this.filterColumns) || !Utils.isEmptyObject(this.filterColumnsPartial)) && (!params || !params.unfiltered)) {
  6051. data = this.data;
  6052. }
  6053. if (params && params.useCurrentPage) {
  6054. data = data.slice(this.pageFrom - 1, this.pageTo);
  6055. }
  6056. if (params && !params.includeHiddenRows) {
  6057. var hiddenRows = this.getHiddenRows();
  6058. data = data.filter(function (row) {
  6059. return Utils.findIndex(hiddenRows, row) === -1;
  6060. });
  6061. }
  6062. if (params && params.formatted) {
  6063. data.forEach(function (row) {
  6064. for (var _i14 = 0, _Object$entries13 = Object.entries(row); _i14 < _Object$entries13.length; _i14++) {
  6065. var _Object$entries13$_i = _slicedToArray(_Object$entries13[_i14], 2),
  6066. key = _Object$entries13$_i[0],
  6067. value = _Object$entries13$_i[1];
  6068. var column = _this17.columns[_this17.fieldsColumnsIndex[key]];
  6069. if (!column) {
  6070. return;
  6071. }
  6072. row[key] = Utils.calculateObjectValue(column, _this17.header.formatters[column.fieldIndex], [value, row, row.index, column.field], value);
  6073. }
  6074. });
  6075. }
  6076. return data;
  6077. }
  6078. }, {
  6079. key: "getSelections",
  6080. value: function getSelections() {
  6081. var _this18 = this;
  6082. return (this.options.maintainMetaData ? this.options.data : this.data).filter(function (row) {
  6083. return row[_this18.header.stateField] === true;
  6084. });
  6085. }
  6086. }, {
  6087. key: "load",
  6088. value: function load(_data) {
  6089. var fixedScroll = false;
  6090. var data = _data; // #431: support pagination
  6091. if (this.options.pagination && this.options.sidePagination === 'server') {
  6092. this.options.totalRows = data[this.options.totalField];
  6093. this.options.totalNotFiltered = data[this.options.totalNotFilteredField];
  6094. this.footerData = data[this.options.footerField] ? [data[this.options.footerField]] : undefined;
  6095. }
  6096. fixedScroll = data.fixedScroll;
  6097. data = Array.isArray(data) ? data : data[this.options.dataField];
  6098. this.initData(data);
  6099. this.initSearch();
  6100. this.initPagination();
  6101. this.initBody(fixedScroll);
  6102. }
  6103. }, {
  6104. key: "append",
  6105. value: function append(data) {
  6106. this.initData(data, 'append');
  6107. this.initSearch();
  6108. this.initPagination();
  6109. this.initSort();
  6110. this.initBody(true);
  6111. }
  6112. }, {
  6113. key: "prepend",
  6114. value: function prepend(data) {
  6115. this.initData(data, 'prepend');
  6116. this.initSearch();
  6117. this.initPagination();
  6118. this.initSort();
  6119. this.initBody(true);
  6120. }
  6121. }, {
  6122. key: "remove",
  6123. value: function remove(params) {
  6124. var removed = 0;
  6125. for (var i = this.options.data.length - 1; i >= 0; i--) {
  6126. var row = this.options.data[i];
  6127. if (!row.hasOwnProperty(params.field) && params.field !== '$index') {
  6128. continue;
  6129. }
  6130. if (!row.hasOwnProperty(params.field) && params.field === '$index' && params.values.includes(i) || params.values.includes(row[params.field])) {
  6131. removed++;
  6132. this.options.data.splice(i, 1);
  6133. }
  6134. }
  6135. if (!removed) {
  6136. return;
  6137. }
  6138. if (this.options.sidePagination === 'server') {
  6139. this.options.totalRows -= removed;
  6140. this.data = _toConsumableArray(this.options.data);
  6141. }
  6142. this.initSearch();
  6143. this.initPagination();
  6144. this.initSort();
  6145. this.initBody(true);
  6146. }
  6147. }, {
  6148. key: "removeAll",
  6149. value: function removeAll() {
  6150. if (this.options.data.length > 0) {
  6151. this.options.data.splice(0, this.options.data.length);
  6152. this.initSearch();
  6153. this.initPagination();
  6154. this.initBody(true);
  6155. }
  6156. }
  6157. }, {
  6158. key: "insertRow",
  6159. value: function insertRow(params) {
  6160. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
  6161. return;
  6162. }
  6163. this.options.data.splice(params.index, 0, params.row);
  6164. this.initSearch();
  6165. this.initPagination();
  6166. this.initSort();
  6167. this.initBody(true);
  6168. }
  6169. }, {
  6170. key: "updateRow",
  6171. value: function updateRow(params) {
  6172. var allParams = Array.isArray(params) ? params : [params];
  6173. var _iterator6 = _createForOfIteratorHelper(allParams),
  6174. _step6;
  6175. try {
  6176. for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
  6177. var _params = _step6.value;
  6178. if (!_params.hasOwnProperty('index') || !_params.hasOwnProperty('row')) {
  6179. continue;
  6180. }
  6181. if (_params.hasOwnProperty('replace') && _params.replace) {
  6182. this.options.data[_params.index] = _params.row;
  6183. } else {
  6184. $__default["default"].extend(this.options.data[_params.index], _params.row);
  6185. }
  6186. }
  6187. } catch (err) {
  6188. _iterator6.e(err);
  6189. } finally {
  6190. _iterator6.f();
  6191. }
  6192. this.initSearch();
  6193. this.initPagination();
  6194. this.initSort();
  6195. this.initBody(true);
  6196. }
  6197. }, {
  6198. key: "getRowByUniqueId",
  6199. value: function getRowByUniqueId(_id) {
  6200. var uniqueId = this.options.uniqueId;
  6201. var len = this.options.data.length;
  6202. var id = _id;
  6203. var dataRow = null;
  6204. var i;
  6205. var row;
  6206. var rowUniqueId;
  6207. for (i = len - 1; i >= 0; i--) {
  6208. row = this.options.data[i];
  6209. if (row.hasOwnProperty(uniqueId)) {
  6210. // uniqueId is a column
  6211. rowUniqueId = row[uniqueId];
  6212. } else if (row._data && row._data.hasOwnProperty(uniqueId)) {
  6213. // uniqueId is a row data property
  6214. rowUniqueId = row._data[uniqueId];
  6215. } else {
  6216. continue;
  6217. }
  6218. if (typeof rowUniqueId === 'string') {
  6219. id = id.toString();
  6220. } else if (typeof rowUniqueId === 'number') {
  6221. if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
  6222. id = parseInt(id, 10);
  6223. } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
  6224. id = parseFloat(id);
  6225. }
  6226. }
  6227. if (rowUniqueId === id) {
  6228. dataRow = row;
  6229. break;
  6230. }
  6231. }
  6232. return dataRow;
  6233. }
  6234. }, {
  6235. key: "updateByUniqueId",
  6236. value: function updateByUniqueId(params) {
  6237. var allParams = Array.isArray(params) ? params : [params];
  6238. var updatedUid = null;
  6239. var _iterator7 = _createForOfIteratorHelper(allParams),
  6240. _step7;
  6241. try {
  6242. for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
  6243. var _params2 = _step7.value;
  6244. if (!_params2.hasOwnProperty('id') || !_params2.hasOwnProperty('row')) {
  6245. continue;
  6246. }
  6247. var rowId = this.options.data.indexOf(this.getRowByUniqueId(_params2.id));
  6248. if (rowId === -1) {
  6249. continue;
  6250. }
  6251. if (_params2.hasOwnProperty('replace') && _params2.replace) {
  6252. this.options.data[rowId] = _params2.row;
  6253. } else {
  6254. $__default["default"].extend(this.options.data[rowId], _params2.row);
  6255. }
  6256. updatedUid = _params2.id;
  6257. }
  6258. } catch (err) {
  6259. _iterator7.e(err);
  6260. } finally {
  6261. _iterator7.f();
  6262. }
  6263. this.initSearch();
  6264. this.initPagination();
  6265. this.initSort();
  6266. this.initBody(true, updatedUid);
  6267. }
  6268. }, {
  6269. key: "removeByUniqueId",
  6270. value: function removeByUniqueId(id) {
  6271. var len = this.options.data.length;
  6272. var row = this.getRowByUniqueId(id);
  6273. if (row) {
  6274. this.options.data.splice(this.options.data.indexOf(row), 1);
  6275. }
  6276. if (len === this.options.data.length) {
  6277. return;
  6278. }
  6279. if (this.options.sidePagination === 'server') {
  6280. this.options.totalRows -= 1;
  6281. this.data = _toConsumableArray(this.options.data);
  6282. }
  6283. this.initSearch();
  6284. this.initPagination();
  6285. this.initBody(true);
  6286. }
  6287. }, {
  6288. key: "updateCell",
  6289. value: function updateCell(params) {
  6290. if (!params.hasOwnProperty('index') || !params.hasOwnProperty('field') || !params.hasOwnProperty('value')) {
  6291. return;
  6292. }
  6293. this.data[params.index][params.field] = params.value;
  6294. if (params.reinit === false) {
  6295. return;
  6296. }
  6297. this.initSort();
  6298. this.initBody(true);
  6299. }
  6300. }, {
  6301. key: "updateCellByUniqueId",
  6302. value: function updateCellByUniqueId(params) {
  6303. var _this19 = this;
  6304. var allParams = Array.isArray(params) ? params : [params];
  6305. allParams.forEach(function (_ref6) {
  6306. var id = _ref6.id,
  6307. field = _ref6.field,
  6308. value = _ref6.value;
  6309. var rowId = _this19.options.data.indexOf(_this19.getRowByUniqueId(id));
  6310. if (rowId === -1) {
  6311. return;
  6312. }
  6313. _this19.options.data[rowId][field] = value;
  6314. });
  6315. if (params.reinit === false) {
  6316. return;
  6317. }
  6318. this.initSort();
  6319. this.initBody(true);
  6320. }
  6321. }, {
  6322. key: "showRow",
  6323. value: function showRow(params) {
  6324. this._toggleRow(params, true);
  6325. }
  6326. }, {
  6327. key: "hideRow",
  6328. value: function hideRow(params) {
  6329. this._toggleRow(params, false);
  6330. }
  6331. }, {
  6332. key: "_toggleRow",
  6333. value: function _toggleRow(params, visible) {
  6334. var row;
  6335. if (params.hasOwnProperty('index')) {
  6336. row = this.getData()[params.index];
  6337. } else if (params.hasOwnProperty('uniqueId')) {
  6338. row = this.getRowByUniqueId(params.uniqueId);
  6339. }
  6340. if (!row) {
  6341. return;
  6342. }
  6343. var index = Utils.findIndex(this.hiddenRows, row);
  6344. if (!visible && index === -1) {
  6345. this.hiddenRows.push(row);
  6346. } else if (visible && index > -1) {
  6347. this.hiddenRows.splice(index, 1);
  6348. }
  6349. this.initBody(true);
  6350. this.initPagination();
  6351. }
  6352. }, {
  6353. key: "getHiddenRows",
  6354. value: function getHiddenRows(show) {
  6355. if (show) {
  6356. this.initHiddenRows();
  6357. this.initBody(true);
  6358. this.initPagination();
  6359. return;
  6360. }
  6361. var data = this.getData();
  6362. var rows = [];
  6363. var _iterator8 = _createForOfIteratorHelper(data),
  6364. _step8;
  6365. try {
  6366. for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
  6367. var row = _step8.value;
  6368. if (this.hiddenRows.includes(row)) {
  6369. rows.push(row);
  6370. }
  6371. }
  6372. } catch (err) {
  6373. _iterator8.e(err);
  6374. } finally {
  6375. _iterator8.f();
  6376. }
  6377. this.hiddenRows = rows;
  6378. return rows;
  6379. }
  6380. }, {
  6381. key: "showColumn",
  6382. value: function showColumn(field) {
  6383. var _this20 = this;
  6384. var fields = Array.isArray(field) ? field : [field];
  6385. fields.forEach(function (field) {
  6386. _this20._toggleColumn(_this20.fieldsColumnsIndex[field], true, true);
  6387. });
  6388. }
  6389. }, {
  6390. key: "hideColumn",
  6391. value: function hideColumn(field) {
  6392. var _this21 = this;
  6393. var fields = Array.isArray(field) ? field : [field];
  6394. fields.forEach(function (field) {
  6395. _this21._toggleColumn(_this21.fieldsColumnsIndex[field], false, true);
  6396. });
  6397. }
  6398. }, {
  6399. key: "_toggleColumn",
  6400. value: function _toggleColumn(index, checked, needUpdate) {
  6401. if (index === -1 || this.columns[index].visible === checked) {
  6402. return;
  6403. }
  6404. this.columns[index].visible = checked;
  6405. this.initHeader();
  6406. this.initSearch();
  6407. this.initPagination();
  6408. this.initBody();
  6409. if (this.options.showColumns) {
  6410. var $items = this.$toolbar.find('.keep-open input:not(".toggle-all")').prop('disabled', false);
  6411. if (needUpdate) {
  6412. $items.filter(Utils.sprintf('[value="%s"]', index)).prop('checked', checked);
  6413. }
  6414. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  6415. $items.filter(':checked').prop('disabled', true);
  6416. }
  6417. }
  6418. }
  6419. }, {
  6420. key: "getVisibleColumns",
  6421. value: function getVisibleColumns() {
  6422. var _this22 = this;
  6423. return this.columns.filter(function (column) {
  6424. return column.visible && !_this22.isSelectionColumn(column);
  6425. });
  6426. }
  6427. }, {
  6428. key: "getHiddenColumns",
  6429. value: function getHiddenColumns() {
  6430. return this.columns.filter(function (_ref7) {
  6431. var visible = _ref7.visible;
  6432. return !visible;
  6433. });
  6434. }
  6435. }, {
  6436. key: "isSelectionColumn",
  6437. value: function isSelectionColumn(column) {
  6438. return column.radio || column.checkbox;
  6439. }
  6440. }, {
  6441. key: "showAllColumns",
  6442. value: function showAllColumns() {
  6443. this._toggleAllColumns(true);
  6444. }
  6445. }, {
  6446. key: "hideAllColumns",
  6447. value: function hideAllColumns() {
  6448. this._toggleAllColumns(false);
  6449. }
  6450. }, {
  6451. key: "_toggleAllColumns",
  6452. value: function _toggleAllColumns(visible) {
  6453. var _this23 = this;
  6454. var _iterator9 = _createForOfIteratorHelper(this.columns.slice().reverse()),
  6455. _step9;
  6456. try {
  6457. for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
  6458. var column = _step9.value;
  6459. if (column.switchable) {
  6460. if (!visible && this.options.showColumns && this.getVisibleColumns().filter(function (it) {
  6461. return it.switchable;
  6462. }).length === this.options.minimumCountColumns) {
  6463. continue;
  6464. }
  6465. column.visible = visible;
  6466. }
  6467. }
  6468. } catch (err) {
  6469. _iterator9.e(err);
  6470. } finally {
  6471. _iterator9.f();
  6472. }
  6473. this.initHeader();
  6474. this.initSearch();
  6475. this.initPagination();
  6476. this.initBody();
  6477. if (this.options.showColumns) {
  6478. var $items = this.$toolbar.find('.keep-open input[type="checkbox"]:not(".toggle-all")').prop('disabled', false);
  6479. if (visible) {
  6480. $items.prop('checked', visible);
  6481. } else {
  6482. $items.get().reverse().forEach(function (item) {
  6483. if ($items.filter(':checked').length > _this23.options.minimumCountColumns) {
  6484. $__default["default"](item).prop('checked', visible);
  6485. }
  6486. });
  6487. }
  6488. if ($items.filter(':checked').length <= this.options.minimumCountColumns) {
  6489. $items.filter(':checked').prop('disabled', true);
  6490. }
  6491. }
  6492. }
  6493. }, {
  6494. key: "mergeCells",
  6495. value: function mergeCells(options) {
  6496. var row = options.index;
  6497. var col = this.getVisibleFields().indexOf(options.field);
  6498. var rowspan = options.rowspan || 1;
  6499. var colspan = options.colspan || 1;
  6500. var i;
  6501. var j;
  6502. var $tr = this.$body.find('>tr[data-index]');
  6503. col += Utils.getDetailViewIndexOffset(this.options);
  6504. var $td = $tr.eq(row).find('>td').eq(col);
  6505. if (row < 0 || col < 0 || row >= this.data.length) {
  6506. return;
  6507. }
  6508. for (i = row; i < row + rowspan; i++) {
  6509. for (j = col; j < col + colspan; j++) {
  6510. $tr.eq(i).find('>td').eq(j).hide();
  6511. }
  6512. }
  6513. $td.attr('rowspan', rowspan).attr('colspan', colspan).show();
  6514. }
  6515. }, {
  6516. key: "checkAll",
  6517. value: function checkAll() {
  6518. this._toggleCheckAll(true);
  6519. }
  6520. }, {
  6521. key: "uncheckAll",
  6522. value: function uncheckAll() {
  6523. this._toggleCheckAll(false);
  6524. }
  6525. }, {
  6526. key: "_toggleCheckAll",
  6527. value: function _toggleCheckAll(checked) {
  6528. var rowsBefore = this.getSelections();
  6529. this.$selectAll.add(this.$selectAll_).prop('checked', checked);
  6530. this.$selectItem.filter(':enabled').prop('checked', checked);
  6531. this.updateRows();
  6532. this.updateSelected();
  6533. var rowsAfter = this.getSelections();
  6534. if (checked) {
  6535. this.trigger('check-all', rowsAfter, rowsBefore);
  6536. return;
  6537. }
  6538. this.trigger('uncheck-all', rowsAfter, rowsBefore);
  6539. }
  6540. }, {
  6541. key: "checkInvert",
  6542. value: function checkInvert() {
  6543. var $items = this.$selectItem.filter(':enabled');
  6544. var checked = $items.filter(':checked');
  6545. $items.each(function (i, el) {
  6546. $__default["default"](el).prop('checked', !$__default["default"](el).prop('checked'));
  6547. });
  6548. this.updateRows();
  6549. this.updateSelected();
  6550. this.trigger('uncheck-some', checked);
  6551. checked = this.getSelections();
  6552. this.trigger('check-some', checked);
  6553. }
  6554. }, {
  6555. key: "check",
  6556. value: function check(index) {
  6557. this._toggleCheck(true, index);
  6558. }
  6559. }, {
  6560. key: "uncheck",
  6561. value: function uncheck(index) {
  6562. this._toggleCheck(false, index);
  6563. }
  6564. }, {
  6565. key: "_toggleCheck",
  6566. value: function _toggleCheck(checked, index) {
  6567. var $el = this.$selectItem.filter("[data-index=\"".concat(index, "\"]"));
  6568. var row = this.data[index];
  6569. if ($el.is(':radio') || this.options.singleSelect || this.options.multipleSelectRow && !this.multipleSelectRowCtrlKey && !this.multipleSelectRowShiftKey) {
  6570. var _iterator10 = _createForOfIteratorHelper(this.options.data),
  6571. _step10;
  6572. try {
  6573. for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
  6574. var r = _step10.value;
  6575. r[this.header.stateField] = false;
  6576. }
  6577. } catch (err) {
  6578. _iterator10.e(err);
  6579. } finally {
  6580. _iterator10.f();
  6581. }
  6582. this.$selectItem.filter(':checked').not($el).prop('checked', false);
  6583. }
  6584. row[this.header.stateField] = checked;
  6585. if (this.options.multipleSelectRow) {
  6586. if (this.multipleSelectRowShiftKey && this.multipleSelectRowLastSelectedIndex >= 0) {
  6587. var _ref8 = this.multipleSelectRowLastSelectedIndex < index ? [this.multipleSelectRowLastSelectedIndex, index] : [index, this.multipleSelectRowLastSelectedIndex],
  6588. _ref9 = _slicedToArray(_ref8, 2),
  6589. fromIndex = _ref9[0],
  6590. toIndex = _ref9[1];
  6591. for (var i = fromIndex + 1; i < toIndex; i++) {
  6592. this.data[i][this.header.stateField] = true;
  6593. this.$selectItem.filter("[data-index=\"".concat(i, "\"]")).prop('checked', true);
  6594. }
  6595. }
  6596. this.multipleSelectRowCtrlKey = false;
  6597. this.multipleSelectRowShiftKey = false;
  6598. this.multipleSelectRowLastSelectedIndex = checked ? index : -1;
  6599. }
  6600. $el.prop('checked', checked);
  6601. this.updateSelected();
  6602. this.trigger(checked ? 'check' : 'uncheck', this.data[index], $el);
  6603. }
  6604. }, {
  6605. key: "checkBy",
  6606. value: function checkBy(obj) {
  6607. this._toggleCheckBy(true, obj);
  6608. }
  6609. }, {
  6610. key: "uncheckBy",
  6611. value: function uncheckBy(obj) {
  6612. this._toggleCheckBy(false, obj);
  6613. }
  6614. }, {
  6615. key: "_toggleCheckBy",
  6616. value: function _toggleCheckBy(checked, obj) {
  6617. var _this24 = this;
  6618. if (!obj.hasOwnProperty('field') || !obj.hasOwnProperty('values')) {
  6619. return;
  6620. }
  6621. var rows = [];
  6622. this.data.forEach(function (row, i) {
  6623. if (!row.hasOwnProperty(obj.field)) {
  6624. return false;
  6625. }
  6626. if (obj.values.includes(row[obj.field])) {
  6627. var $el = _this24.$selectItem.filter(':enabled').filter(Utils.sprintf('[data-index="%s"]', i));
  6628. var onlyCurrentPage = obj.hasOwnProperty('onlyCurrentPage') ? obj.onlyCurrentPage : false;
  6629. $el = checked ? $el.not(':checked') : $el.filter(':checked');
  6630. if (!$el.length && onlyCurrentPage) {
  6631. return;
  6632. }
  6633. $el.prop('checked', checked);
  6634. row[_this24.header.stateField] = checked;
  6635. rows.push(row);
  6636. _this24.trigger(checked ? 'check' : 'uncheck', row, $el);
  6637. }
  6638. });
  6639. this.updateSelected();
  6640. this.trigger(checked ? 'check-some' : 'uncheck-some', rows);
  6641. }
  6642. }, {
  6643. key: "refresh",
  6644. value: function refresh(params) {
  6645. if (params && params.url) {
  6646. this.options.url = params.url;
  6647. }
  6648. if (params && params.pageNumber) {
  6649. this.options.pageNumber = params.pageNumber;
  6650. }
  6651. if (params && params.pageSize) {
  6652. this.options.pageSize = params.pageSize;
  6653. }
  6654. this.trigger('refresh', this.initServer(params && params.silent, params && params.query, params && params.url));
  6655. }
  6656. }, {
  6657. key: "destroy",
  6658. value: function destroy() {
  6659. this.$el.insertBefore(this.$container);
  6660. $__default["default"](this.options.toolbar).insertBefore(this.$el);
  6661. this.$container.next().remove();
  6662. this.$container.remove();
  6663. this.$el.html(this.$el_.html()).css('margin-top', '0').attr('class', this.$el_.attr('class') || ''); // reset the class
  6664. }
  6665. }, {
  6666. key: "resetView",
  6667. value: function resetView(params) {
  6668. var padding = 0;
  6669. if (params && params.height) {
  6670. this.options.height = params.height;
  6671. }
  6672. this.$tableContainer.toggleClass('has-card-view', this.options.cardView);
  6673. if (this.options.height) {
  6674. var fixedBody = this.$tableBody.get(0);
  6675. this.hasScrollBar = fixedBody.scrollWidth > fixedBody.clientWidth;
  6676. }
  6677. if (!this.options.cardView && this.options.showHeader && this.options.height) {
  6678. this.$tableHeader.show();
  6679. this.resetHeader();
  6680. padding += this.$header.outerHeight(true) + 1;
  6681. } else {
  6682. this.$tableHeader.hide();
  6683. this.trigger('post-header');
  6684. }
  6685. if (!this.options.cardView && this.options.showFooter) {
  6686. this.$tableFooter.show();
  6687. this.fitFooter();
  6688. if (this.options.height) {
  6689. padding += this.$tableFooter.outerHeight(true);
  6690. }
  6691. }
  6692. if (this.$container.hasClass('fullscreen')) {
  6693. this.$tableContainer.css('height', '');
  6694. this.$tableContainer.css('width', '');
  6695. } else if (this.options.height) {
  6696. if (this.$tableBorder) {
  6697. this.$tableBorder.css('width', '');
  6698. this.$tableBorder.css('height', '');
  6699. }
  6700. var toolbarHeight = this.$toolbar.outerHeight(true);
  6701. var paginationHeight = this.$pagination.outerHeight(true);
  6702. var height = this.options.height - toolbarHeight - paginationHeight;
  6703. var $bodyTable = this.$tableBody.find('>table');
  6704. var tableHeight = $bodyTable.outerHeight();
  6705. this.$tableContainer.css('height', "".concat(height, "px"));
  6706. if (this.$tableBorder && $bodyTable.is(':visible')) {
  6707. var tableBorderHeight = height - tableHeight - 2;
  6708. if (this.hasScrollBar) {
  6709. tableBorderHeight -= Utils.getScrollBarWidth();
  6710. }
  6711. this.$tableBorder.css('width', "".concat($bodyTable.outerWidth(), "px"));
  6712. this.$tableBorder.css('height', "".concat(tableBorderHeight, "px"));
  6713. }
  6714. }
  6715. if (this.options.cardView) {
  6716. // remove the element css
  6717. this.$el.css('margin-top', '0');
  6718. this.$tableContainer.css('padding-bottom', '0');
  6719. this.$tableFooter.hide();
  6720. } else {
  6721. // Assign the correct sortable arrow
  6722. this.getCaret();
  6723. this.$tableContainer.css('padding-bottom', "".concat(padding, "px"));
  6724. }
  6725. this.trigger('reset-view');
  6726. }
  6727. }, {
  6728. key: "showLoading",
  6729. value: function showLoading() {
  6730. this.$tableLoading.toggleClass('open', true);
  6731. var fontSize = this.options.loadingFontSize;
  6732. if (this.options.loadingFontSize === 'auto') {
  6733. fontSize = this.$tableLoading.width() * 0.04;
  6734. fontSize = Math.max(12, fontSize);
  6735. fontSize = Math.min(32, fontSize);
  6736. fontSize = "".concat(fontSize, "px");
  6737. }
  6738. this.$tableLoading.find('.loading-text').css('font-size', fontSize);
  6739. }
  6740. }, {
  6741. key: "hideLoading",
  6742. value: function hideLoading() {
  6743. this.$tableLoading.toggleClass('open', false);
  6744. }
  6745. }, {
  6746. key: "togglePagination",
  6747. value: function togglePagination() {
  6748. this.options.pagination = !this.options.pagination;
  6749. var icon = this.options.showButtonIcons ? this.options.pagination ? this.options.icons.paginationSwitchDown : this.options.icons.paginationSwitchUp : '';
  6750. var text = this.options.showButtonText ? this.options.pagination ? this.options.formatPaginationSwitchUp() : this.options.formatPaginationSwitchDown() : '';
  6751. this.$toolbar.find('button[name="paginationSwitch"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6752. this.updatePagination();
  6753. this.trigger('toggle-pagination', this.options.pagination);
  6754. }
  6755. }, {
  6756. key: "toggleFullscreen",
  6757. value: function toggleFullscreen() {
  6758. this.$el.closest('.bootstrap-table').toggleClass('fullscreen');
  6759. this.resetView();
  6760. }
  6761. }, {
  6762. key: "toggleView",
  6763. value: function toggleView() {
  6764. this.options.cardView = !this.options.cardView;
  6765. this.initHeader();
  6766. var icon = this.options.showButtonIcons ? this.options.cardView ? this.options.icons.toggleOn : this.options.icons.toggleOff : '';
  6767. var text = this.options.showButtonText ? this.options.cardView ? this.options.formatToggleOff() : this.options.formatToggleOn() : '';
  6768. this.$toolbar.find('button[name="toggle"]').html("".concat(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon), " ").concat(text));
  6769. this.initBody();
  6770. this.trigger('toggle', this.options.cardView);
  6771. }
  6772. }, {
  6773. key: "resetSearch",
  6774. value: function resetSearch(text) {
  6775. var $search = Utils.getSearchInput(this);
  6776. var textToUse = text || '';
  6777. $search.val(textToUse);
  6778. this.searchText = textToUse;
  6779. this.onSearch({
  6780. currentTarget: $search
  6781. }, false);
  6782. }
  6783. }, {
  6784. key: "filterBy",
  6785. value: function filterBy(columns, options) {
  6786. this.filterOptions = Utils.isEmptyObject(options) ? this.options.filterOptions : $__default["default"].extend(this.options.filterOptions, options);
  6787. this.filterColumns = Utils.isEmptyObject(columns) ? {} : columns;
  6788. this.options.pageNumber = 1;
  6789. this.initSearch();
  6790. this.updatePagination();
  6791. }
  6792. }, {
  6793. key: "scrollTo",
  6794. value: function scrollTo(params) {
  6795. var options = {
  6796. unit: 'px',
  6797. value: 0
  6798. };
  6799. if (_typeof(params) === 'object') {
  6800. options = Object.assign(options, params);
  6801. } else if (typeof params === 'string' && params === 'bottom') {
  6802. options.value = this.$tableBody[0].scrollHeight;
  6803. } else if (typeof params === 'string' || typeof params === 'number') {
  6804. options.value = params;
  6805. }
  6806. var scrollTo = options.value;
  6807. if (options.unit === 'rows') {
  6808. scrollTo = 0;
  6809. this.$body.find("> tr:lt(".concat(options.value, ")")).each(function (i, el) {
  6810. scrollTo += $__default["default"](el).outerHeight(true);
  6811. });
  6812. }
  6813. this.$tableBody.scrollTop(scrollTo);
  6814. }
  6815. }, {
  6816. key: "getScrollPosition",
  6817. value: function getScrollPosition() {
  6818. return this.$tableBody.scrollTop();
  6819. }
  6820. }, {
  6821. key: "selectPage",
  6822. value: function selectPage(page) {
  6823. if (page > 0 && page <= this.options.totalPages) {
  6824. this.options.pageNumber = page;
  6825. this.updatePagination();
  6826. }
  6827. }
  6828. }, {
  6829. key: "prevPage",
  6830. value: function prevPage() {
  6831. if (this.options.pageNumber > 1) {
  6832. this.options.pageNumber--;
  6833. this.updatePagination();
  6834. }
  6835. }
  6836. }, {
  6837. key: "nextPage",
  6838. value: function nextPage() {
  6839. if (this.options.pageNumber < this.options.totalPages) {
  6840. this.options.pageNumber++;
  6841. this.updatePagination();
  6842. }
  6843. }
  6844. }, {
  6845. key: "toggleDetailView",
  6846. value: function toggleDetailView(index, _columnDetailFormatter) {
  6847. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"]', index));
  6848. if ($tr.next().is('tr.detail-view')) {
  6849. this.collapseRow(index);
  6850. } else {
  6851. this.expandRow(index, _columnDetailFormatter);
  6852. }
  6853. this.resetView();
  6854. }
  6855. }, {
  6856. key: "expandRow",
  6857. value: function expandRow(index, _columnDetailFormatter) {
  6858. var row = this.data[index];
  6859. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6860. if (this.options.detailViewIcon) {
  6861. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailClose));
  6862. }
  6863. if ($tr.next().is('tr.detail-view')) {
  6864. return;
  6865. }
  6866. $tr.after(Utils.sprintf('<tr class="detail-view"><td colspan="%s"></td></tr>', $tr.children('td').length));
  6867. var $element = $tr.next().find('td');
  6868. var detailFormatter = _columnDetailFormatter || this.options.detailFormatter;
  6869. var content = Utils.calculateObjectValue(this.options, detailFormatter, [index, row, $element], '');
  6870. if ($element.length === 1) {
  6871. $element.append(content);
  6872. }
  6873. this.trigger('expand-row', index, row, $element);
  6874. }
  6875. }, {
  6876. key: "expandRowByUniqueId",
  6877. value: function expandRowByUniqueId(uniqueId) {
  6878. var row = this.getRowByUniqueId(uniqueId);
  6879. if (!row) {
  6880. return;
  6881. }
  6882. this.expandRow(this.data.indexOf(row));
  6883. }
  6884. }, {
  6885. key: "collapseRow",
  6886. value: function collapseRow(index) {
  6887. var row = this.data[index];
  6888. var $tr = this.$body.find(Utils.sprintf('> tr[data-index="%s"][data-has-detail-view]', index));
  6889. if (!$tr.next().is('tr.detail-view')) {
  6890. return;
  6891. }
  6892. if (this.options.detailViewIcon) {
  6893. $tr.find('a.detail-icon').html(Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.detailOpen));
  6894. }
  6895. this.trigger('collapse-row', index, row, $tr.next());
  6896. $tr.next().remove();
  6897. }
  6898. }, {
  6899. key: "collapseRowByUniqueId",
  6900. value: function collapseRowByUniqueId(uniqueId) {
  6901. var row = this.getRowByUniqueId(uniqueId);
  6902. if (!row) {
  6903. return;
  6904. }
  6905. this.collapseRow(this.data.indexOf(row));
  6906. }
  6907. }, {
  6908. key: "expandAllRows",
  6909. value: function expandAllRows() {
  6910. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6911. for (var i = 0; i < trs.length; i++) {
  6912. this.expandRow($__default["default"](trs[i]).data('index'));
  6913. }
  6914. }
  6915. }, {
  6916. key: "collapseAllRows",
  6917. value: function collapseAllRows() {
  6918. var trs = this.$body.find('> tr[data-index][data-has-detail-view]');
  6919. for (var i = 0; i < trs.length; i++) {
  6920. this.collapseRow($__default["default"](trs[i]).data('index'));
  6921. }
  6922. }
  6923. }, {
  6924. key: "updateColumnTitle",
  6925. value: function updateColumnTitle(params) {
  6926. if (!params.hasOwnProperty('field') || !params.hasOwnProperty('title')) {
  6927. return;
  6928. }
  6929. this.columns[this.fieldsColumnsIndex[params.field]].title = this.options.escape ? Utils.escapeHTML(params.title) : params.title;
  6930. if (this.columns[this.fieldsColumnsIndex[params.field]].visible) {
  6931. this.$header.find('th[data-field]').each(function (i, el) {
  6932. if ($__default["default"](el).data('field') === params.field) {
  6933. $__default["default"]($__default["default"](el).find('.th-inner')[0]).text(params.title);
  6934. return false;
  6935. }
  6936. });
  6937. this.resetView();
  6938. }
  6939. }
  6940. }, {
  6941. key: "updateFormatText",
  6942. value: function updateFormatText(formatName, text) {
  6943. if (!/^format/.test(formatName) || !this.options[formatName]) {
  6944. return;
  6945. }
  6946. if (typeof text === 'string') {
  6947. this.options[formatName] = function () {
  6948. return text;
  6949. };
  6950. } else if (typeof text === 'function') {
  6951. this.options[formatName] = text;
  6952. }
  6953. this.initToolbar();
  6954. this.initPagination();
  6955. this.initBody();
  6956. }
  6957. }]);
  6958. return BootstrapTable;
  6959. }();
  6960. BootstrapTable.VERSION = Constants.VERSION;
  6961. BootstrapTable.DEFAULTS = Constants.DEFAULTS;
  6962. BootstrapTable.LOCALES = Constants.LOCALES;
  6963. BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS;
  6964. BootstrapTable.METHODS = Constants.METHODS;
  6965. BootstrapTable.EVENTS = Constants.EVENTS; // BOOTSTRAP TABLE PLUGIN DEFINITION
  6966. // =======================
  6967. $__default["default"].BootstrapTable = BootstrapTable;
  6968. $__default["default"].fn.bootstrapTable = function (option) {
  6969. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key5 = 1; _key5 < _len2; _key5++) {
  6970. args[_key5 - 1] = arguments[_key5];
  6971. }
  6972. var value;
  6973. this.each(function (i, el) {
  6974. var data = $__default["default"](el).data('bootstrap.table');
  6975. var options = $__default["default"].extend({}, BootstrapTable.DEFAULTS, $__default["default"](el).data(), _typeof(option) === 'object' && option);
  6976. if (typeof option === 'string') {
  6977. var _data2;
  6978. if (!Constants.METHODS.includes(option)) {
  6979. throw new Error("Unknown method: ".concat(option));
  6980. }
  6981. if (!data) {
  6982. return;
  6983. }
  6984. value = (_data2 = data)[option].apply(_data2, args);
  6985. if (option === 'destroy') {
  6986. $__default["default"](el).removeData('bootstrap.table');
  6987. }
  6988. }
  6989. if (!data) {
  6990. data = new $__default["default"].BootstrapTable(el, options);
  6991. $__default["default"](el).data('bootstrap.table', data);
  6992. data.init();
  6993. }
  6994. });
  6995. return typeof value === 'undefined' ? this : value;
  6996. };
  6997. $__default["default"].fn.bootstrapTable.Constructor = BootstrapTable;
  6998. $__default["default"].fn.bootstrapTable.theme = Constants.THEME;
  6999. $__default["default"].fn.bootstrapTable.VERSION = Constants.VERSION;
  7000. $__default["default"].fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS;
  7001. $__default["default"].fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS;
  7002. $__default["default"].fn.bootstrapTable.events = BootstrapTable.EVENTS;
  7003. $__default["default"].fn.bootstrapTable.locales = BootstrapTable.LOCALES;
  7004. $__default["default"].fn.bootstrapTable.methods = BootstrapTable.METHODS;
  7005. $__default["default"].fn.bootstrapTable.utils = Utils; // BOOTSTRAP TABLE INIT
  7006. // =======================
  7007. $__default["default"](function () {
  7008. $__default["default"]('[data-toggle="table"]').bootstrapTable();
  7009. });
  7010. return BootstrapTable;
  7011. }));